Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5451: Add (failing) unit tests asserting that create, rename and del…
…ete layer operations mark the map as modified
- Loading branch information
1 parent
6b7f8b5
commit 36180a4
Showing
5 changed files
with
332 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,51 @@ | ||
#include "RadiantTest.h" | ||
|
||
#include "imap.h" | ||
#include "ilayer.h" | ||
#include "algorithm/Scene.h" | ||
|
||
namespace test | ||
{ | ||
|
||
using LayerTest = RadiantTest; | ||
|
||
TEST_F(LayerTest, CreateLayerMarksMapAsModified) | ||
{ | ||
loadMap("general_purpose.mapx"); | ||
|
||
EXPECT_FALSE(GlobalMapModule().isModified()); | ||
|
||
GlobalMapModule().getRoot()->getLayerManager().createLayer("Testlayer"); | ||
|
||
EXPECT_TRUE(GlobalMapModule().isModified()); | ||
} | ||
|
||
TEST_F(LayerTest, RenameLayerMarksMapAsModified) | ||
{ | ||
loadMap("general_purpose.mapx"); | ||
|
||
auto& layerManager = GlobalMapModule().getRoot()->getLayerManager(); | ||
|
||
EXPECT_FALSE(GlobalMapModule().isModified()); | ||
EXPECT_NE(layerManager.getLayerID("Second Layer"), -1); | ||
|
||
layerManager.renameLayer(layerManager.getLayerID("Second Layer"), "Renamed Layer"); | ||
|
||
EXPECT_TRUE(GlobalMapModule().isModified()); | ||
} | ||
|
||
TEST_F(LayerTest, DeleteLayerMarksMapAsModified) | ||
{ | ||
loadMap("general_purpose.mapx"); | ||
|
||
auto& layerManager = GlobalMapModule().getRoot()->getLayerManager(); | ||
|
||
EXPECT_FALSE(GlobalMapModule().isModified()); | ||
EXPECT_NE(layerManager.getLayerID("Second Layer"), -1); | ||
|
||
layerManager.deleteLayer("Second Layer"); | ||
|
||
EXPECT_TRUE(GlobalMapModule().isModified()); | ||
} | ||
|
||
} |
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,278 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<map version="1" format="portable"> | ||
<layers> | ||
<layer id="0" name="Default"/> | ||
<layer id="1" name="Second Layer"/> | ||
<layer id="2" name="Third Layer"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
<properties> | ||
<property key="EditTimeInSeconds" value="126"/> | ||
<property key="LastCameraAngle" value="-46.8 33.6 0"/> | ||
<property key="LastCameraPosition" value="-81.4144 -139.899 261.902"/> | ||
<property key="LastShaderClipboardMaterial" value="textures/numbers/2"/> | ||
</properties> | ||
<entity number="0"> | ||
<primitives> | ||
<brush number="0"> | ||
<faces> | ||
<face> | ||
<plane x="0" y="0" z="1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="0" z="-1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="-1.000000" z="0" d="0"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="-1.000000" y="0" z="0" d="64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0.707107" y="0.707107" z="0" d="-90.509666"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
</faces> | ||
<layers> | ||
<layer id="0"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
</brush> | ||
<brush number="1"> | ||
<faces> | ||
<face> | ||
<plane x="0" y="0" z="1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="1.000000" z="0" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="1.000000" y="0" z="0" d="-128.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="0" z="-1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="-0.707107" y="-0.707107" z="0" d="90.509666"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
</faces> | ||
<layers> | ||
<layer id="0"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
</brush> | ||
<brush number="2"> | ||
<faces> | ||
<face> | ||
<plane x="0" y="0" z="1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="62.000000"/> | ||
<material name="textures/numbers/4"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="1.000000" z="0" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="2.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/4"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="1.000000" y="0" z="0" d="-192.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/4"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="0" z="-1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="2.000000"/> | ||
<material name="textures/numbers/4"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="-0.707107" y="-0.707107" z="0" d="135.764511"/> | ||
<textureProjection xx="0.031250" yx="0" tx="126.585785" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/4"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
</faces> | ||
<layers> | ||
<layer id="1"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
</brush> | ||
<brush number="3"> | ||
<faces> | ||
<face> | ||
<plane x="0" y="0" z="1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="62.000000"/> | ||
<material name="textures/numbers/3"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="0" z="-1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="2.000000"/> | ||
<material name="textures/numbers/3"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="-1.000000" z="0" d="0"/> | ||
<textureProjection xx="0.031250" yx="0" tx="62.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/3"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="-1.000000" y="0" z="0" d="128.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/3"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0.707107" y="0.707107" z="0" d="-135.764511"/> | ||
<textureProjection xx="0.031250" yx="0" tx="1.414214" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/3"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
</faces> | ||
<layers> | ||
<layer id="0"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
</brush> | ||
</primitives> | ||
<keyValues> | ||
<keyValue key="classname" value="worldspawn"/> | ||
<keyValue key="description" value="Brushes in this map have numbers as their material names, such that the unit test algorithm can find them"/> | ||
</keyValues> | ||
<layers> | ||
<layer id="0"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
</entity> | ||
<entity number="1"> | ||
<primitives> | ||
<brush number="0"> | ||
<faces> | ||
<face> | ||
<plane x="0" y="0" z="1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="2.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="0" z="-1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="2.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="-1.000000" z="0" d="-32.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="-1.000000" y="0" z="0" d="-32.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="62.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0.707107" y="0.707107" z="0" d="0"/> | ||
<textureProjection xx="0.031250" yx="0" tx="2.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/1"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
</faces> | ||
<layers> | ||
<layer id="0"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
</brush> | ||
<brush number="1"> | ||
<faces> | ||
<face> | ||
<plane x="0" y="0" z="1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="2.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="1.000000" z="0" d="-32.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="0" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="1.000000" y="0" z="0" d="-32.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="2.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="0" y="0" z="-1.000000" d="-64.000000"/> | ||
<textureProjection xx="0.031250" yx="0" tx="2.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
<face> | ||
<plane x="-0.707107" y="-0.707107" z="0" d="0"/> | ||
<textureProjection xx="0.031250" yx="0" tx="2.000000" xy="0" yy="0.031250" ty="0"/> | ||
<material name="textures/numbers/2"/> | ||
<contentsFlag value="0"/> | ||
</face> | ||
</faces> | ||
<layers> | ||
<layer id="0"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
</brush> | ||
</primitives> | ||
<keyValues> | ||
<keyValue key="classname" value="func_static"/> | ||
<keyValue key="name" value="func_static_1"/> | ||
<keyValue key="model" value="func_static_1"/> | ||
<keyValue key="origin" value="96 -32 0"/> | ||
</keyValues> | ||
<layers> | ||
<layer id="0"/> | ||
</layers> | ||
<selectionGroups/> | ||
<selectionSets/> | ||
</entity> | ||
</map> |
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