feat(xcui): advance core and editor validation flow

This commit is contained in:
2026-04-06 16:20:46 +08:00
parent 33bb84f650
commit 2d030a97da
128 changed files with 9961 additions and 773 deletions

View File

@@ -0,0 +1,12 @@
add_subdirectory(keyboard_focus)
add_subdirectory(pointer_states)
add_subdirectory(scroll_view)
add_subdirectory(shortcut_scope)
add_custom_target(core_ui_input_integration_tests
DEPENDS
core_ui_input_keyboard_focus_validation
core_ui_input_pointer_states_validation
core_ui_input_scroll_view_validation
core_ui_input_shortcut_scope_validation
)

View File

@@ -0,0 +1,8 @@
# Core Input Integration
这个分类只放共享 XCUI 输入能力的手工验证场景。
规则:
- 一个场景目录对应一个独立 exe
- 共享宿主层只放在 `integration/shared/`
- 不允许把多个无关检查点塞进同一个 exe

View File

@@ -0,0 +1,35 @@
set(CORE_UI_INPUT_KEYBOARD_FOCUS_RESOURCES
View.xcui
${CMAKE_SOURCE_DIR}/tests/UI/Core/integration/shared/themes/core_validation.xctheme
)
add_executable(core_ui_input_keyboard_focus_validation WIN32
main.cpp
${CORE_UI_INPUT_KEYBOARD_FOCUS_RESOURCES}
)
target_include_directories(core_ui_input_keyboard_focus_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Core/integration/shared/src
${CMAKE_SOURCE_DIR}/engine/include
)
target_compile_definitions(core_ui_input_keyboard_focus_validation PRIVATE
UNICODE
_UNICODE
)
if(MSVC)
target_compile_options(core_ui_input_keyboard_focus_validation PRIVATE /utf-8 /FS)
set_property(TARGET core_ui_input_keyboard_focus_validation PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
target_link_libraries(core_ui_input_keyboard_focus_validation PRIVATE
core_ui_integration_host
)
set_target_properties(core_ui_input_keyboard_focus_validation PROPERTIES
OUTPUT_NAME "XCUICoreInputKeyboardFocusValidation"
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES View.xcui)

View File

@@ -0,0 +1,15 @@
# Keyboard Focus Validation
可执行 target
- `core_ui_input_keyboard_focus_validation`
运行:
```bash
build\tests\UI\Core\integration\input\keyboard_focus\Debug\XCUICoreInputKeyboardFocusValidation.exe
```
检查点:
1.`Tab`,焦点依次切换三个按钮。
2.`Shift+Tab`,焦点反向切换。
3.`Enter``Space`,当前 `focus` 按钮进入 `active`
4. 松开按键后,`active` 清空。

View File

@@ -0,0 +1,30 @@
<View
name="CoreInputKeyboardFocus"
theme="../../shared/themes/core_validation.xctheme">
<Column padding="24" gap="16">
<Card
title="Core Validation | Keyboard Focus"
subtitle="当前批次Tab 焦点遍历 | Enter / Space 激活"
tone="accent"
height="90">
<Column gap="8">
<Text text="这是 Core 层验证场景,不承载 runtime 游戏 UI。" />
<Text text="这一轮只检查键盘焦点和激活,不混入上层业务面板。" />
</Column>
</Card>
<Card title="Keyboard Focus" subtitle="tab focus active" height="214">
<Column gap="12">
<Text text="只检查下面三个可聚焦按钮和右下角状态叠层。" />
<Row gap="12">
<Button id="focus-first" text="First Focus" />
<Button id="focus-second" text="Second Focus" />
<Button id="focus-third" text="Third Focus" />
</Row>
<Text text="1. 按 Tabfocus 应依次切到 First / Second / Third。" />
<Text text="2. 按 Shift+Tabfocus 应反向切换。" />
<Text text="3. focus 停在任一按钮后,按 Enter 或 Spaceactive 应出现;松开后 active 清空。" />
</Column>
</Card>
</Column>
</View>

View File

@@ -0,0 +1,8 @@
#include "Application.h"
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int nCmdShow) {
return XCEngine::Tests::CoreUI::RunCoreUIValidationApp(
hInstance,
nCmdShow,
"core.input.keyboard_focus");
}

