1
1
/*
2
- * Copyright (c) 2015, 2022 , Oracle and/or its affiliates. All rights reserved.
2
+ * Copyright (c) 2015, 2023 , Oracle and/or its affiliates. All rights reserved.
3
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
4
*
5
5
* This code is free software; you can redistribute it and/or modify it
26
26
* @bug 8141492 8071982 8141636 8147890 8166175 8168965 8176794 8175218 8147881
27
27
* 8181622 8182263 8074407 8187521 8198522 8182765 8199278 8196201 8196202
28
28
* 8184205 8214468 8222548 8223378 8234746 8241219 8254627 8247994 8263528
29
- * 8266808 8248863
29
+ * 8266808 8248863 8305710
30
30
* @summary Test the search feature of javadoc.
31
31
* @library ../../lib
32
32
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -56,7 +56,7 @@ public void test1() {
56
56
"-use" ,
57
57
testSrc ("UnnamedPkgClass.java" ));
58
58
checkExit (Exit .OK );
59
- checkSearchOutput ("UnnamedPkgClass.html" , true , true );
59
+ checkSearchOutput ("UnnamedPkgClass.html" , true );
60
60
checkJqueryAndImageFiles (true );
61
61
checkSearchJS ();
62
62
checkFiles (true ,
@@ -78,8 +78,9 @@ public void test2() {
78
78
checkExit (Exit .OK );
79
79
checkInvalidUsageIndexTag ();
80
80
checkSearchOutput (true );
81
- checkSingleIndex (true , true );
81
+ checkSingleIndex ();
82
82
checkSingleIndexSearchTagDuplication ();
83
+ checkSearchTagIndex ();
83
84
checkJqueryAndImageFiles (true );
84
85
checkSearchJS ();
85
86
checkAllPkgsAllClasses ();
@@ -102,8 +103,9 @@ public void test2a() {
102
103
checkExit (Exit .ERROR );
103
104
checkDocLintErrors ();
104
105
checkSearchOutput (true );
105
- checkSingleIndex (true , true );
106
+ checkSingleIndex ();
106
107
checkSingleIndexSearchTagDuplication ();
108
+ checkSearchTagIndex ();
107
109
checkJqueryAndImageFiles (true );
108
110
checkSearchJS ();
109
111
checkFiles (true ,
@@ -147,7 +149,7 @@ public void test4() {
147
149
"pkg" , "pkg1" , "pkg2" , "pkg3" );
148
150
checkExit (Exit .OK );
149
151
checkSearchOutput (true );
150
- checkSingleIndex (true , true );
152
+ checkSingleIndex ();
151
153
checkSingleIndexSearchTagDuplication ();
152
154
checkJqueryAndImageFiles (true );
153
155
checkSearchJS ();
@@ -279,7 +281,7 @@ public void testURLEncoding() {
279
281
"pkg" , "pkg1" , "pkg2" , "pkg3" );
280
282
checkExit (Exit .OK );
281
283
checkSearchJS ();
282
- checkSearchIndex (true );
284
+ checkSearchIndex ();
283
285
}
284
286
285
287
@ Test
@@ -299,7 +301,7 @@ public void testDefaultJapaneseLocale() {
299
301
"\u30d1 \u30c3 \u30b1 \u30fc \u30b8 pkg1\u306e \u30bd \u30fc \u30b9 \u30fb \u30d5 \u30a1 " +
300
302
"\u30a4 \u30eb \u3092 \u8aad \u307f \u8fbc \u3093 \u3067 \u3044 \u307e \u3059 ...\n " );
301
303
checkSearchJS ();
302
- checkSearchIndex (true );
304
+ checkSearchIndex ();
303
305
} finally {
304
306
Locale .setDefault (prev );
305
307
}
@@ -324,7 +326,7 @@ public void testJapaneseLocaleOption() {
324
326
checkOutput ("index.html" , true ,
325
327
"<span>\u30d1 \u30c3 \u30b1 \u30fc \u30b8 </span>" );
326
328
checkSearchJS ();
327
- checkSearchIndex (true );
329
+ checkSearchIndex ();
328
330
}
329
331
330
332
@ Test
@@ -344,7 +346,7 @@ public void testDefaultChineseLocale() {
344
346
"\u6b63 \u5728 \u52a0 \u8f7d \u7a0b \u5e8f \u5305 pkg2\u7684 \u6e90 \u6587 \u4ef6 ...\n " ,
345
347
"\u6b63 \u5728 \u52a0 \u8f7d \u7a0b \u5e8f \u5305 pkg3\u7684 \u6e90 \u6587 \u4ef6 ...\n " );
346
348
checkSearchJS ();
347
- checkSearchIndex (true );
349
+ checkSearchIndex ();
348
350
} finally {
349
351
Locale .setDefault (prev );
350
352
}
@@ -375,7 +377,7 @@ public void testChineseLocaleOption() {
375
377
checkOutput ("index.html" , true ,
376
378
"<span>\u7a0b \u5e8f \u5305 </span>" );
377
379
checkSearchJS ();
378
- checkSearchIndex (true );
380
+ checkSearchIndex ();
379
381
}
380
382
381
383
void checkDocLintErrors () {
@@ -387,12 +389,8 @@ void checkDocLintErrors() {
387
389
"A test field. Testing only white-spaces in index tag text {@index }." );
388
390
}
389
391
390
- void checkSearchOutput (boolean expectedOutput ) {
391
- checkSearchOutput ("index.html" , expectedOutput , true );
392
- }
393
-
394
- void checkSearchIndex (boolean expectedOutput ) {
395
- checkOutput ("member-search-index.js" , expectedOutput ,
392
+ void checkSearchIndex () {
393
+ checkOutput ("member-search-index.js" , true ,
396
394
"""
397
395
{"p":"pkg","c":"AnotherClass","l":"AnotherClass()","u":"%3Cinit%3E()"}""" ,
398
396
"""
@@ -401,7 +399,7 @@ void checkSearchIndex(boolean expectedOutput) {
401
399
{"p":"pkg2","c":"TestError","l":"TestError()","u":"%3Cinit%3E()"}""" ,
402
400
"""
403
401
{"p":"pkg","c":"AnotherClass","l":"method(byte[], int, String)","u":"method(byte[],int,java.lang.String)"}""" );
404
- checkOutput ("member-search-index.js" , ! expectedOutput ,
402
+ checkOutput ("member-search-index.js" , false ,
405
403
"""
406
404
{"p":"pkg","c":"AnotherClass","l":"method(RegClass)","u":"method-pkg1.RegClass-"}""" ,
407
405
"""
@@ -412,11 +410,11 @@ void checkSearchIndex(boolean expectedOutput) {
412
410
{"p":"pkg","c":"AnotherClass","l":"method(byte[], int, String)","u":"method-byte:A-int-java.lang.String-"}""" );
413
411
}
414
412
415
- void checkSearchOutput (boolean expectedOutput , boolean moduleDirectoriesVar ) {
416
- checkSearchOutput ("index.html" , expectedOutput , moduleDirectoriesVar );
413
+ void checkSearchOutput (boolean expectedOutput ) {
414
+ checkSearchOutput ("index.html" , expectedOutput );
417
415
}
418
416
419
- void checkSearchOutput (String fileName , boolean expectedOutput , boolean moduleDirectoriesVar ) {
417
+ void checkSearchOutput (String fileName , boolean expectedOutput ) {
420
418
// Test for search related markup
421
419
checkOutput (fileName , expectedOutput ,
422
420
"""
@@ -440,11 +438,9 @@ void checkSearchOutput(String fileName, boolean expectedOutput, boolean moduleDi
440
438
"<div class=\" flex-box\" >" );
441
439
}
442
440
443
- void checkSingleIndex (boolean expectedOutput , boolean html5 ) {
444
- String html_span_see_span = html5 ? "html%3Cspan%3Esee%3C/span%3E" : "html-span-see-/span-" ;
445
-
441
+ void checkSingleIndex () {
446
442
// Test for search tags markup in index file.
447
- checkOutput ("index-all.html" , expectedOutput ,
443
+ checkOutput ("index-all.html" , true ,
448
444
"""
449
445
<dt><a href="pkg/package-summary.html#phrasewithspaces" class="search-tag-link">\
450
446
phrase with spaces</a> - Search tag in package pkg</dt>""" ,
@@ -491,7 +487,7 @@ void checkSingleIndex(boolean expectedOutput, boolean html5) {
491
487
test%7D" class="search-tag-link">nested {@index nested_tag_test}</a> - Search ta\
492
488
g in pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE</dt>""" ,
493
489
"""
494
- <dt><a href="pkg/AnotherClass.ModalExclusionType.html#""" + html_span_see_span + """
490
+ <dt><a href="pkg/AnotherClass.ModalExclusionType.html#html%3Cspan%3Esee%3C/span%3E\
495
491
" class="search-tag-link">html <span> see </span></a> - Search tag i\
496
492
n pkg.AnotherClass.ModalExclusionType.APPLICATION_EXCLUDE</dt>""" ,
497
493
"""
@@ -830,4 +826,44 @@ void checkAllPkgsAllClasses() {
830
826
s</a><span class="vertical-separator">|</span><a href="allpackages-index.htm\
831
827
l">All Packages</a>""" );
832
828
}
829
+
830
+ void checkSearchTagIndex () {
831
+ checkOutput ("tag-search-index.js" , true ,
832
+ """
833
+ {"l":"html <span> see </span>","h":"pkg.AnotherClass.ModalExclusionType.APPLICATION_EXCLUDE","u":"pkg/AnotherClass.ModalExclusionType.html#html<span>see</span>"}""" ,
834
+ """
835
+ {"l":"nested {@index nested_tag_test}","h":"pkg.AnotherClass.ModalExclusionType.NO_EXCLUDE","u":"pkg/AnotherClass.ModalExclusionType.html#nested{@indexnested_tag_test}"}""" ,
836
+ """
837
+ {"l":"phrase with spaces","h":"package pkg","u":"pkg/package-summary.html#phrasewithspaces"},{"l":"pkg","h":"package pkg","u":"pkg/package-summary.html#pkg"}""" ,
838
+ """
839
+ {"l":"quoted","h":"pkg.AnotherClass.CONSTANT1","d":"no-space","u":"pkg/AnotherClass.html#quoted"}""" ,
840
+ """
841
+ {"l":"r","h":"package pkg","u":"pkg/package-summary.html#r"}""" ,
842
+ """
843
+ {"l":"search phrase","h":"class pkg1.RegClass","d":"with description","u":"pkg1/RegClass.html#searchphrase"}""" ,
844
+ """
845
+ {"l":"search phrase deprecated","h":"pkg2.TestEnum.ONE","u":"deprecated-list.html#searchphrasedeprecated"}""" ,
846
+ """
847
+ {"l":"search phrase deprecated","h":"pkg2.TestEnum.ONE","u":"pkg2/TestEnum.html#searchphrasedeprecated"}""" ,
848
+ """
849
+ {"l":"search phrase with desc deprecated","h":"annotation interface pkg2.TestAnnotationType","d":"description for phrase deprecated","u":"deprecated-list.html#searchphrasewithdescdeprecated"}""" ,
850
+ """
851
+ {"l":"search phrase with desc deprecated","h":"annotation interface pkg2.TestAnnotationType","d":"description for phrase deprecated","u":"pkg2/TestAnnotationType.html#searchphrasewithdescdeprecated"}""" ,
852
+ """
853
+ {"l":"SearchTagDeprecatedClass","h":"class pkg2.TestClass","u":"deprecated-list.html#SearchTagDeprecatedClass"}""" ,
854
+ """
855
+ {"l":"SearchTagDeprecatedClass","h":"class pkg2.TestClass","u":"pkg2/TestClass.html#SearchTagDeprecatedClass"}""" ,
856
+ """
857
+ {"l":"SearchTagDeprecatedMethod","h":"pkg2.TestError.TestError()","d":"with description","u":"deprecated-list.html#SearchTagDeprecatedMethod"}""" ,
858
+ """
859
+ {"l":"SearchTagDeprecatedMethod","h":"pkg2.TestError.TestError()","d":"with description","u":"pkg2/TestError.html#SearchTagDeprecatedMethod"}""" ,
860
+ """
861
+ {"l":"search term with spaces","h":"interface pkg.TestInterface","d":"description ","u":"pkg/TestInterface.html#searchtermwithspaces"}""" ,
862
+ """
863
+ {"l":"SearchWordWithDescription","h":"pkg1.RegClass.CONSTANT_FIELD_1","d":"search word with desc","u":"pkg1/RegClass.html#SearchWordWithDescription"}""" ,
864
+ """
865
+ {"l":"Serialized Form","h":"","u":"serialized-form.html"},{"l":"SingleWord","h":"package pkg","u":"pkg/package-summary.html#SingleWord"}""" ,
866
+ """
867
+ {"l":"trailing","h":"pkg.AnotherClass.method(byte[], int, String)","d":"backslash\\ \\ ","u":"pkg/AnotherClass.html#trailing"}]""" );
868
+ }
833
869
}
0 commit comments