Update tests to include cone and torus brushes
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
createConeBrush,
|
||||
createRadialPrismBrush,
|
||||
createTorusBrush,
|
||||
createWedgeBrush
|
||||
} from "../../src/document/brushes";
|
||||
import { createPlayerStartEntity } from "../../src/entities/entity-instances";
|
||||
@@ -9,7 +11,7 @@ import { createEmptySceneDocument } from "../../src/document/scene-document";
|
||||
import { buildRuntimeSceneFromDocument } from "../../src/runtime-three/runtime-scene-build";
|
||||
|
||||
describe("whitebox primitives runtime build", () => {
|
||||
it("builds runtime meshes and colliders for wedge and cylinder solids", () => {
|
||||
it("builds runtime meshes and colliders for wedge, cylinder, cone, and torus solids", () => {
|
||||
const document = createEmptySceneDocument({ name: "Primitive Runtime" });
|
||||
const wedge = createWedgeBrush({
|
||||
id: "brush-wedge-runtime",
|
||||
@@ -20,21 +22,36 @@ describe("whitebox primitives runtime build", () => {
|
||||
center: { x: 2, y: 1, z: 0 },
|
||||
sideCount: 12
|
||||
});
|
||||
const cone = createConeBrush({
|
||||
id: "brush-cone-runtime",
|
||||
center: { x: 6, y: 1, z: 0 },
|
||||
sideCount: 12
|
||||
});
|
||||
const torus = createTorusBrush({
|
||||
id: "brush-torus-runtime",
|
||||
center: { x: 10, y: 1, z: 0 },
|
||||
majorSegmentCount: 16,
|
||||
tubeSegmentCount: 8
|
||||
});
|
||||
const playerStart = createPlayerStartEntity({
|
||||
id: "entity-player-start-primitives"
|
||||
});
|
||||
|
||||
document.brushes[wedge.id] = wedge;
|
||||
document.brushes[cylinder.id] = cylinder;
|
||||
document.brushes[cone.id] = cone;
|
||||
document.brushes[torus.id] = torus;
|
||||
document.entities[playerStart.id] = playerStart;
|
||||
|
||||
const runtimeScene = buildRuntimeSceneFromDocument(document);
|
||||
|
||||
expect(runtimeScene.brushes.map((brush) => brush.kind)).toEqual([
|
||||
"wedge",
|
||||
"radialPrism"
|
||||
"radialPrism",
|
||||
"cone",
|
||||
"torus"
|
||||
]);
|
||||
expect(runtimeScene.colliders).toHaveLength(2);
|
||||
expect(runtimeScene.colliders).toHaveLength(4);
|
||||
expect(
|
||||
runtimeScene.colliders.every(
|
||||
(collider) =>
|
||||
|
||||
Reference in New Issue
Block a user