1 /* 2 * Copyright (c) 2012, 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 7112427 8012295 8025633 8026567 8061305 8081854 8150130 8162363 27 * 8167967 8172528 8175200 8178830 8182257 8186332 8182765 8025091 28 * 8203791 8184205 29 * @summary Test of the JavaFX doclet features. 30 * @author jvalenta 31 * @library ../../lib 32 * @modules jdk.javadoc/jdk.javadoc.internal.tool 33 * @build javadoc.tester.* 34 * @run main TestJavaFX 35 */ 36 37 import javadoc.tester.JavadocTester; 38 39 public class TestJavaFX extends JavadocTester { 40 41 public static void main(String... args) throws Exception { 42 TestJavaFX tester = new TestJavaFX(); 43 tester.runTests(); 44 } 45 46 @Test 47 public void test1() { 48 javadoc("-d", "out1", 49 "-sourcepath", testSrc, 50 "-javafx", 51 "--disable-javafx-strict-checks", 52 "-package", 53 "pkg1"); 54 checkExit(Exit.OK); 55 56 checkOutput("pkg1/C.html", true, 57 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" 58 + "<dd><a href=\"#getRate()\"><code>getRate()</code></a>, \n" 59 + "<a href=\"#setRate(double)\"><code>setRate(double)</code></a></dd>", 60 "<pre class=\"methodSignature\">public final void setRate(double value)</pre>\n" 61 + "<div class=\"block\">Sets the value of the property rate.</div>\n" 62 + "<dl>\n" 63 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>", 64 "<pre class=\"methodSignature\">public final double getRate()</pre>\n" 65 + "<div class=\"block\">Gets the value of the property rate.</div>\n" 66 + "<dl>\n" 67 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>", 68 "<td class=\"colFirst\"><code><a href=\"C.DoubleProperty.html\" " 69 + "title=\"class in pkg1\">C.DoubleProperty</a></code></td>\n" 70 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 71 + "<a href=\"#rateProperty\">rate</a></span></code></th>\n" 72 + "<td class=\"colLast\">\n" 73 + "<div class=\"block\">Defines the direction/speed at which the " 74 + "<code>Timeline</code> is expected to\n" 75 + " be played.</div>\n</td>", 76 "<span class=\"simpleTagLabel\">Default value:</span>", 77 "<span class=\"simpleTagLabel\">Since:</span></dt>\n" 78 + "<dd>JavaFX 8.0</dd>", 79 "<p>Sets the value of the property <code>Property</code>", 80 "<p>Gets the value of the property <code>Property</code>", 81 "<span class=\"simpleTagLabel\">Property description:</span>", 82 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 83 + "<a href=\"#setTestMethodProperty()\">" 84 + "setTestMethodProperty</a></span>()</code></th>", 85 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 86 + "<a href=\"#pausedProperty\">paused</a></span></code></th>\n" 87 + "<td class=\"colLast\">\n" 88 + "<div class=\"block\">Defines if paused.</div>", 89 "<h3>paused</h3>\n" 90 + "<a id=\"pausedProperty\">\n" 91 + "<!-- -->\n" 92 + "</a>\n" 93 + "<pre>public final <a href=\"C.BooleanProperty.html\" " 94 + "title=\"class in pkg1\">C.BooleanProperty</a> pausedProperty</pre>\n" 95 + "<div class=\"block\">Defines if paused. The second line.</div>", 96 "<h3>isPaused</h3>\n" 97 + "<a id=\"isPaused()\">\n" 98 + "<!-- -->\n" 99 + "</a>\n" 100 + "<pre class=\"methodSignature\">public final double isPaused()</pre>\n" 101 + "<div class=\"block\">Gets the value of the property paused.</div>", 102 "<h3>setPaused</h3>\n" 103 + "<a id=\"setPaused(boolean)\">\n" 104 + "<!-- -->\n" 105 + "</a>\n" 106 + "<pre class=\"methodSignature\">public final void setPaused(boolean value)</pre>\n" 107 + "<div class=\"block\">Sets the value of the property paused.</div>\n" 108 + "<dl>\n" 109 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" 110 + "<dd>Defines if paused. The second line.</dd>\n" 111 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" 112 + "<dd>false</dd>", 113 "<h3>isPaused</h3>\n" 114 + "<a id=\"isPaused()\">\n" 115 + "<!-- -->\n" 116 + "</a>\n" 117 + "<pre class=\"methodSignature\">public final double isPaused()</pre>\n" 118 + "<div class=\"block\">Gets the value of the property paused.</div>\n" 119 + "<dl>\n" 120 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" 121 + "<dd>Defines if paused. The second line.</dd>\n" 122 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" 123 + "<dd>false</dd>", 124 "<h3>rate</h3>\n" 125 + "<a id=\"rateProperty\">\n" 126 + "<!-- -->\n" 127 + "</a>\n" 128 + "<pre>public final <a href=\"C.DoubleProperty.html\" " 129 + "title=\"class in pkg1\">C.DoubleProperty</a> rateProperty</pre>\n" 130 + "<div class=\"block\">Defines the direction/speed at which the " 131 + "<code>Timeline</code> is expected to\n" 132 + " be played. This is the second line.</div>", 133 "<h3>setRate</h3>\n" 134 + "<a id=\"setRate(double)\">\n" 135 + "<!-- -->\n" 136 + "</a>\n" 137 + "<pre class=\"methodSignature\">public final void setRate(double value)</pre>\n" 138 + "<div class=\"block\">Sets the value of the property rate.</div>\n" 139 + "<dl>\n" 140 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" 141 + "<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to\n" 142 + " be played. This is the second line.</dd>\n" 143 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" 144 + "<dd>11</dd>\n" 145 + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" 146 + "<dd>JavaFX 8.0</dd>", 147 "<h3>getRate</h3>\n" 148 + "<a id=\"getRate()\">\n" 149 + "<!-- -->\n" 150 + "</a>\n" 151 + "<pre class=\"methodSignature\">public final double getRate()</pre>\n" 152 + "<div class=\"block\">Gets the value of the property rate.</div>\n" 153 + "<dl>\n" 154 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" 155 + "<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to\n" 156 + " be played. This is the second line.</dd>\n" 157 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" 158 + "<dd>11</dd>\n" 159 + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" 160 + "<dd>JavaFX 8.0</dd>", 161 "<h2>Property Summary</h2>\n" 162 + "<div class=\"memberSummary\">\n<table>\n" 163 + "<caption><span>Properties</span><span class=\"tabEnd\"> </span></caption>", 164 "<tr class=\"altColor\">\n" 165 + "<td class=\"colFirst\"><code><a href=\"C.BooleanProperty.html\" title=\"class in pkg1\">C.BooleanProperty</a></code></td>\n", 166 "<tr class=\"rowColor\">\n" 167 + "<td class=\"colFirst\"><code><a href=\"C.DoubleProperty.html\" title=\"class in pkg1\">C.DoubleProperty</a></code></td>\n"); 168 169 checkOutput("pkg1/C.html", false, 170 "A()", 171 "<h2>Property Summary</h2>\n" 172 + "<div class=\"memberSummary\">\n" 173 + "<div role=\"tablist\" aria-orientation=\"horizontal\"><button role=\"tab\"" 174 + " aria-selected=\"true\" aria-controls=\"memberSummary_tabpanel\" tabindex=\"0\"" 175 + " onkeydown=\"switchTab(event)\" id=\"t0\" class=\"activeTableTab\">All Methods" 176 + "</button><button role=\"tab\" aria-selected=\"false\"" 177 + " aria-controls=\"memberSummary_tabpanel\" tabindex=\"-1\" onkeydown=\"switchTab(event)\"" 178 + " id=\"t2\" class=\"tableTab\" onclick=\"show(2);\">Instance Methods</button>" 179 + "<button role=\"tab\" aria-selected=\"false\" aria-controls=\"memberSummary_tabpanel\"" 180 + " tabindex=\"-1\" onkeydown=\"switchTab(event)\" id=\"t4\" class=\"tableTab\"" 181 + " onclick=\"show(8);\">Concrete Methods</button></div>", 182 "<tr id=\"i0\" class=\"altColor\">\n" 183 + "<td class=\"colFirst\"><code><a href=\"C.BooleanProperty.html\" title=\"class in pkg1\">C.BooleanProperty</a></code></td>\n", 184 "<tr id=\"i1\" class=\"rowColor\">\n" 185 + "<td class=\"colFirst\"><code><a href=\"C.DoubleProperty.html\" title=\"class in pkg1\">C.DoubleProperty</a></code></td>\n"); 186 187 checkOutput("index-all.html", true, 188 "<div class=\"block\">Gets the value of the property paused.</div>", 189 "<div class=\"block\">Defines if paused.</div>"); 190 191 checkOutput("pkg1/D.html", true, 192 "<h3>Properties inherited from class pkg1." 193 + "<a href=\"C.html\" title=\"class in pkg1\">C</a></h3>\n" 194 + "<a id=\"properties.inherited.from.class.pkg1.C\">\n" 195 + "<!-- -->\n" 196 + "</a><code><a href=\"C.html#pausedProperty\">" 197 + "paused</a>, <a href=\"C.html#rateProperty\">rate</a></code></div>"); 198 199 checkOutput("pkg1/D.html", false, "shouldNotAppear"); 200 } 201 202 /* 203 * Test with -javafx option enabled, to ensure property getters and setters 204 * are treated correctly. 205 */ 206 @Test 207 public void test2() { 208 javadoc("-d", "out2a", 209 "-sourcepath", testSrc, 210 "-javafx", 211 "--disable-javafx-strict-checks", 212 "-package", 213 "pkg2"); 214 checkExit(Exit.OK); 215 checkOutput("pkg2/Test.html", true, 216 "<h2>Property Details</h2>\n" 217 + "<a id=\"property.detail\">\n" 218 + "<!-- -->\n" 219 + "</a>\n" 220 + "<ul class=\"blockList\">\n" 221 + "<li class=\"blockList\">\n" 222 + "<section class=\"detail\">\n" 223 + "<h3>beta</h3>\n" 224 + "<a id=\"betaProperty\">\n" 225 + "<!-- -->\n" 226 + "</a>\n" 227 + "<pre>public java.lang.Object betaProperty</pre>\n" 228 + "</section>\n" 229 + "</li>\n" 230 + "<li class=\"blockList\">\n" 231 + "<section class=\"detail\">\n" 232 + "<h3>gamma</h3>\n" 233 + "<a id=\"gammaProperty\">\n" 234 + "<!-- -->\n" 235 + "</a>\n" 236 + "<pre>public final java.util.List<java.lang.String> gammaProperty</pre>\n" 237 + "</section>\n" 238 + "</li>\n" 239 + "<li class=\"blockListLast\">\n" 240 + "<section class=\"detail\">\n" 241 + "<h3>delta</h3>\n" 242 + "<a id=\"deltaProperty\">\n" 243 + "<!-- -->\n" 244 + "</a>\n" 245 + "<pre>public final java.util.List<" 246 + "java.util.Set<? super java.lang.Object>> deltaProperty</pre>\n" 247 + "</section>\n" 248 + "</li>\n" 249 + "</ul>\n" 250 + "</section>", 251 "<h2>Property Summary</h2>\n" 252 + "<div class=\"memberSummary\">\n<table>\n" 253 + "<caption><span>Properties</span><span class=\"tabEnd\"> </span></caption>"); 254 255 checkOutput("pkg2/Test.html", false, 256 "<h2>Property Summary</h2>\n" 257 + "<div class=\"memberSummary\">\n" 258 + "<div role=\"tablist\" aria-orientation=\"horizontal\"><button role=\"tab\"" 259 + " aria-selected=\"true\" aria-controls=\"memberSummary_tabpanel\" tabindex=\"0\"" 260 + " onkeydown=\"switchTab(event)\" id=\"t0\" class=\"activeTableTab\">All Methods" 261 + "</button><button role=\"tab\" aria-selected=\"false\"" 262 + " aria-controls=\"memberSummary_tabpanel\" tabindex=\"-1\" onkeydown=\"switchTab(event)\"" 263 + " id=\"t2\" class=\"tableTab\" onclick=\"show(2);\">Instance Methods</button>" 264 + "<button role=\"tab\" aria-selected=\"false\" aria-controls=\"memberSummary_tabpanel\"" 265 + " tabindex=\"-1\" onkeydown=\"switchTab(event)\" id=\"t4\" class=\"tableTab\"" 266 + " onclick=\"show(8);\">Concrete Methods</button></div>"); 267 } 268 269 /* 270 * Test without -javafx option, to ensure property getters and setters 271 * are treated just like any other java method. 272 */ 273 @Test 274 public void test3() { 275 javadoc("-d", "out2b", 276 "-sourcepath", testSrc, 277 "-package", 278 "pkg2"); 279 checkExit(Exit.OK); 280 checkOutput("pkg2/Test.html", false, "<h2>Property Summary</h2>"); 281 checkOutput("pkg2/Test.html", true, 282 "<thead>\n" 283 + "<tr>\n" 284 + "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" 285 + "<th class=\"colSecond\" scope=\"col\">Method</th>\n" 286 + "<th class=\"colLast\" scope=\"col\">Description</th>\n" 287 + "</tr>\n" 288 + "</thead>\n" 289 + "<tbody>\n" 290 + "<tr class=\"altColor\" id=\"i0\">\n" 291 + "<td class=\"colFirst\"><code><T> java.lang.Object</code></td>\n" 292 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 293 + "<a href=\"#alphaProperty(java.util.List)\">alphaProperty</a>" 294 + "</span>(java.util.List<T> foo)</code></th>\n" 295 + "<td class=\"colLast\"> </td>\n" 296 + "</tr>\n" 297 + "<tr class=\"rowColor\" id=\"i1\">\n" 298 + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n" 299 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 300 + "<a href=\"#betaProperty()\">betaProperty</a></span>()</code></th>\n" 301 + "<td class=\"colLast\"> </td>\n" 302 + "</tr>\n" 303 + "<tr class=\"altColor\" id=\"i2\">\n" 304 + "<td class=\"colFirst\"><code>java.util.List<java.util.Set<? super java.lang.Object>>" 305 + "</code></td>\n" 306 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 307 + "<a href=\"#deltaProperty()\">deltaProperty</a></span>()</code></th>\n" 308 + "<td class=\"colLast\"> </td>\n" 309 + "</tr>\n" 310 + "<tr class=\"rowColor\" id=\"i3\">\n" 311 + "<td class=\"colFirst\"><code>java.util.List<java.lang.String></code></td>\n" 312 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 313 + "<a href=\"#gammaProperty()\">gammaProperty</a></span>()</code></th>\n" 314 + "<td class=\"colLast\"> </td>" 315 ); 316 } 317 318 /* 319 * Force the doclet to emit a warning when processing a synthesized, 320 * DocComment, and ensure that the run succeeds, using the newer 321 * --javafx flag. 322 */ 323 @Test 324 public void test4() { 325 javadoc("-d", "out4", 326 "--javafx", 327 "--disable-javafx-strict-checks", 328 "-Xdoclint:none", 329 "-sourcepath", testSrc, 330 "-package", 331 "pkg4"); 332 checkExit(Exit.OK); 333 334 // make sure the doclet indeed emits the warning 335 checkOutput(Output.OUT, true, "C.java:0: warning - invalid usage of tag >"); 336 } 337 }