Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
96 lines
2.5 KiB
TypeScript
96 lines
2.5 KiB
TypeScript
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);
|
|||
|
|
});
|
|||
|
|
});
|