Skip to content

Commit

Permalink
Minor cleaning of CMakeLists.txt. Fix C++ warnings and Qt deprecation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jul 10, 2024
1 parent f979210 commit e956df4
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
5 changes: 1 addition & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/mocks/DummyFileTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class DummyFileTree : public MOBase::IFileTree {
return std::make_shared<DummyFileTree>(parent, name);
}

bool doPopulate(std::shared_ptr<const IFileTree> parent,
std::vector<std::shared_ptr<FileTreeEntry>>& entries) const override
bool doPopulate(std::shared_ptr<const IFileTree>,
std::vector<std::shared_ptr<FileTreeEntry>>&) const override
{
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions tests/python/test_organizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DWORD>(-1);
return false;
}
});
Expand Down
14 changes: 8 additions & 6 deletions tests/python/test_qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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", []() {
Expand Down
2 changes: 1 addition & 1 deletion tests/runner/test_iplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e956df4

Please sign in to comment.