Feature: Add interaction reach property and persistence tests for Player Start entity
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
|||||||
DEFAULT_PLAYER_START_CAPSULE_RADIUS,
|
DEFAULT_PLAYER_START_CAPSULE_RADIUS,
|
||||||
DEFAULT_PLAYER_START_CROUCH_SETTINGS,
|
DEFAULT_PLAYER_START_CROUCH_SETTINGS,
|
||||||
DEFAULT_PLAYER_START_EYE_HEIGHT,
|
DEFAULT_PLAYER_START_EYE_HEIGHT,
|
||||||
|
DEFAULT_PLAYER_START_INTERACTION_REACH_METERS,
|
||||||
DEFAULT_PLAYER_START_JUMP_SETTINGS,
|
DEFAULT_PLAYER_START_JUMP_SETTINGS,
|
||||||
DEFAULT_PLAYER_START_MOVE_SPEED,
|
DEFAULT_PLAYER_START_MOVE_SPEED,
|
||||||
DEFAULT_PLAYER_START_MOVEMENT_CAPABILITIES,
|
DEFAULT_PLAYER_START_MOVEMENT_CAPABILITIES,
|
||||||
@@ -49,6 +50,7 @@ describe("entity registry defaults", () => {
|
|||||||
position: { x: 0, y: 0, z: 0 },
|
position: { x: 0, y: 0, z: 0 },
|
||||||
yawDegrees: 0,
|
yawDegrees: 0,
|
||||||
navigationMode: "firstPerson",
|
navigationMode: "firstPerson",
|
||||||
|
interactionReachMeters: DEFAULT_PLAYER_START_INTERACTION_REACH_METERS,
|
||||||
movementTemplate: {
|
movementTemplate: {
|
||||||
kind: "default",
|
kind: "default",
|
||||||
moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED,
|
moveSpeed: DEFAULT_PLAYER_START_MOVE_SPEED,
|
||||||
|
|||||||
@@ -250,6 +250,56 @@ describe("Player Start inspector", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("persists the authored interaction reach for a selected Player Start", async () => {
|
||||||
|
const playerStart = createPlayerStartEntity({
|
||||||
|
id: "entity-player-start-interaction-reach",
|
||||||
|
name: "Interaction Reach"
|
||||||
|
});
|
||||||
|
const store = createEditorStore({
|
||||||
|
initialDocument: {
|
||||||
|
...createEmptySceneDocument({ name: "Player Start Reach Scene" }),
|
||||||
|
entities: {
|
||||||
|
[playerStart.id]: playerStart
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
render(<App store={store} />);
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(viewportHostInstances.length).toBeGreaterThan(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
store.setSelection({
|
||||||
|
kind: "entities",
|
||||||
|
ids: [playerStart.id]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const reachInput = await screen.findByTestId(
|
||||||
|
"player-start-interaction-reach"
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(reachInput).toHaveValue(1.5);
|
||||||
|
|
||||||
|
act(() => {
|
||||||
|
fireEvent.change(reachInput, {
|
||||||
|
target: {
|
||||||
|
value: "3.2"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fireEvent.blur(reachInput);
|
||||||
|
});
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(store.getState().document.entities[playerStart.id]).toMatchObject({
|
||||||
|
kind: "playerStart",
|
||||||
|
interactionReachMeters: 3.2
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("shows authored jump, sprint, and crouch bindings for a selected Player Start", async () => {
|
it("shows authored jump, sprint, and crouch bindings for a selected Player Start", async () => {
|
||||||
const playerStart = createPlayerStartEntity({
|
const playerStart = createPlayerStartEntity({
|
||||||
id: "entity-player-start-locomotion-bindings",
|
id: "entity-player-start-locomotion-bindings",
|
||||||
|
|||||||
Reference in New Issue
Block a user