Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Markdown Lint

on:
push:
paths:
- '**/*.md'
pull_request:
paths:
- '**/*.md'

jobs:
markdownlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Lint Markdown
uses: DavidAnson/markdownlint-cli2-action@v13
with:
globs: '**/*.md'
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Qt Quick Testing Tutorial

This repository demonstrates a minimal Qt Quick Test setup using Qt 6 and CMake.

The example project resides in `quicktest_example/`. Follow the instructions in
its README to build and run the tests.
18 changes: 18 additions & 0 deletions quicktest_example/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cmake_minimum_required(VERSION 3.16)

project(QtQuickTestExample LANGUAGES CXX)

find_package(Qt6 REQUIRED COMPONENTS QuickTest)

# Enable C++17 for this example
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(tst_example
main.cpp
)

target_link_libraries(tst_example PRIVATE Qt6::QuickTest)

add_test(NAME tst_example COMMAND tst_example)

22 changes: 22 additions & 0 deletions quicktest_example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Qt Quick Test Example

This directory contains a minimal example showing how to set up a Qt Quick Test
project using CMake with Qt 6.

## Building

```bash
mkdir build
cd build
cmake .. -DCMAKE_PREFIX_PATH=/path/to/Qt6
cmake --build .
ctest
```

Adjust `CMAKE_PREFIX_PATH` so that CMake can find your Qt 6 installation.

## Files

- `CMakeLists.txt` – CMake configuration for the test project.
- `main.cpp` – Entry point that launches the QML tests.
- `tst_example.qml` – A simple test case demonstrating Qt Quick Test usage.
3 changes: 3 additions & 0 deletions quicktest_example/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <QtQuickTest/quicktest.h>

QUICK_TEST_MAIN(example)
10 changes: 10 additions & 0 deletions quicktest_example/tst_example.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import QtQuick
import QtTest

TestCase {
name: "Example"

function test_addition() {
compare(1 + 1, 2)
}
}