Closed NQNStudios closed 1 year ago
It's hard to say because the log is extremely sparse, but I think the Win64 test is failing because the MSVC build has a different directory structure.
It looks like this prints the absolute path to the dialog when it fails. Would it not make more sense to print just the filename?
I went ahead and made one of the changes that I'd been planning for awhile, which renders your prepend_path
obsolete. Instead you can basically do what the DialogLoader
does – load the XML file and pass it to the cDialog
constructor. (There's no reason to use the resource manager in the tests, I think… though you'll need to at least include the file to use DialogDefn
.)
I'm not quite sure, but I think the directory structure in Windows should look something like this:
rsrc/dialogs/
proj/vs201x
Tests/x64/Debug/
Test.exe
Game/x64/Debug/
data/dialogs/
It's probably easier to grab dialogs from the repository root than the game build directory… the only complicated part is how to do it only when building with MSBuild. Checking _WIN32
is no good, and I'm pretty sure _MSC_VER
doesn't work either because the scons build also uses Microsoft Cl as the compiler. Maybe the only option is to add a preprocessor definition to Test.vcxproj…?
I rebased onto the DialogDefn changes, but have not fixed the Win64 test failure yet.
I refactored the DialogLoader operator()
body into a global function, load_dialog_defn
, because I want to make sure the test is constructing the DialogDefn the same way the game does. I could have duplicated the code loading the XML node, but then the test code could get out of sync with the specific XML settings used in res_dialog.cpp
.
This test case should catch potential regressions of #273.
cDialog prepends data/dialogs onto the path you pass it, so I had to add an optional flag to not do that, so the tests can pass a path relative to their cwd.