View File

@@ -0,0 +1,35 @@
set(CORE_UI_INPUT_POINTER_STATES_RESOURCES
View.xcui
${CMAKE_SOURCE_DIR}/tests/UI/Core/integration/shared/themes/core_validation.xctheme
)
add_executable(core_ui_input_pointer_states_validation WIN32
main.cpp
${CORE_UI_INPUT_POINTER_STATES_RESOURCES}
)
target_include_directories(core_ui_input_pointer_states_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Core/integration/shared/src
${CMAKE_SOURCE_DIR}/engine/include
)
target_compile_definitions(core_ui_input_pointer_states_validation PRIVATE
UNICODE
_UNICODE
)
if(MSVC)
target_compile_options(core_ui_input_pointer_states_validation PRIVATE /utf-8 /FS)
set_property(TARGET core_ui_input_pointer_states_validation PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
target_link_libraries(core_ui_input_pointer_states_validation PRIVATE
core_ui_integration_host
)
set_target_properties(core_ui_input_pointer_states_validation PROPERTIES
OUTPUT_NAME "XCUICoreInputPointerStatesValidation"
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES View.xcui)

View File

@@ -0,0 +1,14 @@
# Pointer States Validation
可执行 target
- `core_ui_input_pointer_states_validation`
运行:
```bash
build\tests\UI\Core\integration\input\pointer_states\Debug\XCUICoreInputPointerStatesValidation.exe
```
检查点:
1. hover 左侧按钮,只应变化 `hover`
2. 按住中间按钮,应看到 `focus``active``capture`
3. 拖到右侧再松开,应看到 `capture` 清空route 转到新的目标。

View File

@@ -0,0 +1,30 @@
<View
name="CoreInputPointerStates"
theme="../../shared/themes/core_validation.xctheme">
<Column padding="24" gap="16">
<Card
title="Core Validation | Pointer States"
subtitle="当前批次:鼠标 hover / focus / active / capture"
tone="accent"
height="90">
<Column gap="8">
<Text text="这是 Core 层验证场景,不承载 runtime 游戏 UI。" />
<Text text="这一轮只检查鼠标输入状态,不混入别的控件实验。" />
</Column>
</Card>
<Card title="Pointer Input" subtitle="hover focus active capture" height="196">
<Column gap="12">
<Text text="这一轮只需要检查下面这三个按钮。" />
<Row gap="12">
<Button id="input-hover" text="Hover / Focus" />
<Button id="input-capture" text="Pointer Capture" capturePointer="true" />
<Button id="input-route" text="Route Target" />
</Row>
<Text text="1. 鼠标移到左侧按钮hover 应变化focus 保持空。" />
<Text text="2. 按住中间按钮focus、active、capture 都应留在中间。" />
<Text text="3. 拖到右侧再松开hover 移到右侧capture 清空focus 仍留中间。" />
</Column>
</Card>
</Column>
</View>

View File

@@ -0,0 +1,8 @@
#include "Application.h"
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int nCmdShow) {
return XCEngine::Tests::CoreUI::RunCoreUIValidationApp(
hInstance,
nCmdShow,
"core.input.pointer_states");
}

View File

