From 995ac04673b2e6558b58d663dd0c522a04045ca5 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 13 Aug 2022 20:11:22 -0600 Subject: [PATCH 1/2] tests: add a few clipnode count tests adjust qbsp_simple_worldspawn_detail.map so it seals in hull1/2 --- testmaps/qbsp_simple_worldspawn_detail.map | 5 +++++ tests/test_qbsp.cc | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/testmaps/qbsp_simple_worldspawn_detail.map b/testmaps/qbsp_simple_worldspawn_detail.map index fc34c9d6..8abe0110 100644 --- a/testmaps/qbsp_simple_worldspawn_detail.map +++ b/testmaps/qbsp_simple_worldspawn_detail.map @@ -80,3 +80,8 @@ ( 48 -32 112 ) ( 48 -32 113 ) ( 48 -31 112 ) +0fan [ 0 1 0 16 ] [ 0 0 -1 0 ] 0 1 1 } } +// entity 3 +{ +"classname" "light" +"origin" "-24 -48 152" +} diff --git a/tests/test_qbsp.cc b/tests/test_qbsp.cc index 34723723..38b91f50 100644 --- a/tests/test_qbsp.cc +++ b/tests/test_qbsp.cc @@ -652,6 +652,13 @@ TEST_CASE("simple_worldspawn_detail", "[testmaps_q1]") // 5 faces for the "button" // 9 faces for the room REQUIRE(bsp.dfaces.size() == 14); + + // 6 for the box room + // 5 for the "button" + CHECK(bsp.dnodes.size() == 11); + + // this is how many we get with ericw-tools-v0.18.1-32-g6660c5f-win64 + CHECK(bsp.dclipnodes.size() <= 22); } TEST_CASE("simple_worldspawn_detail_illusionary", "[testmaps_q1]") @@ -1105,6 +1112,10 @@ TEST_CASE("q1_cube", "[testmaps_q1]") // model bounds are shrunk by 1 unit on each side for some reason CHECK(cube_bounds.grow(-1).mins() == bsp.dmodels[0].mins); CHECK(cube_bounds.grow(-1).maxs() == bsp.dmodels[0].maxs); + + CHECK(6 == bsp.dnodes.size()); + + CHECK(12 == bsp.dclipnodes.size()); } /** From e7adc1108a095c2eba08cd7cc572f793a6a8e598 Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Sat, 13 Aug 2022 20:37:40 -0600 Subject: [PATCH 2/2] qbsp: reset more settings between test cases --- include/common/settings.hh | 2 +- include/qbsp/qbsp.hh | 1 + qbsp/qbsp.cc | 14 ++++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/common/settings.hh b/include/common/settings.hh index 8f08c5c3..176a8161 100644 --- a/include/common/settings.hh +++ b/include/common/settings.hh @@ -713,7 +713,7 @@ public: // copy assignment setting_container &operator=(const setting_container &other) = delete; - void reset(); + virtual void reset(); void copyFrom(const setting_container &other); diff --git a/include/qbsp/qbsp.hh b/include/qbsp/qbsp.hh index da7fdea4..7229f692 100644 --- a/include/qbsp/qbsp.hh +++ b/include/qbsp/qbsp.hh @@ -362,6 +362,7 @@ public: } void initialize(int argc, const char **argv) override; void postinitialize(int argc, const char **argv) override; + void reset() override; bool fVerbose = true; bool fAllverbose = false; diff --git a/qbsp/qbsp.cc b/qbsp/qbsp.cc index e1708dfd..3117ac63 100644 --- a/qbsp/qbsp.cc +++ b/qbsp/qbsp.cc @@ -289,6 +289,20 @@ void qbsp_settings::postinitialize(int argc, const char **argv) common_settings::postinitialize(argc, argv); } + +void qbsp_settings::reset() { + common_settings::reset(); + + fVerbose = false; + fAllverbose = false; + fNoverbose = false; + target_version = nullptr; + target_game = nullptr; + map_path = fs::path(); + bsp_path = fs::path(); + loaded_texture_defs.clear(); + loaded_entity_defs.clear(); +} }; // namespace settings settings::qbsp_settings qbsp_options;