desktopWindowChromeState.test.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334
  1. import { describe, expect, it } from "vitest";
  2. import {
  3. resolveDesktopWindowChromeState,
  4. supportsNativeWindowsRoundedCorners,
  5. } from "../src/main/desktopWindowChromeState.js";
  6. describe("supportsNativeWindowsRoundedCorners", () => {
  7. it("uses Windows build 22000 as the native rounded-corner boundary", () => {
  8. expect(supportsNativeWindowsRoundedCorners("win32", "10.0.21999")).toBe(false);
  9. expect(supportsNativeWindowsRoundedCorners("win32", "10.0.22000")).toBe(true);
  10. expect(supportsNativeWindowsRoundedCorners("win32", "10.0.26100")).toBe(true);
  11. });
  12. it("returns false for legacy, malformed, and non-Windows releases", () => {
  13. expect(supportsNativeWindowsRoundedCorners("win32", "6.3.9600")).toBe(false);
  14. expect(supportsNativeWindowsRoundedCorners("win32", "unknown")).toBe(false);
  15. expect(supportsNativeWindowsRoundedCorners("darwin", "24.5.0")).toBe(false);
  16. expect(supportsNativeWindowsRoundedCorners("linux", "6.8.0")).toBe(false);
  17. });
  18. });
  19. describe("resolveDesktopWindowChromeState", () => {
  20. it.each([
  21. ["24.6.0", 15],
  22. ["25.0.0", 26],
  23. ["invalid", null],
  24. ] as const)("maps Darwin release %s to macOS major %s", (release, macOSMajorVersion) => {
  25. expect(resolveDesktopWindowChromeState(false, "darwin", release)).toEqual({
  26. isMaximized: false,
  27. macOSMajorVersion,
  28. supportsNativeRoundedCorners: false,
  29. });
  30. });
  31. });