Skip to content

Commit

Permalink
Issue #101 unit test (should fail)
Browse files Browse the repository at this point in the history
  • Loading branch information
NQNStudios committed Sep 21, 2024
1 parent f4b1b58 commit e16aa21
Show file tree
Hide file tree
Showing 20 changed files with 20,225 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
{
name: build and unit test,
run: ./.github/workflows/scripts/mac/scons-build.sh
run: ./.github/workflows/scripts/mac/scons-build.sh test=true
}
]
},
Expand Down Expand Up @@ -153,7 +153,7 @@
},
{
name: build and unit test,
run: '.\.github\workflows\scripts\win\scons-build.bat'
run: '.\.github\workflows\scripts\win\scons-build.bat test=true'
},
{
name: warn about failure to launch tests,
Expand Down
2 changes: 1 addition & 1 deletion src/fileio/fileio.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class cScenario;
class cUniverse;

fs::path locate_scenario(std::string scen_name);
bool load_scenario(fs::path file_to_load, cScenario& scenario, bool only_header = false);
bool load_scenario(fs::path file_to_load, cScenario& scenario, bool only_header = false, bool pop_paths = true);

fs::path nav_get_or_decode_party();
fs::path nav_put_or_temp_party(fs::path def = "");
Expand Down
26 changes: 14 additions & 12 deletions src/fileio/fileio_scen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,22 @@ fs::path locate_scenario(std::string scen_name) {
return scenPath;
}

bool load_scenario(fs::path file_to_load, cScenario& scenario, bool only_header) {
bool load_scenario(fs::path file_to_load, cScenario& scenario, bool only_header, bool pop_paths) {
// Before loading a scenario, we may need to pop scenario resource paths.
fs::path graphics_path = ResMgr::graphics.popPath();
for(auto p : graphics_path) {
if(p.string() == "data") {
ResMgr::graphics.pushPath(graphics_path);
break;
if(pop_paths){
fs::path graphics_path = ResMgr::graphics.popPath();
for(auto p : graphics_path) {
if(p.string() == "data") {
ResMgr::graphics.pushPath(graphics_path);
break;
}
}
}
fs::path sounds_path = ResMgr::sounds.popPath();
for(auto p : sounds_path) {
if(p.string() == "data") {
ResMgr::sounds.pushPath(sounds_path);
break;
fs::path sounds_path = ResMgr::sounds.popPath();
for(auto p : sounds_path) {
if(p.string() == "data") {
ResMgr::sounds.pushPath(sounds_path);
break;
}
}
}
scenario = cScenario();
Expand Down
2 changes: 2 additions & 0 deletions test/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ env.AlwaysBuild(env.Install("#build/rsrc/", Dir("#rsrc/strings")))
env.AlwaysBuild(env.Install("#build/rsrc/", Dir("#rsrc/dialogs")))
env.AlwaysBuild(env.Install("#build/rsrc/", Dir("#rsrc/fonts")))
env.AlwaysBuild(env.Install("#build/rsrc/", Dir("#rsrc/graphics")))
# The town boundaries conversion test requires this:
env.AlwaysBuild(env.Install("#build/rsrc/", Dir("#rsrc/sounds")))

env.Command("#build/test/junk/", '', 'mkdir "' + Dir("#build/test/junk").path + '"')
env.Command("#build/test/passed", test, run_tests, chdir=True)
Binary file added test/files/town/townrectMac.exs
Binary file not shown.
Binary file added test/files/town/townrectUniversal/header.exs
Binary file not shown.
Loading

0 comments on commit e16aa21

Please sign in to comment.