Fri, 04 Oct 2013 13:32:30 -0700
8008164: Invisible table captions in javadoc-generated html
Reviewed-by: jjg
1 /*
2 * Copyright (c) 2003, 2013, 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 */
24 /*
25 * @test
26 * @bug 4927167 4974929 7010344
27 * @summary When the type parameters are more than 10 characters in length,
28 * make sure there is a line break between type params and return type
29 * in member summary. Also, test for type parameter links in package-summary and
30 * class-use pages. The class/annotation pages should check for type
31 * parameter links in the class/annotation signature section when -linksource is set.
32 * @author jamieh
33 * @library ../lib/
34 * @build JavadocTester TestTypeParameters
35 * @run main TestTypeParameters
36 */
38 public class TestTypeParameters extends JavadocTester {
40 //Test information.
41 private static final String BUG_ID = "4927167-4974929-7010344";
43 //Javadoc arguments.
44 private static final String[] ARGS1 = new String[]{
45 "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR,
46 "pkg"
47 };
48 private static final String[] ARGS2 = new String[]{
49 "-d", BUG_ID, "-linksource", "-source", "1.5", "-sourcepath", SRC_DIR,
50 "pkg"
51 };
53 //Input for string search tests.
54 private static final String[][] TEST1 = {
55 {BUG_ID + FS + "pkg" + FS + "C.html",
56 "<td class=\"colFirst\"><code><W extends java.lang.String,V extends " +
57 "java.util.List><br>java.lang.Object</code></td>"
58 },
59 {BUG_ID + FS + "pkg" + FS + "C.html",
60 "<code><T> java.lang.Object</code>"
61 },
62 {BUG_ID + FS + "pkg" + FS + "package-summary.html",
63 "C</a><E extends <a href=\"../pkg/Parent.html\" " +
64 "title=\"class in pkg\">Parent</a>>"
65 },
66 {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "Foo4.html",
67 "<a href=\"../../pkg/ClassUseTest3.html\" title=\"class in pkg\">" +
68 "ClassUseTest3</a><T extends <a href=\"../../pkg/ParamTest2.html\" " +
69 "title=\"class in pkg\">ParamTest2</a><java.util.List<? extends " +
70 "<a href=\"../../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>>>>"
71 },
72 //Nested type parameters
73 {BUG_ID + FS + "pkg" + FS + "C.html",
74 "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL +
75 "<!-- -->" + NL +
76 "</a>"
77 },
78 };
79 private static final String[][] TEST2 = {
80 {BUG_ID + FS + "pkg" + FS + "ClassUseTest3.html",
81 "public class <a href=\"../src-html/pkg/ClassUseTest3.html#line.28\">" +
82 "ClassUseTest3</a><T extends <a href=\"../pkg/ParamTest2.html\" " +
83 "title=\"class in pkg\">ParamTest2</a><java.util.List<? extends " +
84 "<a href=\"../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>>>>"
85 }
86 };
87 private static final String[][] NEGATED_TEST = NO_TEST;
89 /**
90 * The entry point of the test.
91 * @param args the array of command line arguments.
92 */
93 public static void main(String[] args) {
94 TestTypeParameters tester = new TestTypeParameters();
95 run(tester, ARGS1, TEST1, NEGATED_TEST);
96 run(tester, ARGS2, TEST2, NEGATED_TEST);
97 tester.printSummary();
98 }
100 /**
101 * {@inheritDoc}
102 */
103 public String getBugId() {
104 return BUG_ID;
105 }
107 /**
108 * {@inheritDoc}
109 */
110 public String getBugName() {
111 return getClass().getName();
112 }
113 }