test: 添加 Input 模块单元测试
- 创建 tests/Input 目录和 CMakeLists.txt
- 添加 28 个测试用例覆盖:
- InputManager: Singleton, Initialize/Shutdown, 按键状态, 鼠标, 轴, 按钮
- InputAxis: 默认构造, 正负键, SetValue
- InputEvent: KeyEvent, MouseButtonEvent, MouseMoveEvent, MouseWheelEvent, TextInputEvent
2026-03-22 16:22:13 +08:00
|
|
|
# ============================================================
|
|
|
|
|
# Input Module Tests
|
|
|
|
|
# ============================================================
|
|
|
|
|
|
|
|
|
|
set(INPUT_TEST_SOURCES
|
|
|
|
|
test_input_manager.cpp
|
2026-03-22 17:14:11 +08:00
|
|
|
test_windows_input_module.cpp
|
test: 添加 Input 模块单元测试
- 创建 tests/Input 目录和 CMakeLists.txt
- 添加 28 个测试用例覆盖:
- InputManager: Singleton, Initialize/Shutdown, 按键状态, 鼠标, 轴, 按钮
- InputAxis: 默认构造, 正负键, SetValue
- InputEvent: KeyEvent, MouseButtonEvent, MouseMoveEvent, MouseWheelEvent, TextInputEvent
2026-03-22 16:22:13 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_executable(xcengine_input_tests ${INPUT_TEST_SOURCES})
|
|
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
|
set_target_properties(xcengine_input_tests PROPERTIES
|
|
|
|
|
LINK_FLAGS "/NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:libcmt.lib"
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
target_link_libraries(xcengine_input_tests
|
|
|
|
|
PRIVATE
|
|
|
|
|
XCEngine
|
|
|
|
|
GTest::gtest
|
|
|
|
|
GTest::gtest_main
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_include_directories(xcengine_input_tests PRIVATE
|
|
|
|
|
${CMAKE_SOURCE_DIR}/engine/include
|
|
|
|
|
${CMAKE_SOURCE_DIR}/tests/fixtures
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_test(NAME InputTests COMMAND xcengine_input_tests)
|