From f8fe4a31fe0dbf2e03ce88590e530f78900777c5 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 18 Nov 2020 10:54:32 -0800 Subject: [PATCH] more tests Signed-off-by: Louise Poubel --- test/integration/factory.cc | 19 ++++++++++++++++++- .../models/testdb/model with spaces/model.sdf | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/test/integration/factory.cc b/test/integration/factory.cc index 400656fb0d..f0db4bd8d1 100644 --- a/test/integration/factory.cc +++ b/test/integration/factory.cc @@ -798,7 +798,8 @@ TEST_F(FactoryTest, ActorSpaces) // Wait for it to be spawned int sleep = 0; int maxSleep = 50; - while (!world->ModelByName("actor with spaces") && sleep++ < maxSleep) + while ((!world->ModelByName("actor with spaces") || + world->ModelCount() < 4) && sleep++ < maxSleep) { common::Time::MSleep(100); } @@ -1257,6 +1258,7 @@ TEST_F(FactoryTest, FilenameModelDatabaseSpaces) auto modelVis = scene->GetVisual("model with spaces"); ASSERT_NE(nullptr, modelVis); + EXPECT_EQ(3u, modelVis->GetChildCount()); // Joints EXPECT_EQ(3u, model->GetJoints().size()); @@ -1352,13 +1354,28 @@ TEST_F(FactoryTest, FilenameModelDatabaseSpaces) auto nestedModel = model->NestedModel("nested model with spaces"); ASSERT_NE(nullptr, nestedModel); + auto nestedModelVis = modelVis->GetChild(2); + ASSERT_NE(nullptr, nestedModelVis); + EXPECT_EQ("model with spaces::nested model with spaces", nestedModelVis->Name()); + EXPECT_EQ(1u, nestedModel->GetLinks().size()); auto nestedLink = nestedModel->GetLink("nested link with spaces"); ASSERT_NE(nullptr, nestedLink); + auto nestedLinkVis = nestedModelVis->GetChild(0); + ASSERT_NE(nullptr, nestedLinkVis); + EXPECT_EQ("model with spaces::nested model with spaces::" + "nested link with spaces", nestedLinkVis->Name()); + EXPECT_EQ(1u, nestedLink->GetCollisions().size()); ASSERT_NE(nullptr, nestedLink->GetCollision("nested collision with spaces")); + auto nestedVisualVis = nestedLinkVis->GetChild(0); + ASSERT_NE(nullptr, nestedVisualVis); + EXPECT_EQ("model with spaces::nested model with spaces::" + "nested link with spaces::nested visual with spaces", + nestedVisualVis->Name()); + // Nested deeper EXPECT_EQ(1u, nestedModel->NestedModels().size()); auto deeperNestedModel = nestedModel->NestedModel( diff --git a/test/models/testdb/model with spaces/model.sdf b/test/models/testdb/model with spaces/model.sdf index d97ee61182..5af1ee3715 100644 --- a/test/models/testdb/model with spaces/model.sdf +++ b/test/models/testdb/model with spaces/model.sdf @@ -71,7 +71,7 @@ - + 1 1 1