Skip to content

Commit

Permalink
#5108: Add unit test cases covering OpenMapFromArchive
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 29, 2020
1 parent cba0b36 commit 3d31502
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/MapSavingLoading.cpp
Expand Up @@ -4,6 +4,7 @@
#include "iundo.h"
#include "imap.h"
#include "imapformat.h"
#include "ifilesystem.h"
#include "iradiant.h"
#include "iselectiongroup.h"
#include "ilightnode.h"
Expand Down Expand Up @@ -286,6 +287,29 @@ TEST_F(MapLoadingTest, openMapFromModPak)
EXPECT_EQ(GlobalMapModule().getMapName(), modRelativePath);
}

TEST_F(MapLoadingTest, openMapFromArchive)
{
auto pakPath = fs::path(_context.getTestResourcePath()) / ".." / "map_loading_test.pk4";
std::string archiveRelativePath = "maps/altar_packed.map";

GlobalCommandSystem().executeCommand("OpenMapFromArchive", pakPath.string(), archiveRelativePath);

// Check if the scene contains what we expect
checkAltarScene();
}

TEST_F(MapLoadingTest, openMapFromArchiveWithoutInfoFile)
{
auto pakPath = fs::path(_context.getTestResourcePath()) / ".." / "map_loading_test.pk4";
std::string archiveRelativePath = "maps/altar_packed_without_dr_file.map";

GlobalCommandSystem().executeCommand("OpenMapFromArchive", pakPath.string(), archiveRelativePath);

// Check if the scene contains what we expect, just the geometry since the map
// is lacking its .darkradiant file
checkAltarSceneGeometry();
}

TEST_F(MapLoadingTest, openNonExistentMap)
{
std::string mapName = "idontexist.map";
Expand Down
Binary file added test/resources/map_loading_test.pk4
Binary file not shown.

0 comments on commit 3d31502

Please sign in to comment.