PackagesHeader.java revision 3294:9adfb22ff08f
1/*
2 * Copyright (c) 2002, 2016, 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
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    JavadocTester
34 * @run main PackagesHeader
35 */
36
37public class PackagesHeader extends JavadocTester {
38
39    public static void main(String... args) throws Exception {
40        JavadocTester tester = new PackagesHeader();
41        tester.runTests();
42    }
43
44    @Test
45    void testHeader() {
46        // First test with -header only
47        javadoc("-d", "out-header",
48                "-header", "Main Frame Header",
49                "-sourcepath", testSrc,
50                "p1", "p2");
51        checkExit(Exit.OK);
52
53        // Test that the -header shows up in the packages frame
54        checkOutput("overview-frame.html", true,
55                "Main Frame Header");
56    }
57
58    @Test
59    void testPackagesHeader() {
60        // Second test with -packagesheader only
61        javadoc("-d", "out-packages-header",
62                "-packagesheader", "Packages Frame Header",
63                "-sourcepath", testSrc,
64                "p1", "p2");
65        checkExit(Exit.OK);
66
67        // Test that the -packagesheader string shows
68        // up in the packages frame
69        checkOutput("overview-frame.html", true,
70                "Packages Frame Header");
71    }
72
73    @Test
74    void testBothHeaders() {
75        // Third test with both -packagesheader and -header
76        javadoc("-d", "out-both",
77                "-packagesheader", "Packages Frame Header",
78                "-header", "Main Frame Header",
79                "-sourcepath", testSrc,
80                "p1", "p2");
81        checkExit(Exit.OK);
82
83        // Test that the both headers show up and are different
84        checkOutput("overview-frame.html", true,
85                "Packages Frame Header");
86
87        checkOutput("overview-summary.html", true,
88                "Main Frame Header");
89    }
90}
91