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): the ui-pick mocks answer uiHitAtScreen

yhha0c7f7e26c1e
diff --git a/sdk/tests/ui-pointer-callback-wasm.test.ts b/sdk/tests/ui-pointer-callback-wasm.test.ts
index 42b6dd8f4..3719d0f6f 100644
--- a/sdk/tests/ui-pointer-callback-wasm.test.ts
+++ b/sdk/tests/ui-pointer-callback-wasm.test.ts
@@ -28,7 +28,7 @@ vi.mock('../src/ui/util/ui-pick', () => ({
screenToUiWorld: (_camera: unknown, x: number, y: number) => ({ x, y }),
screenToUiLayout: (_overlay: unknown, x: number, y: number) => ({ x, y }),
isScreenEntity: () => true,
- uiPointerRay: () => ({}), uiLayoutRay: () => ({}), uiHitTestWorld: () => hit.entity,
+ uiPointerRay: () => ({}), uiLayoutRay: () => ({}), uiHitTestWorld: () => hit.entity, uiHitAtScreen: () => hit.entity,
}));
describe.skipIf(!HAS_WASM)('pointer callback lifecycle on real WASM', () => {
diff --git a/sdk/tests/ui-quick-click-focus.test.ts b/sdk/tests/ui-quick-click-focus.test.ts
index 53344e919..300b6e6d7 100644
--- a/sdk/tests/ui-quick-click-focus.test.ts
+++ b/sdk/tests/ui-quick-click-focus.test.ts
@@ -21,7 +21,7 @@ import { inspectableTypes } from '../src/runtime/worldSnapshot';
const hit = vi.hoisted(() => ({ entity: null as number | null }));
vi.mock('../src/ui/util/ui-pick', () => ({
screenToUiWorld: () => ({ x: 0, y: 0 }), screenToUiLayout: () => ({ x: 0, y: 0 }),
- uiPointerRay: () => ({}), uiLayoutRay: () => ({}), uiHitTestWorld: () => hit.entity,
+ uiPointerRay: () => ({}), uiLayoutRay: () => ({}), uiHitTestWorld: () => hit.entity, uiHitAtScreen: () => hit.entity,
}));
describe('quick pointer focus through real interaction projection', () => {