From e956df41def73dbe46779ff74a9d7d0f6dcd7320 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Wed, 10 Jul 2024 20:32:34 +0200 Subject: [PATCH] Minor cleaning of CMakeLists.txt. Fix C++ warnings and Qt deprecation. --- CMakeLists.txt | 5 +---- tests/mocks/DummyFileTree.h | 4 ++-- tests/python/test_organizer.cpp | 6 +++--- tests/python/test_qt.cpp | 14 ++++++++------ tests/runner/test_iplugin.cpp | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 96e8597..cad15f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,14 +2,11 @@ cmake_minimum_required(VERSION 3.16) cmake_policy(SET CMP0144 NEW) -# remove MinSizeRel otherwise CMP0111 breaks everything -set(CMAKE_CONFIGURATION_TYPES "Debug;Release;RelWithDebInfo" CACHE STRING "" FORCE) - project(plugin_python CXX) find_package(mo2-cmake CONFIG REQUIRED) -find_package(Python 3.12 COMPONENTS Interpreter Development REQUIRED) +find_package(Python ${MO2_PYTHON_VERSION} COMPONENTS Interpreter Development REQUIRED) find_package(pybind11 CONFIG REQUIRED) get_filename_component(Python_HOME ${Python_EXECUTABLE} PATH) diff --git a/tests/mocks/DummyFileTree.h b/tests/mocks/DummyFileTree.h index 6e516ba..cf81691 100644 --- a/tests/mocks/DummyFileTree.h +++ b/tests/mocks/DummyFileTree.h @@ -19,8 +19,8 @@ class DummyFileTree : public MOBase::IFileTree { return std::make_shared(parent, name); } - bool doPopulate(std::shared_ptr parent, - std::vector>& entries) const override + bool doPopulate(std::shared_ptr, + std::vector>&) const override { return true; } diff --git a/tests/python/test_organizer.cpp b/tests/python/test_organizer.cpp index 3f1878d..9a18f7c 100644 --- a/tests/python/test_organizer.cpp +++ b/tests/python/test_organizer.cpp @@ -30,14 +30,14 @@ PYBIND11_MODULE(organizer, m) EXPECT_CALL(*mock, startApplication(Eq("invalid.exe"), _, _, _, _, _)) .WillRepeatedly(Return(INVALID_HANDLE_VALUE)); ON_CALL(*mock, waitForApplication) - .WillByDefault([&mock, original_handle = handle]( - HANDLE handle, bool refresh, LPDWORD exitCode) { + .WillByDefault([&mock, original_handle = handle](HANDLE handle, bool, + LPDWORD exitCode) { if (handle == original_handle) { *exitCode = 0; return true; } else { - *exitCode = -1; + *exitCode = static_cast(-1); return false; } }); diff --git a/tests/python/test_qt.cpp b/tests/python/test_qt.cpp index 35b1785..5ef1f00 100644 --- a/tests/python/test_qt.cpp +++ b/tests/python/test_qt.cpp @@ -72,24 +72,26 @@ PYBIND11_MODULE(qt, m) // QVariant m.def("qvariant_from_none", [](QVariant const& variant) { - return std::make_tuple(variant.userType() == QVariant::Invalid, + return std::make_tuple(variant.userType() == QMetaType::UnknownType, variant.isValid()); }); m.def("qvariant_from_int", [](QVariant const& variant) { - return std::make_tuple(variant.userType() == QVariant::Int, variant.toInt()); + return std::make_tuple(variant.userType() == QMetaType::Int, variant.toInt()); }); m.def("qvariant_from_bool", [](QVariant const& variant) { - return std::make_tuple(variant.userType() == QVariant::Bool, variant.toBool()); + return std::make_tuple(variant.userType() == QMetaType::Bool, variant.toBool()); }); m.def("qvariant_from_str", [](QVariant const& variant) { - return std::make_tuple(variant.userType() == QVariant::String, + return std::make_tuple(variant.userType() == QMetaType::QString, variant.toString()); }); m.def("qvariant_from_list", [](QVariant const& variant) { - return std::make_tuple(variant.userType() == QVariant::List, variant.toList()); + return std::make_tuple(variant.userType() == QMetaType::QVariantList, + variant.toList()); }); m.def("qvariant_from_map", [](QVariant const& variant) { - return std::make_tuple(variant.userType() == QVariant::Map, variant.toMap()); + return std::make_tuple(variant.userType() == QMetaType::QVariantMap, + variant.toMap()); }); m.def("qvariant_none", []() { diff --git a/tests/runner/test_iplugin.cpp b/tests/runner/test_iplugin.cpp index 06421d8..27c4829 100644 --- a/tests/runner/test_iplugin.cpp +++ b/tests/runner/test_iplugin.cpp @@ -35,7 +35,7 @@ TEST(IPlugin, Basic) EXPECT_EQ(settings.size(), 1); EXPECT_EQ(settings[0].key, "a setting"); EXPECT_EQ(settings[0].description, "the setting description"); - EXPECT_EQ(settings[0].defaultValue.userType(), QVariant::Type::Int); + EXPECT_EQ(settings[0].defaultValue.userType(), QMetaType::Type::Int); EXPECT_EQ(settings[0].defaultValue.toInt(), 12); // no translation, no custom implementation -> name()