First vertical slice of velox-gui, built entirely against tools/mockd (no daemon dependency): - rpc/: RpcConnection runs a QLocalSocket on a worker thread with newline-delimited JSON-RPC framing, drives the session.hello / session.subscribe handshake, and reconnects with exponential backoff (250 ms -> 8 s). RpcClient is the main-thread face: marshals calls onto the worker, delivers replies as main-thread callbacks, re-emits server notifications as typed Qt signals, and issues the one-shot download.list on reaching Connected. - models/DownloadTableModel: QAbstractTableModel over TaskSummary. A progress batch is a row patch with a narrow dataChanged over the value columns only; beginResetModel() is reserved for the initial load and a reconnect resync. - widgets/ProgressDelegate: in-cell progress bar for the Status column. - mainwindow/MainWindow: the table, a status-bar connection dot, an offline banner instead of a modal, dialog-free pause/resume/stop actions, and QSettings column/geometry persistence. - gui/CMakeLists.txt links velox::proto (never velox::core, ADR 0009) and self-guards on the veloxproto target so main keeps configuring if it is ever absent again. - i18n from the first commit: every string via tr(), plus an Arabic .ts stub for the RTL check. - tests/: headless QTest for the model — proves the progress patch is a narrow dataChanged and never resets the model. Verified end-to-end against `mockd --tasks 300`: handshake, initial list, live progress batches applied to the model, and a clean Reconnecting -> Connected recovery when mockd is bounced mid-run. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Ne28kx4VreeBWZv82Nksd
23 lines
938 B
CMake
23 lines
938 B
CMake
# GUI unit tests. Lane GUI.
|
|
#
|
|
# CLAUDE.md §5: a feature with no test does not exist. The model is the piece with real
|
|
# logic that can be tested headless — the progress patch must be a narrow dataChanged and
|
|
# must never reset the model (docs/03-gui-spec.md §1).
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
find_package(Qt6 REQUIRED COMPONENTS Test)
|
|
|
|
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")
|