Skip to content

Commit

Permalink
#5780: Expand unit tests to the "OpenMap" command
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Oct 14, 2021
1 parent fd81b0d commit 25748d0
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions test/MapSavingLoading.cpp
Expand Up @@ -1374,6 +1374,15 @@ TEST_F(MapSavingTest, NewMapWithoutUnsavedChanges)
});
}

TEST_F(MapSavingTest, OpenMapWithoutUnsavedChanges)
{
checkBehaviourWithoutUnsavedChanges([]()
{
// Opening a new map will not ask for save, since it hasn't been changed
GlobalCommandSystem().executeCommand("OpenMap", cmd::Argument("maps/csg_merge.map"));
});
}

TEST_F(MapSavingTest, NewMapDiscardingUnsavedChanges)
{
checkBehaviourDiscardingUnsavedChanges(_context.getTestProjectPath(), []()
Expand All @@ -1383,6 +1392,15 @@ TEST_F(MapSavingTest, NewMapDiscardingUnsavedChanges)
});
}

TEST_F(MapSavingTest, OpenMapDiscardingUnsavedChanges)
{
checkBehaviourDiscardingUnsavedChanges(_context.getTestProjectPath(), []()
{
// Opening a new map must ask for save, since the file has been changed
GlobalCommandSystem().executeCommand("OpenMap", cmd::Argument("maps/csg_merge.map"));
});
}

TEST_F(MapSavingTest, NewMapSavingChanges)
{
auto mapPath = createMapCopyInTempDataPath("altar.map", "altar_NewMapSavingChanges.map");
Expand All @@ -1394,6 +1412,17 @@ TEST_F(MapSavingTest, NewMapSavingChanges)
});
}

TEST_F(MapSavingTest, OpenMapSavingChanges)
{
auto mapPath = createMapCopyInTempDataPath("altar.map", "altar_NewMapSavingChanges.map");

checkBehaviourSavingUnsavedChanges(mapPath.string(), []()
{
// Opening a new map must ask for save, since the file has been changed
GlobalCommandSystem().executeCommand("OpenMap", cmd::Argument("maps/csg_merge.map"));
});
}

TEST_F(MapSavingTest, NewMapCancelWithUnsavedChanges)
{
auto mapPath = createMapCopyInTempDataPath("altar.map", "altar_NewMapCancelWithUnsavedChanges.map");
Expand All @@ -1405,4 +1434,15 @@ TEST_F(MapSavingTest, NewMapCancelWithUnsavedChanges)
});
}

TEST_F(MapSavingTest, OpenMapCancelWithUnsavedChanges)
{
auto mapPath = createMapCopyInTempDataPath("altar.map", "altar_NewMapCancelWithUnsavedChanges.map");

checkBehaviourCancellingMapChange(mapPath.string(), []()
{
// Opening a new map must ask for save, since the file has been changed
GlobalCommandSystem().executeCommand("OpenMap", cmd::Argument("maps/csg_merge.map"));
});
}

}

0 comments on commit 25748d0

Please sign in to comment.