Qt VS Code Extensions Manual Tests

From Qt Wiki
Jump to navigation Jump to search


Pre-requisit Result Annotation
Have VS code installed (https://code.visualstudio.com/docs/setup/setup-overview)
Have a Qt installation (https://account.qt.io/s/downloads)
Remove any Qt related setting in VS Code User settings.json (Preferences: Open User Settings (JSON))
Testing Result Annotation
Qt VS code extension packages

- In VS code, go to Extensions

- Type "Qt Pack" in the Search Extensions in Marketplace

- The result should show at the top:

- Qt Extension Pack, with 4 extensions
- Qt C++ Extension Pack, with 7 extensions
- Qt WebAssembly Extension Pack, with 9 entensions

- Select Qt Extension Pack, check that the extensions are

 Qt Core, Qt C++, Qt Qml, Qt UI

- Select Qt C++ Extension Pack, check that the extensions are

 Qt Core, Qt C++, Qt Qml, Qt UI, 
 CMake Tools (from microsoft), C/C++ (from microsoft)

- Select Qt WebAssembly Extension Pack, check that the extensions are

 Qt Core, Qt C++, Qt Qml, Qt UI,
 CMake Tools (from microsoft), C/C++ (from microsoft)
 CMake, Live Preview, Qt WebAssembly Extension Pack (from microsoft)
Installation of the Qt VS-code Extentions

- In VS code, go to Extensions

- Search for Qt Pack

- Select Qt WebAssembly Extension Pack

- Click install

- Select each Qt extension and make sure the latest version is displayed (1.2.1)

Finding Qt Installation

- In VS code command palette -(shift+command+P) on MacOS or (shift+ctrl+P) on Windows/Linux- search for Qt register

- Two option should appear:

 - Qt: Register Qt Installation
 - Qt: Register Qt Installation (by qtpaths or qmake)

- Try both commands

- Run Preferences: Open User Settings (JSON)

- Check that the path to the selected Qt installation has been added under qt-core.qtInstallationRoot

modify when following suggestions have been implemented

https://bugreports.qt.io/browse/VSCODEEXT-156

https://bugreports.qt.io/browse/VSCODEEXT-157

https://bugreports.qt.io/browse/VSCODEEXT-158

Opening, building, running a Qt project

- Get the projet from https://code.qt.io/cgit/qt-labs/vscodeext.git/tree/doc/tutorials/AddressBook

- Open the AddressBook folder in VS code

- From command palette run Qt: Set the recommended Qt Extensions settings

- A .vscode folder should be created with a settings.json file

- A "No active kit" button should appear in the bottom status bar

- Click on adddialog.ui, a button with "Open this file with Qt Widgets Designer" should appear.

- Click on "Open this file with Qt Widgets Designer" a pop up window should appear asking to select a CMake kit

- Click on "Select CMake Kit" and select a Qt- kit

- The selected kit should now show in place of the "No active kit"

- Click again on "Open this file with Qt Widgets Designer", adddialog.ui should now open in Qt Widgets Designer

- In VS code, select addressbook.ui, click on "Open this file with Qt Widgets Designer", it should open

- Build the AddressBook

- Execute it

Debugging the AddressBook Qt Project

- Following: opening, building and running the AddressBook project

- Make sure a Qt Kit is selected

- Remove .vscode/launch.json if present

- Click on the debugger icon

- Click on "create a launch.json file"

- Select C++ (GDB/LLDB) in the selection window popping up

- In the launch.json file click on "Add Configuration" if the option are not already open

- Select a Qt configuration

- Go to addressbook.cpp and place a breaking point at line 29 (item->setData(Qt::UserRole, email);)

- Start the debugger

- In the AddressBook window click on the "Add" button

- Enter a Name and an Email then click "OK"

- In VS code check that the name and email variable have the entered values

- Finish debugging and close the AddressBook window

Qt: Scan for Qt Kits

- In VS code, open CMake: Edit User-Local CMake Kits

- Remove all the Qt related kits

- Run Qt: Scan for Qt Kits

- Make sure the Qt kits reappeared in the cmake-tools-kits.json

- Make sure the generated kits are compatible with the registered Qt version

- Make sure the generated kits are compatible with the machine OS

Qt: Open Widget Designer

- Run the command in the palette

- One possibility appears corresponding to the selected kit

discuss this behaviour

- In case of "No active kit", the previously available Qt Widget designer version still appears

discuss this behaviour
Qt: Documentation commands

- In VS code run Qt: Documentation: Open Homepage

- A browser to https://doc.qt.io should now be open in VS code

- Run Qt: Documentation: Search

- In the dialog box type Qt related key words and check that the related documentation page opens

could be more specific here

- Go to adddialog.cpp and click on QWidget - Run Qt: Documentation: Search for current word - Page https://doc.qt.io/qt-6/qwidget.html should now be open in the browser

QML language server related commands

- In VS code run Check for QML language server update

- If a new version is available a pop up window offers to download the latest version

- If the current version is up to date, a pop up window says so and gives the tag

- Run Qt: Download the most recent QML language server

- Does so, even if the most recent version is already installed

discuss this behaviour

- Run Qt: Restart QML language server

nothing visible happening
Qt: Open Qt Settings

- In VS code run Qt: Open Qt Settings

- The Settings should open in VS code, with the possibility to switch form User to Workspace

- It should be possible to see the settings related to a given extension using the Extensions menu showing under User or Workspace

- The following settings should be visible:

- Qt-cpp: Do Not Ask For CMake Path (User)
- Qt-core: Additional Qt Paths (User and Workspace)
- Qt-core: Do Not Ask For Default Qt Installation Root (User)
- Qt-core: Do Not Ask For VCPKG (User)
- Qt-core: Open Online Documentation In External Browser (User and Workspace)
- Qt-core: Qt Installation Root (User and Workspace)
- Qt-qml: Do Not Ask For Qmlls Download (User)
- Qt-qml › Qmlls: Additional Import Paths (User and Workspace)
- Qt-qml › Qmlls: Custom Exe Path (User and Workspace)
- Qt-qml › Qmlls: Enabled (User and Workspace)
- Qt-qml › Qmlls: Trace Lsp (User and Workspace)
- Qt-qml › Qmlls: Use Qml Import Path Env Var (User and Workspace)
- Qt-qml › Qmlls: Verbose Output (User and Workspace)
- Qt-ui: Custom Widgets Designer Exe Path (User and Workspace)
Qt: Create New Project

In the command palette run Qt: Create Create New Project and name the new project

In the terminal the following choices should appear:

 → [Default] @projects/cpp/console
   [Default] @projects/cpp/qtquick
   [Default] @projects/cpp/qwidget
   [Manually select features]  

Each time you select a project type, the trust window pops up and you're being asked to select a kit. Selecting a kits triggers creation of the build folder. Configuration should end successfully.

Select @projects/cpp/console. In the new project, the following should now be present:

.gitignore
CMakeLists.txt
main.cpp

Select @projects/cpp/qtquick. You should be asked to select a kit.

.gitignore
CMakeLists.txt
main.cpp
Main.qml

Select @projects/cpp/qwidget. You should be asked to select a kit.

.gitignore
CMakeLists.txt
main.cpp
widget.cpp
widget.h
widget.ui
Configuration error VSCODEEXT-169

Select Manually select features. Questions should appear one after the other on the terminal. Answer and save the preset. Below the questions and an example of selected answers.

✔ Pick a preset [Manually select features]
✔ Pick an item to use: [Default] @projects/cpp/console
✔ Qt version: 6
✔ Use translation: Yes
✔ Target language (e.g. en_US, ko_KR): en_US
✔ Save for later use? Yes
✔ Enter the preset name: my_own_preset

Run Qt: Create Create New Project and make sure the saved preset is displayed

 → my_own_preset (projects/cpp/console)
   [Default] @projects/cpp/console     
   [Default] @projects/cpp/qtquick     
   [Default] @projects/cpp/qwidget     
   [Manually select features]   
Qt: Create New File

Run Qt: Create File. Give the file a name. The following option should appear in the terminal

 → [Default] @types/qml      
   [Default] @types/qrc      
   [Default] @types/ts       
   [Default] @types/ui       
   [Manually select features]

Select [Default] @types/qml. Give a name to the new file. Check it looks like expected:

 import QtQuick
 
 Item {
 }

Select [Default] @types/qrc. Give a name to the new file. Check it looks like expected:

 <!DOCTYPE RCC>
 <RCC version="1.0"/>

Select [Default] @types/ts. Give a name to the new file. Check it looks like expected:

 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE TS>
 <TS version="2.1" language="en_US"></TS>

Select [Default] @types/ui. Give a name to the new file. A button to Open this file with Qt Widgets Designer appears.

Select [Manually select features]. Questions should appear one after the other on the terminal. Answer and save the preset. Below the questions and an example of selected answers.

✔ Pick a preset [Manually select features]
✔ Pick an item to use: [Default] @types/qml
✔ Save for later use? Yes
✔ Enter the preset name: my_file

Next time Qt: Create File is run, on should see:

 → my_file (types/qml)       
   [Default] @types/qml      
   [Default] @types/qrc      
   [Default] @types/ts       
   [Default] @types/ui       
   [Manually select features]


Qt: Reset Qt Tools Extension State (For troubleshooting)
to do