Add a unit test for the event-handler reordering bug

This test would fail without the fix from the previous commit.
This commit is contained in:
Steve Cotton 2024-01-20 22:49:40 +01:00 committed by Steve Cotton
parent 508859cfb6
commit 87b42c404b
2 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,40 @@
# wmllint: no translatables
#####
# API(s) being tested: [event]priority=
##
# Actions:
# In a normal-priority start event, add a high priority start event.
# Check that the normal-priority start event only ran once.
##
# Expected end state:
# The test passes when the normal priority start event is only run once.
#####
{GENERIC_UNIT_TEST "events_test_priority_in_same_name" (
[event]
name = prestart
{VARIABLE X 1}
[/event]
[event]
name = start
first_time_only = no
{ASSERT ({VARIABLE_CONDITIONAL X equals 1})}
{VARIABLE X 2}
# Add a high-priority event with the same name as the event that's
# being triggered, which in 1.17.24 caused the events list to be
# reordered, and the current event (the normal priority one) to trigger
# again.
[event]
name = start
priority = 1
{VARIABLE X 2}
[/event]
[/event]
[event]
name = side turn
{SUCCEED}
[/event]
)}

View File

@ -484,6 +484,7 @@
0 order_of_variable_events3
0 premature_end_turn1
2 premature_end_turn2
0 events_test_priority_in_same_name
0 events_test_priority_vs_origin
0 events_test_same_priority
0 events_test_multi_int