author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 43870 | langtools/test/jdk/javadoc/doclet/testNavigation/TestNavigation.java@8805a0acaded |
child 48654 | 36f58bd6269f |
permissions | -rw-r--r-- |
10 | 1 |
/* |
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
10 | 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 |
* |
|
5520 | 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. |
|
10 | 22 |
*/ |
23 |
||
24 |
/* |
|
25 |
* @test |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
26 |
* @bug 4131628 4664607 7025314 8023700 7198273 8025633 8026567 8081854 8150188 8151743 |
10 | 27 |
* @summary Make sure the Next/Prev Class links iterate through all types. |
28 |
* Make sure the navagation is 2 columns, not 3. |
|
29 |
* @author jamieh |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
30 |
* @library ../lib |
36526 | 31 |
* @modules jdk.javadoc/jdk.javadoc.internal.tool |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
32 |
* @build JavadocTester |
19659 | 33 |
* @run main TestNavigation |
10 | 34 |
*/ |
35 |
||
19659 | 36 |
public class TestNavigation extends JavadocTester { |
10 | 37 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
38 |
public static void main(String... args) throws Exception { |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
39 |
TestNavigation tester = new TestNavigation(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
40 |
tester.runTests(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
41 |
} |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
42 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
43 |
@Test |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
44 |
void test() { |
36705 | 45 |
javadoc("-d", "out", "-overview", testSrc("overview.html"), |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
46 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
47 |
"pkg"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
48 |
checkExit(Exit.OK); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
49 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
50 |
checkOutput("pkg/A.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
51 |
"<li>Prev Class</li>", |
36705 | 52 |
"<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Next Class</span></a>", |
53 |
"<li><a href=\"../overview-summary.html\">Overview</a></li>"); |
|
10 | 54 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
55 |
checkOutput("pkg/C.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
56 |
"<a href=\"../pkg/A.html\" title=\"annotation in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>", |
36705 | 57 |
"<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Next Class</span></a>", |
58 |
"<li><a href=\"../overview-summary.html\">Overview</a></li>"); |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
59 |
|
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
60 |
checkOutput("pkg/E.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
61 |
"<a href=\"../pkg/C.html\" title=\"class in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>", |
36705 | 62 |
"<a href=\"../pkg/I.html\" title=\"interface in pkg\"><span class=\"typeNameLink\">Next Class</span></a>", |
63 |
"<li><a href=\"../overview-summary.html\">Overview</a></li>"); |
|
10 | 64 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
65 |
checkOutput("pkg/I.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
66 |
"<a href=\"../pkg/E.html\" title=\"enum in pkg\"><span class=\"typeNameLink\">Prev Class</span></a>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
67 |
"<li>Next Class</li>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
68 |
// Test for 4664607 |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
69 |
"<div class=\"skipNav\"><a href=\"#skip.navbar.top\" title=\"Skip navigation links\">Skip navigation links</a></div>\n" |
31297
86fe1414f12c
8081854: Javadoc should generate named anchors for HTML4 output
bpatel
parents:
30730
diff
changeset
|
70 |
+ "<a name=\"navbar.top.firstrow\">\n" |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
71 |
+ "<!-- -->\n" |
36705 | 72 |
+ "</a>", |
73 |
"<li><a href=\"../overview-summary.html\">Overview</a></li>"); |
|
36526 | 74 |
|
75 |
// Remaining tests check for additional padding to offset the fixed navigation bar. |
|
76 |
checkOutput("pkg/A.html", true, |
|
77 |
"<!-- ========= END OF TOP NAVBAR ========= -->\n" |
|
78 |
+ "</div>\n" |
|
79 |
+ "<div class=\"navPadding\"> </div>\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
80 |
+ "<script type=\"text/javascript\"><!--\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
81 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
82 |
+ "//-->\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
83 |
+ "</script>\n" |
36526 | 84 |
+ "<!-- ======== START OF CLASS DATA ======== -->"); |
85 |
||
86 |
checkOutput("pkg/package-summary.html", true, |
|
87 |
"<!-- ========= END OF TOP NAVBAR ========= -->\n" |
|
88 |
+ "</div>\n" |
|
89 |
+ "<div class=\"navPadding\"> </div>\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
90 |
+ "<script type=\"text/javascript\"><!--\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
91 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
92 |
+ "//-->\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
93 |
+ "</script>\n" |
36526 | 94 |
+ "<div class=\"header\">"); |
95 |
} |
|
96 |
||
97 |
// Test for checking additional padding to offset the fixed navigation bar in HTML5. |
|
98 |
@Test |
|
99 |
void test1() { |
|
100 |
javadoc("-d", "out-1", "-html5", |
|
101 |
"-sourcepath", testSrc, |
|
102 |
"pkg"); |
|
103 |
checkExit(Exit.OK); |
|
104 |
||
105 |
checkOutput("pkg/A.html", true, |
|
106 |
"<!-- ========= END OF TOP NAVBAR ========= -->\n" |
|
107 |
+ "</div>\n" |
|
108 |
+ "<div class=\"navPadding\"> </div>\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
109 |
+ "<script type=\"text/javascript\"><!--\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
110 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
111 |
+ "//-->\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
112 |
+ "</script>\n" |
36526 | 113 |
+ "</nav>\n" |
114 |
+ "</header>\n" |
|
115 |
+ "<!-- ======== START OF CLASS DATA ======== -->"); |
|
116 |
||
117 |
checkOutput("pkg/package-summary.html", true, |
|
118 |
"<!-- ========= END OF TOP NAVBAR ========= -->\n" |
|
119 |
+ "</div>\n" |
|
120 |
+ "<div class=\"navPadding\"> </div>\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
121 |
+ "<script type=\"text/javascript\"><!--\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
122 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
123 |
+ "//-->\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
124 |
+ "</script>\n" |
36526 | 125 |
+ "</nav>"); |
126 |
} |
|
127 |
||
128 |
// Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML4. |
|
129 |
@Test |
|
130 |
void test2() { |
|
131 |
javadoc("-d", "out-2", "-nonavbar", |
|
132 |
"-sourcepath", testSrc, |
|
133 |
"pkg"); |
|
134 |
checkExit(Exit.OK); |
|
135 |
||
136 |
checkOutput("pkg/A.html", false, |
|
137 |
"<!-- ========= END OF TOP NAVBAR ========= -->\n" |
|
138 |
+ "</div>\n" |
|
139 |
+ "<div class=\"navPadding\"> </div>\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
140 |
+ "<script type=\"text/javascript\"><!--\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
141 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
142 |
+ "//-->\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
143 |
+ "</script>\n" |
36526 | 144 |
+ "<!-- ======== START OF CLASS DATA ======== -->"); |
145 |
||
146 |
checkOutput("pkg/package-summary.html", false, |
|
147 |
"<!-- ========= END OF TOP NAVBAR ========= -->\n" |
|
148 |
+ "</div>\n" |
|
149 |
+ "<div class=\"navPadding\"> </div>\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
150 |
+ "<script type=\"text/javascript\"><!--\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
151 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
152 |
+ "//-->\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
153 |
+ "</script>\n" |
36526 | 154 |
+ "<div class=\"header\">"); |
155 |
} |
|
156 |
||
157 |
// Test to make sure that no extra padding for nav bar gets generated if -nonavbar is specified for HTML5. |
|
158 |
@Test |
|
159 |
void test3() { |
|
160 |
javadoc("-d", "out-3", "-html5", "-nonavbar", |
|
161 |
"-sourcepath", testSrc, |
|
162 |
"pkg"); |
|
163 |
checkExit(Exit.OK); |
|
164 |
||
165 |
checkOutput("pkg/A.html", false, |
|
166 |
"<!-- ========= END OF TOP NAVBAR ========= -->\n" |
|
167 |
+ "</div>\n" |
|
168 |
+ "<div class=\"navPadding\"> </div>\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
169 |
+ "<script type=\"text/javascript\"><!--\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
170 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
171 |
+ "//-->\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
172 |
+ "</script>\n" |
36526 | 173 |
+ "</nav>\n" |
174 |
+ "</header>\n" |
|
175 |
+ "<!-- ======== START OF CLASS DATA ======== -->"); |
|
176 |
||
177 |
checkOutput("pkg/package-summary.html", false, |
|
178 |
"<!-- ========= END OF TOP NAVBAR ========= -->\n" |
|
179 |
+ "</div>\n" |
|
180 |
+ "<div class=\"navPadding\"> </div>\n" |
|
43870
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
181 |
+ "<script type=\"text/javascript\"><!--\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
182 |
+ "$('.navPadding').css('padding-top', $('.fixedNav').css(\"height\"));\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
183 |
+ "//-->\n" |
8805a0acaded
8151743: Header can still disappear behind the navbar
bpatel
parents:
36709
diff
changeset
|
184 |
+ "</script>\n" |
36526 | 185 |
+ "</nav>"); |
10 | 186 |
} |
187 |
} |