test: add unit tests for Prefs (#8112)

* fix: hicpp-use-auto,modernize-use-auto

* refactor: make Prefs::getKey() a static method

refactor: make Prefs::isCore() a static method

refactor: make Prefs::type() a static method

* refactor: Application takes a Prefs& arg, not a std::unique_ptr<Prefs> arg

* fix: bugprone-exception-escape

save settings by calling prefs.save() from main()

* refactor: load settings by calling prefs.load() from main()

* refactor: use preferred declaration order in Prefs

* fixup! fix: bugprone-exception-escape

* refactor: add Prefs::current_values()

* refactor: clean up namespace use in Prefs.cc

* feat: add QString, QDateTime serializers

* test: add scaffolding for testing Qt code

test: add tests for Prefs

* refactor: remove unused #includes

* build: add clang-tidy rules to tests/qt/

* refactor: clean up the new test code a little

* chore: add missing copyright statement

* ci: ensure Qt6Test is installed

build: check for QTest when ENABLE_TESTS + ENABLE_QT are ON

* fixup! feat: add QString, QDateTime serializers

* fix: Wswitch warning

* build: do not disable tests in release/windows/build-qt5.psl, build-qt6.psl

* ci: set QT_QPA_PLATFORM for running new Qt tests

* test: build cleanly in Qt 5.15

* fixup! fixup! feat: add QString, QDateTime serializers

fix QDateTime serializer on macOS

* fixup! ci: set QT_QPA_PLATFORM for running new Qt tests

install xcb-util-cursor on alpine
This commit is contained in:
Charles Kerr
2026-01-11 19:23:00 -06:00
committed by GitHub
parent cf0a596a45
commit d177f9f903
19 changed files with 750 additions and 321 deletions

View File

@@ -461,7 +461,7 @@ jobs:
run: apk add --upgrade glibmm-dev gtkmm3-dev
- name: Get Dependencies (Qt6)
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
run: apk add --upgrade qt6-qttools-dev qt6-qtsvg-dev
run: apk add --upgrade qt6-qtbase-dev qt6-qttools-dev qt6-qtsvg-dev xcb-util-cursor
- name: Get Source
uses: actions/checkout@v4
with:
@@ -494,6 +494,7 @@ jobs:
if: ${{ needs.what-to-make.outputs.make-tests == 'true' }}
env:
TMPDIR: /private/tmp
QT_QPA_PLATFORM: offscreen
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure
- name: Install
run: cmake --build obj --config RelWithDebInfo --target install/strip
@@ -765,6 +766,8 @@ jobs:
run: cmake --build obj --config RelWithDebInfo
- name: Test
if: ${{ needs.what-to-make.outputs.make-tests == 'true' }}
env:
QT_QPA_PLATFORM: offscreen
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure
- name: Install
run: cmake --build obj --config RelWithDebInfo --target install/strip
@@ -814,7 +817,7 @@ jobs:
run: dnf install -y glibmm2.68-devel gtkmm4.0-devel
- name: Get Dependencies (Qt6)
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
run: dnf install -y qt6-qtbase-devel qt6-qtsvg-devel qt6-qttools-devel
run: dnf install -y qt6-qtbase-devel qt6-qtsvg-devel qt6-qttools-devel xcb-util-cursor
- name: Get Source
uses: actions/download-artifact@v4
with:
@@ -845,6 +848,8 @@ jobs:
run: cmake --build obj --config RelWithDebInfo
- name: Test
if: ${{ needs.what-to-make.outputs.make-tests == 'true' }}
env:
QT_QPA_PLATFORM: offscreen
run: cmake -E chdir obj ctest -j $(nproc) --build-config RelWithDebInfo --output-on-failure
- name: Install
run: cmake --build obj --config RelWithDebInfo --target install/strip
@@ -1014,7 +1019,7 @@ jobs:
run: sudo apt-get install -y --no-install-recommends libglibmm-2.4-dev libgtkmm-3.0-dev
- name: Get Dependencies (Qt6)
if: ${{ needs.what-to-make.outputs.make-qt == 'true' }}
run: sudo apt-get install -y --no-install-recommends qt6-svg-dev qt6-tools-dev
run: sudo apt-get install -y --no-install-recommends qt6-base-dev qt6-svg-dev qt6-tools-dev
- name: Get Source
uses: actions/checkout@v4
with: