equal
deleted
inserted
replaced
43 import jdk.jpackage.test.Functional.ThrowingRunnable; |
43 import jdk.jpackage.test.Functional.ThrowingRunnable; |
44 import jdk.jpackage.test.Functional.ThrowingSupplier; |
44 import jdk.jpackage.test.Functional.ThrowingSupplier; |
45 |
45 |
46 final public class TKit { |
46 final public class TKit { |
47 |
47 |
|
48 private static final String OS = System.getProperty("os.name").toLowerCase(); |
|
49 |
48 public static final Path TEST_SRC_ROOT = Functional.identity(() -> { |
50 public static final Path TEST_SRC_ROOT = Functional.identity(() -> { |
49 Path root = Path.of(System.getProperty("test.src")); |
51 Path root = Path.of(System.getProperty("test.src")); |
50 |
52 |
51 for (int i = 0; i != 10; ++i) { |
53 for (int i = 0; i != 10; ++i) { |
52 if (root.resolve("apps").toFile().isDirectory()) { |
54 if (root.resolve("apps").toFile().isDirectory()) { |
54 } |
56 } |
55 root = root.resolve(".."); |
57 root = root.resolve(".."); |
56 } |
58 } |
57 |
59 |
58 throw new RuntimeException("Failed to locate apps directory"); |
60 throw new RuntimeException("Failed to locate apps directory"); |
|
61 }).get(); |
|
62 |
|
63 public final static String ICON_SUFFIX = Functional.identity(() -> { |
|
64 if (isOSX()) { |
|
65 return ".icns"; |
|
66 } |
|
67 |
|
68 if (isLinux()) { |
|
69 return ".png"; |
|
70 } |
|
71 |
|
72 if (isWindows()) { |
|
73 return ".ico"; |
|
74 } |
|
75 |
|
76 throw throwUnknownPlatformError(); |
59 }).get(); |
77 }).get(); |
60 |
78 |
61 public static void run(String args[], ThrowingRunnable testBody) { |
79 public static void run(String args[], ThrowingRunnable testBody) { |
62 if (currentTest != null) { |
80 if (currentTest != null) { |
63 throw new IllegalStateException( |
81 throw new IllegalStateException( |
814 TRACE_ASSERTS = isNonOf.test(Set.of("assert", "a")); |
832 TRACE_ASSERTS = isNonOf.test(Set.of("assert", "a")); |
815 VERBOSE_JPACKAGE = isNonOf.test(Set.of("jpackage", "jp")); |
833 VERBOSE_JPACKAGE = isNonOf.test(Set.of("jpackage", "jp")); |
816 VERBOSE_TEST_SETUP = isNonOf.test(Set.of("init", "i")); |
834 VERBOSE_TEST_SETUP = isNonOf.test(Set.of("init", "i")); |
817 } |
835 } |
818 } |
836 } |
819 |
|
820 private static final String OS = System.getProperty("os.name").toLowerCase(); |
|
821 } |
837 } |