Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Doisy committed Jan 6, 2021
1 parent 7147d59 commit 1dd0baa
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/integration/visual_dom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,30 @@ TEST(DOMVisual, Transparency)
EXPECT_FLOAT_EQ(0.22f, vis1->Transparency());
}

//////////////////////////////////////////////////
TEST(DOMVisual, LaserRetro)
{
const std::string testFile =
sdf::filesystem::append(PROJECT_SOURCE_PATH, "test", "sdf",
"shapes.sdf");

// Load the SDF file
sdf::Root root;
EXPECT_TRUE(root.Load(testFile).empty());

const sdf::Model *model = root.ModelByIndex(0);
ASSERT_NE(nullptr, model);

const sdf::Link *link = model->LinkByIndex(0);
ASSERT_NE(nullptr, link);

const sdf::Visual *vis1 = link->VisualByName("sphere_vis_laser_retro");
ASSERT_NE(nullptr, vis1);

ASSERT_EQ(true, vis1->HasLaserRetro());
EXPECT_DOUBLE_EQ(1150, vis1->LaserRetro());
}

/////////////////////////////////////////////////
TEST(DOMVisual, LoadModelFramesRelativeToJoint)
{
Expand Down
9 changes: 9 additions & 0 deletions test/sdf/shapes.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@
</sphere>
</geometry>
</visual>

<visual name="sphere_vis_laser_retro">
<laser_retro>1150</laser_retro>
<geometry>
<sphere>
<radius>0.5</radius>
</sphere>
</geometry>
</visual>
</link>
</model>
</sdf>

0 comments on commit 1dd0baa

Please sign in to comment.