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
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ı
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { exportMeshesToGlb } from "@/lib/glbExport";
|
||||
import { importedShapeFromGlb } from "@/lib/glbImport";
|
||||
import type { ObjExportMesh } from "@/lib/objExport";
|
||||
|
||||
function makeSimpleCubeMesh(): ObjExportMesh {
|
||||
return {
|
||||
name: "test_cube",
|
||||
vertices: [
|
||||
[-5, -5, -5],
|
||||
[5, -5, -5],
|
||||
[5, 5, -5],
|
||||
[-5, 5, -5],
|
||||
[-5, -5, 5],
|
||||
[5, -5, 5],
|
||||
[5, 5, 5],
|
||||
[-5, 5, 5],
|
||||
],
|
||||
faces: [
|
||||
[0, 2, 1], [0, 3, 2],
|
||||
[4, 5, 6], [4, 6, 7],
|
||||
[0, 1, 5], [0, 5, 4],
|
||||
[2, 3, 7], [2, 7, 6],
|
||||
[0, 4, 7], [0, 7, 3],
|
||||
[1, 2, 6], [1, 6, 5],
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
describe("GLB export and import", () => {
|
||||
it("exports meshes to binary glTF (.glb) buffer with valid glTF header", async () => {
|
||||
const mesh = makeSimpleCubeMesh();
|
||||
const glbBuffer = await exportMeshesToGlb([mesh], { test_cube: "#ef4444" });
|
||||
|
||||
expect(glbBuffer).toBeInstanceOf(ArrayBuffer);
|
||||
expect(glbBuffer.byteLength).toBeGreaterThan(50);
|
||||
|
||||
// Verify GLB magic header 0x46546C67 ("glTF")
|
||||
const view = new DataView(glbBuffer);
|
||||
const magic = view.getUint32(0, true);
|
||||
expect(magic).toBe(0x46546c67);
|
||||
|
||||
// Version should be 2 (glTF 2.0)
|
||||
const version = view.getUint32(4, true);
|
||||
expect(version).toBe(2);
|
||||
});
|
||||
|
||||
it("imports binary GLB and reconstitutes a valid WorkplaneShape", async () => {
|
||||
const mesh = makeSimpleCubeMesh();
|
||||
const glbBuffer = await exportMeshesToGlb([mesh], { test_cube: "#3b82f6" });
|
||||
|
||||
const shape = await importedShapeFromGlb("cube.glb", glbBuffer);
|
||||
|
||||
expect(shape.kind).toBe("mesh");
|
||||
expect(shape.importedMesh).toBeDefined();
|
||||
expect(shape.importedMesh?.sourceFormat).toBe("glb");
|
||||
expect(shape.importedMesh?.triangleCount).toBe(12);
|
||||
|
||||
// Dimensions of 10x10x10 cube
|
||||
expect(shape.importedMesh?.baseWidth).toBeCloseTo(10, 1);
|
||||
expect(shape.importedMesh?.baseHeight).toBeCloseTo(10, 1);
|
||||
expect(shape.importedMesh?.baseDepth).toBeCloseTo(10, 1);
|
||||
|
||||
expect(shape.importedMesh?.positions.length).toBe(12 * 9);
|
||||
expect(shape.importedMesh?.normals?.length).toBe(12 * 9);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user