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
- 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ı
77 lines
2.5 KiB
TypeScript
77 lines
2.5 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
IMAGE_PLATE_TRANSPARENT_WARNING,
|
|
IMAGE_PLATE_WHITE_WARNING,
|
|
summarizeImageVisibility,
|
|
} from "@/lib/imagePlate";
|
|
|
|
function pixels(entries: Array<[number, number, number, number]>) {
|
|
const data = new Uint8ClampedArray(entries.length * 4);
|
|
entries.forEach(([r, g, b, a], index) => {
|
|
data[index * 4] = r;
|
|
data[index * 4 + 1] = g;
|
|
data[index * 4 + 2] = b;
|
|
data[index * 4 + 3] = a;
|
|
});
|
|
return data;
|
|
}
|
|
|
|
describe("image plate visibility", () => {
|
|
it("warns when the image is fully transparent", () => {
|
|
const result = summarizeImageVisibility(pixels([
|
|
[0, 0, 0, 0],
|
|
[0, 0, 0, 0],
|
|
[0, 0, 0, 0],
|
|
[0, 0, 0, 0],
|
|
]), 1);
|
|
expect(result.warning).toBe(IMAGE_PLATE_TRANSPARENT_WARNING);
|
|
expect(result.transparentRatio).toBe(1);
|
|
expect(result.visibleRatio).toBe(0);
|
|
});
|
|
|
|
it("warns when the image is fully opaque white", () => {
|
|
const result = summarizeImageVisibility(pixels([
|
|
[255, 255, 255, 255],
|
|
[255, 255, 255, 255],
|
|
[255, 255, 255, 255],
|
|
[255, 255, 255, 255],
|
|
]), 1);
|
|
expect(result.warning).toBe(IMAGE_PLATE_WHITE_WARNING);
|
|
expect(result.transparentRatio).toBe(0);
|
|
expect(result.nearWhiteRatio).toBe(1);
|
|
});
|
|
|
|
it("warns when only a thin dark line is visible on a transparent background", () => {
|
|
const entries: Array<[number, number, number, number]> = [];
|
|
for (let index = 0; index < 100; index += 1) {
|
|
entries.push(index === 50 ? [17, 24, 39, 255] : [0, 0, 0, 0]);
|
|
}
|
|
const result = summarizeImageVisibility(pixels(entries), 1);
|
|
expect(result.warning).toBe(IMAGE_PLATE_TRANSPARENT_WARNING);
|
|
});
|
|
|
|
it("does not warn for a normal opaque image", () => {
|
|
const result = summarizeImageVisibility(pixels([
|
|
[220, 38, 38, 255],
|
|
[37, 99, 235, 255],
|
|
[22, 163, 74, 255],
|
|
[202, 138, 4, 255],
|
|
]), 1);
|
|
expect(result.warning).toBeNull();
|
|
});
|
|
|
|
it("does not warn for a drawing on white paper with visible ink", () => {
|
|
const entries: Array<[number, number, number, number]> = [];
|
|
for (let index = 0; index < 100; index += 1) {
|
|
entries.push(index % 20 === 0 ? [15, 23, 42, 255] : [255, 255, 255, 255]);
|
|
}
|
|
const result = summarizeImageVisibility(pixels(entries), 1);
|
|
expect(result.warning).toBeNull();
|
|
});
|
|
|
|
it("handles empty pixel buffers without throwing", () => {
|
|
const result = summarizeImageVisibility(new Uint8ClampedArray(0), 1);
|
|
expect(result.warning).toBe(IMAGE_PLATE_TRANSPARENT_WARNING);
|
|
});
|
|
});
|