author | erikj |
Tue, 12 Sep 2017 19:03:39 +0200 | |
changeset 47216 | 71c04702a3d5 |
parent 44297 | langtools/test/jdk/javadoc/doclet/testOptions/TestOptions.java@e03f5fb3714b |
child 47284 | 355349babaf4 |
permissions | -rw-r--r-- |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
1 |
/* |
44297
e03f5fb3714b
8175200: Long method signatures disturb Method Summary table
bpatel
parents:
36709
diff
changeset
|
2 |
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
4 |
* |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
8 |
* |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
13 |
* accompanied this code). |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
14 |
* |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
18 |
* |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
21 |
* questions. |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
22 |
*/ |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
23 |
|
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
24 |
/* |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
25 |
* @test |
44297
e03f5fb3714b
8175200: Long method signatures disturb Method Summary table
bpatel
parents:
36709
diff
changeset
|
26 |
* @bug 4749567 8071982 8175200 |
36705 | 27 |
* @summary Test the output for -header, -footer, -nooverview, -nodeprecatedlist, -nonavbar, -notree, -stylesheetfile options. |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
28 |
* @author Bhavesh Patel |
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
29 |
* @library ../lib |
36526 | 30 |
* @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
|
31 |
* @build JavadocTester |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
32 |
* @run main TestOptions |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
33 |
*/ |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
34 |
|
36705 | 35 |
import java.io.File; |
36 |
||
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
37 |
public class TestOptions extends JavadocTester { |
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
38 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
39 |
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
|
40 |
TestOptions tester = new TestOptions(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
41 |
tester.runTests(); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
42 |
} |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
43 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
44 |
@Test |
36705 | 45 |
void testHeaderFooter() { |
46 |
javadoc("-d", "out-1", |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
47 |
"-header", "Test header", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
48 |
"-footer", "Test footer", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
49 |
"-sourcepath", testSrc, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
50 |
"pkg"); |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
51 |
checkExit(Exit.OK); |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
52 |
|
24399
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
53 |
checkOutput("pkg/package-summary.html", true, |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
54 |
"<div class=\"aboutLanguage\">Test header</div>", |
af1a0220d0fa
8038730: Clean up the way JavadocTester is invoked, and checks for errors.
jjg
parents:
24072
diff
changeset
|
55 |
"<div class=\"aboutLanguage\">Test footer</div>"); |
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
56 |
} |
36705 | 57 |
|
58 |
@Test |
|
59 |
void testNoOverview() { |
|
60 |
javadoc("-d", "out-4", |
|
61 |
"-nooverview", |
|
62 |
"-sourcepath", testSrc, |
|
63 |
"pkg", "deprecated"); |
|
64 |
||
65 |
checkExit(Exit.OK); |
|
66 |
||
67 |
checkFiles(false, "overview-summary.html"); |
|
68 |
} |
|
69 |
||
70 |
@Test |
|
71 |
void testNoDeprecatedList() { |
|
72 |
javadoc("-d", "out-5", |
|
73 |
"-nodeprecatedlist", |
|
74 |
"-sourcepath", testSrc, |
|
75 |
"deprecated"); |
|
76 |
checkExit(Exit.OK); |
|
77 |
||
78 |
checkFiles(false, "deprecated-list.html"); |
|
79 |
} |
|
80 |
||
81 |
@Test |
|
82 |
void testNoNavbar() { |
|
83 |
javadoc("-d", "out-6", |
|
84 |
"-nonavbar", |
|
85 |
"-bottom", "Bottom text", |
|
86 |
"-sourcepath", testSrc, |
|
87 |
"pkg"); |
|
88 |
checkExit(Exit.OK); |
|
89 |
||
90 |
checkOutput("pkg/Foo.html", false, "navbar"); |
|
91 |
checkOutput("pkg/Foo.html", true, "Bottom text"); |
|
92 |
} |
|
93 |
||
94 |
@Test |
|
95 |
void testNoTree() { |
|
96 |
javadoc("-d", "out-7", |
|
97 |
"-notree", |
|
98 |
"-sourcepath", testSrc, |
|
99 |
"pkg"); |
|
100 |
checkExit(Exit.OK); |
|
101 |
||
102 |
checkFiles(false, "overview-tree.html"); |
|
103 |
checkFiles(false, "pkg/package-tree.html"); |
|
104 |
checkOutput("pkg/Foo.html", false, "<li><a href=\"package-tree.html\">Tree</a></li>"); |
|
105 |
} |
|
106 |
||
107 |
@Test |
|
108 |
void testStylesheetFile() { |
|
109 |
javadoc("-d", "out-8", |
|
110 |
"-stylesheetfile", new File(testSrc, "custom-stylesheet.css").getAbsolutePath(), |
|
111 |
"-sourcepath", testSrc, |
|
112 |
"pkg"); |
|
113 |
checkExit(Exit.OK); |
|
114 |
||
115 |
checkOutput("custom-stylesheet.css", true, "Custom javadoc style sheet"); |
|
116 |
checkOutput("pkg/Foo.html", true, "<link rel=\"stylesheet\" type=\"text/css\" " |
|
117 |
+ "href=\"../custom-stylesheet.css\" title=\"Style\">"); |
|
118 |
} |
|
119 |
||
120 |
@Test |
|
121 |
void testLinkSource() { |
|
122 |
javadoc("-d", "out-9", |
|
123 |
"-linksource", |
|
124 |
"-javafx", |
|
125 |
"-sourcepath", testSrc, |
|
126 |
"-package", |
|
127 |
"linksource"); |
|
128 |
checkExit(Exit.OK); |
|
129 |
||
130 |
checkOutput("linksource/AnnotationTypeField.html", true, |
|
131 |
"<pre>@Documented\npublic @interface <a href=" |
|
132 |
+ "\"../src-html/linksource/AnnotationTypeField.html#line.31\">" |
|
133 |
+ "AnnotationTypeField</a></pre>", |
|
134 |
"<h4>DEFAULT_NAME</h4>\n<pre>static final java.lang.String " |
|
135 |
+ "<a href=\"../src-html/linksource/AnnotationTypeField.html#line.32\">" |
|
136 |
+ "DEFAULT_NAME</a></pre>", |
|
137 |
"<h4>name</h4>\n<pre>java.lang.String <a href=" |
|
138 |
+ "\"../src-html/linksource/AnnotationTypeField.html#line.34\">name</a></pre>"); |
|
139 |
||
140 |
checkOutput("src-html/linksource/AnnotationTypeField.html", true, |
|
141 |
"<title>Source code</title>", |
|
142 |
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\">" |
|
143 |
+ "@Documented public @interface AnnotationTypeField {</a>"); |
|
144 |
||
145 |
checkOutput("linksource/Properties.html", true, |
|
146 |
"<pre>public class <a href=\"../src-html/linksource/Properties.html#line.29\">" |
|
147 |
+ "Properties</a>", |
|
148 |
"<pre>public java.lang.Object <a href=" |
|
149 |
+ "\"../src-html/linksource/Properties.html#line.31\">someProperty</a></pre>", |
|
150 |
"<pre>public java.lang.Object <a href=" |
|
44297
e03f5fb3714b
8175200: Long method signatures disturb Method Summary table
bpatel
parents:
36709
diff
changeset
|
151 |
+ "\"../src-html/linksource/Properties.html#line.31\">someProperty</a>​()</pre>"); |
36705 | 152 |
|
153 |
checkOutput("src-html/linksource/Properties.html", true, |
|
154 |
"<title>Source code</title>", |
|
155 |
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\"> " |
|
156 |
+ "public Object someProperty() {</a>"); |
|
157 |
||
158 |
checkOutput("linksource/SomeClass.html", true, |
|
159 |
"<pre>public class <a href=\"../src-html/linksource/SomeClass.html#line.29\">" |
|
160 |
+ "SomeClass</a>\nextends java.lang.Object</pre>", |
|
161 |
"<pre>public int <a href=\"../src-html/linksource/SomeClass.html#line.31\">" |
|
162 |
+ "field</a></pre>", |
|
163 |
"<pre>public <a href=\"../src-html/linksource/SomeClass.html#line.33\">" |
|
44297
e03f5fb3714b
8175200: Long method signatures disturb Method Summary table
bpatel
parents:
36709
diff
changeset
|
164 |
+ "SomeClass</a>​()</pre>", |
36705 | 165 |
"<pre>public int <a href=\"../src-html/linksource/SomeClass.html#line.36\">" |
44297
e03f5fb3714b
8175200: Long method signatures disturb Method Summary table
bpatel
parents:
36709
diff
changeset
|
166 |
+ "method</a>​()</pre>"); |
36705 | 167 |
|
168 |
checkOutput("src-html/linksource/SomeClass.html", true, |
|
169 |
"<title>Source code</title>", |
|
170 |
"<span class=\"sourceLineNo\">029</span><a name=\"line.29\">" |
|
171 |
+ "public class SomeClass {</a>", |
|
172 |
"<span class=\"sourceLineNo\">031</span><a name=\"line.31\"> " |
|
173 |
+ "public int field;</a>", |
|
174 |
"<span class=\"sourceLineNo\">033</span><a name=\"line.33\"> " |
|
175 |
+ "public SomeClass() {</a>", |
|
176 |
"<span class=\"sourceLineNo\">036</span><a name=\"line.36\"> " |
|
177 |
+ "public int method() {</a>"); |
|
178 |
||
179 |
checkOutput("linksource/SomeEnum.html", true, |
|
180 |
"<pre>public static final <a href=\"../linksource/SomeEnum.html\" " |
|
181 |
+ "title=\"enum in linksource\">SomeEnum</a> <a href=" |
|
182 |
+ "\"../src-html/linksource/SomeEnum.html#line.29\">VALUE1</a></pre>", |
|
183 |
"<pre>public static final <a href=\"../linksource/SomeEnum.html\" " |
|
184 |
+ "title=\"enum in linksource\">SomeEnum</a> <a href=" |
|
185 |
+ "\"../src-html/linksource/SomeEnum.html#line.30\">VALUE2</a></pre>"); |
|
186 |
||
187 |
checkOutput("src-html/linksource/SomeEnum.html", true, |
|
188 |
"<span class=\"sourceLineNo\">029</span><a name=\"line.29\"> VALUE1,</a>", |
|
189 |
"<span class=\"sourceLineNo\">030</span><a name=\"line.30\"> VALUE2</a>"); |
|
190 |
} |
|
191 |
||
192 |
@Test |
|
193 |
void testNoQualifier() { |
|
194 |
javadoc("-d", "out-10", |
|
195 |
"-noqualifier", "pkg", |
|
196 |
"-sourcepath", testSrc, |
|
197 |
"pkg", "deprecated"); |
|
198 |
checkExit(Exit.OK); |
|
199 |
||
200 |
checkOutput("pkg/Foo.html", true, |
|
201 |
"<li>Foo</li>"); |
|
202 |
checkOutput("deprecated/Foo.html", true, |
|
203 |
"<li>deprecated.Foo</li>"); |
|
204 |
||
205 |
javadoc("-d", "out-10a", |
|
206 |
"-noqualifier", "all", |
|
207 |
"-sourcepath", testSrc, |
|
208 |
"pkg", "deprecated"); |
|
209 |
checkExit(Exit.OK); |
|
210 |
||
211 |
checkOutput("pkg/Foo.html", true, |
|
212 |
"<li>Foo</li>"); |
|
213 |
checkOutput("deprecated/Foo.html", true, |
|
214 |
"<li>Foo</li>"); |
|
215 |
} |
|
19254
0988183c8164
4749567: stddoclet: Add CSS style for setting header/footer to be italic
bpatel
parents:
diff
changeset
|
216 |
} |