From 176401f0c8f758f4eeff8ac8fe09f2c8c913153d Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Wed, 30 Mar 2022 11:45:53 -0700 Subject: [PATCH] Fix tests Signed-off-by: Louise Poubel --- src/Helpers_TEST.cc | 5 ++++- src/MainWindow_TEST.cc | 6 ++++-- test/integration/minimal_scene.cc | 5 ++++- test/integration/transport_scene_manager.cc | 9 ++++++--- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/Helpers_TEST.cc b/src/Helpers_TEST.cc index 3a3479703..bd0d28d8c 100644 --- a/src/Helpers_TEST.cc +++ b/src/Helpers_TEST.cc @@ -27,7 +27,10 @@ #include "ignition/gui/Helpers.hh" int gg_argc = 1; -char **gg_argv = new char *[gg_argc]; +char* gg_argv[] = +{ + reinterpret_cast(const_cast("./Helpers_TEST")), +}; using namespace ignition; using namespace gui; diff --git a/src/MainWindow_TEST.cc b/src/MainWindow_TEST.cc index af9791e87..84e6e1388 100644 --- a/src/MainWindow_TEST.cc +++ b/src/MainWindow_TEST.cc @@ -521,7 +521,8 @@ void FindExitDialogButtons( QObject *buttonBox{nullptr}; for (const auto& c : dialog->findChildren()) { - if (c->metaObject()->className() == std::string("QQuickDialogButtonBox")) + if (std::string(c->metaObject()->className()).find("ButtonBox") != + std::string::npos) { const auto& p = c->property("standardButtons"); if (p.isValid() && p.toInt() != 0) @@ -543,7 +544,8 @@ void FindExitDialogButtons( Q_RETURN_ARG(QQuickItem *, button), Q_ARG(int, index)); - ASSERT_STREQ("QQuickButton", button->metaObject()->className()); + ASSERT_NE(std::string::npos, + std::string(button->metaObject()->className()).find("Button")); buttons.push_back(button); } diff --git a/test/integration/minimal_scene.cc b/test/integration/minimal_scene.cc index ae08c35c6..d6fc675cd 100644 --- a/test/integration/minimal_scene.cc +++ b/test/integration/minimal_scene.cc @@ -34,7 +34,10 @@ #include "ignition/gui/MainWindow.hh" int g_argc = 1; -char **g_argv = new char *[g_argc]; +char* g_argv[] = +{ + reinterpret_cast(const_cast("./MinimalScene_TEST")), +}; using namespace ignition; using namespace gui; diff --git a/test/integration/transport_scene_manager.cc b/test/integration/transport_scene_manager.cc index dec0e3efa..e907edfce 100644 --- a/test/integration/transport_scene_manager.cc +++ b/test/integration/transport_scene_manager.cc @@ -37,13 +37,16 @@ #include "ignition/gui/MainWindow.hh" int g_argc = 1; -char **g_argv = new char *[g_argc]; +char* g_argv[] = +{ + reinterpret_cast(const_cast("./TransportSceneManager_TEST")), +}; using namespace ignition; using namespace gui; ///////////////////////////////////////////////// -TEST(MinimalSceneTest, IGN_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Load)) +TEST(TransportSceneManagerTest, IGN_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Load)) { common::Console::SetVerbosity(4); @@ -77,7 +80,7 @@ TEST(MinimalSceneTest, IGN_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Load)) } ///////////////////////////////////////////////// -TEST(MinimalSceneTest, IGN_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) +TEST(TransportSceneManagerTest, IGN_UTILS_TEST_ENABLED_ONLY_ON_LINUX(Config)) { bool sceneRequested{false}; std::function sceneService =