Add pause bindings migration in scene document JSON tests
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
|||||||
LOCAL_LIGHTS_AND_SKYBOX_SCENE_DOCUMENT_VERSION,
|
LOCAL_LIGHTS_AND_SKYBOX_SCENE_DOCUMENT_VERSION,
|
||||||
MODEL_ASSET_PIPELINE_SCENE_DOCUMENT_VERSION,
|
MODEL_ASSET_PIPELINE_SCENE_DOCUMENT_VERSION,
|
||||||
NPC_ENTITY_FOUNDATION_SCENE_DOCUMENT_VERSION,
|
NPC_ENTITY_FOUNDATION_SCENE_DOCUMENT_VERSION,
|
||||||
|
NPC_DIALOGUE_REFERENCE_SCENE_DOCUMENT_VERSION,
|
||||||
PATH_FOUNDATION_SCENE_DOCUMENT_VERSION,
|
PATH_FOUNDATION_SCENE_DOCUMENT_VERSION,
|
||||||
PLAYER_START_AIR_CONTROL_SCENE_DOCUMENT_VERSION,
|
PLAYER_START_AIR_CONTROL_SCENE_DOCUMENT_VERSION,
|
||||||
PLAYER_START_AIR_DIRECTION_CONTROL_SCENE_DOCUMENT_VERSION,
|
PLAYER_START_AIR_DIRECTION_CONTROL_SCENE_DOCUMENT_VERSION,
|
||||||
@@ -625,7 +626,8 @@ describe("scene document JSON", () => {
|
|||||||
moveRight: "Period",
|
moveRight: "Period",
|
||||||
jump: "Space",
|
jump: "Space",
|
||||||
sprint: "ShiftRight",
|
sprint: "ShiftRight",
|
||||||
crouch: "KeyC"
|
crouch: "KeyC",
|
||||||
|
pauseTime: "KeyP"
|
||||||
},
|
},
|
||||||
gamepad: {
|
gamepad: {
|
||||||
moveForward: "dpadUp",
|
moveForward: "dpadUp",
|
||||||
@@ -635,6 +637,7 @@ describe("scene document JSON", () => {
|
|||||||
jump: "buttonNorth",
|
jump: "buttonNorth",
|
||||||
sprint: "rightShoulder",
|
sprint: "rightShoulder",
|
||||||
crouch: "buttonEast",
|
crouch: "buttonEast",
|
||||||
|
pauseTime: "buttonMenu",
|
||||||
cameraLook: "rightStick"
|
cameraLook: "rightStick"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -946,6 +949,47 @@ describe("scene document JSON", () => {
|
|||||||
expect(migratedDocument.entities[playerStart.id]).toEqual(playerStart);
|
expect(migratedDocument.entities[playerStart.id]).toEqual(playerStart);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("migrates version 51 Player Start input bindings to include default pause bindings", () => {
|
||||||
|
const playerStart = createPlayerStartEntity({
|
||||||
|
id: "entity-player-start-legacy-pause-binding"
|
||||||
|
});
|
||||||
|
const legacyDocument = {
|
||||||
|
...createEmptySceneDocument({ name: "Legacy Player Pause Binding Scene" }),
|
||||||
|
version: NPC_DIALOGUE_REFERENCE_SCENE_DOCUMENT_VERSION,
|
||||||
|
entities: {
|
||||||
|
[playerStart.id]: {
|
||||||
|
...playerStart,
|
||||||
|
inputBindings: {
|
||||||
|
keyboard: {
|
||||||
|
moveForward: playerStart.inputBindings.keyboard.moveForward,
|
||||||
|
moveBackward: playerStart.inputBindings.keyboard.moveBackward,
|
||||||
|
moveLeft: playerStart.inputBindings.keyboard.moveLeft,
|
||||||
|
moveRight: playerStart.inputBindings.keyboard.moveRight,
|
||||||
|
jump: playerStart.inputBindings.keyboard.jump,
|
||||||
|
sprint: playerStart.inputBindings.keyboard.sprint,
|
||||||
|
crouch: playerStart.inputBindings.keyboard.crouch
|
||||||
|
},
|
||||||
|
gamepad: {
|
||||||
|
moveForward: playerStart.inputBindings.gamepad.moveForward,
|
||||||
|
moveBackward: playerStart.inputBindings.gamepad.moveBackward,
|
||||||
|
moveLeft: playerStart.inputBindings.gamepad.moveLeft,
|
||||||
|
moveRight: playerStart.inputBindings.gamepad.moveRight,
|
||||||
|
jump: playerStart.inputBindings.gamepad.jump,
|
||||||
|
sprint: playerStart.inputBindings.gamepad.sprint,
|
||||||
|
crouch: playerStart.inputBindings.gamepad.crouch,
|
||||||
|
cameraLook: playerStart.inputBindings.gamepad.cameraLook
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const migratedDocument = migrateSceneDocument(legacyDocument);
|
||||||
|
|
||||||
|
expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION);
|
||||||
|
expect(migratedDocument.entities[playerStart.id]).toEqual(playerStart);
|
||||||
|
});
|
||||||
|
|
||||||
it("migrates version 30 Player Start entities to include the default movement template", () => {
|
it("migrates version 30 Player Start entities to include the default movement template", () => {
|
||||||
const playerStart = {
|
const playerStart = {
|
||||||
id: "entity-player-start-legacy-movement-template",
|
id: "entity-player-start-legacy-movement-template",
|
||||||
|
|||||||
Reference in New Issue
Block a user