[K3c] TS-Fassung von Schnitt/Ansicht gelöscht: Fassaden toSection/toElevation, Tests auf den Kern umgestellt, Gleichheitstest entfernt

This commit is contained in:
Claude committed 2026-10-29 07:59:49 +00:00
1 parent e9ea2b787a
commit 5debff412e
41 files changed
+320 -5070

No files matched your search

+17 -9
View File
@@ -1,8 +1,10 @@
// Geschnittene Fenster/Türen im Schnitt (Kern, `core/src/plan/section.rs`), über `generateSectionPlan`
// mit `openings: true` wie in der Schnitt-Ansicht.
import { describe, expect, it } from "vitest";
import { sampleProject } from "../model/sampleProject";
import type { DrawingLevel } from "../model/types";
import type { Primitive } from "./generatePlan";
import { sectionOpeningPrimitives } from "./sectionOpenings";
import { computeSection, generateSectionPlan } from "./toSection";
const section = (x: number): DrawingLevel => ({
id: "sx",
@@ -15,10 +17,14 @@ const section = (x: number): DrawingLevel => ({
directionSign: 1,
});
describe("sectionOpeningPrimitives", () => {
it("geschnittenes Fenster: Rahmenprofile an Brüstung/Sturz + Glaslinie, wählbar", () => {
const prims = sectionOpeningPrimitives(sampleProject, section(3.5));
const own = prims.filter((p) => "openingId" in p && p.openingId === "O1");
async function openingPrims(level: DrawingLevel, openings = true): Promise<Primitive[]> {
const out = (await computeSection(sampleProject, level))!;
return generateSectionPlan(out, false, { openings }).primitives.filter((p) => "openingId" in p && p.openingId);
}
describe("Schnitt: geschnittene Öffnungen", () => {
it("geschnittenes Fenster: Rahmenprofile an Brüstung/Sturz + Glaslinie, wählbar", async () => {
const own = (await openingPrims(section(3.5))).filter((p) => "openingId" in p && p.openingId === "O1");
expect(own.length).toBeGreaterThanOrEqual(4);
const glass = own.filter((p): p is Extract<Primitive, { kind: "line" }> => p.kind === "line");
expect(glass.length).toBeGreaterThan(0);
@@ -28,11 +34,13 @@ describe("sectionOpeningPrimitives", () => {
expect(Math.max(...vs)).toBeLessThan(2.1 + 1e-9);
});
it("Schnitt neben dem Fenster: nichts", () => {
expect(sectionOpeningPrimitives(sampleProject, section(1.0)).some((p) => "openingId" in p && p.openingId === "O1")).toBe(false);
it("Schnitt neben dem Fenster: nichts", async () => {
expect((await openingPrims(section(1.0))).some((p) => "openingId" in p && p.openingId === "O1")).toBe(false);
});
it("Ansichten bekommen keine Schnitt-Öffnungen", () => {
expect(sectionOpeningPrimitives(sampleProject, { ...section(3.5), kind: "elevation" })).toEqual([]);
it("nur auf Wunsch (Export ohne Öffnungen) und nie in Ansichten", async () => {
expect(await openingPrims(section(3.5), false)).toEqual([]);
const out = (await computeSection(sampleProject, { ...section(3.5), kind: "elevation" }))!;
expect(generateSectionPlan(out, false, { openings: true }).primitives.some((p) => "openingId" in p && p.openingId)).toBe(false);
});
});