Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed Nov 18, 2020
1 parent c15bd9b commit f8fe4a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
19 changes: 18 additions & 1 deletion test/integration/factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion test/models/testdb/model with spaces/model.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
</box>
</geometry>
</collision>
<visual name="neste visual with spaces">
<visual name="nested visual with spaces">
<geometry>
<box>
<size>1 1 1</size>
Expand Down

0 comments on commit f8fe4a3

Please sign in to comment.