testqbsp: add detail_illusionary + water test

This commit is contained in:
Eric Wasylishen 2022-07-12 00:07:39 -06:00
parent da7e36390f
commit f1f558b069
1 changed files with 20 additions and 3 deletions

View File

@ -13,10 +13,15 @@ TEST_CASE("StripFilename", "[common]")
REQUIRE("" == fs::path("bar.txt").parent_path()); REQUIRE("" == fs::path("bar.txt").parent_path());
} }
TEST_CASE("q1 contents", "[common]") TEST_CASE("q1 contents", "[common][!mayfail]")
{ {
auto* game_q1 = bspver_q1.game; auto* game_q1 = bspver_q1.game;
const auto solid = game_q1->create_solid_contents();
const auto detail_solid = game_q1->create_detail_solid_contents(solid);
const auto detail_fence = game_q1->create_detail_fence_contents(solid);
const auto detail_illusionary = game_q1->create_detail_illusionary_contents(solid);
const std::array test_contents{ const std::array test_contents{
contentflags_t{CONTENTS_EMPTY}, contentflags_t{CONTENTS_EMPTY},
contentflags_t{CONTENTS_SOLID}, contentflags_t{CONTENTS_SOLID},
@ -24,10 +29,13 @@ TEST_CASE("q1 contents", "[common]")
contentflags_t{CONTENTS_SLIME}, contentflags_t{CONTENTS_SLIME},
contentflags_t{CONTENTS_LAVA}, contentflags_t{CONTENTS_LAVA},
contentflags_t{CONTENTS_SKY}, contentflags_t{CONTENTS_SKY},
detail_solid,
detail_fence,
detail_illusionary
}; };
SECTION("solid combined with others"){ SECTION("solid combined with others") {
auto solid = game_q1->create_solid_contents();
CHECK(solid.native == CONTENTS_SOLID); CHECK(solid.native == CONTENTS_SOLID);
CHECK(!solid.game_data.has_value()); CHECK(!solid.game_data.has_value());
@ -36,8 +44,17 @@ TEST_CASE("q1 contents", "[common]")
CHECK(combined.native == CONTENTS_SOLID); CHECK(combined.native == CONTENTS_SOLID);
CHECK(combined.is_solid(game_q1)); CHECK(combined.is_solid(game_q1));
CHECK(!combined.is_any_detail(game_q1));
} }
} }
SECTION("detail_illusionary plus water") {
auto combined = game_q1->combine_contents(detail_illusionary, contentflags_t{CONTENTS_WATER});
CHECK(combined.native == CONTENTS_WATER);
CHECK(combined.is_detail_illusionary(game_q1));
}
} }
TEST_CASE("q2 contents", "[common]") TEST_CASE("q2 contents", "[common]")