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
93 lines
4.0 KiB
TypeScript
93 lines
4.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
CAD_MODIFIER_MAX_SHARP_ANGLE,
|
|
CAD_MODIFIER_MAX_PREPARE_TIMEOUT_MS,
|
|
CAD_MODIFIER_REQUEST_TIMEOUT_MS,
|
|
CAD_MODIFIER_RUNTIME_BASE,
|
|
cadModifierPrepareTimeoutMs,
|
|
cadModifierTopologyEdgeIsSelectable,
|
|
cadTransformRequiresGeneralTransform,
|
|
cadModifierTimeoutMessage,
|
|
defaultCadModifierTangentChain,
|
|
edgeModifierSelectionStatus,
|
|
isCadModifierWasmMemoryFault,
|
|
selectableCadModifierEdge,
|
|
} from "@/lib/cadModifierRuntime";
|
|
|
|
describe("CAD modifier runtime state", () => {
|
|
it("uses the build-managed OCCT runtime", () => {
|
|
expect(CAD_MODIFIER_RUNTIME_BASE).toBe("/occt");
|
|
});
|
|
|
|
it("does not report zero edges before preparation finishes", () => {
|
|
expect(edgeModifierSelectionStatus(false, 0, 0)).toBe("Preparing edges\u2026");
|
|
expect(edgeModifierSelectionStatus(true, 0, 0)).toBe("0 of 0 sharp edges selected");
|
|
expect(edgeModifierSelectionStatus(true, 2, 12)).toBe("2 of 12 sharp edges selected");
|
|
});
|
|
|
|
it("keeps exact CAD preparation short and gives imported meshes a bounded triangle-aware budget", () => {
|
|
expect(CAD_MODIFIER_REQUEST_TIMEOUT_MS).toBeGreaterThanOrEqual(20_000);
|
|
expect(CAD_MODIFIER_REQUEST_TIMEOUT_MS).toBeLessThanOrEqual(60_000);
|
|
expect(cadModifierPrepareTimeoutMs(0)).toBe(CAD_MODIFIER_REQUEST_TIMEOUT_MS);
|
|
expect(cadModifierPrepareTimeoutMs(Number.NaN)).toBe(CAD_MODIFIER_REQUEST_TIMEOUT_MS);
|
|
expect(cadModifierPrepareTimeoutMs(10_000)).toBe(60_000);
|
|
expect(cadModifierPrepareTimeoutMs(100_000)).toBe(120_000);
|
|
expect(cadModifierPrepareTimeoutMs(180_000)).toBe(CAD_MODIFIER_MAX_PREPARE_TIMEOUT_MS);
|
|
expect(cadModifierTimeoutMessage("prepare")).toContain("lower-detail STL");
|
|
expect(cadModifierTimeoutMessage("prepare")).not.toContain("Firefox");
|
|
});
|
|
|
|
it("does not expose thresholds above the worker's folded edge-angle range", () => {
|
|
expect(CAD_MODIFIER_MAX_SHARP_ANGLE).toBe(90);
|
|
});
|
|
|
|
it("recognizes browser-specific WebAssembly memory fault messages", () => {
|
|
expect(isCadModifierWasmMemoryFault("toBREP: memory access out of bounds")).toBe(true);
|
|
expect(isCadModifierWasmMemoryFault("toBREP: Out of bounds memory access (evaluating 'func(...args)')")).toBe(true);
|
|
expect(isCadModifierWasmMemoryFault("Unreachable code reached", "RuntimeError")).toBe(true);
|
|
expect(isCadModifierWasmMemoryFault("The selected edges cannot be filleted together", "Error")).toBe(false);
|
|
expect(isCadModifierWasmMemoryFault("fillet: [object WebAssembly.Exception]", "OcctError")).toBe(false);
|
|
expect(isCadModifierWasmMemoryFault("fillet: wasm exception", "OcctError")).toBe(false);
|
|
});
|
|
|
|
it("routes rotated non-uniform resize transforms through OCCT's general transform", () => {
|
|
const angle = Math.PI / 4;
|
|
const cosine = Math.cos(angle);
|
|
const sine = Math.sin(angle);
|
|
const rotatedNonUniformResize = [
|
|
2 * cosine, 0, 2 * sine, 12,
|
|
0, 1, 0, 4,
|
|
-sine, 0, cosine, -8,
|
|
];
|
|
const rigidRotation = [
|
|
cosine, 0, sine, 12,
|
|
0, 1, 0, 4,
|
|
-sine, 0, cosine, -8,
|
|
];
|
|
|
|
expect(cadTransformRequiresGeneralTransform(rotatedNonUniformResize)).toBe(true);
|
|
expect(cadTransformRequiresGeneralTransform(rigidRotation)).toBe(false);
|
|
});
|
|
|
|
it("does not auto-chain newly created edges after an applied edge treatment", () => {
|
|
expect(defaultCadModifierTangentChain(0)).toBe(true);
|
|
expect(defaultCadModifierTangentChain(1)).toBe(false);
|
|
expect(defaultCadModifierTangentChain(2)).toBe(false);
|
|
});
|
|
|
|
it("keeps valid post-treatment edges selectable when normal outline display suppresses them", () => {
|
|
const hiddenDetailEdge = {
|
|
display: false,
|
|
selectable: true,
|
|
manifold: true,
|
|
boundary: false,
|
|
angle: 45,
|
|
points: [0, 0, 0, 1, 0, 0],
|
|
};
|
|
|
|
expect(cadModifierTopologyEdgeIsSelectable(hiddenDetailEdge)).toBe(true);
|
|
expect(selectableCadModifierEdge(hiddenDetailEdge, 25)).toBe(true);
|
|
expect(selectableCadModifierEdge(hiddenDetailEdge, 60)).toBe(false);
|
|
});
|
|
});
|