Add focus_spoof_test (and close the dedicated-hook-tests item)
focus_spoof_test plays game + host: it creates a top-level window (which
find_main_window picks up), installs the spoof, and checks that
GetForegroundWindow / GetActiveWindow / GetFocus now report that window, that the
status flag flips on install and off on removal, and that a ClipCursor request is
swallowed while cursor release is the default. Skips if the window can't be
enumerated.
With this and d3d9_hook_test, the dedicated-hook-tests item is done. vk_hook's
present path is intentionally not given a separate in-process test: it's exercised
end to end by mock_game_test's vk-inject path ("hook captured Vulkan present
calls"), and the off-thread VkCapture it drives has vk_capture_perf_test -- a
standalone in-process Vulkan swapchain harness would just duplicate that at high
cost.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -268,6 +268,21 @@ target_link_libraries(d3d9_hook_test PRIVATE
|
||||
dxgi)
|
||||
add_test(NAME d3d9_hook_test COMMAND d3d9_hook_test)
|
||||
|
||||
# In-process self-test for the focus-spoof subsystem: installs the spoof on the test's own top-level
|
||||
# window and checks the focus-query APIs report it foreground/active/focused, that removal restores
|
||||
# them, and that a ClipCursor request is swallowed while cursor release is active.
|
||||
add_executable(focus_spoof_test
|
||||
focus_spoof_test.cpp
|
||||
${CMAKE_SOURCE_DIR}/hook/src/focus_spoof.cpp
|
||||
${CMAKE_SOURCE_DIR}/hook/src/debug_log.cpp
|
||||
${CMAKE_SOURCE_DIR}/hook/src/hook_registry.cpp)
|
||||
target_include_directories(focus_spoof_test PRIVATE ${CMAKE_SOURCE_DIR}/hook/src)
|
||||
target_link_libraries(focus_spoof_test PRIVATE
|
||||
coop_common
|
||||
safetyhook::safetyhook
|
||||
user32)
|
||||
add_test(NAME focus_spoof_test COMMAND focus_spoof_test)
|
||||
|
||||
# Comprehensive capture/audio/hook stress test against coop_mock_game: launches the
|
||||
# animated, frame-numbered A/V game, injects coop_hook.dll, decodes captured frame
|
||||
# numbers (DX11 + DX12) to assert a monotonic/advancing mirror, checks audio capture, and
|
||||
@@ -386,6 +401,7 @@ coop_output_subdir(tests
|
||||
present_hook_test
|
||||
dx12_present_hook_test
|
||||
d3d9_hook_test
|
||||
focus_spoof_test
|
||||
opengl_hook_test
|
||||
mock_game_test
|
||||
audio_verify_test
|
||||
|
||||
Reference in New Issue
Block a user