Skip to content

Commit 4aaf883

Browse files
committed
test(dlopen): 添加 GamepadControlUnit dlopen 测试
1 parent b720bc8 commit 4aaf883

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

test/dlopen/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ if(WITH_CUSTOM_CONTROLLER)
3636
target_compile_definitions(DlopenTesting PRIVATE WITH_CUSTOM_CONTROLLER)
3737
endif()
3838

39+
if(WITH_GAMEPAD_CONTROLLER)
40+
target_compile_definitions(DlopenTesting PRIVATE WITH_GAMEPAD_CONTROLLER)
41+
endif()
42+
3943
add_dependencies(DlopenTesting LibraryHolder)
4044

4145
set_target_properties(DlopenTesting PROPERTIES FOLDER Testing)

test/dlopen/main.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,20 @@ int main()
6969
return -1;
7070
}
7171

72+
#endif
73+
74+
#ifdef WITH_GAMEPAD_CONTROLLER
75+
76+
std::cout << "********** GamepadControlUnitLibraryHolder::create_control_unit **********" << std::endl;
77+
auto gamepad_handle = MAA_NS::GamepadControlUnitLibraryHolder::create_control_unit(
78+
nullptr,
79+
MaaGamepadType_Xbox360,
80+
MaaWin32ScreencapMethod_None);
81+
if (!gamepad_handle) {
82+
std::cerr << "Failed to create gamepad control unit" << std::endl;
83+
return -1;
84+
}
85+
7286
#endif
7387

7488
std::cout << "********** Done **********" << std::endl;

0 commit comments

Comments
 (0)