1/* 2 * Copyright (c) 2015, 2017, 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 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881 8181622 8182263 27 * @summary Test the search feature of javadoc. 28 * @author bpatel 29 * @library ../lib 30 * @modules jdk.javadoc/jdk.javadoc.internal.tool 31 * @build JavadocTester 32 * @run main TestSearch 33 */ 34public class TestSearch extends JavadocTester { 35 36 public static void main(String... args) throws Exception { 37 TestSearch tester = new TestSearch(); 38 tester.runTests(); 39 } 40 41 @Test 42 void test1() { 43 javadoc("-d", "out-1", "-sourcepath", "-use", testSrc("UnnamedPkgClass.java")); 44 checkExit(Exit.OK); 45 checkSearchOutput("UnnamedPkgClass.html", true); 46 checkJqueryAndImageFiles(true); 47 checkSearchJS(); 48 checkFiles(false, 49 "package-search-index.zip", 50 "tag-search-index.zip", 51 "package-search-index.js", 52 "tag-search-index.js"); 53 checkFiles(true, 54 "member-search-index.zip", 55 "type-search-index.zip", 56 "member-search-index.js", 57 "type-search-index.js"); 58 } 59 60 @Test 61 void test2() { 62 javadoc("-d", "out-2", "-Xdoclint:none", "-sourcepath", testSrc, 63 "-use", "pkg", "pkg1", "pkg2", "pkg3"); 64 checkExit(Exit.OK); 65 checkInvalidUsageIndexTag(); 66 checkSearchOutput(true); 67 checkSingleIndex(true); 68 checkSingleIndexSearchTagDuplication(); 69 checkJqueryAndImageFiles(true); 70 checkSearchJS(); 71 checkFiles(true, 72 "member-search-index.zip", 73 "package-search-index.zip", 74 "tag-search-index.zip", 75 "type-search-index.zip", 76 "member-search-index.js", 77 "package-search-index.js", 78 "tag-search-index.js", 79 "type-search-index.js"); 80 } 81 82 @Test 83 void test2a() { 84 javadoc("-d", "out-2a", "-Xdoclint:all", "-sourcepath", testSrc, 85 "-use", "pkg", "pkg1", "pkg2", "pkg3"); 86 checkExit(Exit.ERROR); 87 checkDocLintErrors(); 88 checkSearchOutput(true); 89 checkSingleIndex(true); 90 checkSingleIndexSearchTagDuplication(); 91 checkJqueryAndImageFiles(true); 92 checkSearchJS(); 93 checkFiles(true, 94 "member-search-index.zip", 95 "package-search-index.zip", 96 "tag-search-index.zip", 97 "type-search-index.zip", 98 "member-search-index.js", 99 "package-search-index.js", 100 "tag-search-index.js", 101 "type-search-index.js"); 102 } 103 104 @Test 105 void test3() { 106 javadoc("-d", "out-3", "-noindex", "-Xdoclint:none", 107 "-sourcepath", testSrc, 108 "-use", "pkg", "pkg1", "pkg2", "pkg3"); 109 checkExit(Exit.OK); 110 checkSearchOutput(false); 111 checkJqueryAndImageFiles(false); 112 checkFiles(false, 113 "member-search-index.zip", 114 "package-search-index.zip", 115 "tag-search-index.zip", 116 "type-search-index.zip", 117 "member-search-index.js", 118 "package-search-index.js", 119 "tag-search-index.js", 120 "type-search-index.js", 121 "index-all.html"); 122 } 123 124 @Test 125 void test4() { 126 javadoc("-d", "out-4", "-html5", "-Xdoclint:none", 127 "-sourcepath", testSrc, 128 "-use", "pkg", "pkg1", "pkg2", "pkg3"); 129 checkExit(Exit.OK); 130 checkSearchOutput(true); 131 checkSingleIndex(true); 132 checkSingleIndexSearchTagDuplication(); 133 checkJqueryAndImageFiles(true); 134 checkSearchJS(); 135 checkFiles(true, 136 "member-search-index.zip", 137 "package-search-index.zip", 138 "tag-search-index.zip", 139 "type-search-index.zip", 140 "member-search-index.js", 141 "package-search-index.js", 142 "tag-search-index.js", 143 "type-search-index.js"); 144 } 145 146 @Test 147 void test5() { 148 javadoc("-d", "out-5", "-noindex", "-html5", "-Xdoclint:none", 149 "-sourcepath", testSrc, 150 "-use", "pkg", "pkg1", "pkg2", "pkg3"); 151 checkExit(Exit.OK); 152 checkSearchOutput(false); 153 checkJqueryAndImageFiles(false); 154 checkFiles(false, 155 "member-search-index.zip", 156 "package-search-index.zip", 157 "tag-search-index.zip", 158 "type-search-index.zip", 159 "member-search-index.js", 160 "package-search-index.js", 161 "tag-search-index.js", 162 "type-search-index.js", 163 "index-all.html"); 164 } 165 166 @Test 167 void test6() { 168 javadoc("-d", "out-6", "-nocomment", "-Xdoclint:none", 169 "-sourcepath", testSrc, 170 "-use", "pkg", "pkg1", "pkg2", "pkg3"); 171 checkExit(Exit.OK); 172 checkSearchOutput(true); 173 checkIndexNoComment(); 174 checkJqueryAndImageFiles(true); 175 checkSearchJS(); 176 checkFiles(true, 177 "member-search-index.zip", 178 "package-search-index.zip", 179 "tag-search-index.zip", 180 "type-search-index.zip", 181 "member-search-index.js", 182 "package-search-index.js", 183 "tag-search-index.js", 184 "type-search-index.js"); 185 } 186 187 @Test 188 void test7() { 189 javadoc("-d", "out-7", "-nodeprecated", "-Xdoclint:none", 190 "-sourcepath", testSrc, 191 "-use", "pkg", "pkg1", "pkg2", "pkg3"); 192 checkExit(Exit.OK); 193 checkSearchOutput(true); 194 checkIndexNoDeprecated(); 195 checkJqueryAndImageFiles(true); 196 checkSearchJS(); 197 checkFiles(true, 198 "member-search-index.zip", 199 "package-search-index.zip", 200 "tag-search-index.zip", 201 "type-search-index.zip", 202 "member-search-index.js", 203 "package-search-index.js", 204 "tag-search-index.js", 205 "type-search-index.js"); 206 } 207 208 @Test 209 void test8() { 210 javadoc("-d", "out-8", "-splitindex", "-Xdoclint:none", "-sourcepath", testSrc, 211 "-use", "pkg", "pkg1", "pkg2", "pkg3"); 212 checkExit(Exit.OK); 213 checkInvalidUsageIndexTag(); 214 checkSearchOutput(true); 215 checkSplitIndex(); 216 checkSplitIndexSearchTagDuplication(); 217 checkJqueryAndImageFiles(true); 218 checkSearchJS(); 219 checkFiles(true, 220 "member-search-index.zip", 221 "package-search-index.zip", 222 "tag-search-index.zip", 223 "type-search-index.zip", 224 "member-search-index.js", 225 "package-search-index.js", 226 "tag-search-index.js", 227 "type-search-index.js"); 228 } 229 230 @Test 231 void test9() { 232 javadoc("-d", "out-9", "-sourcepath", testSrc, "-javafx", "-package", 233 "-use", "pkgfx", "pkg3"); 234 checkExit(Exit.OK); 235 checkSearchOutput(true); 236 checkJavaFXOutput(); 237 checkJqueryAndImageFiles(true); 238 checkSearchJS(); 239 checkFiles(false, 240 "tag-search-index.zip", 241 "tag-search-index.js"); 242 checkFiles(true, 243 "member-search-index.zip", 244 "package-search-index.zip", 245 "type-search-index.zip", 246 "member-search-index.js", 247 "package-search-index.js", 248 "type-search-index.js"); 249 } 250 251 void checkDocLintErrors() { 252 checkOutput(Output.OUT, true, 253 "A sample method. Testing search tag for {@index \"unclosed quote}.", 254 "Another test class. Testing empty {@index }.", 255 "Constant field. Testing no text in index tag {@index}.", 256 "A test field. Testing only white-spaces in index tag text {@index }."); 257 } 258 259 void checkSearchOutput(boolean expectedOutput) { 260 checkSearchOutput("overview-summary.html", expectedOutput); 261 } 262 263 void checkSearchOutput(String fileName, boolean expectedOutput) { 264 // Test for search related markup 265 checkOutput(fileName, expectedOutput, 266 "<link rel=\"stylesheet\" type=\"text/css\" href=\"jquery/jquery-ui.css\" title=\"Style\">\n", 267 "<script type=\"text/javascript\" src=\"jquery/jszip/dist/jszip.min.js\"></script>\n", 268 "<script type=\"text/javascript\" src=\"jquery/jszip-utils/dist/jszip-utils.min.js\"></script>\n", 269 "<!--[if IE]>\n", 270 "<script type=\"text/javascript\" src=\"jquery/jszip-utils/dist/jszip-utils-ie.min.js\"></script>\n", 271 "<![endif]-->\n", 272 "<script type=\"text/javascript\" src=\"jquery/jquery-1.10.2.js\"></script>\n", 273 "<script type=\"text/javascript\" src=\"jquery/jquery-ui.js\"></script>", 274 "var pathtoroot = \"./\";loadScripts(document, 'script');", 275 "<ul class=\"navListSearch\">\n", 276 "<li><label for=\"search\">SEARCH:</label>\n" 277 + "<input type=\"text\" id=\"search\" value=\"search\" disabled=\"disabled\">\n" 278 + "<input type=\"reset\" id=\"reset\" value=\"reset\" disabled=\"disabled\">\n"); 279 checkOutput(fileName, true, 280 "<div class=\"fixedNav\">"); 281 } 282 283 void checkSingleIndex(boolean expectedOutput) { 284 // Test for search tags markup in index file. 285 checkOutput("index-all.html", expectedOutput, 286 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">" 287 + "phrase with spaces</a></span> - Search tag in pkg</dt>", 288 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg\">" 289 + "pkg</a></span> - Search tag in pkg</dt>", 290 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg2.5\">" 291 + "pkg2.5</a></span> - Search tag in pkg</dt>", 292 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#r\">" 293 + "r</a></span> - Search tag in pkg</dt>", 294 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">" 295 + "search phrase</a></span> - Search tag in pkg1.RegClass</dt>", 296 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">" 297 + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>", 298 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">" 299 + "search phrase with desc deprecated</a></span> - Search tag in pkg2.TestAnnotationType</dt>", 300 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestClass.html#SearchTagDeprecatedClass\">" 301 + "SearchTagDeprecatedClass</a></span> - Search tag in pkg2.TestClass</dt>", 302 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">" 303 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>", 304 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">" 305 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>", 306 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">" 307 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>", 308 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">" 309 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>", 310 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#SingleWord\">" 311 + "SingleWord</a></span> - Search tag in pkg</dt>", 312 "<dt><span class=\"searchTagLink\"><a href=\"pkg/AnotherClass.ModalExclusionType.html" 313 + "#nested%7B@indexnested_tag_test%7D\">nested {@index nested_tag_test}</a></span> - " 314 + "Search tag in pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE</dt>", 315 "<dt><span class=\"searchTagLink\"><a href=\"pkg/AnotherClass.ModalExclusionType.html" 316 + "#html-span-see-/span-\">html <span> see </span></a></span> - Search " 317 + "tag in pkg.AnotherClass.ModalExclusionType.APPLICATION_EXCLUDE</dt>", 318 "<dt><span class=\"searchTagLink\"><a href=\"pkg/AnotherClass.html#quoted\">quoted</a>" 319 + "</span> - Search tag in pkg.AnotherClass.CONSTANT1</dt>", 320 "<dt><span class=\"memberNameLink\"><a href=\"pkg2/TestEnum.html#ONE\">ONE</a></span> - " 321 + "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>", 322 "<dt><span class=\"memberNameLink\"><a href=\"pkg2/TestEnum.html#THREE\">THREE</a></span> - " 323 + "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>", 324 "<dt><span class=\"memberNameLink\"><a href=\"pkg2/TestEnum.html#TWO\">TWO</a></span> - " 325 + "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>"); 326 checkOutput("index-all.html", true, 327 "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag" 328 + " <a id=\"SearchTagDeprecatedClass\" class=\"searchTagResult\">SearchTagDeprecatedClass</a></span></div>", 329 "<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n" 330 + " method <a id=\"SearchTagDeprecatedMethod\" class=\"searchTagResult\">SearchTagDeprecatedMethod</a></span></div>"); 331 } 332 333 void checkSplitIndex() { 334 // Test for search tags markup in split index file. 335 checkOutput("index-files/index-13.html", true, 336 "<dt><span class=\"searchTagLink\"><a href=\"../pkg1/RegClass.html#searchphrase\">" 337 + "search phrase</a></span> - Search tag in pkg1.RegClass</dt>", 338 "<dt><span class=\"searchTagLink\"><a href=\"../pkg1/RegClass.html#SearchWordWithDescription\">" 339 + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>", 340 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">" 341 + "search phrase with desc deprecated</a></span> - Search tag in pkg2.TestAnnotationType</dt>", 342 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestClass.html#SearchTagDeprecatedClass\">" 343 + "SearchTagDeprecatedClass</a></span> - Search tag in pkg2.TestClass</dt>", 344 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestEnum.html#searchphrasedeprecated\">" 345 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>", 346 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestEnum.html#searchphrasedeprecated\">" 347 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>", 348 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">" 349 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>", 350 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">" 351 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>", 352 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#SingleWord\">" 353 + "SingleWord</a></span> - Search tag in pkg</dt>"); 354 checkOutput("index-files/index-10.html", true, 355 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#phrasewithspaces\">" 356 + "phrase with spaces</a></span> - Search tag in pkg</dt>", 357 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#pkg\">" 358 + "pkg</a></span> - Search tag in pkg</dt>", 359 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#pkg2.5\">" 360 + "pkg2.5</a></span> - Search tag in pkg</dt>"); 361 checkOutput("index-files/index-12.html", true, 362 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#r\">" 363 + "r</a></span> - Search tag in pkg</dt>"); 364 checkOutput("index-files/index-8.html", true, 365 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/AnotherClass.ModalExclusionType.html" 366 + "#nested%7B@indexnested_tag_test%7D\">nested {@index nested_tag_test}</a></span> - " 367 + "Search tag in pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE</dt>"); 368 checkOutput("index-files/index-5.html", true, 369 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/AnotherClass.ModalExclusionType.html" 370 + "#html-span-see-/span-\">html <span> see </span></a></span> - Search " 371 + "tag in pkg.AnotherClass.ModalExclusionType.APPLICATION_EXCLUDE</dt>"); 372 checkOutput("index-files/index-11.html", true, 373 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/AnotherClass.html#quoted\">quoted</a>" 374 + "</span> - Search tag in pkg.AnotherClass.CONSTANT1</dt>"); 375 checkOutput("index-files/index-9.html", true, 376 "<dt><span class=\"memberNameLink\"><a href=\"../pkg2/TestEnum.html#ONE\">ONE</a>" 377 + "</span> - pkg2.<a href=\"../pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>"); 378 checkOutput("index-files/index-14.html", true, 379 "<dt><span class=\"memberNameLink\"><a href=\"../pkg2/TestEnum.html#THREE\">THREE</a></span> - " 380 + "pkg2.<a href=\"../pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>", 381 "<dt><span class=\"memberNameLink\"><a href=\"../pkg2/TestEnum.html#TWO\">TWO</a></span> - " 382 + "pkg2.<a href=\"../pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>"); 383 } 384 385 void checkIndexNoComment() { 386 // Test for search tags markup in index file when javadoc is executed with -nocomment. 387 checkOutput("index-all.html", false, 388 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">" 389 + "phrase with spaces</a></span> - Search tag in pkg</dt>", 390 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg\">" 391 + "pkg</a></span> - Search tag in pkg</dt>", 392 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg2.5\">" 393 + "pkg2.5</a></span> - Search tag in pkg</dt>", 394 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#r\">" 395 + "r</a></span> - Search tag in pkg</dt>", 396 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">" 397 + "search phrase</a></span> - Search tag in pkg1.RegClass</dt>", 398 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">" 399 + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>", 400 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">" 401 + "search phrase with desc deprecated</a></span> - Search tag in pkg2.TestAnnotationType</dt>", 402 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestClass.html#SearchTagDeprecatedClass\">" 403 + "SearchTagDeprecatedClass</a></span> - Search tag in pkg2.TestClass</dt>", 404 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#SingleWord\">" 405 + "SingleWord</a></span> - Search tag in pkg</dt>", 406 "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag" 407 + " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></span></div>", 408 "<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n" 409 + " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></span></div>"); 410 checkOutput("index-all.html", true, 411 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">" 412 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>", 413 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">" 414 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>"); 415 } 416 417 void checkIndexNoDeprecated() { 418 // Test for search tags markup in index file when javadoc is executed using -nodeprecated. 419 checkOutput("index-all.html", true, 420 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">" 421 + "phrase with spaces</a></span> - Search tag in pkg</dt>", 422 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">" 423 + "search phrase</a></span> - Search tag in pkg1.RegClass</dt>", 424 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">" 425 + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>", 426 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#SingleWord\">" 427 + "SingleWord</a></span> - Search tag in pkg</dt>"); 428 checkOutput("index-all.html", false, 429 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">" 430 + "search phrase with desc deprecated</a></span> - Search tag in pkg2.TestAnnotationType</dt>", 431 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestClass.html#SearchTagDeprecatedClass\">" 432 + "SearchTagDeprecatedClass</a></span> - Search tag in pkg2.TestClass</dt>", 433 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">" 434 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>", 435 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">" 436 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>", 437 "<div class=\"block\"><span class=\"deprecationComment\">class_test1 passes. Search tag" 438 + " <a id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</a></span></div>", 439 "<div class=\"block\"><span class=\"deprecationComment\">error_test3 passes. Search tag for\n" 440 + " method <a id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</a></span></div>"); 441 } 442 443 void checkJavaFXOutput() { 444 checkOutput("index-all.html", false, "test treat as private"); 445 } 446 447 void checkInvalidUsageIndexTag() { 448 checkOutput(Output.OUT, true, 449 "AnotherClass.java:29: warning - invalid usage of tag {@index", 450 "AnotherClass.java:41: warning - invalid usage of tag {@index", 451 "AnotherClass.java:36: warning - invalid usage of tag {@index", 452 "AnotherClass.java:70: warning - invalid usage of tag {@index"); 453 } 454 455 void checkJqueryAndImageFiles(boolean expectedOutput) { 456 checkFiles(expectedOutput, 457 "search.js", 458 "jquery/jquery-1.10.2.js", 459 "jquery/jquery-ui.js", 460 "jquery/jquery-ui.css", 461 "jquery/jquery-ui.min.js", 462 "jquery/jquery-ui.min.css", 463 "jquery/jquery-ui.structure.min.css", 464 "jquery/jquery-ui.structure.css", 465 "jquery/external/jquery/jquery.js", 466 "jquery/jszip/dist/jszip.js", 467 "jquery/jszip/dist/jszip.min.js", 468 "jquery/jszip-utils/dist/jszip-utils.js", 469 "jquery/jszip-utils/dist/jszip-utils.min.js", 470 "jquery/jszip-utils/dist/jszip-utils-ie.js", 471 "jquery/jszip-utils/dist/jszip-utils-ie.min.js", 472 "jquery/images/ui-bg_flat_0_aaaaaa_40x100.png", 473 "jquery/images/ui-icons_454545_256x240.png", 474 "jquery/images/ui-bg_glass_95_fef1ec_1x400.png", 475 "jquery/images/ui-bg_glass_75_dadada_1x400.png", 476 "jquery/images/ui-bg_highlight-soft_75_cccccc_1x100.png", 477 "jquery/images/ui-icons_888888_256x240.png", 478 "jquery/images/ui-icons_2e83ff_256x240.png", 479 "jquery/images/ui-bg_glass_65_ffffff_1x400.png", 480 "jquery/images/ui-icons_cd0a0a_256x240.png", 481 "jquery/images/ui-bg_glass_55_fbf9ee_1x400.png", 482 "jquery/images/ui-icons_222222_256x240.png", 483 "jquery/images/ui-bg_glass_75_e6e6e6_1x400.png", 484 "jquery/images/ui-bg_flat_75_ffffff_40x100.png", 485 "resources/x.png", 486 "resources/glass.png"); 487 } 488 489 void checkSearchJS() { 490 checkOutput("search.js", true, 491 "camelCaseRegexp = ($.ui.autocomplete.escapeRegex(request.term)).split(/(?=[A-Z])/).join(\"([a-z0-9_$]*?)\");", 492 "var camelCaseMatcher = new RegExp(\"^\" + camelCaseRegexp);", 493 "camelCaseMatcher.test(item.l)", 494 "var secondaryresult = new Array();", 495 "function nestedName(e) {", 496 "function sortAndConcatResults(a1, a2) {", 497 "if (exactMatcher.test(item.l)) {\n" 498 + " presult.unshift(item);", 499 "$(\"#search\").on('click keydown', function() {\n" 500 + " if ($(this).val() == watermark) {\n" 501 + " $(this).val('').removeClass('watermark');\n" 502 + " }\n" 503 + " });"); 504 } 505 506 void checkSingleIndexSearchTagDuplication() { 507 // Test for search tags duplication in index file. 508 checkOutput("index-all.html", true, 509 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">" 510 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>\n" 511 + "<dd>with description</dd>"); 512 checkOutput("index-all.html", false, 513 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">" 514 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>\n" 515 + "<dd>with description</dd>\n" 516 + "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">" 517 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>\n" 518 + "<dd>with description</dd>"); 519 } 520 521 void checkSplitIndexSearchTagDuplication() { 522 // Test for search tags duplication in index file. 523 checkOutput("index-files/index-13.html", true, 524 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">" 525 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>\n" 526 + "<dd>with description</dd>"); 527 checkOutput("index-files/index-13.html", false, 528 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">" 529 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>\n" 530 + "<dd>with description</dd>\n" 531 + "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">" 532 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError</dt>\n" 533 + "<dd>with description</dd>"); 534 } 535} 536