Ran wmlindent on the new unit test. Some formatting had to be manually fixed.

This commit is contained in:
Charles Dang 2015-01-08 06:07:07 +11:00
parent 2c6d4dacf7
commit d9ef035bc0

View file

@ -3,26 +3,26 @@
#
{GENERIC_UNIT_TEST "test_wml_menu_items_1" (
[event]
name = start
[set_menu_item]
id=test1
description="store location"
[command]
{VARIABLE mx $x1}
{VARIABLE my $y1}
[/command]
[/set_menu_item]
[event]
name = start
[lua]
code = << wesnoth.fire_wml_menu_item("test1", 3, 3) >>
[/lua]
[set_menu_item]
id=test1
description="store location"
[command]
{VARIABLE mx $x1}
{VARIABLE my $y1}
[/command]
[/set_menu_item]
{ASSERT {VARIABLE_CONDITIONAL mx equals 3}}
{ASSERT {VARIABLE_CONDITIONAL my equals 3}}
{RETURN ([true][/true])}
[/event]
[lua]
code = << wesnoth.fire_wml_menu_item("test1", 3, 3) >>
[/lua]
{ASSERT {VARIABLE_CONDITIONAL mx equals 3}}
{ASSERT {VARIABLE_CONDITIONAL my equals 3}}
{RETURN ([true][/true])}
[/event]
)}
#
@ -33,35 +33,35 @@
# attempt to fire it.
#
{GENERIC_UNIT_TEST "test_wml_menu_items_2" (
[event]
name = start
[set_menu_item]
id=test2
description="spawn a unit"
[filter_location]
[not]
[have_unit]
x=$x1
y=$y1
[/have_unit]
[/not]
[/filter_location]
[command]
{UNIT 2 "Orcish Grunt" $x1 $y1 ()}
[/command]
[/set_menu_item]
[event]
name = start
[lua]
code = << r = wesnoth.fire_wml_menu_item("test2", 3, 3)
[set_menu_item]
id=test2
description="spawn a unit"
[filter_location]
[not]
[have_unit]
x=$x1
y=$y1
[/have_unit]
[/not]
[/filter_location]
[command]
{UNIT 2 "Orcish Grunt" $x1 $y1 ()}
[/command]
[/set_menu_item]
[lua]
code = << r = wesnoth.fire_wml_menu_item("test2", 3, 3)
r = r and not wesnoth.fire_wml_menu_item("test2", 3, 3)
r = r and wesnoth.fire_wml_menu_item("test2", 4, 4)
r = r and not wesnoth.fire_wml_menu_item("test2", 4, 4)
wesnoth.set_variable("result", r) >>
[/lua]
[/lua]
{RETURN {VARIABLE_CONDITIONAL result boolean_equals true}}
[/event]
{RETURN {VARIABLE_CONDITIONAL result boolean_equals true}}
[/event]
)}
#
@ -69,50 +69,54 @@
# being fired twice.
#
{GENERIC_UNIT_TEST "test_wml_menu_items_3" (
[event]
name = start
[event]
name = start
[set_menu_item]
id=test3
description="Summon Troll"
[show_if]
[not]
[have_unit]
x,y=$x1,$y1
[/have_unit]
[/not]
[/show_if]
[filter_location]
[/filter_location]
[command]
{NAMED_LOYAL_UNIT $side_number (Troll) $x1 $y1 (MagicTroll) ("Magic Troll")}
[fire_event]
name=apply_troll_skin
[primary_unit]
x=$x1
y=$y1
[/primary_unit]
[/fire_event]
[/command]
[/set_menu_item]
[set_menu_item]
id=test3
description="Summon Troll"
[show_if]
[not]
[have_unit]
x,y=$x1,$y1
[/have_unit]
[/not]
[/show_if]
[filter_location]
[/filter_location]
[command]
{NAMED_LOYAL_UNIT $side_number (Troll) $x1 $y1 (MagicTroll) ("Magic Troll")}
[fire_event]
name=apply_troll_skin
[primary_unit]
x=$x1
y=$y1
[/primary_unit]
[/fire_event]
[/command]
[/set_menu_item]
[lua]
code = << r = wesnoth.fire_wml_menu_item("test3", 3, 3) >>
[/lua]
{ASSERT ([have_unit]
x,y = 3,3
[/have_unit])}
[lua]
code = << r = wesnoth.fire_wml_menu_item("test3", 3, 3) >>
[/lua]
{ASSERT (
[have_unit]
x,y = 3,3
[/have_unit]
)}
[lua]
code = << r = r and wesnoth.fire_wml_menu_item("test3", 4, 4) >>
[/lua]
{ASSERT ([have_unit]
x,y = 4,4
[/have_unit])}
[lua]
code = << r = r and wesnoth.fire_wml_menu_item("test3", 4, 4) >>
[/lua]
{ASSERT (
[have_unit]
x,y = 4,4
[/have_unit]
)}
[lua]
code = << wesnoth.set_variable("result", r) >>
[/lua]
{RETURN {VARIABLE_CONDITIONAL result boolean_equals true}}
[/event]
[lua]
code = << wesnoth.set_variable("result", r) >>
[/lua]
{RETURN {VARIABLE_CONDITIONAL result boolean_equals true}}
[/event]
)}