Wed, 08 Oct 2014 12:38:55 -0700
Added tag jdk8u40-b09 for changeset 8bb38a350722
1 /*
2 * Copyright (c) 2009, 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 6786688 8008164
27 * @summary HTML tables should have table summary, caption and table headers.
28 * @author Bhavesh Patel
29 * @library ../lib/
30 * @build JavadocTester
31 * @build TestHtmlTableTags
32 * @run main TestHtmlTableTags
33 */
35 public class TestHtmlTableTags extends JavadocTester {
37 //Test information.
38 private static final String BUG_ID = "6786688";
40 //Javadoc arguments.
41 private static final String[] ARGS = new String[] {
42 "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2"
43 };
45 //Input for string tests for HTML table tags.
46 private static final String[][] TABLE_TAGS_TEST = {
47 /*
48 * Test for validating summary for HTML tables
49 */
51 //Package summary
52 {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
53 "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
54 " cellspacing=\"0\" summary=\"Class Summary table, " +
55 "listing classes, and an explanation\">"
56 },
57 {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
58 "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
59 " cellspacing=\"0\" summary=\"Interface Summary table, " +
60 "listing interfaces, and an explanation\">"
61 },
62 {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
63 "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
64 " cellspacing=\"0\" summary=\"Enum Summary table, " +
65 "listing enums, and an explanation\">"
66 },
67 {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
68 "<table class=\"typeSummary\" border=\"0\" cellpadding=\"3\"" +
69 " cellspacing=\"0\" summary=\"Annotation Types Summary table, " +
70 "listing annotation types, and an explanation\">"
71 },
72 // Class documentation
73 {BUG_ID + FS + "pkg1" + FS + "C1.html",
74 "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
75 "cellspacing=\"0\" summary=\"Field Summary table, listing fields, " +
76 "and an explanation\">"
77 },
78 {BUG_ID + FS + "pkg1" + FS + "C1.html",
79 "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
80 "cellspacing=\"0\" summary=\"Method Summary table, listing methods, " +
81 "and an explanation\">"
82 },
83 {BUG_ID + FS + "pkg2" + FS + "C2.html",
84 "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
85 "cellspacing=\"0\" summary=\"Nested Class Summary table, listing " +
86 "nested classes, and an explanation\">"
87 },
88 {BUG_ID + FS + "pkg2" + FS + "C2.html",
89 "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
90 "cellspacing=\"0\" summary=\"Constructor Summary table, listing " +
91 "constructors, and an explanation\">"
92 },
93 {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
94 "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
95 "cellspacing=\"0\" summary=\"Enum Constant Summary table, listing " +
96 "enum constants, and an explanation\">"
97 },
98 {BUG_ID + FS + "pkg2" + FS + "C3.html",
99 "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
100 "cellspacing=\"0\" summary=\"Required Element Summary table, " +
101 "listing required elements, and an explanation\">"
102 },
103 {BUG_ID + FS + "pkg2" + FS + "C4.html",
104 "<table class=\"memberSummary\" border=\"0\" cellpadding=\"3\" " +
105 "cellspacing=\"0\" summary=\"Optional Element Summary table, " +
106 "listing optional elements, and an explanation\">"
107 },
108 // Class use documentation
109 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
110 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
111 "table, listing packages, and an explanation\">"
112 },
113 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
114 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
115 "table, listing fields, and an explanation\">"
116 },
117 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
118 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
119 "table, listing methods, and an explanation\">"
120 },
121 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
122 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
123 "table, listing fields, and an explanation\">"
124 },
125 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
126 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
127 "table, listing methods, and an explanation\">"
128 },
129 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
130 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
131 "table, listing packages, and an explanation\">"
132 },
133 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
134 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
135 "table, listing methods, and an explanation\">"
136 },
137 // Package use documentation
138 {BUG_ID + FS + "pkg1" + FS + "package-use.html",
139 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
140 "table, listing packages, and an explanation\">"
141 },
142 {BUG_ID + FS + "pkg1" + FS + "package-use.html",
143 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
144 "table, listing classes, and an explanation\">"
145 },
146 {BUG_ID + FS + "pkg2" + FS + "package-use.html",
147 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
148 "table, listing packages, and an explanation\">"
149 },
150 {BUG_ID + FS + "pkg2" + FS + "package-use.html",
151 "<table class=\"useSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" summary=\"Use " +
152 "table, listing classes, and an explanation\">"
153 },
154 // Deprecated
155 {BUG_ID + FS + "deprecated-list.html",
156 "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
157 "summary=\"Deprecated Fields table, listing deprecated fields, " +
158 "and an explanation\">"
159 },
160 {BUG_ID + FS + "deprecated-list.html",
161 "<table class=\"deprecatedSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
162 "summary=\"Deprecated Methods table, listing deprecated methods, " +
163 "and an explanation\">"
164 },
165 // Constant values
166 {BUG_ID + FS + "constant-values.html",
167 "<table class=\"constantsSummary\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\" " +
168 "summary=\"Constant Field Values table, listing " +
169 "constant fields, and values\">"
170 },
171 // Overview Summary
172 {BUG_ID + FS + "overview-summary.html",
173 "<table class=\"overviewSummary\" border=\"0\" cellpadding=\"3\" " +
174 "cellspacing=\"0\" summary=\"Packages table, " +
175 "listing packages, and an explanation\">"
176 },
178 /*
179 * Test for validating caption for HTML tables
180 */
182 //Package summary
183 {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
184 "<caption><span>Class Summary</span><span class=\"tabEnd\">" +
185 " </span></caption>"
186 },
187 {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
188 "<caption><span>Interface Summary</span><span class=\"tabEnd\">" +
189 " </span></caption>"
190 },
191 {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
192 "<caption><span>Enum Summary</span><span class=\"tabEnd\">" +
193 " </span></caption>"
194 },
195 {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
196 "<caption><span>Annotation Types Summary</span><span class=\"tabEnd\">" +
197 " </span></caption>"
198 },
199 // Class documentation
200 {BUG_ID + FS + "pkg1" + FS + "C1.html",
201 "<caption><span>Fields</span><span class=\"tabEnd\"> </span></caption>"
202 },
203 {BUG_ID + FS + "pkg1" + FS + "C1.html",
204 "<caption><span id=\"t0\" class=\"activeTableTab\"><span>All " +
205 "Methods</span><span class=\"tabEnd\"> </span></span>" +
206 "<span id=\"t2\" class=\"tableTab\"><span><a href=\"javascript:show(2);\">" +
207 "Instance Methods</a></span><span class=\"tabEnd\"> </span></span>" +
208 "<span id=\"t4\" class=\"tableTab\"><span><a href=\"javascript:show(8);\">" +
209 "Concrete Methods</a></span><span class=\"tabEnd\"> </span></span>" +
210 "<span id=\"t6\" class=\"tableTab\"><span><a href=\"javascript:show(32);\">" +
211 "Deprecated Methods</a></span><span class=\"tabEnd\"> </span></span>" +
212 "</caption>"
213 },
214 {BUG_ID + FS + "pkg2" + FS + "C2.html",
215 "<caption><span>Nested Classes</span><span class=\"tabEnd\"> </span></caption>"
216 },
217 {BUG_ID + FS + "pkg2" + FS + "C2.html",
218 "<caption><span>Constructors</span><span class=\"tabEnd\"> </span></caption>"
219 },
220 {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
221 "<caption><span>Enum Constants</span><span class=\"tabEnd\"> </span></caption>"
222 },
223 {BUG_ID + FS + "pkg2" + FS + "C3.html",
224 "<caption><span>Required Elements</span><span class=\"tabEnd\"> " +
225 "</span></caption>"
226 },
227 {BUG_ID + FS + "pkg2" + FS + "C4.html",
228 "<caption><span>Optional Elements</span><span class=\"tabEnd\"> " +
229 "</span></caption>"
230 },
231 // Class use documentation
232 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
233 "<caption><span>Packages that use <a href=\"../../pkg1/I1.html\" " +
234 "title=\"interface in pkg1\">I1</a></span><span class=\"tabEnd\">" +
235 " </span></caption>"
236 },
237 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
238 "<caption><span>Fields in <a href=\"../../pkg2/package-summary.html\">" +
239 "pkg2</a> declared as <a href=\"../../pkg1/C1.html\" " +
240 "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\"> " +
241 "</span></caption>"
242 },
243 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
244 "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" +
245 "pkg2</a> that return <a href=\"../../pkg1/C1.html\" " +
246 "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">" +
247 " </span></caption>"
248 },
249 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
250 "<caption><span>Fields in <a href=\"../../pkg1/package-summary.html\">" +
251 "pkg1</a> declared as <a href=\"../../pkg2/C2.html\" " +
252 "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" +
253 " </span></caption>"
254 },
255 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
256 "<caption><span>Methods in <a href=\"../../pkg1/package-summary.html\">" +
257 "pkg1</a> that return <a href=\"../../pkg2/C2.html\" " +
258 "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" +
259 " </span></caption>"
260 },
261 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
262 "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" +
263 "pkg2</a> that return <a href=\"../../pkg2/C2.ModalExclusionType.html\" " +
264 "title=\"enum in pkg2\">C2.ModalExclusionType</a></span>" +
265 "<span class=\"tabEnd\"> </span></caption>"
266 },
267 // Package use documentation
268 {BUG_ID + FS + "pkg1" + FS + "package-use.html",
269 "<caption><span>Packages that use <a href=\"../pkg1/package-summary.html\">" +
270 "pkg1</a></span><span class=\"tabEnd\"> </span></caption>"
271 },
272 {BUG_ID + FS + "pkg1" + FS + "package-use.html",
273 "<caption><span>Classes in <a href=\"../pkg1/package-summary.html\">" +
274 "pkg1</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" +
275 "</span><span class=\"tabEnd\"> </span></caption>"
276 },
277 {BUG_ID + FS + "pkg2" + FS + "package-use.html",
278 "<caption><span>Packages that use <a href=\"../pkg2/package-summary.html\">" +
279 "pkg2</a></span><span class=\"tabEnd\"> </span></caption>"
280 },
281 {BUG_ID + FS + "pkg2" + FS + "package-use.html",
282 "<caption><span>Classes in <a href=\"../pkg2/package-summary.html\">" +
283 "pkg2</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" +
284 "</span><span class=\"tabEnd\"> </span></caption>"
285 },
286 // Deprecated
287 {BUG_ID + FS + "deprecated-list.html",
288 "<caption><span>Deprecated Fields</span><span class=\"tabEnd\">" +
289 " </span></caption>"
290 },
291 {BUG_ID + FS + "deprecated-list.html",
292 "<caption><span>Deprecated Methods</span><span class=\"tabEnd\">" +
293 " </span></caption>"
294 },
295 // Constant values
296 {BUG_ID + FS + "constant-values.html",
297 "<caption><span>pkg1.<a href=\"pkg1/C1.html\" title=\"class in pkg1\">" +
298 "C1</a></span><span class=\"tabEnd\"> </span></caption>"
299 },
300 // Overview Summary
301 {BUG_ID + FS + "overview-summary.html",
302 "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>"
303 },
305 /*
306 * Test for validating headers for HTML tables
307 */
309 //Package summary
310 {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
311 "<th class=\"colFirst\" scope=\"col\">" +
312 "Class</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
313 ">Description</th>"
314 },
315 {BUG_ID + FS + "pkg1" + FS + "package-summary.html",
316 "<th class=\"colFirst\" scope=\"col\">" +
317 "Interface</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
318 ">Description</th>"
319 },
320 {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
321 "<th class=\"colFirst\" scope=\"col\">" +
322 "Enum</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
323 ">Description</th>"
324 },
325 {BUG_ID + FS + "pkg2" + FS + "package-summary.html",
326 "<th class=\"colFirst\" scope=\"col\">" +
327 "Annotation Type</th>" + NL + "<th class=\"colLast\"" +
328 " scope=\"col\">Description</th>"
329 },
330 // Class documentation
331 {BUG_ID + FS + "pkg1" + FS + "C1.html",
332 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
333 "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
334 },
335 {BUG_ID + FS + "pkg1" + FS + "C1.html",
336 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
337 "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
338 },
339 {BUG_ID + FS + "pkg2" + FS + "C2.html",
340 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
341 "<th class=\"colLast\" scope=\"col\">Class and Description</th>"
342 },
343 {BUG_ID + FS + "pkg2" + FS + "C2.html",
344 "<th class=\"colOne\" scope=\"col\">Constructor and Description</th>"
345 },
346 {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html",
347 "<th class=\"colOne\" scope=\"col\">Enum Constant and Description</th>"
348 },
349 {BUG_ID + FS + "pkg2" + FS + "C3.html",
350 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
351 "<th class=\"colLast\" scope=\"col\">Required Element and Description</th>"
352 },
353 {BUG_ID + FS + "pkg2" + FS + "C4.html",
354 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
355 "<th class=\"colLast\" scope=\"col\">Optional Element and Description</th>"
356 },
357 // Class use documentation
358 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html",
359 "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
360 "<th class=\"colLast\" scope=\"col\">Description</th>"
361 },
362 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
363 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
364 "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
365 },
366 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html",
367 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
368 "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
369 },
370 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
371 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
372 "<th class=\"colLast\" scope=\"col\">Field and Description</th>"
373 },
374 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html",
375 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
376 "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
377 },
378 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
379 "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
380 "<th class=\"colLast\" scope=\"col\">Description</th>"
381 },
382 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html",
383 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL +
384 "<th class=\"colLast\" scope=\"col\">Method and Description</th>"
385 },
386 // Package use documentation
387 {BUG_ID + FS + "pkg1" + FS + "package-use.html",
388 "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
389 "<th class=\"colLast\" scope=\"col\">Description</th>"
390 },
391 {BUG_ID + FS + "pkg1" + FS + "package-use.html",
392 "<th class=\"colOne\" scope=\"col\">Class and Description</th>"
393 },
394 {BUG_ID + FS + "pkg2" + FS + "package-use.html",
395 "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL +
396 "<th class=\"colLast\" scope=\"col\">Description</th>"
397 },
398 {BUG_ID + FS + "pkg2" + FS + "package-use.html",
399 "<th class=\"colOne\" scope=\"col\">Class and Description</th>"
400 },
401 // Deprecated
402 {BUG_ID + FS + "deprecated-list.html",
403 "<th class=\"colOne\" scope=\"col\">Field and Description</th>"
404 },
405 {BUG_ID + FS + "deprecated-list.html",
406 "<th class=\"colOne\" scope=\"col\">Method and Description</th>"
407 },
408 // Constant values
409 {BUG_ID + FS + "constant-values.html",
410 "<th class=\"colFirst\" scope=\"col\">" +
411 "Modifier and Type</th>" + NL + "<th" +
412 " scope=\"col\">Constant Field</th>" + NL +
413 "<th class=\"colLast\" scope=\"col\">Value</th>"
414 },
415 // Overview Summary
416 {BUG_ID + FS + "overview-summary.html",
417 "<th class=\"colFirst\" scope=\"col\">" +
418 "Package</th>" + NL + "<th class=\"colLast\" scope=\"col\"" +
419 ">Description</th>"
420 }
421 };
422 private static final String[][] NEGATED_TEST = NO_TEST;
424 /**
425 * The entry point of the test.
426 * @param args the array of command line arguments.
427 */
428 public static void main(String[] args) {
429 TestHtmlTableTags tester = new TestHtmlTableTags();
430 run(tester, ARGS, TABLE_TAGS_TEST, NEGATED_TEST);
431 tester.printSummary();
432 }
434 /**
435 * {@inheritDoc}
436 */
437 public String getBugId() {
438 return BUG_ID;
439 }
441 /**
442 * {@inheritDoc}
443 */
444 public String getBugName() {
445 return getClass().getName();
446 }
447 }