@@ -0,0 +1,35 @@
set(CORE_UI_INPUT_SCROLL_VIEW_RESOURCES
View.xcui
${CMAKE_SOURCE_DIR}/tests/UI/Core/integration/shared/themes/core_validation.xctheme
)
add_executable(core_ui_input_scroll_view_validation WIN32
main.cpp
${CORE_UI_INPUT_SCROLL_VIEW_RESOURCES}
)
target_include_directories(core_ui_input_scroll_view_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Core/integration/shared/src
${CMAKE_SOURCE_DIR}/engine/include
)
target_compile_definitions(core_ui_input_scroll_view_validation PRIVATE
UNICODE
_UNICODE
)
if(MSVC)
target_compile_options(core_ui_input_scroll_view_validation PRIVATE /utf-8 /FS)
set_property(TARGET core_ui_input_scroll_view_validation PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
target_link_libraries(core_ui_input_scroll_view_validation PRIVATE
core_ui_integration_host
)
set_target_properties(core_ui_input_scroll_view_validation PROPERTIES
OUTPUT_NAME "XCUICoreInputScrollViewValidation"
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES View.xcui)

View File

@@ -0,0 +1,61 @@
<View
name="CoreInputScrollView"
theme="../../shared/themes/core_validation.xctheme">
<Column padding="20" gap="12">
<Card
title="功能ScrollView 滚动 / clip / overflow"
subtitle="只检查滚轮滚动、裁剪、overflow 与 target 路由,不检查业务面板"
tone="accent"
height="118">
<Column gap="6">
<Text text="1. 把鼠标放到下方日志区内滚动滚轮:内容应上下移动,右下角 Scroll target 应落到 validation-scroll。" />
<Text text="2. 连续向下滚到末尾再继续滚Offset 应被 clampResult 应显示 Scroll delta clamped to current offset。" />
<Text text="3. 把鼠标移到日志区外再滚动日志位置不应变化Result 应显示 No hovered ScrollView。" />
<Text text="4. 这个场景只验证 ScrollView 基础能力,不验证上层业务面板。" />
</Column>
</Card>
<Card
title="Scrollable Log"
subtitle="wheel inside this viewport"
height="fill">
<ScrollView id="validation-scroll" height="fill">
<Column gap="8">
<Text text="Line 01 - Scroll validation log" />
<Text text="Line 02 - Scroll validation log" />
<Text text="Line 03 - Scroll validation log" />
<Text text="Line 04 - Scroll validation log" />
<Text text="Line 05 - Scroll validation log" />
<Text text="Line 06 - Scroll validation log" />
<Text text="Line 07 - Scroll validation log" />
<Text text="Line 08 - Scroll validation log" />
<Text text="Line 09 - Scroll validation log" />
<Text text="Line 10 - Scroll validation log" />
<Text text="Line 11 - Scroll validation log" />
<Text text="Line 12 - Scroll validation log" />
<Text text="Line 13 - Scroll validation log" />
<Text text="Line 14 - Scroll validation log" />
<Text text="Line 15 - Scroll validation log" />
<Text text="Line 16 - Scroll validation log" />
<Text text="Line 17 - Scroll validation log" />
<Text text="Line 18 - Scroll validation log" />
<Text text="Line 19 - Scroll validation log" />
<Text text="Line 20 - Scroll validation log" />
<Text text="Line 21 - Scroll validation log" />
<Text text="Line 22 - Scroll validation log" />
<Text text="Line 23 - Scroll validation log" />
<Text text="Line 24 - Scroll validation log" />
</Column>
</ScrollView>
</Card>
<Card
title="Outside Area"
subtitle="wheel here should not move the log"
height="84">
<Column gap="8">
<Text text="把鼠标移到这个区域再滚动,用来检查 No hovered ScrollView。" />
</Column>
</Card>
</Column>
</View>

View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1,8 @@
#include "Application.h"
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int nCmdShow) {
return XCEngine::Tests::CoreUI::RunCoreUIValidationApp(
hInstance,
nCmdShow,
"core.input.scroll_view");
}

View File

