Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5235: Add unit tests covering "SelectItemsByModel" & "DeselectItemsB…
…yModel"
- Loading branch information
1 parent
be81e5e
commit 6014e4d
Showing
5 changed files
with
170 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "RadiantTest.h" | ||
|
||
#include "iselection.h" | ||
#include "icommandsystem.h" | ||
#include "selectionlib.h" | ||
|
||
namespace test | ||
{ | ||
|
||
TEST_F(RadiantTest, SelectItemsByModel) | ||
{ | ||
loadMap("select_items_by_model.map"); | ||
|
||
auto staticMeshPath = "models/just_a_static_mesh.ase"; | ||
auto md5MeshPath = "just_an_md5.md5mesh"; | ||
|
||
GlobalSelectionSystem().setSelectedAll(false); | ||
ASSERT_TRUE(GlobalSelectionSystem().getSelectionInfo().totalCount == 0); | ||
|
||
// Select the two entities with the regular "model" "" spawnarg | ||
GlobalCommandSystem().executeCommand("SelectItemsByModel", { staticMeshPath }); | ||
ASSERT_TRUE(GlobalSelectionSystem().getSelectionInfo().entityCount == 2); | ||
|
||
// Deselect the two entities with the regular "model" "" spawnarg | ||
GlobalCommandSystem().executeCommand("DeselectItemsByModel", { staticMeshPath }); | ||
ASSERT_TRUE(GlobalSelectionSystem().getSelectionInfo().totalCount == 0); | ||
|
||
// Select the three entities that reference the md5 mesh through a model def | ||
GlobalCommandSystem().executeCommand("SelectItemsByModel", { md5MeshPath }); | ||
ASSERT_TRUE(GlobalSelectionSystem().getSelectionInfo().entityCount == 3); | ||
|
||
GlobalCommandSystem().executeCommand("DeselectItemsByModel", { md5MeshPath }); | ||
ASSERT_TRUE(GlobalSelectionSystem().getSelectionInfo().totalCount == 0); | ||
} | ||
|
||
} |
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,10 @@ | ||
model just_a_model | ||
{ | ||
mesh just_an_md5.md5mesh | ||
} | ||
|
||
entityDef dr:entity_using_modeldef | ||
{ | ||
"model" "just_a_model" | ||
"random" "1" | ||
} |
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,122 @@ | ||
Version 2 | ||
// entity 0 | ||
{ | ||
"classname" "worldspawn" | ||
// primitive 0 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -208 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 1 0 0 -384 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 -1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( -1 0 0 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 0 -1 192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
} | ||
} | ||
// primitive 1 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 1 0 -208 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 1 0 0 -384 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 0 -1 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( -1 0 0 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 -1 0 192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
} | ||
} | ||
// primitive 2 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 1 0 0 -400 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 0 -1 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 -1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( -1 0 0 384 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
} | ||
} | ||
// primitive 3 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 1 0 0 -384 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 0 -1 -80 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 -1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( -1 0 0 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 0 1 64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
} | ||
} | ||
// primitive 4 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 1 0 0 -384 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 0 -1 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 -1 0 -208 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( -1 0 0 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 1 0 192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
} | ||
} | ||
// primitive 5 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 0 -1 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 0 -1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( -1 0 0 -80 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
( 1 0 0 64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "_default" 0 0 0 | ||
} | ||
} | ||
} | ||
// entity 1 | ||
{ | ||
"classname" "dr:entity_using_modeldef" | ||
"name" "dr_entity_using_modeldef_1" | ||
"origin" "96 0 -63.0868" | ||
"rotation" "1 0 0 0 1 0 0 0 1" | ||
} | ||
// entity 2 | ||
{ | ||
"classname" "dr:entity_using_modeldef" | ||
"name" "dr_entity_using_modeldef_2" | ||
"origin" "208 -80 -63.0868" | ||
"rotation" "1 0 0 0 1 0 0 0 1" | ||
} | ||
// entity 3 | ||
{ | ||
"classname" "dr:entity_using_modeldef" | ||
"name" "dr_entity_using_modeldef_3" | ||
"origin" "272 48 -63.0868" | ||
"rotation" "1 0 0 0 1 0 0 0 1" | ||
} | ||
// entity 4 | ||
{ | ||
"classname" "light" | ||
"name" "light_1" | ||
"origin" "32 112 -48" | ||
"light_center" "0 0 0" | ||
"light_radius" "160 176 320" | ||
} | ||
// entity 5 | ||
{ | ||
"classname" "func_static" | ||
"name" "func_static_1" | ||
"origin" "96 -64 -48" | ||
"rotation" "1 0 0 0 1 0 0 0 1" | ||
"model" "models/just_a_static_mesh.ase" | ||
} | ||
// entity 6 | ||
{ | ||
"classname" "func_static" | ||
"name" "func_static_2" | ||
"origin" "96 -112 -48" | ||
"rotation" "1 0 0 0 1 0 0 0 1" | ||
"model" "models/just_a_static_mesh.ase" | ||
} |
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