1 /*
2  * Copyright (c) 2002, 2019, 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 8182765 8196202
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  * @library ../../lib
32  * @modules jdk.javadoc/jdk.javadoc.internal.tool
33  * @build javadoc.tester.*
34  * @run main ValidHtml
35  */
36 
37 import javadoc.tester.JavadocTester;
38 
39 public class ValidHtml extends JavadocTester {
40 
main(String... args)41     public static void main(String... args) throws Exception {
42         ValidHtml tester = new ValidHtml();
43         tester.runTests();
44     }
45 
46     @Test
test()47     public void test() {
48         // Test for all cases except the split index page
49         javadoc("-d", "out",
50                     "-doctitle", "Document Title",
51                     "-windowtitle", "Window Title",
52                     "-use",
53                     "-overview", testSrc("overview.html"),
54                     "-sourcepath", testSrc,
55                     "p1", "p2");
56         checkExit(Exit.OK);
57         // Test the table elements are in the correct order:
58         checkOutput("p1/package-use.html", true,
59                 "</td>\n"
60                 + "</tr>");
61         String HTML5 = "<!DOCTYPE HTML>";
62         checkValidHTML(HTML5);
63     }
64 
checkValidHTML(String doctype)65     void checkValidHTML(String doctype) {
66         // Test the proper DOCTYPE element are present:
67         checkOutput("index.html", true, doctype);
68         checkOutput("overview-summary.html", true, doctype);
69         checkOutput("p1/package-summary.html", true, doctype);
70         checkOutput("p1/C.html", true, doctype);
71     }
72 }
73