Files
Enes Yakıştır 33b0940012
Build and Push Docker Images / build (push) Canceled after 0s
CI / Typecheck and unit tests (push) Canceled after 0s
feat: SnapCAD Studio'yu YakHub deposuna taşı
- DWG/DXF içe aktarma ve .skf yeniden açma düzeltmeleri

- YakNet Bulut eşitlemede boş/eski kopya koruması ve yerel-only proje bildirimi

- Panelden içe aktarma duyuruları ve erişilebilir Türkçe hata mesajları

- AGPL-3.0 lisansı, README ve YakHub bağlantıları
2026-10-25 18:20:21 +03:00

97 lines
2.5 KiB
TypeScript

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { describe, expect, it } from "vitest";
import type { WorkplaneShape } from "@/types/sketchforge";
describe("Wall Opening & Window Cutout Unit Tests", () => {
it("calculates correct through-cutting hole dimensions and position for a wall", () => {
const wall: WorkplaneShape = {
id: "wall-sample",
name: "Taşıyıcı Duvar",
kind: "box",
color: "#94a3b8",
x: 0,
z: 0,
width: 120,
depth: 20,
height: 60,
size: 60,
elevation: 0,
rotation: 0,
};
const windowConfig = {
width: 30,
height: 30,
elevation: 20, // sill height
offsetX: 0,
};
// Calculate hole box penetrating through the wall
const holeDepth = (wall.depth ?? 20) + 6; // 26mm, ensures 3mm overhang on each side
const holeShape: WorkplaneShape = {
id: "hole-1",
name: "Pencere Kesici",
kind: "box",
color: "#6b7280",
x: (wall.x ?? 0) + windowConfig.offsetX,
z: wall.z ?? 0,
width: windowConfig.width,
depth: holeDepth,
height: windowConfig.height,
size: windowConfig.height,
elevation: (wall.elevation ?? 0) + windowConfig.elevation,
rotation: wall.rotation ?? 0,
hole: true,
};
expect(holeShape.hole).toBe(true);
expect(holeShape.depth).toBeGreaterThan(wall.depth ?? 0);
expect(holeShape.elevation).toBe(20);
expect(holeShape.width).toBe(30);
expect(holeShape.height).toBe(30);
});
it("handles door cutout at zero elevation (ground level)", () => {
const wall: WorkplaneShape = {
id: "wall-sample-door",
name: "Giriş Duvarı",
kind: "box",
color: "#94a3b8",
x: 50,
z: -20,
width: 100,
depth: 20,
height: 60,
size: 60,
elevation: 0,
rotation: 0,
};
const doorConfig = {
width: 25,
height: 50,
elevation: 0, // door sill at ground
offsetX: -20,
};
const holeShape: WorkplaneShape = {
id: "door-hole",
name: "Kapı Kesici",
kind: "box",
color: "#6b7280",
x: (wall.x ?? 0) + doorConfig.offsetX,
z: wall.z ?? 0,
width: doorConfig.width,
depth: (wall.depth ?? 20) + 6,
height: doorConfig.height,
size: doorConfig.height,
elevation: (wall.elevation ?? 0) + doorConfig.elevation,
rotation: wall.rotation ?? 0,
hole: true,
};
expect(holeShape.elevation).toBe(0);
expect(holeShape.x).toBe(30); // 50 - 20
expect(holeShape.height).toBe(50);
});
});