mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-08 17:13:57 -07:00
feat(command-zone): add logic layer with tests
Implement CommandZoneLogic - the card data management layer for zones. This layer handles card insertion, removal, and ordering independently of Qt graphics rendering. Key components: - CommandZoneLogic: manages card data within a zone - AddCardAlgorithm: generic insertion algorithm for ordered zones - CardZoneLogic modifications: integrate with existing zone hierarchy Design decisions: - Separation of data logic from graphics enables unit testing - addCardImpl uses a stable insertion algorithm for consistent ordering - Mock card items enable testing without Qt graphics dependencies Test coverage verifies card insertion behavior across edge cases.
This commit is contained in:
parent
3c2e4a3fb2
commit
8422357878
10 changed files with 480 additions and 5 deletions
|
|
@ -10,6 +10,27 @@ set(TEST_QT_MODULES
|
|||
${COCKATRICE_QT_VERSION_NAME}::Widgets
|
||||
)
|
||||
|
||||
# ------------------------
|
||||
# Command Zone Logic Test
|
||||
# Tests addCardImpl insertion behavior
|
||||
# ------------------------
|
||||
add_executable(command_zone_logic_test
|
||||
mocks/mock_card_item.cpp
|
||||
command_zone_logic_test.cpp
|
||||
)
|
||||
|
||||
target_include_directories(command_zone_logic_test
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/cockatrice/src/game/zones/logic
|
||||
)
|
||||
|
||||
target_link_libraries(command_zone_logic_test
|
||||
PRIVATE Threads::Threads
|
||||
PRIVATE ${GTEST_BOTH_LIBRARIES}
|
||||
PRIVATE ${TEST_QT_MODULES}
|
||||
)
|
||||
|
||||
add_test(NAME command_zone_logic_test COMMAND command_zone_logic_test)
|
||||
|
||||
# ------------------------
|
||||
# Command Zone State Test
|
||||
# Tests the extracted CommandZoneState pure state machine
|
||||
|
|
@ -36,5 +57,6 @@ add_test(NAME command_zone_state_test COMMAND command_zone_state_test)
|
|||
# Dependencies on gtest
|
||||
# ------------------------
|
||||
if(NOT GTEST_FOUND)
|
||||
add_dependencies(command_zone_logic_test gtest)
|
||||
add_dependencies(command_zone_state_test gtest)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue