TestHtmlTableTags.java revision 765:90af8d87741f
1/* 2 * Copyright (c) 2009, 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 6786688 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 */ 34 35public class TestHtmlTableTags extends JavadocTester { 36 37 //Test information. 38 private static final String BUG_ID = "6786688"; 39 40 //Javadoc arguments. 41 private static final String[] ARGS = new String[] { 42 "-d", BUG_ID, "-sourcepath", SRC_DIR, "-use", "pkg1", "pkg2" 43 }; 44 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 */ 50 51 //Package summary 52 {BUG_ID + FS + "pkg1" + FS + "package-summary.html", 53 "<table class=\"packageSummary\" 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=\"packageSummary\" 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=\"packageSummary\" 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=\"packageSummary\" 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=\"overviewSummary\" 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=\"overviewSummary\" 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=\"overviewSummary\" 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=\"overviewSummary\" 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=\"overviewSummary\" 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=\"overviewSummary\" 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=\"overviewSummary\" 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 }, 177 178 /* 179 * Test for validating caption for HTML tables 180 */ 181 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>Methods</span><span class=\"tabEnd\"> </span></caption>" 205 }, 206 {BUG_ID + FS + "pkg2" + FS + "C2.html", 207 "<caption><span>Nested Classes</span><span class=\"tabEnd\"> </span></caption>" 208 }, 209 {BUG_ID + FS + "pkg2" + FS + "C2.html", 210 "<caption><span>Constructors</span><span class=\"tabEnd\"> </span></caption>" 211 }, 212 {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html", 213 "<caption><span>Enum Constants</span><span class=\"tabEnd\"> </span></caption>" 214 }, 215 {BUG_ID + FS + "pkg2" + FS + "C3.html", 216 "<caption><span>Required Elements</span><span class=\"tabEnd\"> " + 217 "</span></caption>" 218 }, 219 {BUG_ID + FS + "pkg2" + FS + "C4.html", 220 "<caption><span>Optional Elements</span><span class=\"tabEnd\"> " + 221 "</span></caption>" 222 }, 223 // Class use documentation 224 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html", 225 "<caption><span>Packages that use <a href=\"../../pkg1/I1.html\" " + 226 "title=\"interface in pkg1\">I1</a></span><span class=\"tabEnd\">" + 227 " </span></caption>" 228 }, 229 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html", 230 "<caption><span>Fields in <a href=\"../../pkg2/package-summary.html\">" + 231 "pkg2</a> declared as <a href=\"../../pkg1/C1.html\" " + 232 "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\"> " + 233 "</span></caption>" 234 }, 235 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html", 236 "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" + 237 "pkg2</a> that return <a href=\"../../pkg1/C1.html\" " + 238 "title=\"class in pkg1\">C1</a></span><span class=\"tabEnd\">" + 239 " </span></caption>" 240 }, 241 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html", 242 "<caption><span>Fields in <a href=\"../../pkg1/package-summary.html\">" + 243 "pkg1</a> declared as <a href=\"../../pkg2/C2.html\" " + 244 "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" + 245 " </span></caption>" 246 }, 247 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.html", 248 "<caption><span>Methods in <a href=\"../../pkg1/package-summary.html\">" + 249 "pkg1</a> that return <a href=\"../../pkg2/C2.html\" " + 250 "title=\"class in pkg2\">C2</a></span><span class=\"tabEnd\">" + 251 " </span></caption>" 252 }, 253 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html", 254 "<caption><span>Methods in <a href=\"../../pkg2/package-summary.html\">" + 255 "pkg2</a> that return <a href=\"../../pkg2/C2.ModalExclusionType.html\" " + 256 "title=\"enum in pkg2\">C2.ModalExclusionType</a></span>" + 257 "<span class=\"tabEnd\"> </span></caption>" 258 }, 259 // Package use documentation 260 {BUG_ID + FS + "pkg1" + FS + "package-use.html", 261 "<caption><span>Packages that use <a href=\"../pkg1/package-summary.html\">" + 262 "pkg1</a></span><span class=\"tabEnd\"> </span></caption>" 263 }, 264 {BUG_ID + FS + "pkg1" + FS + "package-use.html", 265 "<caption><span>Classes in <a href=\"../pkg1/package-summary.html\">" + 266 "pkg1</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" + 267 "</span><span class=\"tabEnd\"> </span></caption>" 268 }, 269 {BUG_ID + FS + "pkg2" + FS + "package-use.html", 270 "<caption><span>Packages that use <a href=\"../pkg2/package-summary.html\">" + 271 "pkg2</a></span><span class=\"tabEnd\"> </span></caption>" 272 }, 273 {BUG_ID + FS + "pkg2" + FS + "package-use.html", 274 "<caption><span>Classes in <a href=\"../pkg2/package-summary.html\">" + 275 "pkg2</a> used by <a href=\"../pkg1/package-summary.html\">pkg1</a>" + 276 "</span><span class=\"tabEnd\"> </span></caption>" 277 }, 278 // Deprecated 279 {BUG_ID + FS + "deprecated-list.html", 280 "<caption><span>Deprecated Fields</span><span class=\"tabEnd\">" + 281 " </span></caption>" 282 }, 283 {BUG_ID + FS + "deprecated-list.html", 284 "<caption><span>Deprecated Methods</span><span class=\"tabEnd\">" + 285 " </span></caption>" 286 }, 287 // Constant values 288 {BUG_ID + FS + "constant-values.html", 289 "<caption><span>pkg1.<a href=\"pkg1/C1.html\" title=\"class in pkg1\">" + 290 "C1</a></span><span class=\"tabEnd\"> </span></caption>" 291 }, 292 // Overview Summary 293 {BUG_ID + FS + "overview-summary.html", 294 "<caption><span>Packages</span><span class=\"tabEnd\"> </span></caption>" 295 }, 296 297 /* 298 * Test for validating headers for HTML tables 299 */ 300 301 //Package summary 302 {BUG_ID + FS + "pkg1" + FS + "package-summary.html", 303 "<th class=\"colFirst\" scope=\"col\">" + 304 "Class</th>" + NL + "<th class=\"colLast\" scope=\"col\"" + 305 ">Description</th>" 306 }, 307 {BUG_ID + FS + "pkg1" + FS + "package-summary.html", 308 "<th class=\"colFirst\" scope=\"col\">" + 309 "Interface</th>" + NL + "<th class=\"colLast\" scope=\"col\"" + 310 ">Description</th>" 311 }, 312 {BUG_ID + FS + "pkg2" + FS + "package-summary.html", 313 "<th class=\"colFirst\" scope=\"col\">" + 314 "Enum</th>" + NL + "<th class=\"colLast\" scope=\"col\"" + 315 ">Description</th>" 316 }, 317 {BUG_ID + FS + "pkg2" + FS + "package-summary.html", 318 "<th class=\"colFirst\" scope=\"col\">" + 319 "Annotation Type</th>" + NL + "<th class=\"colLast\"" + 320 " scope=\"col\">Description</th>" 321 }, 322 // Class documentation 323 {BUG_ID + FS + "pkg1" + FS + "C1.html", 324 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL + 325 "<th class=\"colLast\" scope=\"col\">Field and Description</th>" 326 }, 327 {BUG_ID + FS + "pkg1" + FS + "C1.html", 328 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL + 329 "<th class=\"colLast\" scope=\"col\">Method and Description</th>" 330 }, 331 {BUG_ID + FS + "pkg2" + FS + "C2.html", 332 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL + 333 "<th class=\"colLast\" scope=\"col\">Class and Description</th>" 334 }, 335 {BUG_ID + FS + "pkg2" + FS + "C2.html", 336 "<th class=\"colOne\" scope=\"col\">Constructor and Description</th>" 337 }, 338 {BUG_ID + FS + "pkg2" + FS + "C2.ModalExclusionType.html", 339 "<th class=\"colOne\" scope=\"col\">Enum Constant and Description</th>" 340 }, 341 {BUG_ID + FS + "pkg2" + FS + "C3.html", 342 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL + 343 "<th class=\"colLast\" scope=\"col\">Required Element and Description</th>" 344 }, 345 {BUG_ID + FS + "pkg2" + FS + "C4.html", 346 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL + 347 "<th class=\"colLast\" scope=\"col\">Optional Element and Description</th>" 348 }, 349 // Class use documentation 350 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "I1.html", 351 "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL + 352 "<th class=\"colLast\" scope=\"col\">Description</th>" 353 }, 354 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html", 355 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL + 356 "<th class=\"colLast\" scope=\"col\">Field and Description</th>" 357 }, 358 {BUG_ID + FS + "pkg1" + FS + "class-use" + FS + "C1.html", 359 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL + 360 "<th class=\"colLast\" scope=\"col\">Method and Description</th>" 361 }, 362 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.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 + "pkg2" + FS + "class-use" + FS + "C2.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.ModalExclusionType.html", 371 "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL + 372 "<th class=\"colLast\" scope=\"col\">Description</th>" 373 }, 374 {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "C2.ModalExclusionType.html", 375 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>" + NL + 376 "<th class=\"colLast\" scope=\"col\">Method and Description</th>" 377 }, 378 // Package use documentation 379 {BUG_ID + FS + "pkg1" + FS + "package-use.html", 380 "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL + 381 "<th class=\"colLast\" scope=\"col\">Description</th>" 382 }, 383 {BUG_ID + FS + "pkg1" + FS + "package-use.html", 384 "<th class=\"colOne\" scope=\"col\">Class and Description</th>" 385 }, 386 {BUG_ID + FS + "pkg2" + FS + "package-use.html", 387 "<th class=\"colFirst\" scope=\"col\">Package</th>" + NL + 388 "<th class=\"colLast\" scope=\"col\">Description</th>" 389 }, 390 {BUG_ID + FS + "pkg2" + FS + "package-use.html", 391 "<th class=\"colOne\" scope=\"col\">Class and Description</th>" 392 }, 393 // Deprecated 394 {BUG_ID + FS + "deprecated-list.html", 395 "<th class=\"colOne\" scope=\"col\">Field and Description</th>" 396 }, 397 {BUG_ID + FS + "deprecated-list.html", 398 "<th class=\"colOne\" scope=\"col\">Method and Description</th>" 399 }, 400 // Constant values 401 {BUG_ID + FS + "constant-values.html", 402 "<th class=\"colFirst\" scope=\"col\">" + 403 "Modifier and Type</th>" + NL + "<th" + 404 " scope=\"col\">Constant Field</th>" + NL + 405 "<th class=\"colLast\" scope=\"col\">Value</th>" 406 }, 407 // Overview Summary 408 {BUG_ID + FS + "overview-summary.html", 409 "<th class=\"colFirst\" scope=\"col\">" + 410 "Package</th>" + NL + "<th class=\"colLast\" scope=\"col\"" + 411 ">Description</th>" 412 } 413 }; 414 private static final String[][] NEGATED_TEST = NO_TEST; 415 416 /** 417 * The entry point of the test. 418 * @param args the array of command line arguments. 419 */ 420 public static void main(String[] args) { 421 TestHtmlTableTags tester = new TestHtmlTableTags(); 422 run(tester, ARGS, TABLE_TAGS_TEST, NEGATED_TEST); 423 tester.printSummary(); 424 } 425 426 /** 427 * {@inheritDoc} 428 */ 429 public String getBugId() { 430 return BUG_ID; 431 } 432 433 /** 434 * {@inheritDoc} 435 */ 436 public String getBugName() { 437 return getClass().getName(); 438 } 439} 440