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