test/langtools/jdk/javadoc/doclet/ValidHtml/ValidHtml.java
changeset 49139 771616d26ca1
parent 47216 71c04702a3d5
child 50293 edfb87b2520e
equal deleted inserted replaced
49138:67912cbf784a 49139:771616d26ca1
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    21  * questions.
    21  * questions.
    22  */
    22  */
    23 
    23 
    24 /*
    24 /*
    25  * @test
    25  * @test
    26  * @bug 4275630 4749453 4625400 4753048 4415270 8074521
    26  * @bug 4275630 4749453 4625400 4753048 4415270 8074521 8182765
    27  * @summary  Generated HTML is invalid with frames.
    27  * @summary  Generated HTML is invalid with frames.
    28  *           Displays unnecessary horizontal scroll bars.
    28  *           Displays unnecessary horizontal scroll bars.
    29  *           Missing whitespace in DOCTYPE declaration
    29  *           Missing whitespace in DOCTYPE declaration
    30  *           HTML table tags inserted in wrong place in pakcage use page
    30  *           HTML table tags inserted in wrong place in pakcage use page
    31  * @author dkramer
    31  * @author dkramer
    51                     "-use",
    51                     "-use",
    52                     "-overview", testSrc("overview.html"),
    52                     "-overview", testSrc("overview.html"),
    53                     "-sourcepath", testSrc,
    53                     "-sourcepath", testSrc,
    54                     "p1", "p2");
    54                     "p1", "p2");
    55         checkExit(Exit.OK);
    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:
    56         // Test for IFRAME element:
    67         checkOutput("index.html", true,
    57         checkOutput("index.html", true,
    68                 "<iframe");
    58                 "<iframe");
    69 
       
    70         // Test the table elements are in the correct order:
    59         // Test the table elements are in the correct order:
    71         checkOutput("p1/package-use.html", true,
    60         checkOutput("p1/package-use.html", true,
    72                 "</td>\n"
    61                 "</td>\n"
    73                 + "</tr>");
    62                 + "</tr>");
       
    63         String HTML5 = "<!DOCTYPE HTML>";
       
    64         checkValidHTML(HTML5);
    74     }
    65     }
    75 
    66 
    76     private static final String LOOSE =
    67     @Test
    77             "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
    68     void test_html4() {
       
    69         // Test for all cases except the split index page
       
    70         javadoc("-d", "out-html4",
       
    71                 "-html4",
       
    72                 "-doctitle", "Document Title",
       
    73                 "-windowtitle", "Window Title",
       
    74                 "-use",
       
    75                 "-overview", testSrc("overview.html"),
       
    76                 "-sourcepath", testSrc,
       
    77                 "p1", "p2");
       
    78         checkExit(Exit.OK);
       
    79         String HTML4 = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
       
    80 
       
    81         checkValidHTML(HTML4);
    78 }
    82 }
       
    83 
       
    84     void checkValidHTML(String doctype) {
       
    85         // Test the proper DOCTYPE element are present:
       
    86         checkOutput("index.html", true, doctype);
       
    87         checkOutput("overview-summary.html", true, doctype);
       
    88         checkOutput("p1/package-summary.html", true, doctype);
       
    89         checkOutput("p1/C.html", true, doctype);
       
    90         checkOutput("overview-frame.html", true, doctype);
       
    91         checkOutput("allclasses-frame.html", true, doctype);
       
    92         checkOutput("p1/package-frame.html", true, doctype);
       
    93     }
       
    94 }