ValidHtml.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 4275630 4749453 4625400 4753048 4415270 8074521
27 * @summary  Generated HTML is invalid with frames.
28 *           Displays unnecessary horizontal scroll bars.
29 *           Missing whitespace in DOCTYPE declaration
30 *           HTML table tags inserted in wrong place in pakcage use page
31 * @author dkramer
32 * @library ../lib
33 * @modules jdk.javadoc/jdk.javadoc.internal.tool
34 * @build JavadocTester
35 * @run main ValidHtml
36 */
37
38public class ValidHtml extends JavadocTester {
39
40    public static void main(String... args) throws Exception {
41        ValidHtml tester = new ValidHtml();
42        tester.runTests();
43    }
44
45    @Test
46    void test() {
47        // Test for all cases except the split index page
48        javadoc("-d", "out",
49                    "-doctitle", "Document Title",
50                    "-windowtitle", "Window Title",
51                    "-use",
52                    "-overview", testSrc("overview.html"),
53                    "-sourcepath", testSrc,
54                    "p1", "p2");
55        checkExit(Exit.OK);
56
57        // Test the proper DOCTYPE element are present:
58        checkOutput("index.html",              true, LOOSE);
59        checkOutput("overview-summary.html",   true, LOOSE);
60        checkOutput("p1/package-summary.html", true, LOOSE);
61        checkOutput("p1/C.html",               true, LOOSE);
62        checkOutput("overview-frame.html",     true, LOOSE);
63        checkOutput("allclasses-frame.html",   true, LOOSE);
64        checkOutput("p1/package-frame.html",   true, LOOSE);
65
66        // Test for IFRAME element:
67        checkOutput("index.html", true,
68                "<iframe");
69
70        // Test the table elements are in the correct order:
71        checkOutput("p1/package-use.html", true,
72                "</td>\n"
73                + "</tr>");
74    }
75
76    private static final String LOOSE =
77            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
78}
79