1 /*
   2  * Copyright (c) 2015, 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 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881
  27  *      8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202
  28  *      8184205 8214468 8222548 8223378 8234746
  29  * @summary Test the search feature of javadoc.
  30  * @library ../../lib
  31  * @modules jdk.javadoc/jdk.javadoc.internal.tool
  32  * @build javadoc.tester.*
  33  * @run main TestSearch
  34  */
  35 import javadoc.tester.JavadocTester;
  36 
  37 public class TestSearch extends JavadocTester {
  38 
  39     public static void main(String... args) throws Exception {
  40         TestSearch tester = new TestSearch();
  41         tester.runTests();
  42     }
  43 
  44     @Test
  45     public void test1() {
  46         javadoc("-d", "out-1",
  47                 "-sourcepath",
  48                 "-use",
  49                 testSrc("UnnamedPkgClass.java"));
  50         checkExit(Exit.OK);
  51         checkSearchOutput("UnnamedPkgClass.html", true, true);
  52         checkJqueryAndImageFiles(true);
  53         checkSearchJS();
  54         checkFiles(false,
  55                 "tag-search-index.js");
  56         checkFiles(true,
  57                 "package-search-index.js",
  58                 "member-search-index.js",
  59                 "type-search-index.js");
  60     }
  61 
  62     @Test
  63     public void test2() {
  64         javadoc("-d", "out-2",
  65                 "-Xdoclint:none",
  66                 "-sourcepath", testSrc,
  67                 "-use",
  68                 "pkg", "pkg1", "pkg2", "pkg3");
  69         checkExit(Exit.OK);
  70         checkInvalidUsageIndexTag();
  71         checkSearchOutput(true);
  72         checkSingleIndex(true, true);
  73         checkSingleIndexSearchTagDuplication();
  74         checkJqueryAndImageFiles(true);
  75         checkSearchJS();
  76         checkAllPkgsAllClasses();
  77         checkFiles(true,
  78                 "member-search-index.js",
  79                 "package-search-index.js",
  80                 "tag-search-index.js",
  81                 "type-search-index.js");
  82     }
  83 
  84     @Test
  85     public void test2a() {
  86         javadoc("-d", "out-2a",
  87                 "-Xdoclint:all",
  88                 "-sourcepath", testSrc,
  89                 "-use",
  90                 "pkg", "pkg1", "pkg2", "pkg3");
  91         checkExit(Exit.ERROR);
  92         checkDocLintErrors();
  93         checkSearchOutput(true);
  94         checkSingleIndex(true, true);
  95         checkSingleIndexSearchTagDuplication();
  96         checkJqueryAndImageFiles(true);
  97         checkSearchJS();
  98         checkFiles(true,
  99                 "member-search-index.js",
 100                 "package-search-index.js",
 101                 "tag-search-index.js",
 102                 "type-search-index.js");
 103     }
 104 
 105     @Test
 106     public void test3() {
 107         javadoc("-d", "out-3",
 108                 "-noindex",
 109                 "-Xdoclint:none",
 110                 "-sourcepath", testSrc,
 111                 "-use",
 112                 "pkg", "pkg1", "pkg2", "pkg3");
 113         checkExit(Exit.OK);
 114         checkSearchOutput(false);
 115         checkJqueryAndImageFiles(false);
 116         checkFiles(false,
 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                 "allpackages-index.html",
 123                 "allclasses-index.html");
 124     }
 125 
 126     @Test
 127     public void test4() {
 128         javadoc("-d", "out-4",
 129                 "-html5",
 130                 "-Xdoclint:none",
 131                 "-sourcepath", testSrc,
 132                 "-use",
 133                 "pkg", "pkg1", "pkg2", "pkg3");
 134         checkExit(Exit.OK);
 135         checkSearchOutput(true);
 136         checkSingleIndex(true, true);
 137         checkSingleIndexSearchTagDuplication();
 138         checkJqueryAndImageFiles(true);
 139         checkSearchJS();
 140         checkFiles(true,
 141                 "member-search-index.js",
 142                 "package-search-index.js",
 143                 "tag-search-index.js",
 144                 "type-search-index.js");
 145     }
 146 
 147     @Test
 148     public void test5() {
 149         javadoc("-d", "out-5",
 150                 "-html5",
 151                 "-noindex",
 152                 "-Xdoclint:none",
 153                 "-sourcepath", testSrc,
 154                 "-use",
 155                 "pkg", "pkg1", "pkg2", "pkg3");
 156         checkExit(Exit.OK);
 157         checkSearchOutput(false);
 158         checkJqueryAndImageFiles(false);
 159         checkFiles(false,
 160                 "member-search-index.js",
 161                 "package-search-index.js",
 162                 "tag-search-index.js",
 163                 "type-search-index.js",
 164                 "index-all.html");
 165     }
 166 
 167     @Test
 168     public void test6() {
 169         javadoc("-d", "out-6",
 170                 "-nocomment",
 171                 "-Xdoclint:none",
 172                 "-sourcepath", testSrc,
 173                 "-use",
 174                 "pkg", "pkg1", "pkg2", "pkg3");
 175         checkExit(Exit.OK);
 176         checkSearchOutput(true);
 177         checkIndexNoComment();
 178         checkJqueryAndImageFiles(true);
 179         checkSearchJS();
 180         checkFiles(true,
 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     public void test7() {
 189         javadoc("-d", "out-7",
 190                 "-nodeprecated",
 191                 "-Xdoclint:none",
 192                 "-sourcepath", testSrc,
 193                 "-use",
 194                 "pkg", "pkg1", "pkg2", "pkg3");
 195 
 196         checkExit(Exit.OK);
 197         checkSearchOutput(true);
 198         checkIndexNoDeprecated();
 199         checkJqueryAndImageFiles(true);
 200         checkSearchJS();
 201         checkFiles(true,
 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     public void test8() {
 210         javadoc("-d", "out-8",
 211                 "-splitindex",
 212                 "-Xdoclint:none",
 213                 "-sourcepath", testSrc,
 214                 "-use",
 215                 "pkg", "pkg1", "pkg2", "pkg3");
 216         checkExit(Exit.OK);
 217         checkInvalidUsageIndexTag();
 218         checkSearchOutput(true);
 219         checkSplitIndex();
 220         checkSplitIndexSearchTagDuplication();
 221         checkJqueryAndImageFiles(true);
 222         checkSearchJS();
 223         checkFiles(true,
 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     public void test9() {
 232         javadoc("-d", "out-9",
 233                 "-sourcepath", testSrc,
 234                 "-javafx",
 235                 "--disable-javafx-strict-checks",
 236                 "-package",
 237                 "-use",
 238                 "pkgfx", "pkg3");
 239         checkExit(Exit.OK);
 240         checkSearchOutput(true);
 241         checkJavaFXOutput();
 242         checkJqueryAndImageFiles(true);
 243         checkSearchJS();
 244         checkFiles(false,
 245                 "tag-search-index.js");
 246         checkFiles(true,
 247                 "member-search-index.js",
 248                 "package-search-index.js",
 249                 "type-search-index.js");
 250     }
 251 
 252     @Test
 253     public void testURLEncoding() {
 254         javadoc("-d", "out-encode-html5",
 255                 "-Xdoclint:none",
 256                 "-sourcepath", testSrc,
 257                 "-use",
 258                 "pkg", "pkg1", "pkg2", "pkg3");
 259         checkExit(Exit.OK);
 260         checkSearchJS();
 261         checkSearchIndex(true);
 262     }
 263 
 264     @Test
 265     public void testJapaneseLocale() {
 266         javadoc("-locale", "ja_JP",
 267                 "-d", "out-jp",
 268                 "-Xdoclint:none",
 269                 "-sourcepath", testSrc,
 270                 "-use",
 271                 "pkg", "pkg1", "pkg2", "pkg3");
 272         checkExit(Exit.OK);
 273         checkOutput(Output.OUT, true,
 274                 "\u30d1\u30c3\u30b1\u30fc\u30b8pkg\u306e\u30bd\u30fc\u30b9\u30fb\u30d5\u30a1" +
 275                         "\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059...\n",
 276                 "\u30d1\u30c3\u30b1\u30fc\u30b8pkg1\u306e\u30bd\u30fc\u30b9\u30fb\u30d5\u30a1" +
 277                         "\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3044\u307e\u3059...\n");
 278         checkSearchJS();
 279         checkSearchIndex(true);
 280     }
 281 
 282     @Test
 283     public void testChineseLocale() {
 284         javadoc("-locale", "zh_CN",
 285                 "-d", "out-cn",
 286                 "-Xdoclint:none",
 287                 "-sourcepath", testSrc,
 288                 "-use",
 289                 "pkg", "pkg1", "pkg2", "pkg3");
 290         checkExit(Exit.OK);
 291         checkOutput(Output.OUT, true,
 292                 "\u6b63\u5728\u52a0\u8f7d\u7a0b\u5e8f\u5305pkg\u7684\u6e90\u6587\u4ef6...\n",
 293                 "\u6b63\u5728\u52a0\u8f7d\u7a0b\u5e8f\u5305pkg1\u7684\u6e90\u6587\u4ef6...\n",
 294                 "\u6b63\u5728\u52a0\u8f7d\u7a0b\u5e8f\u5305pkg2\u7684\u6e90\u6587\u4ef6...\n",
 295                 "\u6b63\u5728\u52a0\u8f7d\u7a0b\u5e8f\u5305pkg3\u7684\u6e90\u6587\u4ef6...\n");
 296         checkSearchJS();
 297         checkSearchIndex(true);
 298     }
 299 
 300     void checkDocLintErrors() {
 301         checkOutput(Output.OUT, true,
 302                 "A sample method. Testing search tag for {@index \"unclosed quote}.",
 303                 "Another test class. Testing empty {@index }.",
 304                 "Constant field. Testing no text in index tag {@index}.",
 305                 "A test field. Testing only white-spaces in index tag text {@index       }.");
 306     }
 307 
 308     void checkSearchOutput(boolean expectedOutput) {
 309         checkSearchOutput("index.html", expectedOutput, true);
 310     }
 311 
 312     void checkSearchIndex(boolean expectedOutput) {
 313         checkOutput("member-search-index.js", expectedOutput,
 314                 "{\"p\":\"pkg\",\"c\":\"AnotherClass\",\"l\":\"AnotherClass()\",\"url\":\"%3Cinit%3E()\"}",
 315                 "{\"p\":\"pkg1\",\"c\":\"RegClass\",\"l\":\"RegClass()\",\"url\":\"%3Cinit%3E()\"}",
 316                 "{\"p\":\"pkg2\",\"c\":\"TestError\",\"l\":\"TestError()\",\"url\":\"%3Cinit%3E()\"}",
 317                 "{\"p\":\"pkg\",\"c\":\"AnotherClass\",\"l\":\"method(byte[], int, String)\",\"url\":\"method(byte[],int,java.lang.String)\"}");
 318         checkOutput("member-search-index.js", !expectedOutput,
 319                 "{\"p\":\"pkg\",\"c\":\"AnotherClass\",\"l\":\"method(RegClass)\",\"url\":\"method-pkg1.RegClass-\"}",
 320                 "{\"p\":\"pkg2\",\"c\":\"TestClass\",\"l\":\"TestClass()\",\"url\":\"TestClass--\"}",
 321                 "{\"p\":\"pkg\",\"c\":\"TestError\",\"l\":\"TestError()\",\"url\":\"TestError--\"}",
 322                 "{\"p\":\"pkg\",\"c\":\"AnotherClass\",\"l\":\"method(byte[], int, String)\",\"url\":\"method-byte:A-int-java.lang.String-\"}");
 323     }
 324 
 325     void checkSearchOutput(boolean expectedOutput, boolean moduleDirectoriesVar) {
 326         checkSearchOutput("index.html", expectedOutput, moduleDirectoriesVar);
 327     }
 328 
 329     void checkSearchOutput(String fileName, boolean expectedOutput, boolean moduleDirectoriesVar) {
 330         // Test for search related markup
 331         checkOutput(fileName, expectedOutput,
 332                 "<link rel=\"stylesheet\" type=\"text/css\" href=\"script-dir/jquery-ui.css\" title=\"Style\">\n",
 333                 "<script type=\"text/javascript\" src=\"script-dir/jquery-3.4.1.js\"></script>\n",
 334                 "<script type=\"text/javascript\" src=\"script-dir/jquery-ui.js\"></script>",
 335                 "var pathtoroot = \"./\";\n"
 336                 + "loadScripts(document, 'script');",
 337                 "<div class=\"navListSearch\">",
 338                 "<label for=\"search\">SEARCH:</label>\n"
 339                 + "<input type=\"text\" id=\"search\" value=\"search\" disabled=\"disabled\">\n"
 340                 + "<input type=\"reset\" id=\"reset\" value=\"reset\" disabled=\"disabled\">\n");
 341         checkOutput(fileName, true,
 342                 "<div class=\"flexBox\">");
 343     }
 344 
 345     void checkSingleIndex(boolean expectedOutput, boolean html5) {
 346         String html_span_see_span = html5 ? "html%3Cspan%3Esee%3C/span%3E" : "html-span-see-/span-";
 347 
 348         // Test for search tags markup in index file.
 349         checkOutput("index-all.html", expectedOutput,
 350                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">"
 351                 + "phrase with spaces</a></span> - Search tag in package pkg</dt>",
 352                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg\">"
 353                 + "pkg</a></span> - Search tag in package pkg</dt>",
 354                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg2.5\">"
 355                 + "pkg2.5</a></span> - Search tag in package pkg</dt>",
 356                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#r\">"
 357                 + "r</a></span> - Search tag in package pkg</dt>",
 358                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">"
 359                 + "search phrase</a></span> - Search tag in class pkg1.RegClass</dt>",
 360                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">"
 361                 + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>",
 362                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">"
 363                 + "search phrase with desc deprecated</a></span> - Search tag in annotation type pkg2.TestAnnotationType</dt>",
 364                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestClass.html#SearchTagDeprecatedClass\">"
 365                 + "SearchTagDeprecatedClass</a></span> - Search tag in class pkg2.TestClass</dt>",
 366                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">"
 367                 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>",
 368                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">"
 369                 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>",
 370                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 371                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>",
 372                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 373                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>",
 374                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#SingleWord\">"
 375                 + "SingleWord</a></span> - Search tag in package pkg</dt>",
 376                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/AnotherClass.ModalExclusionType.html"
 377                 + "#nested%7B@indexnested_tag_test%7D\">nested {@index nested_tag_test}</a></span> - "
 378                 + "Search tag in pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE</dt>",
 379                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/AnotherClass.ModalExclusionType.html"
 380                 + "#" + html_span_see_span + "\">html &lt;span&gt; see &lt;/span&gt;</a></span> - Search "
 381                 + "tag in pkg.AnotherClass.ModalExclusionType.APPLICATION_EXCLUDE</dt>",
 382                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/AnotherClass.html#quoted\">quoted</a>"
 383                 + "</span> - Search tag in pkg.AnotherClass.CONSTANT1</dt>",
 384                 "<dt><span class=\"memberNameLink\"><a href=\"pkg2/TestEnum.html#ONE\">ONE</a></span> - "
 385                 + "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>",
 386                 "<dt><span class=\"memberNameLink\"><a href=\"pkg2/TestEnum.html#THREE\">THREE</a></span> - "
 387                 + "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>",
 388                 "<dt><span class=\"memberNameLink\"><a href=\"pkg2/TestEnum.html#TWO\">TWO</a></span> - "
 389                 + "pkg2.<a href=\"pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>");
 390         checkOutput("index-all.html", true,
 391                 "<div class=\"deprecationComment\">class_test1 passes. Search tag"
 392                 + " <span id=\"SearchTagDeprecatedClass\" class=\"searchTagResult\">SearchTagDeprecatedClass</span></div>",
 393                 "<div class=\"deprecationComment\">error_test3 passes. Search tag for\n"
 394                 + " method <span id=\"SearchTagDeprecatedMethod\" class=\"searchTagResult\">SearchTagDeprecatedMethod</span></div>");
 395     }
 396 
 397     void checkSplitIndex() {
 398         // Test for search tags markup in split index file.
 399         checkOutput("index-files/index-13.html", true,
 400                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg1/RegClass.html#searchphrase\">"
 401                 + "search phrase</a></span> - Search tag in class pkg1.RegClass</dt>",
 402                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg1/RegClass.html#SearchWordWithDescription\">"
 403                 + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>",
 404                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">"
 405                 + "search phrase with desc deprecated</a></span> - Search tag in annotation type pkg2.TestAnnotationType</dt>",
 406                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestClass.html#SearchTagDeprecatedClass\">"
 407                 + "SearchTagDeprecatedClass</a></span> - Search tag in class pkg2.TestClass</dt>",
 408                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestEnum.html#searchphrasedeprecated\">"
 409                 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>",
 410                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestEnum.html#searchphrasedeprecated\">"
 411                 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>",
 412                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 413                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>",
 414                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 415                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>",
 416                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#SingleWord\">"
 417                 + "SingleWord</a></span> - Search tag in package pkg</dt>",
 418                 "<br><a href=\"../allclasses-index.html\">All&nbsp;Classes</a>"
 419                 + "<span class=\"verticalSeparator\">|</span>"
 420                 + "<a href=\"../allpackages-index.html\">All&nbsp;Packages</a>");
 421         checkOutput("index-files/index-10.html", true,
 422                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#phrasewithspaces\">"
 423                 + "phrase with spaces</a></span> - Search tag in package pkg</dt>",
 424                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#pkg\">"
 425                 + "pkg</a></span> - Search tag in package pkg</dt>",
 426                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#pkg2.5\">"
 427                 + "pkg2.5</a></span> - Search tag in package pkg</dt>");
 428         checkOutput("index-files/index-12.html", true,
 429                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/package-summary.html#r\">"
 430                 + "r</a></span> - Search tag in package pkg</dt>");
 431         checkOutput("index-files/index-8.html", true,
 432                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/AnotherClass.ModalExclusionType.html"
 433                 + "#nested%7B@indexnested_tag_test%7D\">nested {@index nested_tag_test}</a></span> - "
 434                 + "Search tag in pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE</dt>");
 435         checkOutput("index-files/index-5.html", true,
 436                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/AnotherClass.ModalExclusionType.html"
 437                 + "#html%3Cspan%3Esee%3C/span%3E\">html &lt;span&gt; see &lt;/span&gt;</a></span> - Search "
 438                 + "tag in pkg.AnotherClass.ModalExclusionType.APPLICATION_EXCLUDE</dt>");
 439         checkOutput("index-files/index-11.html", true,
 440                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg/AnotherClass.html#quoted\">quoted</a>"
 441                 + "</span> - Search tag in pkg.AnotherClass.CONSTANT1</dt>");
 442         checkOutput("index-files/index-9.html", true,
 443                 "<dt><span class=\"memberNameLink\"><a href=\"../pkg2/TestEnum.html#ONE\">ONE</a>"
 444                 + "</span> - pkg2.<a href=\"../pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>");
 445         checkOutput("index-files/index-14.html", true,
 446                 "<dt><span class=\"memberNameLink\"><a href=\"../pkg2/TestEnum.html#THREE\">THREE</a></span> - "
 447                 + "pkg2.<a href=\"../pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>",
 448                 "<dt><span class=\"memberNameLink\"><a href=\"../pkg2/TestEnum.html#TWO\">TWO</a></span> - "
 449                 + "pkg2.<a href=\"../pkg2/TestEnum.html\" title=\"enum in pkg2\">TestEnum</a></dt>");
 450     }
 451 
 452     void checkIndexNoComment() {
 453         // Test for search tags markup in index file when javadoc is executed with -nocomment.
 454         checkOutput("index-all.html", false,
 455                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">"
 456                 + "phrase with spaces</a></span> - Search tag in package pkg</dt>",
 457                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg\">"
 458                 + "pkg</a></span> - Search tag in package pkg</dt>",
 459                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#pkg2.5\">"
 460                 + "pkg2.5</a></span> - Search tag in package pkg</dt>",
 461                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#r\">"
 462                 + "r</a></span> - Search tag in package pkg</dt>",
 463                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">"
 464                 + "search phrase</a></span> - Search tag in class pkg1.RegClass</dt>",
 465                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">"
 466                 + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>",
 467                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">"
 468                 + "search phrase with desc deprecated</a></span> - Search tag in annotation type pkg2.TestAnnotationType</dt>",
 469                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestClass.html#SearchTagDeprecatedClass\">"
 470                 + "SearchTagDeprecatedClass</a></span> - Search tag in class pkg2.TestClass</dt>",
 471                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#SingleWord\">"
 472                 + "SingleWord</a></span> - Search tag in package pkg</dt>",
 473                 "<div class=\"deprecationComment\">class_test1 passes. Search tag"
 474                 + " <span id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</span></div>",
 475                 "<div class=\"deprecationComment\">error_test3 passes. Search tag for\n"
 476                 + " method <span id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</span></div>");
 477         checkOutput("index-all.html", true,
 478                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">"
 479                 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>",
 480                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 481                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>");
 482     }
 483 
 484     void checkIndexNoDeprecated() {
 485         // Test for search tags markup in index file when javadoc is executed using -nodeprecated.
 486         checkOutput("index-all.html", true,
 487                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#phrasewithspaces\">"
 488                 + "phrase with spaces</a></span> - Search tag in package pkg</dt>",
 489                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#searchphrase\">"
 490                 + "search phrase</a></span> - Search tag in class pkg1.RegClass</dt>",
 491                 "<dt><span class=\"searchTagLink\"><a href=\"pkg1/RegClass.html#SearchWordWithDescription\">"
 492                 + "SearchWordWithDescription</a></span> - Search tag in pkg1.RegClass.CONSTANT_FIELD_1</dt>",
 493                 "<dt><span class=\"searchTagLink\"><a href=\"pkg/package-summary.html#SingleWord\">"
 494                 + "SingleWord</a></span> - Search tag in package pkg</dt>");
 495         checkOutput("index-all.html", false,
 496                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated\">"
 497                 + "search phrase with desc deprecated</a></span> - Search tag in annotation type pkg2.TestAnnotationType</dt>",
 498                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestClass.html#SearchTagDeprecatedClass\">"
 499                 + "SearchTagDeprecatedClass</a></span> - Search tag in class pkg2.TestClass</dt>",
 500                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestEnum.html#searchphrasedeprecated\">"
 501                 + "search phrase deprecated</a></span> - Search tag in pkg2.TestEnum.ONE</dt>",
 502                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 503                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>",
 504                 "<div class=\"deprecationComment\">class_test1 passes. Search tag"
 505                 + " <span id=\"SearchTagDeprecatedClass\">SearchTagDeprecatedClass</span></div>",
 506                 "<div class=\"deprecationComment\">error_test3 passes. Search tag for\n"
 507                 + " method <span id=\"SearchTagDeprecatedMethod\">SearchTagDeprecatedMethod</span></div>");
 508     }
 509 
 510     void checkJavaFXOutput() {
 511         checkOutput("index-all.html", false, "test treat as private");
 512     }
 513 
 514     void checkInvalidUsageIndexTag() {
 515         checkOutput(Output.OUT, true,
 516                 "AnotherClass.java:29: warning - invalid usage of tag {@index",
 517                 "AnotherClass.java:39: warning - invalid usage of tag {@index",
 518                 "AnotherClass.java:34: warning - invalid usage of tag {@index",
 519                 "AnotherClass.java:68: warning - invalid usage of tag {@index");
 520     }
 521 
 522     void checkJqueryAndImageFiles(boolean expectedOutput) {
 523         checkFiles(expectedOutput,
 524                 "search.js",
 525                 "script-dir/jquery-3.4.1.js",
 526                 "script-dir/jquery-ui.js",
 527                 "script-dir/jquery-ui.css",
 528                 "script-dir/jquery-ui.min.js",
 529                 "script-dir/jquery-ui.min.css",
 530                 "script-dir/jquery-ui.structure.min.css",
 531                 "script-dir/jquery-ui.structure.css",
 532                 "script-dir/external/jquery/jquery.js",
 533                 "script-dir/images/ui-bg_glass_65_dadada_1x400.png",
 534                 "script-dir/images/ui-icons_454545_256x240.png",
 535                 "script-dir/images/ui-bg_glass_95_fef1ec_1x400.png",
 536                 "script-dir/images/ui-bg_glass_75_dadada_1x400.png",
 537                 "script-dir/images/ui-bg_highlight-soft_75_cccccc_1x100.png",
 538                 "script-dir/images/ui-icons_888888_256x240.png",
 539                 "script-dir/images/ui-icons_2e83ff_256x240.png",
 540                 "script-dir/images/ui-icons_cd0a0a_256x240.png",
 541                 "script-dir/images/ui-bg_glass_55_fbf9ee_1x400.png",
 542                 "script-dir/images/ui-icons_222222_256x240.png",
 543                 "script-dir/images/ui-bg_glass_75_e6e6e6_1x400.png",
 544                 "resources/x.png",
 545                 "resources/glass.png");
 546     }
 547 
 548     void checkSearchJS() {
 549         checkOutput("search.js", true,
 550                 "function concatResults(a1, a2) {",
 551                 "$(\"#search\").on('click keydown paste', function() {\n"
 552                 + "        if ($(this).val() == watermark) {\n"
 553                 + "            $(this).val('').removeClass('watermark');\n"
 554                 + "        }\n"
 555                 + "    });",
 556                 "function getURLPrefix(ui) {\n"
 557                 + "    var urlPrefix=\"\";\n"
 558                 + "    var slash = \"/\";\n"
 559                 + "    if (ui.item.category === catModules) {\n"
 560                 + "        return ui.item.l + slash;\n"
 561                 + "    } else if (ui.item.category === catPackages && ui.item.m) {\n"
 562                 + "        return ui.item.m + slash;\n"
 563                 + "    } else if ((ui.item.category === catTypes && ui.item.p) || ui.item.category === catMembers) {\n"
 564                 + "        $.each(packageSearchIndex, function(index, item) {\n"
 565                 + "            if (item.m && ui.item.p == item.l) {\n"
 566                 + "                urlPrefix = item.m + slash;\n"
 567                 + "            }\n"
 568                 + "        });\n"
 569                 + "        return urlPrefix;\n"
 570                 + "    } else {\n"
 571                 + "        return urlPrefix;\n"
 572                 + "    }\n"
 573                 + "    return urlPrefix;\n"
 574                 + "}",
 575                 "url += ui.item.l;");
 576     }
 577 
 578     void checkSingleIndexSearchTagDuplication() {
 579         // Test for search tags duplication in index file.
 580         checkOutput("index-all.html", true,
 581                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 582                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>\n"
 583                 + "<dd>with description</dd>");
 584         checkOutput("index-all.html", false,
 585                 "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 586                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>\n"
 587                 + "<dd>with description</dd>\n"
 588                 + "<dt><span class=\"searchTagLink\"><a href=\"pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 589                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>\n"
 590                 + "<dd>with description</dd>");
 591     }
 592 
 593     void checkSplitIndexSearchTagDuplication() {
 594         // Test for search tags duplication in index file.
 595         checkOutput("index-files/index-13.html", true,
 596                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 597                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>\n"
 598                 + "<dd>with description</dd>");
 599         checkOutput("index-files/index-13.html", false,
 600                 "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 601                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>\n"
 602                 + "<dd>with description</dd>\n"
 603                 + "<dt><span class=\"searchTagLink\"><a href=\"../pkg2/TestError.html#SearchTagDeprecatedMethod\">"
 604                 + "SearchTagDeprecatedMethod</a></span> - Search tag in pkg2.TestError.TestError()</dt>\n"
 605                 + "<dd>with description</dd>");
 606     }
 607 
 608     void checkAllPkgsAllClasses() {
 609         checkOutput("allclasses-index.html", true,
 610                 "<div class=\"typeSummary\">\n"
 611                 + "<div role=\"tablist\" aria-orientation=\"horizontal\"><button role=\"tab\""
 612                 + " aria-selected=\"true\" aria-controls=\"typeSummary_tabpanel\" tabindex=\"0\""
 613                 + " onkeydown=\"switchTab(event)\" id=\"t0\" class=\"activeTableTab\">All Classes</button>"
 614                 + "<button role=\"tab\" aria-selected=\"false\" aria-controls=\"typeSummary_tabpanel\""
 615                 + " tabindex=\"-1\" onkeydown=\"switchTab(event)\" id=\"t1\" class=\"tableTab\""
 616                 + " onclick=\"show(1);\">Interface Summary</button><button role=\"tab\" aria-selected=\"false\""
 617                 + " aria-controls=\"typeSummary_tabpanel\" tabindex=\"-1\" onkeydown=\"switchTab(event)\""
 618                 + " id=\"t2\" class=\"tableTab\" onclick=\"show(2);\">Class Summary</button><button role=\"tab\""
 619                 + " aria-selected=\"false\" aria-controls=\"typeSummary_tabpanel\" tabindex=\"-1\""
 620                 + " onkeydown=\"switchTab(event)\" id=\"t3\" class=\"tableTab\" onclick=\"show(4);\">"
 621                 + "Enum Summary</button><button role=\"tab\" aria-selected=\"false\""
 622                 + " aria-controls=\"typeSummary_tabpanel\" tabindex=\"-1\" onkeydown=\"switchTab(event)\""
 623                 + " id=\"t4\" class=\"tableTab\" onclick=\"show(8);\">Exception Summary</button><button role=\"tab\""
 624                 + " aria-selected=\"false\" aria-controls=\"typeSummary_tabpanel\" tabindex=\"-1\""
 625                 + " onkeydown=\"switchTab(event)\" id=\"t5\" class=\"tableTab\" onclick=\"show(16);\">"
 626                 + "Error Summary</button><button role=\"tab\" aria-selected=\"false\""
 627                 + " aria-controls=\"typeSummary_tabpanel\" tabindex=\"-1\" onkeydown=\"switchTab(event)\""
 628                 + " id=\"t6\" class=\"tableTab\" onclick=\"show(32);\">Annotation Types Summary</button></div>\n"
 629                 + "<div id=\"typeSummary_tabpanel\" role=\"tabpanel\">\n"
 630                 + "<table aria-labelledby=\"t0\">\n"
 631                 + "<thead>\n"
 632                 + "<tr>\n"
 633                 + "<th class=\"colFirst\" scope=\"col\">Class</th>\n"
 634                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
 635                 + "</tr>",
 636                 "var data = {\"i0\":32,\"i1\":2,\"i2\":4,\"i3\":2,\"i4\":2,\"i5\":1,\"i6\":2,\"i7\":32,"
 637                 + "\"i8\":2,\"i9\":4,\"i10\":16,\"i11\":16,\"i12\":8,\"i13\":8,\"i14\":1,\"i15\":2};");
 638         checkOutput("allpackages-index.html", true,
 639                 "<div class=\"packagesSummary\">\n<table>\n"
 640                 + "<caption><span>Package Summary</span><span class=\"tabEnd\">&nbsp;</span></caption>\n"
 641                 + "<thead>\n"
 642                 + "<tr>\n"
 643                 + "<th class=\"colFirst\" scope=\"col\">Package</th>\n"
 644                 + "<th class=\"colLast\" scope=\"col\">Description</th>\n"
 645                 + "</tr>\n");
 646         checkOutput("type-search-index.js", true,
 647                 "{\"l\":\"All Classes\",\"url\":\"allclasses-index.html\"}");
 648         checkOutput("package-search-index.js", true,
 649                 "{\"l\":\"All Packages\",\"url\":\"allpackages-index.html\"}");
 650         checkOutput("index-all.html", true,
 651                     "<br><a href=\"allclasses-index.html\">All&nbsp;Classes</a>"
 652                     + "<span class=\"verticalSeparator\">|</span>"
 653                     + "<a href=\"allpackages-index.html\">All&nbsp;Packages</a>");
 654     }
 655 }