Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5410: Unit test asserting that it's possible to assign a texture to …
…a forcedly visible brush
- Loading branch information
1 parent
d7bb39e
commit de3e2ae
Showing
6 changed files
with
685 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,50 @@ | ||
#include "RadiantTest.h" | ||
|
||
#include "ishaders.h" | ||
#include "imap.h" | ||
#include "ifilter.h" | ||
#include "ibrush.h" | ||
#include "ipatch.h" | ||
#include "algorithm/Scene.h" | ||
#include "scenelib.h" | ||
#include "selectionlib.h" | ||
|
||
namespace test | ||
{ | ||
|
||
using SelectionTest = RadiantTest; | ||
|
||
TEST_F(SelectionTest, ApplyShadersToForcedVisibleObjects) | ||
{ | ||
loadMap("primitives_with_clip_material.map"); | ||
|
||
auto worldspawn = GlobalMapModule().findOrInsertWorldspawn(); | ||
auto brush = algorithm::findFirstBrushWithMaterial(worldspawn, "textures/common/clip"); | ||
auto patch = algorithm::findFirstPatchWithMaterial(worldspawn, "textures/common/clip"); | ||
|
||
// Filter out the objects using the clip material | ||
GlobalFilterSystem().setFilterState("Clip Textures", true); | ||
|
||
// Glitch: Since this brush is completely filtered out, this won't be called by the filter system | ||
Node_getIBrush(brush)->updateFaceVisibility(); | ||
|
||
EXPECT_FALSE(brush->visible()); | ||
EXPECT_FALSE(patch->visible()); | ||
|
||
Node_setSelected(brush, true); | ||
Node_setSelected(patch, true); | ||
|
||
EXPECT_TRUE(brush->visible()); | ||
EXPECT_TRUE(patch->visible()); | ||
|
||
// Apply the caulk material to the selection | ||
selection::applyShaderToSelection("textures/common/caulk"); | ||
|
||
auto brushNode = std::dynamic_pointer_cast<IBrushNode>(brush); | ||
auto patchNode = std::dynamic_pointer_cast<IPatchNode>(patch); | ||
|
||
EXPECT_TRUE(brushNode->getIBrush().hasShader("textures/common/caulk")); | ||
EXPECT_EQ(patchNode->getPatch().getShader(), ("textures/common/caulk")); | ||
} | ||
|
||
} |
114 changes: 114 additions & 0 deletions
114
test/resources/tdm/maps/primitives_with_clip_material.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
Version 2 | ||
// entity 0 | ||
{ | ||
"classname" "worldspawn" | ||
// primitive 0 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -136 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 1 0 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 1 0 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 -1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( -1 0 0 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 0 -1 128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
} | ||
} | ||
// primitive 1 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 1 0 -136 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 1 0 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 0 -1 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( -1 0 0 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 -1 0 128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
} | ||
} | ||
// primitive 2 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 1 0 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 1 0 0 -200 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 0 -1 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 -1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( -1 0 0 192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
} | ||
} | ||
// primitive 3 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 1 0 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 1 0 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 0 -1 -72 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 -1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( -1 0 0 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 0 1 64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
} | ||
} | ||
// primitive 4 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 1 0 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 0 -1 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 -1 0 -200 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( -1 0 0 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 1 0 192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
} | ||
} | ||
// primitive 5 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 1 0 -128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 0 -1 -64 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 -1 0 -192 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( -1 0 0 -136 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 1 0 0 128 ) ( ( 0.03125 0 0 ) ( 0 0.03125 0 ) ) "textures/common/caulk" 0 0 0 | ||
} | ||
} | ||
// primitive 6 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -16 ) ( ( 0.015625 0 127 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 1 0 -104 ) ( ( 0.015625 0 0 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 1 0 0 -120 ) ( ( 0.015625 0 127 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 0 -1 -40 ) ( ( 0.015625 0 127 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0 | ||
( 0 -1 0 56 ) ( ( 0.015625 0 0 ) ( 0 0.015625 127.875 ) ) "textures/common/caulk" 0 0 0 | ||
( -1 0 0 72 ) ( ( 0.015625 0 1 ) ( 0 0.015625 0 ) ) "textures/common/caulk" 0 0 0 | ||
} | ||
} | ||
// primitive 7 | ||
{ | ||
brushDef3 | ||
{ | ||
( 0 0 1 -16 ) ( ( 0.015625 0 127 ) ( 0 0.015625 1.625 ) ) "textures/common/clip" 0 0 0 | ||
( 0 1 0 -104 ) ( ( 0.015625 0 126.375 ) ( 0 0.015625 0 ) ) "textures/common/clip" 0 0 0 | ||
( 1 0 0 -16 ) ( ( 0.015625 0 127 ) ( 0 0.015625 0 ) ) "textures/common/clip" 0 0 0 | ||
( 0 0 -1 -40 ) ( ( 0.015625 0 127 ) ( 0 0.015625 126.375 ) ) "textures/common/clip" 0 0 0 | ||
( 0 -1 0 56 ) ( ( 0.015625 0 1.625 ) ( 0 0.015625 127.875 ) ) "textures/common/clip" 0 0 0 | ||
( -1 0 0 -32 ) ( ( 0.015625 0 1 ) ( 0 0.015625 0 ) ) "textures/common/clip" 0 0 0 | ||
} | ||
} | ||
// primitive 8 | ||
{ | ||
patchDef2 | ||
{ | ||
"textures/common/clip" | ||
( 3 3 0 0 0 ) | ||
( | ||
( ( -96 56 -12 0 0 ) ( -96 80 -12 0 -0.375 ) ( -96 104 -12 0 -0.75 ) ) | ||
( ( -72 56 -12 0.375 0 ) ( -72 80 -12 0.375 -0.375 ) ( -72 104 -12 0.375 -0.75 ) ) | ||
( ( -48 56 -12 0.75 0 ) ( -48 80 -12 0.75 -0.375 ) ( -48 104 -12 0.75 -0.75 ) ) | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.