test/jdk/tools/jpackage/share/FileAssociationsTest.java
branchJDK-8200758-branch
changeset 58696 61c44899b4eb
parent 58648 3bf53ffa9ae7
child 58761 88e2753a2334
equal deleted inserted replaced
58695:64adf683bc7b 58696:61c44899b4eb
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
       
    24 import java.nio.file.Path;
    24 import jdk.jpackage.test.TKit;
    25 import jdk.jpackage.test.TKit;
    25 import jdk.jpackage.test.PackageTest;
    26 import jdk.jpackage.test.PackageTest;
    26 import jdk.jpackage.test.FileAssociations;
    27 import jdk.jpackage.test.FileAssociations;
    27 import jdk.jpackage.test.Annotations.Test;
    28 import jdk.jpackage.test.Annotations.Test;
    28 
    29 
    40  * commend line. The same applies to ".jptest2" suffix.
    41  * commend line. The same applies to ".jptest2" suffix.
    41  *
    42  *
    42  * On Linux use "echo > foo.jptest1" and not "touch foo.jptest1" to create test
    43  * On Linux use "echo > foo.jptest1" and not "touch foo.jptest1" to create test
    43  * file as empty files are always interpreted as plain text and will not be
    44  * file as empty files are always interpreted as plain text and will not be
    44  * opened with the test app. This is a known bug.
    45  * opened with the test app. This is a known bug.
       
    46  *
       
    47  * Icon associated with the main launcher should be associated with files with
       
    48  * ".jptest1" suffix. Different icon should be associated with files with with
       
    49  * ".jptest2" suffix. Icon for files with ".jptest1" suffix is platform specific
       
    50  * and is one of 'icon.*' files in test/jdk/tools/jpackage/resources directory.
    45  */
    51  */
    46 
    52 
    47 /*
    53 /*
    48  * @test
    54  * @test
    49  * @summary jpackage with --file-associations
    55  * @summary jpackage with --file-associations
    58     @Test
    64     @Test
    59     public static void test() {
    65     public static void test() {
    60         PackageTest packageTest = new PackageTest();
    66         PackageTest packageTest = new PackageTest();
    61 
    67 
    62         applyFileAssociations(packageTest, new FileAssociations("jptest1"));
    68         applyFileAssociations(packageTest, new FileAssociations("jptest1"));
       
    69 
       
    70         Path icon = TKit.TEST_SRC_ROOT.resolve(Path.of("resources", "icon"
       
    71                 + TKit.ICON_SUFFIX));
       
    72 
    63         applyFileAssociations(packageTest,
    73         applyFileAssociations(packageTest,
    64                 new FileAssociations("jptest2").setFilename("fa2"));
    74                 new FileAssociations("jptest2").setFilename("fa2").setIcon(icon));
    65         packageTest.run();
    75         packageTest.run();
    66     }
    76     }
    67 
    77 
    68     private static void applyFileAssociations(PackageTest test,
    78     private static void applyFileAssociations(PackageTest test,
    69             FileAssociations fa) {
    79             FileAssociations fa) {