TestJavaFX.java revision 3764:cb9e896265ef
1/* 2 * Copyright (c) 2012, 2016, 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 8167967 27 * @summary Test of the JavaFX doclet features. 28 * @author jvalenta 29 * @library ../lib 30 * @modules jdk.javadoc/jdk.javadoc.internal.tool 31 * @build JavadocTester 32 * @run main TestJavaFX 33 */ 34 35public class TestJavaFX extends JavadocTester { 36 37 public static void main(String... args) throws Exception { 38 TestJavaFX tester = new TestJavaFX(); 39 tester.runTests(); 40 } 41 42 @Test 43 void test1() { 44 javadoc("-d", "out1", 45 "-sourcepath", testSrc, 46 "-javafx", 47 "-package", 48 "pkg1"); 49 checkExit(Exit.OK); 50 51 checkOutput("pkg1/C.html", true, 52 "<dt><span class=\"seeLabel\">See Also:</span></dt>\n" 53 + "<dd><a href=\"../pkg1/C.html#getRate--\"><code>getRate()</code></a>, \n" 54 + "<a href=\"../pkg1/C.html#setRate-double-\">" 55 + "<code>setRate(double)</code></a></dd>", 56 "<pre>public final void setRate(double value)</pre>\n" 57 + "<div class=\"block\">Sets the value of the property rate.</div>\n" 58 + "<dl>\n" 59 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>", 60 "<pre>public final double getRate()</pre>\n" 61 + "<div class=\"block\">Gets the value of the property rate.</div>\n" 62 + "<dl>\n" 63 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>", 64 "<td class=\"colFirst\"><code><a href=\"../pkg1/C.DoubleProperty.html\" " 65 + "title=\"class in pkg1\">C.DoubleProperty</a></code></td>\n" 66 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 67 + "<a href=\"../pkg1/C.html#rateProperty\">rate</a></span></code></th>\n" 68 + "<td class=\"colLast\">\n" 69 + "<div class=\"block\">Defines the direction/speed at which the " 70 + "<code>Timeline</code> is expected to\n" 71 + " be played.</div>\n</td>", 72 "<span class=\"simpleTagLabel\">Default value:</span>", 73 "<span class=\"simpleTagLabel\">Since:</span></dt>\n" 74 + "<dd>JavaFX 8.0</dd>", 75 "<p>Sets the value of the property <code>Property</code>", 76 "<p>Gets the value of the property <code>Property</code>", 77 "<span class=\"simpleTagLabel\">Property description:</span>", 78 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 79 + "<a href=\"../pkg1/C.html#setTestMethodProperty--\">" 80 + "setTestMethodProperty</a></span>()</code></th>", 81 "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 82 + "<a href=\"../pkg1/C.html#pausedProperty\">paused</a></span></code></th>\n" 83 + "<td class=\"colLast\">\n" 84 + "<div class=\"block\">Defines if paused.</div>", 85 "<h4>paused</h4>\n" 86 + "<pre>public final <a href=\"../pkg1/C.BooleanProperty.html\" " 87 + "title=\"class in pkg1\">C.BooleanProperty</a> pausedProperty</pre>\n" 88 + "<div class=\"block\">Defines if paused. The second line.</div>", 89 "<h4>isPaused</h4>\n" 90 + "<pre>public final double isPaused()</pre>\n" 91 + "<div class=\"block\">Gets the value of the property paused.</div>", 92 "<h4>setPaused</h4>\n" 93 + "<pre>public final void setPaused(boolean value)</pre>\n" 94 + "<div class=\"block\">Sets the value of the property paused.</div>\n" 95 + "<dl>\n" 96 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" 97 + "<dd>Defines if paused. The second line.</dd>\n" 98 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" 99 + "<dd>false</dd>", 100 "<h4>isPaused</h4>\n" 101 + "<pre>public final double isPaused()</pre>\n" 102 + "<div class=\"block\">Gets the value of the property paused.</div>\n" 103 + "<dl>\n" 104 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" 105 + "<dd>Defines if paused. The second line.</dd>\n" 106 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" 107 + "<dd>false</dd>", 108 "<h4>rate</h4>\n" 109 + "<pre>public final <a href=\"../pkg1/C.DoubleProperty.html\" " 110 + "title=\"class in pkg1\">C.DoubleProperty</a> rateProperty</pre>\n" 111 + "<div class=\"block\">Defines the direction/speed at which the " 112 + "<code>Timeline</code> is expected to\n" 113 + " be played. This is the second line.</div>", 114 "<h4>setRate</h4>\n" 115 + "<pre>public final void setRate(double value)</pre>\n" 116 + "<div class=\"block\">Sets the value of the property rate.</div>\n" 117 + "<dl>\n" 118 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" 119 + "<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to\n" 120 + " be played. This is the second line.</dd>\n" 121 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" 122 + "<dd>11</dd>\n" 123 + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" 124 + "<dd>JavaFX 8.0</dd>", 125 "<h4>getRate</h4>\n" 126 + "<pre>public final double getRate()</pre>\n" 127 + "<div class=\"block\">Gets the value of the property rate.</div>\n" 128 + "<dl>\n" 129 + "<dt><span class=\"simpleTagLabel\">Property description:</span></dt>\n" 130 + "<dd>Defines the direction/speed at which the <code>Timeline</code> is expected to\n" 131 + " be played. This is the second line.</dd>\n" 132 + "<dt><span class=\"simpleTagLabel\">Default value:</span></dt>\n" 133 + "<dd>11</dd>\n" 134 + "<dt><span class=\"simpleTagLabel\">Since:</span></dt>\n" 135 + "<dd>JavaFX 8.0</dd>", 136 ""); 137 138 checkOutput("pkg1/C.html", false, 139 "A()"); 140 141 checkOutput("index-all.html", true, 142 "<div class=\"block\">Gets the value of the property paused.</div>", 143 "<div class=\"block\">Defines if paused.</div>"); 144 145 checkOutput("pkg1/D.html", true, 146 "<h3>Properties inherited from class pkg1." 147 + "<a href=\"../pkg1/C.html\" title=\"class in pkg1\">C</a></h3>\n" 148 + "<code><a href=\"../pkg1/C.html#pausedProperty\">" 149 + "paused</a>, <a href=\"../pkg1/C.html#rateProperty\">rate</a></code></li>"); 150 151 checkOutput("pkg1/D.html", false, "shouldNotAppear"); 152 } 153 /* 154 * Test with -javafx option enabled, to ensure property getters and setters 155 * are treated correctly. 156 */ 157 @Test 158 void test2() { 159 javadoc("-d", "out2a", 160 "-sourcepath", testSrc, 161 "-javafx", 162 "-package", 163 "pkg2"); 164 checkExit(Exit.OK); 165 checkOutput("pkg2/Test.html", true, 166 "<h3>Property Detail</h3>\n" 167 + "<a name=\"betaProperty\">\n" 168 + "<!-- -->\n" 169 + "</a>\n" 170 + "<ul class=\"blockList\">\n" 171 + "<li class=\"blockList\">\n" 172 + "<h4>beta</h4>\n" 173 + "<pre>public java.lang.Object betaProperty</pre>\n" 174 + "</li>\n" 175 + "</ul>\n" 176 + "<a name=\"gammaProperty\">\n" 177 + "<!-- -->\n" 178 + "</a>\n" 179 + "<ul class=\"blockList\">\n" 180 + "<li class=\"blockList\">\n" 181 + "<h4>gamma</h4>\n" 182 + "<pre>public final java.util.List<java.lang.String> gammaProperty</pre>\n" 183 + "</li>\n" 184 + "</ul>\n" 185 + "<a name=\"deltaProperty\">\n" 186 + "<!-- -->\n" 187 + "</a>\n" 188 + "<ul class=\"blockListLast\">\n" 189 + "<li class=\"blockList\">\n" 190 + "<h4>delta</h4>\n" 191 + "<pre>public final java.util.List<" 192 + "java.util.Set<? super java.lang.Object>> deltaProperty</pre>\n" 193 + "</li>\n" 194 + "</ul>\n" 195 + "</li>\n" 196 + "</ul>"); 197 } 198 199 /* 200 * Test without -javafx option, to ensure property getters and setters 201 * are treated just like any other java method. 202 */ 203 @Test 204 void test3() { 205 javadoc("-d", "out2b", 206 "-sourcepath", testSrc, 207 "-package", 208 "pkg2"); 209 checkExit(Exit.OK); 210 checkOutput("pkg2/Test.html", false, "<h3>Property Summary</h3>"); 211 checkOutput("pkg2/Test.html", true, 212 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" 213 + "<th class=\"colSecond\" scope=\"col\">Method</th>\n" 214 + "<th class=\"colLast\" scope=\"col\">Description</th>\n" 215 + "</tr>\n" 216 + "<tr id=\"i0\" class=\"altColor\">\n" 217 + "<td class=\"colFirst\"><code><T> java.lang.Object</code></td>\n" 218 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 219 + "<a href=\"../pkg2/Test.html#alphaProperty-java.util.List-\">alphaProperty</a>" 220 + "</span>(java.util.List<T> foo)</code></th>\n" 221 + "<td class=\"colLast\"> </td>\n" 222 + "</tr>\n" 223 + "<tr id=\"i1\" class=\"rowColor\">\n" 224 + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n" 225 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 226 + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>()</code></th>\n" 227 + "<td class=\"colLast\"> </td>\n" 228 + "</tr>\n" 229 + "<tr id=\"i2\" class=\"altColor\">\n" 230 + "<td class=\"colFirst\"><code>java.util.List<java.util.Set<? super java.lang.Object>>" 231 + "</code></td>\n" 232 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 233 + "<a href=\"../pkg2/Test.html#deltaProperty--\">deltaProperty</a></span>()</code></th>\n" 234 + "<td class=\"colLast\"> </td>\n" 235 + "</tr>\n" 236 + "<tr id=\"i3\" class=\"rowColor\">\n" 237 + "<td class=\"colFirst\"><code>java.util.List<java.lang.String></code></td>\n" 238 + "<th class=\"colSecond\" scope=\"row\"><code><span class=\"memberNameLink\">" 239 + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a></span>()</code></th>\n" 240 + "<td class=\"colLast\"> </td>" 241 ); 242 } 243 244 /* 245 * Force the doclet to emit a warning when processing a synthesized, 246 * DocComment, and ensure that the run succeeds. 247 */ 248 @Test 249 void test4() { 250 javadoc("-d", "out4", 251 "-javafx", 252 "-Xdoclint:none", 253 "-sourcepath", testSrc, 254 "-package", 255 "pkg4"); 256 checkExit(Exit.OK); 257 258 // make sure the doclet indeed emits the warning 259 checkOutput(Output.OUT, true, "C.java:0: warning - invalid usage of tag >"); 260 } 261} 262