|
25 | 25 |
|
26 | 26 | import java.nio.file.Path; |
27 | 27 | import java.util.Map; |
| 28 | +import jdk.jpackage.test.AdditionalLauncher; |
28 | 29 | import jdk.jpackage.test.Annotations.Parameter; |
29 | 30 | import jdk.jpackage.test.Annotations.Test; |
30 | 31 | import jdk.jpackage.test.FileAssociations; |
31 | 32 | import jdk.jpackage.test.JPackageCommand; |
32 | 33 | import jdk.jpackage.test.PackageTest; |
33 | 34 | import jdk.jpackage.test.PackageType; |
| 35 | +import jdk.jpackage.test.RunnablePackageTest; |
34 | 36 | import jdk.jpackage.test.TKit; |
35 | 37 |
|
36 | 38 | /** |
@@ -85,7 +87,7 @@ public class FileAssociationsTest { |
85 | 87 | @Parameter("true") |
86 | 88 | @Parameter("false") |
87 | 89 | public static void test(boolean includeDescription) { |
88 | | - PackageTest packageTest = new PackageTest(); |
| 90 | + PackageTest packageTest = new PackageTest().configureHelloApp(); |
89 | 91 |
|
90 | 92 | // Not supported |
91 | 93 | packageTest.excludeTypes(PackageType.MAC_DMG); |
@@ -144,6 +146,34 @@ public static void testTooManyMimes() { |
144 | 146 | }).run(); |
145 | 147 | } |
146 | 148 |
|
| 149 | + @Test |
| 150 | + @Parameter("true") |
| 151 | + @Parameter("false") |
| 152 | + public static void testFromAppImage(boolean withAdditionalLauncher) { |
| 153 | + |
| 154 | + var appImageCmd = JPackageCommand.helloAppImage(); |
| 155 | + |
| 156 | + if (RunnablePackageTest.hasAction(RunnablePackageTest.Action.INSTALL)) { |
| 157 | + // Ensure launchers are executable. |
| 158 | + appImageCmd.ignoreFakeRuntime(); |
| 159 | + } |
| 160 | + |
| 161 | + if (withAdditionalLauncher) { |
| 162 | + new AdditionalLauncher("foo").applyTo(appImageCmd); |
| 163 | + } |
| 164 | + |
| 165 | + var test = new PackageTest().excludeTypes(PackageType.MAC_DMG) |
| 166 | + .addRunOnceInitializer(appImageCmd::execute) |
| 167 | + .addInitializer(cmd -> { |
| 168 | + cmd.removeArgumentWithValue("--input"); |
| 169 | + cmd.setArgumentValue("--app-image", appImageCmd.outputBundle()); |
| 170 | + }); |
| 171 | + |
| 172 | + new FileAssociations("jptest3").applyTo(test); |
| 173 | + |
| 174 | + test.run(); |
| 175 | + } |
| 176 | + |
147 | 177 | private static PackageTest initPackageTest() { |
148 | 178 | return new PackageTest() |
149 | 179 | .excludeTypes(PackageType.MAC) |
|
0 commit comments