Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

test(ui): verify authored input and dialog inspection (#82)

YHH1d3425052823
diff --git a/desktop b/desktop
index fb81b2352..72e6d3a17 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit fb81b2352095f05429b3940ccda0dc020081439e
+Subproject commit 72e6d3a17b50583ffbf54e19ad547dbeea0f746f
diff --git a/examples/ui-localization-debug/README.md b/examples/ui-localization-debug/README.md
index c54a77eac..7f8e4ce5b 100644
--- a/examples/ui-localization-debug/README.md
+++ b/examples/ui-localization-debug/README.md
@@ -113,3 +113,10 @@ mixed English/Chinese text, then Enter submits. While recording, Events shows
actual change/submit; select its event node and Read runtime snapshot to check
TextInput.value. Fixture keys do not run while editing. This validates character
entry and focus handoff, not an OS IME candidate-window session.
+
+For authored widget inspection, run `node tools/ui-localization-browser.mjs`
+and open `http://127.0.0.1:5194/__localization` in the built-in browser. The
+disposable scene uses SceneCommands to add TextInput to Inside and UIDialog
+to OuterMask. After the verification report, open Window → UI Debugger.
+Elements exposes these components; edit Value in Details and check that
+TextInput.value updates here. Reading the inspector never writes scene data.
diff --git a/examples/ui-localization-debug/VALIDATION.md b/examples/ui-localization-debug/VALIDATION.md
index e1f6fc661..53311ac49 100644
--- a/examples/ui-localization-debug/VALIDATION.md
+++ b/examples/ui-localization-debug/VALIDATION.md
@@ -277,6 +277,27 @@ snapshot; live-game-only dialogs and scripts need runtime acceptance separately.
runner launched. Modal stacking order, real devices, IME/accessibility,
desktop custom-scheme, text shaping and cache performance remain open.
+## Authored input and dialog inspection — 2026-10-09
+
+- Engine #81 merged after its packaging, Android API 29–36 and PR report
+ checks passed. Emulator checks do not establish device input acceptance.
+- UI Debugger Elements previously omitted TextInput and UIDialog in the
+ editor world. It now shows their actual component fields, including value,
+ readOnly, focused, cursorPos and closeOnEscape/closeOnBackdrop. Runtime
+ selection continues to use the existing live component snapshot.
+- The ordinary browser fixture authors these components through SceneCommands
+ and checks their real editor-world values. All 35 checks pass with WebGL2,
+ including detached inspection and unchanged scene data after reading/picking.
+ Three editor regression tests and typecheck pass.
+- Built-in browser panel interaction: select Inside, expand TextInput, edit
+ Value in Details to updated 中文; Elements synchronizes to the same value.
+ Select OuterMask and expand UIDialog: closeOnEscape=false and
+ closeOnBackdrop=true match the authored fields.
+- The browser fixture has unrelated existing limitations: desktop MCP is not
+ available and the optional DragonBones module is not staged. No native
+ runner was launched. Device IME/accessibility and the remaining RM-009
+ acceptance items are still open.
+
## Quick click focus and actual text entry — 2026-10-09
diff --git a/tools/ui-localization-browser.tsx b/tools/ui-localization-browser.tsx
index f59d865fe..5bd89f46c 100644
--- a/tools/ui-localization-browser.tsx
+++ b/tools/ui-localization-browser.tsx
@@ -58,6 +58,14 @@ SceneCommands.deleteEntities(SceneModel.serialize().entities.filter(entity => en
await EngineHost.loadScene('/__mask-scene.json');
EngineHost.syncEditorViewToScene();
for (let i = 0; i < 12; i++) await new Promise(requestAnimationFrame);
+const widgetScene = SceneModel.serialize();
+const inputSource = widgetScene.entities.find(entity => entity.name === 'Inside')!.id;
+const dialogSource = widgetScene.entities.find(entity => entity.name === 'OuterMask')!.id;
+SceneCommands.addComponent(inputSource, 'TextInput');
+SceneCommands.setFieldValue(inputSource, 'TextInput', 'value', '中文 draft');
+SceneCommands.setFieldValue(inputSource, 'TextInput', 'readOnly', true);
+SceneCommands.addComponent(dialogSource, 'UIDialog');
+SceneCommands.setFieldValue(dialogSource, 'UIDialog', 'closeOnEscape', false);
const maskBefore = JSON.stringify(SceneModel.serialize());
const maskedRows = captureUILayoutRows();
check(maskedRows.length === 6, 'Mask scene resolves Canvas, two masks and three buttons');
@@ -68,6 +76,16 @@ const inside = maskedRows.find(row => row.name === 'Inside')!;
const detail = readUIElement(EngineHost.world!, inside.entity);
check(detail?.width === 120 && detail.height === 32, 'Selected UI detail reads actual computed layout');
check(detail?.components.some(component => component.type === 'Interactable' && component.data.raycastTarget === true), 'Debugger reads actual input component values without verdicts');
+const inputDetail = detail?.components.find(component => component.type === 'TextInput');
+check(inputDetail?.data.value === '中文 draft' && inputDetail.data.readOnly === true,
+ 'Debugger exposes authored TextInput value and readOnly state');
+const dialogRuntime = SceneModel.runtimeFor(dialogSource)!;
+const dialogDetail = readUIElement(EngineHost.world!, dialogRuntime as never)?.components.find(component => component.type === 'UIDialog');
+check(dialogDetail?.data.closeOnEscape === false && dialogDetail.data.closeOnBackdrop === true,
+ 'Debugger exposes authored UIDialog dismissal settings');
+if (inputDetail) inputDetail.data.value = 'snapshot only';
+check(readUIElement(EngineHost.world!, inside.entity)?.components.find(component => component.type === 'TextInput')?.data.value === '中文 draft',
+ 'Detached widget inspection cannot change the editor world');
const screenRect = ViewportController.getEntityScreenRect(inside.entity)!;
const canvasRect = EngineHost.canvas!.getBoundingClientRect();
const point = { x: canvasRect.left + screenRect.x + screenRect.w / 2, y: canvasRect.top + screenRect.y + screenRect.h / 2 };