Skip to content

Commit 5291b82

Browse files
committed
Write unit-tests
1 parent ddb5498 commit 5291b82

39 files changed

Lines changed: 2373 additions & 657 deletions

.github/workflows/cmake_build.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ jobs:
6969

7070
- name: Setup (Linux)
7171
if: startsWith (matrix.os, 'ubuntu')
72-
run: sudo apt-get install libxkbcommon-dev
72+
run: |
73+
sudo apt-get update
74+
sudo apt-get install libxkbcommon-dev xvfb
7375
7476
- name: Setup VS tools (Windows)
7577
if: startsWith (matrix.os, 'windows')
@@ -82,3 +84,21 @@ jobs:
8284

8385
- name: Build with ${{ matrix.compiler }}
8486
run: cmake --build build --config ${{ matrix.configuration }}
87+
88+
- name: Run Tests (Linux)
89+
if: startsWith (matrix.os, 'ubuntu')
90+
run: |
91+
cd build
92+
xvfb-run -a ctest --output-on-failure --progress
93+
94+
- name: Run Tests (macOS)
95+
if: startsWith (matrix.os, 'macos')
96+
run: |
97+
cd build
98+
ctest --output-on-failure --progress
99+
100+
- name: Run Tests (Windows)
101+
if: startsWith (matrix.os, 'windows')
102+
run: |
103+
cd build
104+
ctest --output-on-failure --progress

.travis.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ option(BUILD_DEBUG_POSTFIX_D "Append d suffix to debug libraries" OFF)
3030
option(QT_NODES_FORCE_TEST_COLOR "Force colorized unit test output" OFF)
3131
option(USE_QT6 "Build with Qt6 (Enabled by default)" ON)
3232

33-
enable_testing()
34-
3533
if(QT_NODES_DEVELOPER_DEFAULTS)
3634
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
3735
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
@@ -212,9 +210,11 @@ endif()
212210
##################
213211
# Automated Tests
214212
##
213+
enable_testing()
214+
215215

216216
if(BUILD_TESTING)
217-
#add_subdirectory(test)
217+
add_subdirectory(test)
218218
endif()
219219

220220
###############

README.rst

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,13 @@ Qt Creator
136136
----------
137137

138138
1. Open `CMakeLists.txt` as project.
139-
2. If you don't have the `Catch2` library installed, go to `Build Settings`, disable the checkbox `BUILD_TESTING`.
140-
3. `Build -> Run CMake`
141-
4. `Build -> Build All`
142-
5. Click the button `Run`
139+
2. `Build -> Run CMake`
140+
3. `Build -> Build All`
141+
4. Click the button `Run`
142+
143+
.. note::
144+
The project includes unit tests built with Catch2. If you don't have Catch2 installed,
145+
you can disable testing by setting `-DBUILD_TESTING=OFF` in CMake configuration.
143146

144147

145148
With Cmake using `vcpkg`
@@ -153,6 +156,39 @@ With Cmake using `vcpkg`
153156
-DCMAKE_TOOLCHAIN_FILE=<vcpkg_dir>/scripts/buildsystems/scripts/buildsystems/vcpkg.cmake
154157

155158

159+
Testing
160+
=======
161+
162+
QtNodes includes a comprehensive unit test suite built with Catch2.
163+
164+
**Running Tests**
165+
166+
From the build directory:
167+
168+
::
169+
170+
# Build tests
171+
make test_nodes
172+
173+
# Run all tests
174+
./bin/test_nodes
175+
176+
# Run specific categories
177+
./bin/test_nodes "[core]" # Core functionality tests
178+
./bin/test_nodes "[graphics]" # Graphics system tests
179+
180+
**Test Coverage**
181+
182+
* Core model operations (node CRUD, connections)
183+
* Signal emission verification (AbstractGraphModel signals)
184+
* Serialization (JSON save/load)
185+
* Undo system integration
186+
* Graphics scene management
187+
* Connection utilities
188+
189+
For detailed testing documentation, see the `Testing Guide <https://qtnodes.readthedocs.io/en/latest/testing.html>`_.
190+
191+
156192
Help Needed
157193
===========
158194

docs/development.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,19 @@ Development Progress
77
- [✅ done] Dynamic ports
88
- [✅ done] ``AbstractNodeGeometry``, ``AbstractNodePainter``
99
- [✅ done] Website with documentation
10-
- [✅] ``ConnectionPaintDelegate``
11-
- [➡️ work in progress] Unit-Tests
10+
- [✅ done] ``ConnectionPaintDelegate``
11+
- [✅ done] Unit-Tests
1212
- [➡️ work in progress] Ctrl+D for copying and inserting a selection duplicate
1313
- [⏸ not started] Node groups
1414
- [⏸ not started] Check how styles work and what needs to be done. See old pull-requests
1515
- [☝ help needed] Python bindings. Maybe a wrapper using Shiboken
1616
- Python examples
1717
- [☝ help needed] QML front-end
1818

19+
20+
Testing
21+
=======
22+
23+
QtNodes includes a comprehensive unit test suite. For detailed information about
24+
running tests, test coverage, and implementation details, see :doc:`testing`.
25+

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ QtNodes Documentation
1010
features
1111
porting
1212
development
13+
testing
1314
classes
1415
notes
1516
license_link

0 commit comments

Comments
 (0)