Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina committed May 13, 2020
1 parent 80998c0 commit 9ecee15
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions examples/plugin/gui_system_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(GuiSystemPlugin)

set(CMAKE_AUTOMOC ON)

find_package(ignition-gazebo2 REQUIRED COMPONENTS gui)
find_package(ignition-gazebo3 REQUIRED COMPONENTS gui)

QT5_ADD_RESOURCES(resources_RCC ${PROJECT_NAME}.qrc)

Expand All @@ -17,5 +17,5 @@ add_library(${PROJECT_NAME} SHARED
${resources_RCC}
)
target_link_libraries(${PROJECT_NAME}
PRIVATE ignition-gazebo2::gui
PRIVATE ignition-gazebo3::gui
)
4 changes: 2 additions & 2 deletions examples/standalone/custom_server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
find_package(ignition-gazebo2 REQUIRED)
set(IGN_COMMON_VER ${ignition-gazebo2_VERSION_MAJOR})
find_package(ignition-gazebo3 REQUIRED)
set(IGN_COMMON_VER ${ignition-gazebo3_VERSION_MAJOR})

add_executable(custom_server custom_server.cc)
target_link_libraries(custom_server
Expand Down
42 changes: 21 additions & 21 deletions src/SdfGenerator_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ static bool isSubset(const sdf::ElementPtr &_elemA,
TEST(CompareElements, CompareWithDuplicateElements)
{
const std::string m1Sdf = R"(
<sdf version="1.6">
<sdf version="1.7">
<model name="M1">
<pose>0 0 0 0 0 0 0</pose>
</model>
</sdf>
)";
const std::string m1CompTestSdf = R"(
<sdf version="1.6">
<sdf version="1.7">
<model name="M1">
<pose>0 0 0 0 0 0 0</pose>
<pose>0 0 0 0 0 0 0</pose>
Expand Down Expand Up @@ -159,7 +159,13 @@ class ElementUpdateFixture : public ::testing::Test

public: virtual void LoadWorld(const std::string &_path)
{
this->root.Load(common::joinPaths(PROJECT_SOURCE_PATH, _path));
auto errors = this->root.Load(common::joinPaths(PROJECT_SOURCE_PATH,
_path));
EXPECT_TRUE(errors.empty()) << _path;

for (auto error : errors)
igndbg << error.Message() << std::endl;

ASSERT_EQ(1u, root.WorldCount());
this->world = root.WorldByIndex(0);
ASSERT_NE(nullptr, this->world);
Expand All @@ -168,7 +174,12 @@ class ElementUpdateFixture : public ::testing::Test

public: virtual void LoadWorldString(const std::string &_worldSdf)
{
this->root.LoadSdfString(_worldSdf);
auto errors = this->root.LoadSdfString(_worldSdf);
EXPECT_TRUE(errors.empty()) << _worldSdf;

for (auto error : errors)
igndbg << error.Message() << std::endl;

ASSERT_EQ(1u, root.WorldCount());
this->world = root.WorldByIndex(0);
ASSERT_NE(nullptr, this->world);
Expand Down Expand Up @@ -530,16 +541,11 @@ TEST_F(ElementUpdateFixture, WorldWithModelsIncludedWithInvalidUris)
// Thes following two URIs are valid, but have a trailing '/'
"https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Backpack/",
"https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Backpack/1/",
// Thes following two URIs are invalid, and will not be saved
"https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Backpack/"
"notInt",
"https://fuel.ignitionrobotics.org/1.0/openrobotics/models/Backpack/"
"notInt/",
};

std::string worldSdf = R"(
<?xml version="1.0" ?>
<sdf version="1.6">
<sdf version="1.7">
<world name="invalid_uris">
<include>
<uri>)" + fuelUris[0] + R"(</uri>
Expand All @@ -549,14 +555,6 @@ TEST_F(ElementUpdateFixture, WorldWithModelsIncludedWithInvalidUris)
<uri>)" + fuelUris[1] + R"(</uri>
<name>backpack2</name>
</include>
<include>

This comment has been minimized.

Copy link
@azeey

azeey May 14, 2020

Contributor

So we can still keep these in and the test will pass if we allow LoadWorld not fail if there are error messages when calling sdf::Root::Load. These URIs are invalid and the test is checking that that invalid URIs aren't saved.
i.e, if we remove line 178 ( EXPECT_TRUE(errors.empty()) << _path;)

This comment has been minimized.

Copy link
@chapulina

chapulina May 15, 2020

Author Contributor

Thanks, reverted!

<uri>)" + fuelUris[2] + R"(</uri>
<name>backpack3</name>
</include>
<include>
<uri>)" + fuelUris[3] + R"(</uri>
<name>backpack3</name>
</include>
</world>
</sdf>
)";
Expand Down Expand Up @@ -594,7 +592,7 @@ TEST_F(ElementUpdateFixture, WorldWithModelsIncludedWithNonFuelUris)

std::string worldSdf = R"(
<?xml version="1.0" ?>
<sdf version="1.6">
<sdf version="1.7">
<world name="nonfuel_uris">
<include>
<uri>)" + includeUris[0] + R"(</uri>
Expand All @@ -604,7 +602,9 @@ TEST_F(ElementUpdateFixture, WorldWithModelsIncludedWithNonFuelUris)
<uri>)" + includeUris[1] + R"(</uri>
<name>model2</name>
</include>
<model name="model3"/>
<model name="model3">
<link name="link3"/>
</model>
</world>
</sdf>
)";
Expand Down Expand Up @@ -777,7 +777,7 @@ TEST_F(ElementUpdateFixture, WorldWithModelsUsingRelativeResourceURIs)

std::string worldSdf = R"(
<?xml version="1.0" ?>
<sdf version="1.6">
<sdf version="1.7">
<world name="test_relative_resource">
<include>
<uri>)" + includeUri + R"(</uri>
Expand Down

0 comments on commit 9ecee15

Please sign in to comment.