|
|
|
@ -73,14 +73,16 @@ namespace
|
|
|
|
|
|
|
|
|
|
TEST_F(DetourNavigatorNavigatorTest, find_path_for_empty_should_return_empty)
|
|
|
|
|
{
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut),
|
|
|
|
|
Status::NavMeshNotFound);
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(DetourNavigatorNavigatorTest, find_path_for_existing_agent_with_no_navmesh_should_throw_exception)
|
|
|
|
|
{
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), NavigatorException);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut),
|
|
|
|
|
Status::StartPolygonNotFound);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(DetourNavigatorNavigatorTest, add_agent_should_count_each_agent)
|
|
|
|
@ -88,7 +90,8 @@ namespace
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
mNavigator->addAgent(mAgentHalfExtents);
|
|
|
|
|
mNavigator->removeAgent(mAgentHalfExtents);
|
|
|
|
|
EXPECT_THROW(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), NavigatorException);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut),
|
|
|
|
|
Status::StartPolygonNotFound);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(DetourNavigatorNavigatorTest, update_then_find_path_should_return_path)
|
|
|
|
@ -108,7 +111,7 @@ namespace
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait();
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
|
|
|
@ -158,7 +161,7 @@ namespace
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait();
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, std::back_inserter(mPath));
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
|
|
|
@ -191,7 +194,8 @@ namespace
|
|
|
|
|
mNavigator->wait();
|
|
|
|
|
|
|
|
|
|
mPath.clear();
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, std::back_inserter(mPath));
|
|
|
|
|
mOut = std::back_inserter(mPath);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(-215, 215, 1.87826788425445556640625),
|
|
|
|
@ -242,7 +246,7 @@ namespace
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait();
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, std::back_inserter(mPath));
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(-215, 215, 1.87826788425445556640625),
|
|
|
|
@ -277,7 +281,8 @@ namespace
|
|
|
|
|
mNavigator->wait();
|
|
|
|
|
|
|
|
|
|
mPath.clear();
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut);
|
|
|
|
|
mOut = std::back_inserter(mPath);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
|
|
|
@ -334,7 +339,7 @@ namespace
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait();
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(-215, 215, 1.96328866481781005859375),
|
|
|
|
@ -390,7 +395,7 @@ namespace
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait();
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(-215, 215, 1.9393787384033203125),
|
|
|
|
@ -443,7 +448,7 @@ namespace
|
|
|
|
|
mEnd.x() = 0;
|
|
|
|
|
mEnd.z() = 300;
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_swim, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_swim, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(0, 215, 185.33331298828125),
|
|
|
|
@ -489,7 +494,8 @@ namespace
|
|
|
|
|
mStart.x() = 0;
|
|
|
|
|
mEnd.x() = 0;
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_swim | Flag_walk, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_swim | Flag_walk, mOut),
|
|
|
|
|
Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(0, 215, -94.75363922119140625),
|
|
|
|
@ -535,7 +541,8 @@ namespace
|
|
|
|
|
mStart.x() = 0;
|
|
|
|
|
mEnd.x() = 0;
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_swim | Flag_walk, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_swim | Flag_walk, mOut),
|
|
|
|
|
Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(0, 215, -94.75363922119140625),
|
|
|
|
@ -581,7 +588,7 @@ namespace
|
|
|
|
|
mStart.x() = 0;
|
|
|
|
|
mEnd.x() = 0;
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(0, 215, -94.75363922119140625),
|
|
|
|
@ -630,7 +637,7 @@ namespace
|
|
|
|
|
mNavigator->update(mPlayerPosition);
|
|
|
|
|
mNavigator->wait();
|
|
|
|
|
|
|
|
|
|
mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut);
|
|
|
|
|
EXPECT_EQ(mNavigator->findPath(mAgentHalfExtents, mStepSize, mStart, mEnd, Flag_walk, mOut), Status::Success);
|
|
|
|
|
|
|
|
|
|
EXPECT_EQ(mPath, std::deque<osg::Vec3f>({
|
|
|
|
|
osg::Vec3f(-215, 215, 1.85963428020477294921875),
|
|
|
|
|