diff --git a/apps/openmw_test_suite/detournavigator/navigator.cpp b/apps/openmw_test_suite/detournavigator/navigator.cpp index 1ec153af7a..f6de993a85 100644 --- a/apps/openmw_test_suite/detournavigator/navigator.cpp +++ b/apps/openmw_test_suite/detournavigator/navigator.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -1232,11 +1233,16 @@ namespace TEST_F(DetourNavigatorNavigatorTest, update_for_very_big_object_should_be_limited) { - CollisionShapeInstance bigBox(std::make_unique(btVector3(1e9, 1e9, 1e9))); + const float size = static_cast(2 * static_cast(std::numeric_limits::max()) - 1); + CollisionShapeInstance bigBox(std::make_unique(btVector3(size, size, 1))); + const ObjectTransform objectTransform{ + .mPosition = ESM::Position{ .pos = { 0, 0, 0 }, .rot{ 0, 0, 0 } }, + .mScale = 1.0f, + }; mNavigator->updateBounds(mPlayerPosition, nullptr); mNavigator->addAgent(mAgentBounds); - mNavigator->addObject(ObjectId(&bigBox.shape()), ObjectShapes(bigBox.instance(), mObjectTransform), + mNavigator->addObject(ObjectId(&bigBox.shape()), ObjectShapes(bigBox.instance(), objectTransform), btTransform::getIdentity(), nullptr); bool updated = false; @@ -1257,5 +1263,16 @@ namespace } thread.join(); + + mNavigator->wait(WaitConditionType::allJobsDone, &mListener); + + EXPECT_EQ(mNavigator->getRecastMeshTiles().size(), 509); + + const auto navMesh = mNavigator->getNavMesh(mAgentBounds); + ASSERT_NE(navMesh, nullptr); + + std::size_t usedNavMeshTiles = 0; + navMesh->lockConst()->forEachUsedTile([&](const auto&...) { ++usedNavMeshTiles; }); + EXPECT_EQ(usedNavMeshTiles, 509); } }