test/langtools/jdk/javadoc/doclet/PackagesHeader/PackagesHeader.java
branchJDK-8200758-branch
changeset 57317 c4980b115ead
parent 57316 2891b3ae222d
parent 54478 cdc54443fee5
child 57320 5a5e00cc9932
equal deleted inserted replaced
57316:2891b3ae222d 57317:c4980b115ead
     1 /*
       
     2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    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
       
    21  * questions.
       
    22  */
       
    23 
       
    24 /*
       
    25  * @test
       
    26  * @bug      4766385 8196202
       
    27  * @summary  Test that the header option for upper left frame
       
    28  *           is present for three sets of options: (1) -header,
       
    29  *           (2) -packagesheader, and (3) -header -packagesheader
       
    30  * @author   dkramer
       
    31  * @library  ../../lib
       
    32  * @modules jdk.javadoc/jdk.javadoc.internal.tool
       
    33  * @build    javadoc.tester.*
       
    34  * @run main PackagesHeader
       
    35  */
       
    36 
       
    37 import javadoc.tester.JavadocTester;
       
    38 
       
    39 public class PackagesHeader extends JavadocTester {
       
    40 
       
    41     public static void main(String... args) throws Exception {
       
    42         JavadocTester tester = new PackagesHeader();
       
    43         tester.runTests();
       
    44     }
       
    45 
       
    46     @Test
       
    47     public void testHeader() {
       
    48         // First test with -header only
       
    49         javadoc("-d", "out-header",
       
    50                 "-header", "Main Frame Header",
       
    51                 "--frames",
       
    52                 "-sourcepath", testSrc,
       
    53                 "p1", "p2");
       
    54         checkExit(Exit.OK);
       
    55 
       
    56         // Test that the -header shows up in the packages frame
       
    57         checkOutput("overview-frame.html", true,
       
    58                 "Main Frame Header");
       
    59     }
       
    60 
       
    61     @Test
       
    62     public void testPackagesHeader() {
       
    63         // Second test with -packagesheader only
       
    64         javadoc("-d", "out-packages-header",
       
    65                 "-packagesheader", "Packages Frame Header",
       
    66                 "--frames",
       
    67                 "-sourcepath", testSrc,
       
    68                 "p1", "p2");
       
    69         checkExit(Exit.OK);
       
    70 
       
    71         // Test that the -packagesheader string shows
       
    72         // up in the packages frame
       
    73         checkOutput("overview-frame.html", true,
       
    74                 "Packages Frame Header");
       
    75     }
       
    76 
       
    77     @Test
       
    78     public void testBothHeaders() {
       
    79         // Third test with both -packagesheader and -header
       
    80         javadoc("-d", "out-both",
       
    81                 "-packagesheader", "Packages Frame Header",
       
    82                 "-header", "Main Frame Header",
       
    83                 "--frames",
       
    84                 "-sourcepath", testSrc,
       
    85                 "p1", "p2");
       
    86         checkExit(Exit.OK);
       
    87 
       
    88         // Test that the both headers show up and are different
       
    89         checkOutput("overview-frame.html", true,
       
    90                 "Packages Frame Header");
       
    91 
       
    92         checkOutput("overview-summary.html", true,
       
    93                 "Main Frame Header");
       
    94     }
       
    95 }