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/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/minimal_scene/CMakeLists.txt b/src/plugins/minimal_scene/CMakeLists.txt index 6eb0a1335..f037a862b 100644 --- a/src/plugins/minimal_scene/CMakeLists.txt +++ b/src/plugins/minimal_scene/CMakeLists.txt @@ -39,6 +39,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 94ae25335..08a04d3cd 100644 --- a/src/plugins/minimal_scene/MinimalScene.cc +++ b/src/plugins/minimal_scene/MinimalScene.cc @@ -840,6 +840,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/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 3e110220f..8152437e0 100644 --- a/test/integration/camera_tracking.cc +++ b/test/integration/camera_tracking.cc @@ -60,7 +60,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" @@ -119,7 +119,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())); }