@@ -0,0 +1,35 @@
set(CORE_UI_INPUT_SHORTCUT_SCOPE_RESOURCES
View.xcui
${CMAKE_SOURCE_DIR}/tests/UI/Core/integration/shared/themes/core_validation.xctheme
)
add_executable(core_ui_input_shortcut_scope_validation WIN32
main.cpp
${CORE_UI_INPUT_SHORTCUT_SCOPE_RESOURCES}
)
target_include_directories(core_ui_input_shortcut_scope_validation PRIVATE
${CMAKE_SOURCE_DIR}/tests/UI/Core/integration/shared/src
${CMAKE_SOURCE_DIR}/engine/include
)
target_compile_definitions(core_ui_input_shortcut_scope_validation PRIVATE
UNICODE
_UNICODE
)
if(MSVC)
target_compile_options(core_ui_input_shortcut_scope_validation PRIVATE /utf-8 /FS)
set_property(TARGET core_ui_input_shortcut_scope_validation PROPERTY
MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
endif()
target_link_libraries(core_ui_input_shortcut_scope_validation PRIVATE
core_ui_integration_host
)
set_target_properties(core_ui_input_shortcut_scope_validation PROPERTIES
OUTPUT_NAME "XCUICoreInputShortcutScopeValidation"
)
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES View.xcui)

View File

@@ -0,0 +1,69 @@
<View
name="CoreInputShortcutScope"
theme="../../shared/themes/core_validation.xctheme"
shortcut="Ctrl+P"
shortcutCommand="global.command"
shortcutScope="global">
<Column padding="20" gap="12">
<Card
title="Core Validation | Shortcut Scope"
subtitle="验证功能Core shortcut scope 路由与 text input suppression"
tone="accent"
height="100">
<Column gap="6">
<Text text="功能 1验证 Ctrl+P 在 Widget / Panel / Window / Global 间按优先级命中 shortcut。" />
<Text text="功能 2验证 Text Input Proxy 会抑制 Ctrl+P 和 Tab 焦点遍历。" />
</Column>
</Card>
<Button id="global-focus" text="Global Focus" />
<Card
id="window-shell"
title="Window Scope"
subtitle="Ctrl+P -> window.command"
shortcutScopeRoot="window"
shortcut="Ctrl+P"
shortcutCommand="window.command"
shortcutScope="window">
<Column gap="10">
<Text text="先检查优先级widget > panel > window > global。" />
<Button id="window-focus" text="Window Focus" />
<Card
id="panel-shell"
title="Panel Scope"
subtitle="Ctrl+P -> panel.command"
shortcutScopeRoot="panel"
shortcut="Ctrl+P"
shortcutCommand="panel.command"
shortcutScope="panel">
<Column gap="10">
<Button id="panel-focus" text="Panel Focus" />
<Card
id="widget-shell"
title="Widget Scope"
subtitle="Ctrl+P -> widget.command"
tone="accent-alt"
shortcutScopeRoot="widget"
shortcut="Ctrl+P"
shortcutCommand="widget.command"
shortcutScope="widget">
<Column gap="10">
<Button id="widget-focus" text="Widget Focus" />
</Column>
</Card>
<Button id="text-input" text="Text Input Proxy" textInput="true" />
<Text text="操作指引:" />
<Text text="1. 依次点 Widget / Panel / Window / Global Focus再按 Ctrl+P。" />
<Text text="2. 右下角 Recent shortcut 应分别显示 widget / panel / window / global且状态为 handled。" />
<Text text="3. 点 Text Input Proxy 再按 Ctrl+PRecent shortcut 状态应变为 suppressed。" />
<Text text="4. 保持 Text Input Proxy focus 再按 TabResult 应显示 focus traversal suppressedfocus 不应跳走。" />
</Column>
</Card>
</Column>
</Card>
</Column>
</View>

View File

@@ -0,0 +1,8 @@
#include "Application.h"
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, LPWSTR, int nCmdShow) {
return XCEngine::Tests::CoreUI::RunCoreUIValidationApp(
hInstance,
nCmdShow,
"core.input.shortcut_scope");
}