mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Expose INVALID_HANDLE_VALUE as mobase.INVALID_HANDLE_VALUE. (#131)
* Expose INVALID_HANDLE_VALUE as mobase.INVALID_HANDLE_VALUE. * Add tests for startApplication() returning INVALID_HANDLE_VALUE. * Clean tests and generate stub files for them.
This commit is contained in:
@@ -13,6 +13,10 @@ using ::testing::NiceMock;
|
||||
|
||||
PYBIND11_MODULE(organizer, m)
|
||||
{
|
||||
using ::testing::_;
|
||||
using ::testing::Eq;
|
||||
using ::testing::Return;
|
||||
|
||||
m.def(
|
||||
"organizer",
|
||||
[]() -> IOrganizer* {
|
||||
@@ -21,9 +25,10 @@ PYBIND11_MODULE(organizer, m)
|
||||
return "profile";
|
||||
});
|
||||
const auto handle = (HANDLE)std::uintptr_t{4654};
|
||||
ON_CALL(*mock, startApplication).WillByDefault([&mock, handle](auto&&...) {
|
||||
return handle;
|
||||
});
|
||||
EXPECT_CALL(*mock, startApplication(Eq("valid.exe"), _, _, _, _, _))
|
||||
.WillRepeatedly(Return(handle));
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user