2026-02-28 22:53:30 +00:00
|
|
|
import { describe, it, expect } from "vitest";
|
|
|
|
|
import { readFileSync, existsSync } from "fs";
|
|
|
|
|
import { resolve } from "path";
|
|
|
|
|
|
|
|
|
|
describe("Window icon configuration", () => {
|
|
|
|
|
const srcTauriDir = resolve(__dirname, "../../src-tauri");
|
|
|
|
|
|
2026-03-01 00:49:08 +00:00
|
|
|
it("lib.rs sets window icon using set_icon in setup hook", () => {
|
2026-02-28 22:53:30 +00:00
|
|
|
const libRs = readFileSync(resolve(srcTauriDir, "src/lib.rs"), "utf-8");
|
2026-03-01 00:49:08 +00:00
|
|
|
expect(libRs).toContain("set_icon");
|
2026-02-28 22:53:30 +00:00
|
|
|
expect(libRs).toContain("icon.png");
|
|
|
|
|
});
|
|
|
|
|
|
2026-03-01 00:49:08 +00:00
|
|
|
it("Cargo.toml enables image-png feature for icon loading", () => {
|
|
|
|
|
const cargoToml = readFileSync(resolve(srcTauriDir, "Cargo.toml"), "utf-8");
|
|
|
|
|
expect(cargoToml).toContain("image-png");
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-28 22:53:30 +00:00
|
|
|
it("icon.png exists in the icons directory", () => {
|
|
|
|
|
const iconPath = resolve(srcTauriDir, "icons/icon.png");
|
|
|
|
|
expect(existsSync(iconPath)).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("icon.ico exists in the icons directory for Windows", () => {
|
|
|
|
|
const icoPath = resolve(srcTauriDir, "icons/icon.ico");
|
|
|
|
|
expect(existsSync(icoPath)).toBe(true);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it("tauri.conf.json includes icon.ico in bundle icons", () => {
|
|
|
|
|
const config = JSON.parse(
|
|
|
|
|
readFileSync(resolve(srcTauriDir, "tauri.conf.json"), "utf-8")
|
|
|
|
|
);
|
|
|
|
|
expect(config.bundle.icon).toContain("icons/icon.ico");
|
|
|
|
|
expect(config.bundle.icon).toContain("icons/icon.png");
|
|
|
|
|
});
|
|
|
|
|
});
|