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
|
2026-04-04 18:55:20 +08:00
|
|
|
test_xcui_input_dispatcher.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
|
|
|
)
|
|
|
|
|
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
add_executable(input_tests ${INPUT_TEST_SOURCES})
|
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
|
|
|
|
|
|
|
|
if(MSVC)
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
set_target_properties(input_tests PROPERTIES
|
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
|
|
|
LINK_FLAGS "/NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:libcmt.lib"
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
target_link_libraries(input_tests
|
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
|
|
|
PRIVATE
|
|
|
|
|
XCEngine
|
|
|
|
|
GTest::gtest
|
|
|
|
|
GTest::gtest_main
|
|
|
|
|
)
|
|
|
|
|
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
target_include_directories(input_tests PRIVATE
|
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
|
|
|
${CMAKE_SOURCE_DIR}/engine/include
|
2026-03-29 01:36:53 +08:00
|
|
|
${CMAKE_SOURCE_DIR}/tests/Fixtures
|
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
|
|
|
)
|
|
|
|
|
|
refactor: improve test infrastructure and fix OpenGL GLAD initialization
- Rename D3D12Enum.h to D3D12Enums.h for naming consistency
- Fix OpenGL unit test GLAD initialization by using gladLoadGL()
instead of gladLoadGLLoader(wglGetProcAddress) for fallback support
- Migrate remaining tests to use gtest_discover_tests for granular
test discovery (math, core, containers, memory, threading, debug,
components, scene, resources, input, opengl)
- Remove obsolete TEST_RESOURCES_DIR and copy_directory commands
from OpenGL unit test CMakeLists (minimal/Res doesn't exist)
- Update TEST_SPEC.md with performance metrics and per-module
build/test commands for faster development workflow
- Update CMake path references to use lowercase paths
2026-03-23 00:43:02 +08:00
|
|
|
include(GoogleTest)
|
|
|
|
|
gtest_discover_tests(input_tests)
|