mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-10 04:16:43 -07:00
feat(command-zone): add commander tax counter system with tests
Implement CommanderTaxCounter - tracks casting cost increases for commanders that have been cast multiple times. Key components: - CommanderTaxCounter: specialized counter with value clamping - AbstractCounter modifications: support for counter ID system - CounterGeneral/TranslateCounterName: UI integration for display Design decisions: - Counter values clamped to valid range (0 to max) - Builds on counter_ids.h constants from commit 1 - Uses z_values.h from commit 4 for proper visual layering - Counter visibility tied to zone state (hidden when zone hidden) Test coverage: - commander_tax_counter_test: verifies setValue clamping behavior - counter_visibility_test: verifies visibility state transitions Note: Tests include <climits> for INT_MIN usage (required on some compilers like GCC on Debian 11 where INT_MIN is not transitively included).
This commit is contained in:
parent
8422357878
commit
7a0a3ff9ac
10 changed files with 694 additions and 8 deletions
|
|
@ -31,6 +31,22 @@ target_link_libraries(command_zone_logic_test
|
|||
|
||||
add_test(NAME command_zone_logic_test COMMAND command_zone_logic_test)
|
||||
|
||||
# ------------------------
|
||||
# Commander Tax Counter Test
|
||||
# Tests setValue clamping behavior
|
||||
# ------------------------
|
||||
add_executable(commander_tax_counter_test
|
||||
commander_tax_counter_test.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(commander_tax_counter_test
|
||||
PRIVATE Threads::Threads
|
||||
PRIVATE ${GTEST_BOTH_LIBRARIES}
|
||||
PRIVATE ${TEST_QT_MODULES}
|
||||
)
|
||||
|
||||
add_test(NAME commander_tax_counter_test COMMAND commander_tax_counter_test)
|
||||
|
||||
# ------------------------
|
||||
# Command Zone State Test
|
||||
# Tests the extracted CommandZoneState pure state machine
|
||||
|
|
@ -53,10 +69,28 @@ target_link_libraries(command_zone_state_test
|
|||
|
||||
add_test(NAME command_zone_state_test COMMAND command_zone_state_test)
|
||||
|
||||
# ------------------------
|
||||
# Counter Visibility Test
|
||||
# Tests counter visibility during zone state transitions
|
||||
# ------------------------
|
||||
add_executable(counter_visibility_test
|
||||
counter_visibility_test.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(counter_visibility_test
|
||||
PRIVATE Threads::Threads
|
||||
PRIVATE ${GTEST_BOTH_LIBRARIES}
|
||||
PRIVATE ${TEST_QT_MODULES}
|
||||
)
|
||||
|
||||
add_test(NAME counter_visibility_test COMMAND counter_visibility_test)
|
||||
|
||||
# ------------------------
|
||||
# Dependencies on gtest
|
||||
# ------------------------
|
||||
if(NOT GTEST_FOUND)
|
||||
add_dependencies(command_zone_logic_test gtest)
|
||||
add_dependencies(commander_tax_counter_test gtest)
|
||||
add_dependencies(command_zone_state_test gtest)
|
||||
add_dependencies(counter_visibility_test gtest)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue