TestHeadings.java revision 3658:7f3b6ce62ea7
1/*
2 * Copyright (c) 2003, 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      4905786 6259611 8162363
27 * @summary  Make sure that headings use the TH tag instead of the TD tag.
28 * @author   jamieh
29 * @library ../lib
30 * @modules jdk.javadoc/jdk.javadoc.internal.tool
31 * @build    JavadocTester
32 * @build    TestHeadings
33 * @run main TestHeadings
34 */
35
36public class TestHeadings extends JavadocTester {
37
38    private static final String[][] TEST = {
39
40        {
41        },
42        { "serialized-form.html"
43        },
44        { "serialized-form.html"
45        },
46
47        {
48        },
49        { "overview-frame.html"
50        },
51        {
52        }
53    };
54
55    public static void main(String... args) throws Exception {
56        TestHeadings tester = new TestHeadings();
57        tester.runTests();
58    }
59
60    @Test
61    void test() {
62        javadoc("-d", "out",
63                "-sourcepath", testSrc,
64                "-use",
65                "-header", "Test Files",
66                "pkg1", "pkg2");
67        checkExit(Exit.OK);
68
69        //Package summary
70        checkOutput("pkg1/package-summary.html", true,
71                "<th class=\"colFirst\" scope=\"col\">"
72                + "Class</th>\n"
73                + "<th class=\"colLast\" scope=\"col\""
74                + ">Description</th>");
75
76        // Class documentation
77        checkOutput("pkg1/C1.html", true,
78                "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
79                + "<th class=\"colSecond\" scope=\"col\">Field</th>\n"
80                + "<th class=\"colLast\" scope=\"col\">Description</th>",
81                "<h3>Methods inherited from class&nbsp;java.lang.Object</h3>");
82
83        // Class use documentation
84        checkOutput("pkg1/class-use/C1.html", true,
85                "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
86                + "<th class=\"colLast\" scope=\"col\">Description</th>",
87                "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
88                + "<th class=\"colSecond\" scope=\"col\">Field</th>\n"
89                + "<th class=\"colLast\" scope=\"col\">Description</th>");
90
91        // Deprecated
92        checkOutput("deprecated-list.html", true,
93                "<th class=\"colFirst\" scope=\"col\">Method</th>\n"
94                + "<th class=\"colLast\" scope=\"col\">Description</th>");
95
96        // Constant values
97        checkOutput("constant-values.html", true,
98                "<th class=\"colFirst\" scope=\"col\">"
99                + "Modifier and Type</th>\n"
100                + "<th class=\"colSecond\" scope=\"col\">Constant Field</th>\n"
101                + "<th class=\"colLast\" scope=\"col\">Value</th>");
102
103        // Serialized Form
104        checkOutput("serialized-form.html", true,
105                "<h2 title=\"Package\">Package&nbsp;pkg1</h2>",
106                "<h3>Class <a href=\"pkg1/C1.html\" title=\"class in pkg1\">"
107                + "pkg1.C1</a> extends java.lang.Object implements Serializable</h3>",
108                "<h3>Serialized Fields</h3>");
109
110        // Overview Frame
111        checkOutput("overview-frame.html", true,
112                "<h1 title=\"Test Files\" class=\"bar\">Test Files</h1>",
113                "<title>Overview List</title>");
114
115        // Overview Summary
116        checkOutput("overview-summary.html", true,
117                "<title>Overview</title>");
118    }
119}
120