Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5374: Add a unit test checking that Map::exportSelected is not faili…
…ng and produces a string result that looks like an XML file.
- Loading branch information
1 parent
e5b3ae0
commit 079ade4
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "RadiantTest.h" | ||
|
||
#include "imap.h" | ||
#include "imapformat.h" | ||
#include "ibrush.h" | ||
#include "iselection.h" | ||
#include "scenelib.h" | ||
#include "string/predicate.h" | ||
#include "xmlutil/Document.h" | ||
|
||
namespace test | ||
{ | ||
|
||
using MapExportTest = RadiantTest; | ||
|
||
TEST_F(MapExportTest, exportSelectedWithFormat) | ||
{ | ||
auto worldspawn = GlobalMapModule().findOrInsertWorldspawn(); | ||
|
||
auto brushNode = GlobalBrushCreator().createBrush(); | ||
worldspawn->addChildNode(brushNode); | ||
|
||
GlobalSelectionSystem().setSelectedAll(false); | ||
Node_setSelected(brushNode, true); | ||
|
||
auto format = GlobalMapFormatManager().getMapFormatByName(map::PORTABLE_MAP_FORMAT_NAME); | ||
|
||
std::ostringstream output; | ||
GlobalMapModule().exportSelected(output, format); | ||
|
||
output.flush(); | ||
|
||
// Minimal assertion: we got a string that appears to start like an XML document | ||
auto result = output.str(); | ||
ASSERT_TRUE(string::starts_with(result, "<?xml version=\"1.0\" encoding=\"utf-8\"?>")); | ||
ASSERT_TRUE(result.find("<map") != std::string::npos); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters