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