Files
vdm/gui/tests/CMakeLists.txt
T
samiandClaude Sonnet 5 51fa1201bd gui: category tree, menus, toolbar, splitter — build-order step 3
- CategoryPanel: the left tree — All Downloads / Unfinished / Finished,
  then Categories and Queues populated from category.list / queue.list,
  with per-node task counts. Selecting a node emits a TaskSelection.
- DownloadFilterProxy: QSortFilterProxyModel keyed off that selection.
  Client-side for M1 (the whole list fits); asTaskFilter() exposes the
  equivalent TaskFilter for a server-side download.list once paging lands.
- MainWindow: menu bar (Tasks / Downloads / View / Help) sharing QAction
  objects with the toolbar; QSplitter [panel | table]; Delete with a
  confirm; Resume/Pause All; View menu toggles the panel. Actions
  disabled while offline.
- Counts are computed off a throttled 400 ms timer, not the 4 Hz progress
  path. Fixed a debounce-vs-throttle bug found in the first screenshot:
  restarting the timer on every progress tick meant it never fired and
  the status bar sat at "0 of 0 downloads".
- First-run column widths that fit the content.
- tst_downloadfilterproxy: nodes filter to their own rows, the
  Finished/Unfinished split is correct, and the filter is dynamic (a row
  that finishes leaves the Unfinished node with no re-list). Verified
  against mockd --tasks 400 (screenshot: tree counts 75/84/89/83/69 sum
  to 400, status bar "400 of 400, 21 active").

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Ne28kx4VreeBWZv82Nksd
2026-09-10 15:41:29 +04:00

55 lines
2.8 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")
# 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")