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