diff --git a/test/integration/user_commands.cc b/test/integration/user_commands.cc index 19c1d7e761..a298123114 100644 --- a/test/integration/user_commands.cc +++ b/test/integration/user_commands.cc @@ -1116,16 +1116,37 @@ TEST_F(UserCommandsTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(MaterialColor)) gz::msgs::Set(materialColorMsg.mutable_diffuse(), gz::math::Color(1.0f, 1.0f, 1.0f, 1.0f)); + Entity sphereEntity0 = + ecm->EntityByComponents(components::Name("sphere_0")); + Entity sphereEntity1 = + ecm->EntityByComponents(components::Name("sphere_1")); + auto sphereLinkEntity0 = + ecm->ChildrenByComponents(sphereEntity0, components::Name("sphere_link_0"))[0]; + auto sphereLinkEntity1 = + ecm->ChildrenByComponents(sphereEntity1, components::Name("sphere_link_1"))[0]; + auto sphereVisualEntity0 = + ecm->ChildrenByComponents(sphereLinkEntity0, components::Name("sphere_visual"))[0]; + auto sphereVisualEntity1 = + ecm->ChildrenByComponents(sphereLinkEntity1, components::Name("sphere_visual"))[0]; + auto updatedVisual0 = + ecm->Component(sphereVisualEntity0); + auto updatedVisual1 = + ecm->Component(sphereVisualEntity1); + EXPECT_TRUE((math::Color(0.0f, 0.0f, 0.0f, 1.0f) == + updatedVisual0->Data().Diffuse()) || + (math::Color(0.0f, 0.0f, 0.0f, 1.0f) == + updatedVisual1->Data().Diffuse())); + // Publish material color pub.Publish(materialColorMsg); server.Run(true, 100, false); // Sleep for a small duration to allow Run thread to start GZ_SLEEP_MS(100); - auto updatedVisual = - ecm->Component(sphereVisualEntity); EXPECT_EQ(math::Color(1.0f, 1.0f, 1.0f, 1.0f), - updatedVisual->Data().Diffuse()); + updatedVisual0->Data().Diffuse()); + EXPECT_EQ(math::Color(1.0f, 1.0f, 1.0f, 1.0f), + updatedVisual1->Data().Diffuse()); } ///////////////////////////////////////////////// diff --git a/test/worlds/material_color.sdf b/test/worlds/material_color.sdf index 3a430ae806..5458071dbd 100644 --- a/test/worlds/material_color.sdf +++ b/test/worlds/material_color.sdf @@ -19,9 +19,9 @@ ogre2 - + 0 0.0 0.0 0 0 0 - + 1 0 1.3 0 0 0 @@ -57,7 +57,7 @@ 0.5 1.0 0.0 0 0 0 - +