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