Skip to content

Commit

Permalink
Some final scenario read tests
Browse files Browse the repository at this point in the history
  • Loading branch information
CelticMinstrel committed Sep 30, 2015
1 parent 43e8228 commit 5c37fa1
Show file tree
Hide file tree
Showing 22 changed files with 772 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tools/fileio_scen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ void readScenarioFromXml(ticpp::Document&& data, cScenario& scenario) {
} else if(type == "editor") {
std::set<std::string> reqs = {"default-ground", "last-out-section", "last-town"};
Iterator<Element> edit;
int num_storage = 0, num_pics = 0, sndnum = 0;
int num_storage = 0, num_pics = 0;
for(edit = edit.begin(elem.Get()); edit != edit.end(); edit++) {
edit->GetValue(&type);
reqs.erase(type);
Expand All @@ -839,6 +839,7 @@ void readScenarioFromXml(ticpp::Document&& data, cScenario& scenario) {
} else if(type == "last-town") {
edit->GetText(&scenario.last_town_edited);
} else if(type == "sound") {
int sndnum = 0;
edit->GetAttribute("id", &sndnum);
if(sndnum < 100)
throw xBadVal(type, "id", std::to_string(sndnum), edit->Row(), edit->Column(), fname);
Expand Down
21 changes: 21 additions & 0 deletions test/files/scenario/bad_difficulty.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>7</difficulty>
</ratings>
</scenario>
43 changes: 43 additions & 0 deletions test/files/scenario/bad_editor_node.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<adjust-difficulty>true</adjust-difficulty>
<legacy>false</legacy>
<custom-graphics>false</custom-graphics>
</flags>
<creator>
<type>oboe</type>
<version>2.5.3</version>
<os></os>
</creator>
<game>
<num-towns>3</num-towns>
<out-width>2</out-width>
<out-height>1</out-height>
<start-town>7</start-town>
<town-start x="24" y="28" />
<outdoor-start x="1" y="3" />
<sector-start x="12" y="21" />
</game>
<editor>
<bad/>
</editor>
</scenario>
24 changes: 24 additions & 0 deletions test/files/scenario/bad_flag.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<bad/>
</flags>
</scenario>
34 changes: 34 additions & 0 deletions test/files/scenario/bad_game_node.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<adjust-difficulty>true</adjust-difficulty>
<legacy>false</legacy>
<custom-graphics>false</custom-graphics>
</flags>
<creator>
<type>oboe</type>
<version>2.5.3</version>
<os></os>
</creator>
<game>
<bad/>
</game>
</scenario>
46 changes: 46 additions & 0 deletions test/files/scenario/bad_snd_name.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<adjust-difficulty>true</adjust-difficulty>
<legacy>false</legacy>
<custom-graphics>false</custom-graphics>
</flags>
<creator>
<type>oboe</type>
<version>2.5.3</version>
<os></os>
</creator>
<game>
<num-towns>3</num-towns>
<out-width>2</out-width>
<out-height>1</out-height>
<start-town>7</start-town>
<town-start x="24" y="28" />
<outdoor-start x="1" y="3" />
<sector-start x="12" y="21" />
</game>
<editor>
<default-ground>2</default-ground>
<last-out-section x="0" y="0" />
<last-town>0</last-town>
<sound id='5'>Can't rename preset sounds</sound>
</editor>
</scenario>
4 changes: 4 additions & 0 deletions test/files/scenario/bad_toplevel.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<bad/>
</scenario>
1 change: 1 addition & 0 deletions test/files/scenario/optional.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@
<default-ground>2</default-ground>
<last-out-section x="0" y="0" />
<last-town>0</last-town>
<sound id='100'>The name of my custom sound</sound>
</editor>
</scenario>
34 changes: 34 additions & 0 deletions test/files/scenario/rect_bad_attr.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<adjust-difficulty>true</adjust-difficulty>
<legacy>false</legacy>
<custom-graphics>false</custom-graphics>
</flags>
<creator>
<type>oboe</type>
<version>2.5.3</version>
<os></os>
</creator>
<game>
<store-items bad='0'/>
</game>
</scenario>
34 changes: 34 additions & 0 deletions test/files/scenario/rect_missing_bottom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<adjust-difficulty>true</adjust-difficulty>
<legacy>false</legacy>
<custom-graphics>false</custom-graphics>
</flags>
<creator>
<type>oboe</type>
<version>2.5.3</version>
<os></os>
</creator>
<game>
<store-items town='0' top='0' left='0' right='10'/>
</game>
</scenario>
34 changes: 34 additions & 0 deletions test/files/scenario/rect_missing_left.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<adjust-difficulty>true</adjust-difficulty>
<legacy>false</legacy>
<custom-graphics>false</custom-graphics>
</flags>
<creator>
<type>oboe</type>
<version>2.5.3</version>
<os></os>
</creator>
<game>
<store-items town='0' top='0' bottom='10' right='10'/>
</game>
</scenario>
34 changes: 34 additions & 0 deletions test/files/scenario/rect_missing_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<adjust-difficulty>true</adjust-difficulty>
<legacy>false</legacy>
<custom-graphics>false</custom-graphics>
</flags>
<creator>
<type>oboe</type>
<version>2.5.3</version>
<os></os>
</creator>
<game>
<store-items town='0' top='0' left='0' bottom='10'/>
</game>
</scenario>
34 changes: 34 additions & 0 deletions test/files/scenario/rect_missing_top.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<scenario boes="2.1.5">
<title>Test Scenario</title>
<icon>7</icon>
<id>campaign</id>
<version>2.6.7</version>
<language>en-US</language>
<author>
<name>BoE Test Suite</name>
<email>[email protected]</email>
</author>
<text>
<teaser>Teaser 1</teaser>
<teaser>Teaser 2</teaser>
<intro-msg><![CDATA[Welcome!!! To the test scenario!]]></intro-msg>
</text>
<ratings>
<content>R</content>
<difficulty>3</difficulty>
</ratings>
<flags>
<adjust-difficulty>true</adjust-difficulty>
<legacy>false</legacy>
<custom-graphics>false</custom-graphics>
</flags>
<creator>
<type>oboe</type>
<version>2.5.3</version>
<os></os>
</creator>
<game>
<store-items town='0' left='0' bottom='10' right='10'/>
</game>
</scenario>
Loading

0 comments on commit 5c37fa1

Please sign in to comment.