ValidHtml.java revision 3294:9adfb22ff08f
1179055Sjfv/*
2171384Sjfv * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
3320897Serj * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4171384Sjfv *
5320897Serj * This code is free software; you can redistribute it and/or modify it
6320897Serj * under the terms of the GNU General Public License version 2 only, as
7171384Sjfv * published by the Free Software Foundation.
8320897Serj *
9320897Serj * This code is distributed in the hope that it will be useful, but WITHOUT
10171384Sjfv * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11320897Serj * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12320897Serj * version 2 for more details (a copy is included in the LICENSE file that
13320897Serj * accompanied this code).
14171384Sjfv *
15320897Serj * You should have received a copy of the GNU General Public License version
16320897Serj * 2 along with this work; if not, write to the Free Software Foundation,
17320897Serj * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18171384Sjfv *
19320897Serj * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20171384Sjfv * or visit www.oracle.com if you need additional information or have any
21320897Serj * questions.
22320897Serj */
23320897Serj
24320897Serj/*
25320897Serj * @test
26320897Serj * @bug 4275630 4749453 4625400 4753048 4415270 8074521
27320897Serj * @summary  Generated HTML is invalid with frames.
28320897Serj *           Displays unnecessary horizontal scroll bars.
29171384Sjfv *           Missing whitespace in DOCTYPE declaration
30171384Sjfv *           HTML table tags inserted in wrong place in pakcage use page
31171384Sjfv * @author dkramer
32179055Sjfv * @library ../lib
33179055Sjfv * @modules jdk.javadoc/jdk.javadoc.internal.tool
34171384Sjfv * @build JavadocTester
35171384Sjfv * @run main ValidHtml
36215911Sjfv */
37251964Sjfv
38251964Sjfvpublic class ValidHtml extends JavadocTester {
39171384Sjfv
40171384Sjfv    public static void main(String... args) throws Exception {
41171384Sjfv        ValidHtml tester = new ValidHtml();
42171384Sjfv        tester.runTests();
43171384Sjfv    }
44171384Sjfv
45171384Sjfv    @Test
46171384Sjfv    void test() {
47230775Sjfv        // Test for all cases except the split index page
48171384Sjfv        javadoc("-d", "out",
49171384Sjfv                    "-doctitle", "Document Title",
50171384Sjfv                    "-windowtitle", "Window Title",
51171384Sjfv                    "-use",
52171384Sjfv                    "-overview", testSrc("overview.html"),
53171384Sjfv                    "-sourcepath", testSrc,
54200239Sjfv                    "p1", "p2");
55230775Sjfv        checkExit(Exit.OK);
56230775Sjfv
57230775Sjfv        // Test the proper DOCTYPE element are present:
58230775Sjfv        checkOutput("index.html",              true, LOOSE);
59230775Sjfv        checkOutput("overview-summary.html",   true, LOOSE);
60230775Sjfv        checkOutput("p1/package-summary.html", true, LOOSE);
61230775Sjfv        checkOutput("p1/C.html",               true, LOOSE);
62215911Sjfv        checkOutput("overview-frame.html",     true, LOOSE);
63171384Sjfv        checkOutput("allclasses-frame.html",   true, LOOSE);
64179055Sjfv        checkOutput("p1/package-frame.html",   true, LOOSE);
65179055Sjfv
66171384Sjfv        // Test for IFRAME element:
67179055Sjfv        checkOutput("index.html", true,
68171384Sjfv                "<iframe");
69179055Sjfv
70171384Sjfv        // Test the table elements are in the correct order:
71179055Sjfv        checkOutput("p1/package-use.html", true,
72179055Sjfv                "</td>\n"
73292674Ssbruno                + "</tr>");
74171384Sjfv    }
75200239Sjfv
76200239Sjfv    private static final String LOOSE =
77171384Sjfv            "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
78280182Sjfv}
79179055Sjfv