Files
thomaskippster-comfymodeldo…/src/test/java/de/tki/comfymodels/util/PlatformUtilsTest.java
T
Thomas 5c6f37741f feat: comprehensive model management enhancements and platform fixes
- Block 1: Refactored path logic into a centralized PathResolver for OS-agnostic and relative path handling.
- Block 2: Improved platform compatibility (shutdown, macOS menu, System Tray fallback).
- Block 3: Added Power-User features (Model Updater, Smart Cleanup, Thumbnails, Node Sync, Remote Status).
- Fixes: Recursive subfolder scanning, archive detection logic, and UI progress throttling.
2026-05-02 19:53:49 +02:00

73 lines
2.0 KiB
Java

package de.tki.comfymodels.util;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
public class PlatformUtilsTest {
@AfterEach
void tearDown() {
// Reset to real OS
PlatformUtils.setOsNameForTesting(System.getProperty("os.name"));
}
@Test
void testWindowsDetection() {
PlatformUtils.setOsNameForTesting("Windows 11");
assertTrue(PlatformUtils.isWindows());
assertFalse(PlatformUtils.isMac());
assertFalse(PlatformUtils.isLinux());
}
@Test
void testMacDetection() {
PlatformUtils.setOsNameForTesting("Mac OS X");
assertTrue(PlatformUtils.isMac());
assertFalse(PlatformUtils.isWindows());
assertFalse(PlatformUtils.isLinux());
}
@Test
void testLinuxDetection() {
PlatformUtils.setOsNameForTesting("Linux");
assertTrue(PlatformUtils.isLinux());
assertFalse(PlatformUtils.isWindows());
assertFalse(PlatformUtils.isMac());
}
@Test
void testAixDetection() {
PlatformUtils.setOsNameForTesting("AIX");
assertTrue(PlatformUtils.isLinux());
assertFalse(PlatformUtils.isWindows());
assertFalse(PlatformUtils.isMac());
}
@Test
void testWindowsShutdownCommand() {
PlatformUtils.setOsNameForTesting("Windows 11");
String[] cmd = PlatformUtils.getShutdownCommand();
assertNotNull(cmd);
assertEquals("shutdown", cmd[0]);
assertEquals("/s", cmd[1]);
}
@Test
void testMacShutdownCommand() {
PlatformUtils.setOsNameForTesting("Mac OS X");
String[] cmd = PlatformUtils.getShutdownCommand();
assertNotNull(cmd);
assertEquals("osascript", cmd[0]);
}
@Test
void testLinuxShutdownCommand() {
PlatformUtils.setOsNameForTesting("Linux");
String[] cmd = PlatformUtils.getShutdownCommand();
assertNotNull(cmd);
assertEquals("shutdown", cmd[0]);
assertEquals("-h", cmd[1]);
}
}