Refactor scene document JSON tests and update player start entity handling
This commit is contained in:
@@ -55,47 +55,25 @@ describe("scene document JSON", () => {
|
|||||||
const brush = createBoxBrush({
|
const brush = createBoxBrush({
|
||||||
id: "brush-box-room",
|
id: "brush-box-room",
|
||||||
name: "Entry Room",
|
name: "Entry Room",
|
||||||
center: {
|
const playerStart = createPlayerStartEntity({
|
||||||
x: 0,
|
id: "entity-player-start-legacy-look"
|
||||||
y: 1,
|
});
|
||||||
z: 0
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
x: 4,
|
|
||||||
y: 2,
|
|
||||||
z: 6
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const document = {
|
|
||||||
...createEmptySceneDocument({ name: "Brush Scene" }),
|
|
||||||
brushes: {
|
|
||||||
[brush.id]: brush
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(parseSceneDocumentJson(serializeSceneDocument(document))).toEqual(document);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("round-trips floating-point whitebox box transforms without accidental snapping", () => {
|
|
||||||
const brush = createBoxBrush({
|
|
||||||
id: "brush-float-transform",
|
|
||||||
center: {
|
|
||||||
x: 1.25,
|
|
||||||
y: 1.5,
|
|
||||||
z: -0.875
|
|
||||||
},
|
|
||||||
rotationDegrees: {
|
|
||||||
x: 12.5,
|
|
||||||
y: 37.5,
|
|
||||||
z: -8.25
|
|
||||||
},
|
|
||||||
size: {
|
|
||||||
x: 2.5,
|
|
||||||
y: 3.25,
|
y: 3.25,
|
||||||
z: 4.75
|
z: 4.75
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const document = {
|
[playerStart.id]: {
|
||||||
|
...playerStart,
|
||||||
|
inputBindings: {
|
||||||
|
...playerStart.inputBindings,
|
||||||
|
gamepad: {
|
||||||
|
moveForward: playerStart.inputBindings.gamepad.moveForward,
|
||||||
|
moveBackward: playerStart.inputBindings.gamepad.moveBackward,
|
||||||
|
moveLeft: playerStart.inputBindings.gamepad.moveLeft,
|
||||||
|
moveRight: playerStart.inputBindings.gamepad.moveRight
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
...createEmptySceneDocument({ name: "Float Transform Scene" }),
|
...createEmptySceneDocument({ name: "Float Transform Scene" }),
|
||||||
brushes: {
|
brushes: {
|
||||||
[brush.id]: brush
|
[brush.id]: brush
|
||||||
@@ -621,11 +599,7 @@ describe("scene document JSON", () => {
|
|||||||
const migratedDocument = migrateSceneDocument(legacyDocument);
|
const migratedDocument = migrateSceneDocument(legacyDocument);
|
||||||
|
|
||||||
expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION);
|
expect(migratedDocument.version).toBe(SCENE_DOCUMENT_VERSION);
|
||||||
expect(migratedDocument.entities[playerStart.id]).toEqual(
|
expect(migratedDocument.entities[playerStart.id]).toEqual(playerStart);
|
||||||
createPlayerStartEntity({
|
|
||||||
...playerStart
|
|
||||||
})
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("migrates version 24 Player Start entities to default to first-person navigation", () => {
|
it("migrates version 24 Player Start entities to default to first-person navigation", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user