diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 736670e0e..2c94852da 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -10,10 +10,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Add ticket to inbox - uses: technote-space/create-project-card-action@v1 + uses: actions/add-to-project@v0.5.0 with: - PROJECT: Core development - COLUMN: Inbox - GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }} - CHECK_ORG_PROJECT: true + project-url: https://github.com/orgs/gazebosim/projects/7 + github-token: ${{ secrets.TRIAGE_TOKEN }} diff --git a/CMakeLists.txt b/CMakeLists.txt index e17a5ff60..078ea7f98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR) #============================================================================ # Initialize the project #============================================================================ -project(gz-gui7 VERSION 7.1.0) +project(gz-gui7 VERSION 7.2.1) #============================================================================ # Find gz-cmake @@ -30,11 +30,9 @@ message(STATUS "\n\n-- ====== Finding Dependencies ======") #-------------------------------------- # Find Protobuf -set(REQ_PROTOBUF_VER 3) gz_find_package(GzProtobuf - VERSION ${REQ_PROTOBUF_VER} - REQUIRED - PRETTY Protobuf) + REQUIRED + PRETTY Protobuf) #-------------------------------------- # Find Tinyxml2 diff --git a/Changelog.md b/Changelog.md index 7c94464d1..5f193ea15 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,8 +2,90 @@ ### Gazebo GUI 7.X.X (202X-XX-XX) -### Gazebo GUI 7.1.0 (2023-03-10) +### Gazebo GUI 7.2.1 (2023-09-26) + +1. Fix segfaulting tests + * [Pull request #429](https://github.com/gazebosim/gz-gui/pull/429) + +1. Find any major version of Protobuf + * [Pull request #544](https://github.com/gazebosim/gz-gui/pull/544) + +1. Fix data race issues in CameraTracking plugin + * [Pull request #537](https://github.com/gazebosim/gz-gui/pull/537) + +1. Infrastructure + * [Pull request #560](https://github.com/gazebosim/gz-gui/pull/560) + * [Pull request #559](https://github.com/gazebosim/gz-gui/pull/559) + * [Pull request #536](https://github.com/gazebosim/gz-gui/pull/536) + + +### Gazebo GUI 7.2.0 (2023-05-14) + +1. Add support for bayer images to get displayed in gazebo gui + * [Pull request #528](https://github.com/gazebosim/gz-gui/pull/528) + +1. Disable deprecation messages about onFoo connections + * [Pull request #534](https://github.com/gazebosim/gz-gui/pull/534) + +1. Apply low-pass filter to RTF display + * [Pull request #529](https://github.com/gazebosim/gz-gui/pull/529) + +1. Disable Teleop_TEST on macOS + * [Pull request #530](https://github.com/gazebosim/gz-gui/pull/530) + +1. ign -> gz Migrate config and log directories : gz-gui + * [Pull request #454](https://github.com/gazebosim/gz-gui/pull/454) + +1. 6 ➡️ 7 + * [Pull request #524](https://github.com/gazebosim/gz-gui/pull/524) + +1. CI workflow: use checkout v3 + * [Pull request #526](https://github.com/gazebosim/gz-gui/pull/526) + +1. Rename COPYING to LICENSE + * [Pull request #525](https://github.com/gazebosim/gz-gui/pull/525) + +1. ign to gz + * [Pull request #524](https://github.com/gazebosim/gz-gui/pull/524) + +1. Add Camera FPS plugin + * [Pull request #523](https://github.com/gazebosim/gz-gui/pull/523) + +1. Update maintainer email + * [Pull request #521](https://github.com/gazebosim/gz-gui/pull/521) + +1. Fix INTEGRATION_camera_tracking test + * [Pull request #519](https://github.com/gazebosim/gz-gui/pull/519) + +1. 3.12.0 release + * [Pull request #508](https://github.com/gazebosim/gz-gui/pull/508) + +1. 3.12.0 pre1 + * [Pull request #507](https://github.com/gazebosim/gz-gui/pull/507) + +1. ign -> gz Migrate Ignition Headers : gz-gui + * [Pull request #466](https://github.com/gazebosim/gz-gui/pull/466) + +1. Add pointer check in Application::RemovePlugin + * [Pull request #501](https://github.com/gazebosim/gz-gui/pull/501) + +1. Add key publisher test + * [Pull request #477](https://github.com/gazebosim/gz-gui/pull/477) + +1. Update cmd/CMakeLists to conform with all other gz libraries + * [Pull request #478](https://github.com/gazebosim/gz-gui/pull/478) +1. Fix image display test + * [Pull request #468](https://github.com/gazebosim/gz-gui/pull/468) + +1. Add degree as an optional unit for rotation in GzPose + * [Pull request #475](https://github.com/gazebosim/gz-gui/pull/475) + +1. 🎈 3.11.2 + * [Pull request #474](https://github.com/gazebosim/gz-gui/pull/474) + + +### Gazebo GUI 7.1.0 (2023-03-10) 1. Set View Camera controller from plugin configuration * [Pull request #506](https://github.com/gazebosim/gz-gui/pull/506) @@ -215,6 +297,45 @@ ## Gazebo GUI 6 +### Gazebo GUI 6.7.0 (2023-05-12) + +1. Add degree as an optional unit for rotation in GzPose. + * [Pull request #475](https://github.com/gazebosim/gz-gui/pull/475) + +1. Fix image display test. + * [Pull request #468](https://github.com/gazebosim/gz-gui/pull/468) + +1. Update cmd/CMakeLists to conform with all other gz libraries. + * [Pull request #478](https://github.com/gazebosim/gz-gui/pull/478) + +1. Add key publisher test. + * [Pull request #477](https://github.com/gazebosim/gz-gui/pull/477) + +1. Add pointer check in Application::RemovePlugin. + * [Pull request #501](https://github.com/gazebosim/gz-gui/pull/501) + +1. ign -> gz Migrate Ignition Headers : gz-gui. + * [Pull request #466](https://github.com/gazebosim/gz-gui/pull/466) + +1. Fix INTEGRATION_camera_tracking test. + * [Pull request #519](https://github.com/gazebosim/gz-gui/pull/519) + +1. Update maintainer email. + * [Pull request #521](https://github.com/gazebosim/gz-gui/pull/521) + +1. Add Camera FPS plugin. + * [Pull request #523](https://github.com/gazebosim/gz-gui/pull/523) + +1. Rename COPYING to LICENSE. + * [Pull request #525](https://github.com/gazebosim/gz-gui/pull/525) + +1. CI workflow: use checkout v3. + * [Pull request #526](https://github.com/gazebosim/gz-gui/pull/526) + * [Pull request #536](https://github.com/gazebosim/gz-gui/pull/536) + +1. Fix data race issues in CameraTracking plugin. + * [Pull request #537](https://github.com/gazebosim/gz-gui/pull/537) + ### Gazebo GUI 6.7.0 (2022-12-02) 1. Set View Camera controller from plugin configuration diff --git a/src/Helpers_TEST.cc b/src/Helpers_TEST.cc index 980306fd8..4556cf7fa 100644 --- a/src/Helpers_TEST.cc +++ b/src/Helpers_TEST.cc @@ -194,11 +194,11 @@ TEST(HelpersTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(renderEngine)) EXPECT_TRUE(renderEngineName().empty()); // Set the render engine GUI name - mainWindow->SetRenderEngine("ogre"); + mainWindow->SetRenderEngine("ogre2"); // Has render engine EXPECT_FALSE(renderEngineName().empty()); - EXPECT_EQ("ogre", renderEngineName()); + EXPECT_EQ("ogre2", renderEngineName()); // Set no render engine mainWindow->SetRenderEngine({}); diff --git a/src/plugins/camera_tracking/CameraTracking.cc b/src/plugins/camera_tracking/CameraTracking.cc index 87f07cb7c..d9e56f6ef 100644 --- a/src/plugins/camera_tracking/CameraTracking.cc +++ b/src/plugins/camera_tracking/CameraTracking.cc @@ -259,14 +259,12 @@ bool CameraTrackingPrivate::OnFollow(const msgs::StringMsg &_msg, ///////////////////////////////////////////////// void CameraTrackingPrivate::OnMoveToComplete() { - std::lock_guard lock(this->mutex); this->moveToTarget.clear(); } ///////////////////////////////////////////////// void CameraTrackingPrivate::OnMoveToPoseComplete() { - std::lock_guard lock(this->mutex); this->moveToPoseValue.reset(); } @@ -329,6 +327,8 @@ bool CameraTrackingPrivate::OnMoveToPose(const msgs::GUICamera &_msg, ///////////////////////////////////////////////// void CameraTrackingPrivate::OnRender() { + std::lock_guard lock(this->mutex); + if (nullptr == this->scene) { this->scene = rendering::sceneFromFirstRenderEngine(); @@ -466,13 +466,14 @@ CameraTracking::CameraTracking() this->dataPtr->timer = new QTimer(this); this->connect(this->dataPtr->timer, &QTimer::timeout, [=]() { - if (!this->dataPtr->camera) - return; - if (this->dataPtr->cameraPosePub.HasConnections()) - { - auto poseMsg = msgs::Convert(this->dataPtr->camera->WorldPose()); - this->dataPtr->cameraPosePub.Publish(poseMsg); - } + std::lock_guard lock(this->dataPtr->mutex); + if (!this->dataPtr->camera) + return; + if (this->dataPtr->cameraPosePub.HasConnections()) + { + auto poseMsg = msgs::Convert(this->dataPtr->camera->WorldPose()); + this->dataPtr->cameraPosePub.Publish(poseMsg); + } }); this->dataPtr->timer->setInterval(1000.0 / 50.0); this->dataPtr->timer->start(); diff --git a/src/plugins/minimal_scene/CMakeLists.txt b/src/plugins/minimal_scene/CMakeLists.txt index 8e2a9526c..ebd6fd108 100644 --- a/src/plugins/minimal_scene/CMakeLists.txt +++ b/src/plugins/minimal_scene/CMakeLists.txt @@ -36,6 +36,6 @@ if (APPLE) MinimalSceneRhiMetal.mm PROPERTIES COMPILE_FLAGS - "-fobjc-arc" + "-fobjc-arc -Wno-nullability-completeness" ) endif() diff --git a/src/plugins/minimal_scene/MinimalScene.cc b/src/plugins/minimal_scene/MinimalScene.cc index bbd59d550..443390844 100644 --- a/src/plugins/minimal_scene/MinimalScene.cc +++ b/src/plugins/minimal_scene/MinimalScene.cc @@ -687,6 +687,10 @@ void GzRenderer::Destroy() // TODO(anyone) If that was the last scene, terminate engine? } + + // clean up in the rendering thread + this->dataPtr->camera.reset(); + this->dataPtr->rayQuery.reset(); } ///////////////////////////////////////////////// diff --git a/src/plugins/point_cloud/PointCloud_TEST.cc b/src/plugins/point_cloud/PointCloud_TEST.cc index 5fee2ecf3..f06072683 100644 --- a/src/plugins/point_cloud/PointCloud_TEST.cc +++ b/src/plugins/point_cloud/PointCloud_TEST.cc @@ -18,15 +18,19 @@ #include #include +#include +#include +#include + #include #include +#include #include #include "test_config.hh" // NOLINT(build/include) #include "gz/gui/Application.hh" #include "gz/gui/MainWindow.hh" #include "gz/gui/Plugin.hh" -#include "PointCloud.hh" int g_argc = 1; char* g_argv[] = @@ -37,16 +41,170 @@ char* g_argv[] = using namespace gz; using namespace gui; +class PointCloudTestFixture : public ::testing::Test +{ + public: + transport::Node node; + transport::Node::Publisher pointcloudPub; + transport::Node::Publisher flatPub; + msgs::PointCloudPacked pcMsg; + msgs::Float_V flatMsg; + std::atomic receivedMsg; + + PointCloudTestFixture() + { + this->pointcloudPub = this->node.Advertise( + "/point_cloud"); + this->flatPub = this->node.Advertise("/flat"); + + this->InitMockData(); + + this->node.Advertise("/marker", + &PointCloudTestFixture::OnMarkerMsg, this); + this->receivedMsg = false; + } + + public: void InitMockData() + { + msgs::InitPointCloudPacked(this->pcMsg, "some_frame", true, + {{"xyz", msgs::PointCloudPacked::Field::FLOAT32}}); + + int numberOfPoints{1000}; + unsigned int dataSize{numberOfPoints * this->pcMsg.point_step()}; + this->pcMsg.mutable_data()->resize(dataSize); + this->pcMsg.set_height(1); + this->pcMsg.set_width(1000); + + // Populate messages + msgs::PointCloudPackedIterator xIter(this->pcMsg, "x"); + msgs::PointCloudPackedIterator yIter(this->pcMsg, "y"); + msgs::PointCloudPackedIterator zIter(this->pcMsg, "z"); + + for (float x = 0.0, y = 0.0, z = 0.0; + xIter != xIter.End(); + ++xIter, ++yIter, ++zIter) + { + *xIter = x; + *yIter = y; + *zIter = z; + flatMsg.add_data(x); + + x += 1.0; + if (x > 9) + { + x = 0.0; + y += 1.0; + } + if (y > 9) + { + y = 0.0; + z += 1.0; + } + } + } + + /// \brief Publish pointcloud packed data + public: void Publish() + { + this->pointcloudPub.Publish(this->pcMsg); + this->flatPub.Publish(this->flatMsg); + } + + /// \brief Color for minimum value + public: const math::Color minColor{1.0f, 0.0f, 0.0f, 1.0f}; + + /// \brief Color for maximum value + public: const math::Color maxColor{0.0f, 1.0f, 0.0f, 1.0f}; + + public: bool indexRecieved[10][10][10] = {false}; + + /// \brief Callback that receives marker messages. + /// \param[in] _req The marker message. + public: void OnMarkerMsg(const msgs::Marker &_req) + { + if (_req.action() == msgs::Marker::ADD_MODIFY) + { + EXPECT_EQ(_req.id(), 1); + EXPECT_EQ(_req.ns(), "/point_cloud/flat"); + EXPECT_EQ(_req.type(), msgs::Marker::POINTS); + EXPECT_EQ(_req.visibility(), msgs::Marker::GUI); + if (_req.point().size() != 0) + { + // We might receive empty packets as the sending process + // is asynchronuous + EXPECT_EQ(_req.point().size(), this->flatMsg.data().size()); + EXPECT_EQ(_req.materials().size(), this->flatMsg.data().size()); + + auto dR = maxColor.R() - minColor.R(); + auto dG = maxColor.G() - minColor.G(); + auto dB = maxColor.B() - minColor.B(); + auto dA = maxColor.A() - minColor.A(); + + for (int idx = 0; idx < _req.point().size(); idx++) + { + // Check color correctness + EXPECT_NEAR(dR * (_req.point()[idx].x() / 9) + minColor.R(), + _req.materials()[idx].diffuse().r(), 1e-3); + EXPECT_NEAR(dG * (_req.point()[idx].x() / 9) + minColor.G(), + _req.materials()[idx].diffuse().g(), 1e-3); + EXPECT_NEAR(dB * (_req.point()[idx].x() / 9) + minColor.B(), + _req.materials()[idx].diffuse().b(), 1e-3); + EXPECT_NEAR(dA * (_req.point()[idx].x() / 9) + minColor.A(), + _req.materials()[idx].diffuse().a(), 1e-3); + + std::size_t x = round(_req.point()[idx].x()); + std::size_t y = round(_req.point()[idx].y()); + std::size_t z = round(_req.point()[idx].z()); + + // Mark this voxel as occupied + this->indexRecieved[x][y][z] = true; + } + + // Check all points in the point cloud have been populated. + for (std::size_t i = 0; i < 10; i++) + { + for (std::size_t j = 0; j < 10; j++) + { + for (std::size_t k = 0; k < 10; k++) + { + EXPECT_TRUE(this->indexRecieved[i][j][k]); + } + } + } + this->receivedMsg = true; + } + } + else if (_req.action() != msgs::Marker::DELETE_ALL) + { + // if DELETE_ALL, its ok to clear the screen. Otherwise fail + ADD_FAILURE(); + } + + } +}; + ///////////////////////////////////////////////// -TEST(PointCloudTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(PointCloud)) +TEST_F(PointCloudTestFixture, + GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(PointCloudTestFixture)) { common::Console::SetVerbosity(4); // Load the plugin Application app(g_argc, g_argv); - app.AddPluginPath(std::string(PROJECT_BINARY_PATH) + "/lib"); + app.AddPluginPath( + common::joinPaths(std::string(PROJECT_BINARY_PATH), "lib")); + // Load plugin + const char *pluginStr = + "" + "/point_cloud" + "/flat" + ""; + + tinyxml2::XMLDocument pluginDoc; + EXPECT_EQ(tinyxml2::XML_SUCCESS, pluginDoc.Parse(pluginStr)); - EXPECT_TRUE(app.LoadPlugin("PointCloud")); + EXPECT_TRUE(app.LoadPlugin("PointCloud", + pluginDoc.FirstChildElement("plugin"))); // Get main window auto window = app.findChild(); @@ -56,6 +214,22 @@ TEST(PointCloudTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(PointCloud)) auto plugins = window->findChildren(); EXPECT_EQ(plugins.size(), 1); + // Show, but don't exec, so we don't block + window->QuickWindow()->show(); + + this->Publish(); + + int sleep = 0; + int maxSleep = 30; + while (!this->receivedMsg && sleep < maxSleep) + { + this->Publish(); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + QCoreApplication::processEvents(); + ++sleep; + } + EXPECT_TRUE(this->receivedMsg); + // Cleanup plugins.clear(); } diff --git a/test/helpers/RenderEngineHelper.hh b/test/helpers/RenderEngineHelper.hh new file mode 100644 index 000000000..06d0ad6dd --- /dev/null +++ b/test/helpers/RenderEngineHelper.hh @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2023 Open Source Robotics Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +#ifndef GZ_GUI_RENDERENGINEHELPER_HH_ +#define GZ_GUI_RENDERENGINEHELPER_HH_ + +#include + +#include +#include + +#include +#include + +#include "gz/gui/GuiEvents.hh" + +#include "TestHelper.hh" + +namespace gz +{ +namespace gui +{ +namespace testing +{ + /// \brief Get the render engine + /// This function should be called after the main window is + /// shown (mainWindow.show()). It blocks until render events + /// are received. + /// \return A pointer to the render engine or nullptr if it's not available. + static rendering::RenderEngine* getRenderEngine( + const std::string &_engine) + { + // Filter events + bool receivedPreRenderEvent{false}; + bool receivedRenderEvent{false}; + auto testHelper = std::make_unique(); + testHelper->forwardEvent = [&](QEvent *_event) + { + if (_event->type() == gui::events::PreRender::kType) + { + receivedPreRenderEvent = true; + } + if (_event->type() == gui::events::Render::kType) + { + receivedRenderEvent = true; + } + }; + + int sleep = 0; + int maxSleep = 30; + while (!receivedRenderEvent && sleep < maxSleep) + { + std::this_thread::sleep_for(std::chrono::milliseconds(100)); + QCoreApplication::processEvents(); + ++sleep; + } + EXPECT_TRUE(receivedPreRenderEvent); + EXPECT_TRUE(receivedRenderEvent); + + // Check scene + auto engine = rendering::engine(_engine); + return engine; + } +} +} +} + +#endif diff --git a/test/integration/camera_tracking.cc b/test/integration/camera_tracking.cc index d541e722b..273be2b30 100644 --- a/test/integration/camera_tracking.cc +++ b/test/integration/camera_tracking.cc @@ -61,7 +61,7 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Load plugins const char *pluginStr = "" - "ogre" + "ogre2" "banana" "1.0 0 0" "0 1 0" @@ -120,7 +120,7 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) EXPECT_TRUE(poseMsg.has_position()); EXPECT_TRUE(poseMsg.has_orientation()); - auto engine = rendering::engine("ogre"); + auto engine = rendering::engine("ogre2"); ASSERT_NE(nullptr, engine); auto scene = engine->SceneByName("banana"); diff --git a/test/integration/marker_manager.cc b/test/integration/marker_manager.cc index f6f620534..0463d406d 100644 --- a/test/integration/marker_manager.cc +++ b/test/integration/marker_manager.cc @@ -32,6 +32,8 @@ #include #include "test_config.hh" // NOLINT(build/include) +#include "../helpers/TestHelper.hh" +#include "../helpers/RenderEngineHelper.hh" #include "gz/gui/Application.hh" #include "gz/gui/GuiEvents.hh" #include "gz/gui/MainWindow.hh" @@ -115,7 +117,7 @@ TEST_F(MarkerManagerTestFixture, const char *pluginMinimalSceneStr = "" - "ogre" + "ogre2" "scene" ""; @@ -142,19 +144,10 @@ TEST_F(MarkerManagerTestFixture, // Show, but don't exec, so we don't block window->QuickWindow()->show(); - // Check scene - auto engine = rendering::engine("ogre"); + // get render engine after window is shown + auto engine = gz::gui::testing::getRenderEngine("ogre2"); ASSERT_NE(nullptr, engine); - int sleep = 0; - int maxSleep = 30; - while (0 == engine->SceneCount() && sleep < maxSleep) - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - QCoreApplication::processEvents(); - sleep++; - } - EXPECT_EQ(1u, engine->SceneCount()); scene = engine->SceneByName("scene"); ASSERT_NE(nullptr, scene); @@ -218,4 +211,7 @@ TEST_F(MarkerManagerTestFixture, // Cleanup plugins.clear(); + scene.reset(); + + window->QuickWindow()->close(); } diff --git a/test/integration/minimal_scene.cc b/test/integration/minimal_scene.cc index 6e1546fb2..a789cc396 100644 --- a/test/integration/minimal_scene.cc +++ b/test/integration/minimal_scene.cc @@ -28,6 +28,7 @@ #include "test_config.hh" // NOLINT(build/include) #include "../helpers/TestHelper.hh" +#include "../helpers/RenderEngineHelper.hh" #include "gz/gui/Application.hh" #include "gz/gui/GuiEvents.hh" #include "gz/gui/Plugin.hh" @@ -80,7 +81,7 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Load plugin const char *pluginStr = "" - "ogre" + "ogre2" "banana" "1.0 0 0" "0 1 0" @@ -106,37 +107,10 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Show, but don't exec, so we don't block win->QuickWindow()->show(); - // Filter events - bool receivedPreRenderEvent{false}; - bool receivedRenderEvent{false}; - auto testHelper = std::make_unique(); - testHelper->forwardEvent = [&](QEvent *_event) - { - if (_event->type() == events::PreRender::kType) - { - receivedPreRenderEvent = true; - } - if (_event->type() == events::Render::kType) - { - receivedRenderEvent = true; - } - }; - - // Check scene - auto engine = rendering::engine("ogre"); + // get render engine after window is shown + auto engine = gz::gui::testing::getRenderEngine("ogre2"); ASSERT_NE(nullptr, engine); - int sleep = 0; - int maxSleep = 30; - while (!receivedRenderEvent && sleep < maxSleep) - { - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - QCoreApplication::processEvents(); - ++sleep; - } - EXPECT_TRUE(receivedPreRenderEvent); - EXPECT_TRUE(receivedRenderEvent); - EXPECT_EQ(1u, engine->SceneCount()); auto scene = engine->SceneByName("banana"); ASSERT_NE(nullptr, scene); @@ -170,7 +144,7 @@ TEST(MinimalSceneTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) EXPECT_TRUE(app.RemovePlugin(pluginName)); plugins.clear(); + + scene.reset(); win->QuickWindow()->close(); - engine->DestroyScene(scene); - EXPECT_TRUE(rendering::unloadEngine(engine->Name())); } diff --git a/test/integration/transport_scene_manager.cc b/test/integration/transport_scene_manager.cc index fa35aa3b9..6cfd41ada 100644 --- a/test/integration/transport_scene_manager.cc +++ b/test/integration/transport_scene_manager.cc @@ -32,6 +32,7 @@ #include "test_config.hh" // NOLINT(build/include) #include "../helpers/TestHelper.hh" +#include "../helpers/RenderEngineHelper.hh" #include "gz/gui/Application.hh" #include "gz/gui/GuiEvents.hh" #include "gz/gui/Plugin.hh" @@ -123,7 +124,7 @@ TEST(TransportSceneManagerTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Load plugins const char *pluginStr = "" - "ogre" + "ogre2" "banana" "1.0 0 0" "0 1 0" @@ -154,8 +155,8 @@ TEST(TransportSceneManagerTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) // Show, but don't exec, so we don't block win->QuickWindow()->show(); - // Get scene - auto engine = rendering::engine("ogre"); + // get render engine after window is shown + auto engine = gz::gui::testing::getRenderEngine("ogre2"); ASSERT_NE(nullptr, engine); int sleep = 0; @@ -259,8 +260,7 @@ TEST(TransportSceneManagerTest, GZ_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) } plugins.clear(); + scene.reset(); win->QuickWindow()->close(); - engine->DestroyScene(scene); - EXPECT_TRUE(rendering::unloadEngine(engine->Name())); }