From f3f81a21129d38c1db0097fb72bbbe964b404a03 Mon Sep 17 00:00:00 2001 From: Guillaume Doisy Date: Wed, 6 Jan 2021 19:07:29 +0100 Subject: [PATCH] add integration test Signed-off-by: Guillaume Doisy --- test/integration/visual_dom.cc | 24 ++++++++++++++++++++++++ test/sdf/shapes.sdf | 9 +++++++++ 2 files changed, 33 insertions(+) diff --git a/test/integration/visual_dom.cc b/test/integration/visual_dom.cc index dd7d27fcc..df124f51b 100644 --- a/test/integration/visual_dom.cc +++ b/test/integration/visual_dom.cc @@ -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) { diff --git a/test/sdf/shapes.sdf b/test/sdf/shapes.sdf index b5e2ce799..3401fbb15 100644 --- a/test/sdf/shapes.sdf +++ b/test/sdf/shapes.sdf @@ -153,6 +153,15 @@ + + + 1150 + + + 0.5 + + +