Continues the build order past Options/Scheduler/Speed Limiter/Batch/ Grabber/tray. - DropTargetWidget: frameless always-on-top drop target (docs/03-gui-spec.md §5), position persisted, accepts a dropped http(s) URL or link text and opens FileInfoDialog directly (skipping Add URL, since the URL is already known). Shown/hidden from general.showDropTarget, live via event.settings.changed, same pattern MainWindow already used for general.minimizeToTray. - Clipboard, explicit path #2 (docs/06-risks-and-spikes.md R2): GlobalShortcut wraps org.freedesktop.portal.GlobalShortcuts (CreateSession -> BindShortcuts -> Activated), triggering the same Add URL flow. Guarded end-to-end on `if(TARGET Qt6::DBus)` / VELOX_GUI_HAVE_DBUS so a build without the component degrades to "feature skipped," not broken (gui/docs/pkg-qa-requests-m1.md R4). Best-effort by design per the risk doc: fails silent, never advertised. Verified live against the real portal (a real Wayland session, not just offscreen): `CreateSession` refuses every caller with "An app id is required" — reproduced identically via a bare `busctl` call with no Qt involved at all, so this is the portal requiring a sandboxed caller identity, not something fixable from an unconfined process. Recorded as a partial Spike S2 answer in docs/06-risks-and-spikes.md: this explicit path likely doesn't work for Velox as a traditionally-packaged app on stock GNOME, only if/when it ships confined. Also fixed a real leak this verification caught: QDBusInterface's introspection cache reads as a LeakSanitizer leak the first time anything touches D-Bus (tst_rtl went red under ASan) — switched to QDBusMessage::createMethodCall, which needs no introspection. - Theming (docs/03-gui-spec.md §7): gui/resources/qss/{idm-like,dark}.qss, each with a documented palette block up top (QSS itself has no variable syntax), applied by ThemeManager and kept live via QStyleHints::colorSchemeChanged. util/Theme.hpp gives the handful of inline C++ styles (status dot, offline banner, the eleven identical error-label styles across dialogs) named constants instead of a twelfth copy of the same hex. - UiThreadWatchdog: the M1 DoD's 200 ms debug-build watchdog. A background std::thread pings the UI thread every 50 ms via a queued invokeMethod and warns once (not per-poll) if a ping goes unanswered past 200 ms; no QThread, no Qt event loop of its own, so the watchdog itself can never be what blocks the thread it watches. No-op in a release build. Proven both ways in tst_uithreadwatchdog: fires on a genuinely blocked UI thread (synchronous sleep, no processEvents) and stays silent on a responsive one. Full non-conformance suite (55 tests across every lane, `ctest -LE conformance`) passes clean at this point, including the whole gui label under ASan+UBSan. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NSCdCWFXBTSBBK3MzWtJiC
172 lines
9.5 KiB
CMake
172 lines
9.5 KiB
CMake
# GUI unit tests. Lane GUI.
|
|
#
|
|
# CLAUDE.md §5: a feature with no test does not exist. Each test below has a concrete
|
|
# failure it catches — that is the bar, not "it runs green".
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
find_package(Qt6 REQUIRED COMPONENTS Test)
|
|
|
|
# tst_downloadtablemodel — the model's logic, headless.
|
|
# Red when: a progress patch widens past the value columns, a reset slips into
|
|
# applyProgress, applyProgress starts synthesizing rows for unknown ids, or add/remove
|
|
# stops emitting rowsInserted/rowsRemoved.
|
|
add_executable(tst_downloadtablemodel
|
|
tst_downloadtablemodel.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../src/models/DownloadTableModel.cpp
|
|
)
|
|
target_include_directories(tst_downloadtablemodel PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src)
|
|
target_compile_features(tst_downloadtablemodel PRIVATE cxx_std_23)
|
|
target_compile_options(tst_downloadtablemodel PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_downloadtablemodel PRIVATE Qt6::Core Qt6::Test)
|
|
add_test(NAME gui_downloadtablemodel COMMAND tst_downloadtablemodel)
|
|
set_tests_properties(gui_downloadtablemodel PROPERTIES LABELS "gui")
|
|
|
|
# tst_downloadfilterproxy — the category-tree filter.
|
|
# Red when: a node stops filtering to its own rows, the Finished/Unfinished split
|
|
# misclassifies a state, or the filter stops being dynamic.
|
|
add_executable(tst_downloadfilterproxy tst_downloadfilterproxy.cpp)
|
|
target_compile_features(tst_downloadfilterproxy PRIVATE cxx_std_23)
|
|
target_compile_options(tst_downloadfilterproxy PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_downloadfilterproxy PRIVATE velox-gui-lib Qt6::Test)
|
|
add_test(NAME gui_downloadfilterproxy COMMAND tst_downloadfilterproxy)
|
|
set_tests_properties(gui_downloadfilterproxy PROPERTIES LABELS "gui")
|
|
|
|
# tst_rtl — the real RTL check the GUI DoD asks for (the .ts stub alone verifies nothing).
|
|
# Red when: the main window stops propagating Qt::RightToLeft to its children, or the
|
|
# offline-banner layout is pinned so it does not mirror under RTL.
|
|
add_executable(tst_rtl tst_rtl.cpp)
|
|
target_compile_features(tst_rtl PRIVATE cxx_std_23)
|
|
target_compile_options(tst_rtl PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_rtl PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_rtl COMMAND tst_rtl)
|
|
set_tests_properties(gui_rtl PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_segmentbarswidget — the per-connection bar grid.
|
|
# Red when: a determinate segment stops rendering its percentage, an unknown-length
|
|
# segment stops falling back to the indeterminate range, a shrinking segment set
|
|
# destroys rows instead of hiding them, or rows start getting rebuilt per tick.
|
|
add_executable(tst_segmentbarswidget tst_segmentbarswidget.cpp)
|
|
target_compile_features(tst_segmentbarswidget PRIVATE cxx_std_23)
|
|
target_compile_options(tst_segmentbarswidget PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_segmentbarswidget PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_segmentbarswidget COMMAND tst_segmentbarswidget)
|
|
set_tests_properties(gui_segmentbarswidget PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_speedgraphwidget — the 60 s rolling speed graph.
|
|
# Red when: addSample stops throttling bursts to 1 Hz, the bucket count stops
|
|
# incrementing on genuinely separated samples, clear() leaves stale state, or painting
|
|
# crashes before two samples exist.
|
|
add_executable(tst_speedgraphwidget tst_speedgraphwidget.cpp)
|
|
target_compile_features(tst_speedgraphwidget PRIVATE cxx_std_23)
|
|
target_compile_options(tst_speedgraphwidget PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_speedgraphwidget PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_speedgraphwidget COMMAND tst_speedgraphwidget)
|
|
set_tests_properties(gui_speedgraphwidget PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_fileinfodialog — FileInfoDialog::buildSpec, the pure DownloadSpec builder.
|
|
# Red when: an empty optional field starts getting sent instead of omitted, or the
|
|
# queueId stops being dropped for a startMode other than "queue".
|
|
add_executable(tst_fileinfodialog tst_fileinfodialog.cpp)
|
|
target_compile_features(tst_fileinfodialog PRIVATE cxx_std_23)
|
|
target_compile_options(tst_fileinfodialog PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_fileinfodialog PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_fileinfodialog COMMAND tst_fileinfodialog)
|
|
set_tests_properties(gui_fileinfodialog PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_optionsdialog — OptionsDialog::diffChanged, the "only send what changed" logic, and
|
|
# allKeys() against the real schema.
|
|
# Red when an unchanged key gets resent, a key missing from `original` stops counting
|
|
# as changed, or allKeys() drifts from Settings.schema.json in either direction.
|
|
add_executable(tst_optionsdialog tst_optionsdialog.cpp)
|
|
target_compile_features(tst_optionsdialog PRIVATE cxx_std_23)
|
|
target_compile_options(tst_optionsdialog PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_compile_definitions(tst_optionsdialog PRIVATE VELOX_REPO_ROOT="${CMAKE_SOURCE_DIR}")
|
|
target_link_libraries(tst_optionsdialog PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_optionsdialog COMMAND tst_optionsdialog)
|
|
set_tests_properties(gui_optionsdialog PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_speedlimiterdialog — SpeedLimiterDialog::buildParams.
|
|
# Red when disabling stops zeroing globalBps, or enabling at 0 KiB/s stops being
|
|
# clamped to 1 (Limiter.schema.json: enabled+0 "must not be offered").
|
|
add_executable(tst_speedlimiterdialog tst_speedlimiterdialog.cpp)
|
|
target_compile_features(tst_speedlimiterdialog PRIVATE cxx_std_23)
|
|
target_compile_options(tst_speedlimiterdialog PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_speedlimiterdialog PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_speedlimiterdialog COMMAND tst_speedlimiterdialog)
|
|
set_tests_properties(gui_speedlimiterdialog PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_schedulerdialog — SchedulerDialog::buildSchedule.
|
|
# Red when "use a schedule" unchecked stops sending JSON null, "run until it drains"
|
|
# stops nulling stopTime, or daysOfWeek/onceDate leak into the wrong mode.
|
|
add_executable(tst_schedulerdialog tst_schedulerdialog.cpp)
|
|
target_compile_features(tst_schedulerdialog PRIVATE cxx_std_23)
|
|
target_compile_options(tst_schedulerdialog PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_schedulerdialog PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_schedulerdialog COMMAND tst_schedulerdialog)
|
|
set_tests_properties(gui_schedulerdialog PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_batchdialog — parseUrlBlob, expandWildcard, buildAddBatchParams.
|
|
# Red when the clipboard parser stops deduping or lets a non-URL line through, the
|
|
# wildcard expander mishandles zero-padding or an ambiguous/malformed range, or
|
|
# addBatch params include an empty optional field or a stray queueId.
|
|
add_executable(tst_batchdialog tst_batchdialog.cpp)
|
|
target_compile_features(tst_batchdialog PRIVATE cxx_std_23)
|
|
target_compile_options(tst_batchdialog PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_batchdialog PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_batchdialog COMMAND tst_batchdialog)
|
|
set_tests_properties(gui_batchdialog PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_grabberwizard — buildFileTypes, buildStartParams, buildHarvestParams.
|
|
# Red when every file-type box unchecked stops meaning "every type" (null, not []),
|
|
# a blank filter stops becoming schema null, or a selected fileId goes missing from
|
|
# the harvest params.
|
|
add_executable(tst_grabberwizard tst_grabberwizard.cpp)
|
|
target_compile_features(tst_grabberwizard PRIVATE cxx_std_23)
|
|
target_compile_options(tst_grabberwizard PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_grabberwizard PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_grabberwizard COMMAND tst_grabberwizard)
|
|
set_tests_properties(gui_grabberwizard PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# tst_uithreadwatchdog — the 200 ms debug-build UI-thread watchdog.
|
|
# Red when a genuinely blocked UI thread (synchronous sleep, no processEvents) stops
|
|
# producing a warning, or a responsive one starts producing a false-positive one.
|
|
add_executable(tst_uithreadwatchdog tst_uithreadwatchdog.cpp)
|
|
target_compile_features(tst_uithreadwatchdog PRIVATE cxx_std_23)
|
|
target_compile_options(tst_uithreadwatchdog PRIVATE -Wall -Wextra -Wpedantic -Werror)
|
|
target_link_libraries(tst_uithreadwatchdog PRIVATE velox-gui-lib Qt6::Widgets Qt6::Test)
|
|
add_test(NAME gui_uithreadwatchdog COMMAND tst_uithreadwatchdog)
|
|
set_tests_properties(gui_uithreadwatchdog PROPERTIES
|
|
LABELS "gui"
|
|
ENVIRONMENT "QT_QPA_PLATFORM=offscreen")
|
|
|
|
# gui-dod-harness — the M1 DoD gates (scroll-60fps / rss-flat / unhappy-path).
|
|
add_subdirectory(dod)
|
|
|
|
# gui_no_download_logic — CLAUDE.md §3 as an executable check, not a hope.
|
|
# Red when: a download-logic token (curl, raw pwrite, sqlite, QSqlDatabase) appears
|
|
# under gui/src. grep exits 0 only when it finds a match, so a hit fails the test.
|
|
add_test(NAME gui_no_download_logic
|
|
COMMAND ${CMAKE_COMMAND}
|
|
-DGUI_SRC=${CMAKE_CURRENT_SOURCE_DIR}/../src
|
|
-P ${CMAKE_CURRENT_SOURCE_DIR}/no_download_logic.cmake)
|
|
set_tests_properties(gui_no_download_logic PROPERTIES LABELS "gui")
|