TestJavaFX.java revision 3279:e90d9efcb13f
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 27 * @summary Test of the JavaFX doclet features. 28 * @author jvalenta 29 * @library ../lib 30 * @modules jdk.javadoc 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=\"colLast\"><code><span class=\"memberNameLink\">" 65 + "<a href=\"../pkg1/C.html#rateProperty\">rate</a></span></code>\n" 66 + "<div class=\"block\">Defines the direction/speed at which the " 67 + "<code>Timeline</code> is expected to", 68 "<span class=\"simpleTagLabel\">Default value:</span>", 69 "<span class=\"simpleTagLabel\">Since:</span></dt>\n" 70 + "<dd>JavaFX 8.0</dd>", 71 "<p>Sets the value of the property <code>Property</code>", 72 "<p>Gets the value of the property <code>Property</code>", 73 "<span class=\"simpleTagLabel\">Property description:</span>", 74 "<td class=\"colLast\"><code><span class=\"memberNameLink\">" 75 + "<a href=\"../pkg1/C.html#setTestMethodProperty--\">" 76 + "setTestMethodProperty</a></span>()</code> </td>", 77 "<h4>isPaused</h4>\n" 78 + "<pre>public final double isPaused()</pre>\n" 79 + "<div class=\"block\">Gets the value of the property paused.</div>"); 80 81 checkOutput("pkg1/C.html", false, 82 "A()"); 83 84 checkOutput("pkg1/D.html", true, 85 "<h3>Properties inherited from class pkg1." 86 + "<a href=\"../pkg1/C.html\" title=\"class in pkg1\">C</a></h3>\n" 87 + "<code><a href=\"../pkg1/C.html#pausedProperty\">" 88 + "paused</a>, <a href=\"../pkg1/C.html#rateProperty\">rate</a></code></li>"); 89 90 checkOutput("pkg1/D.html", false, "shouldNotAppear"); 91 } 92 /* 93 * Test with -javafx option enabled, to ensure property getters and setters 94 * are treated correctly. 95 */ 96 @Test 97 void test2() { 98 javadoc("-d", "out2a", 99 "-sourcepath", testSrc, 100 "-javafx", 101 "-package", 102 "pkg2"); 103 checkExit(Exit.OK); 104 checkOutput("pkg2/Test.html", true, 105 "<li class=\"blockList\"><a name=\"property.detail\">\n" 106 + "<!-- -->\n" 107 + "</a>\n" 108 + "<h3>Property Detail</h3>\n" 109 + "<a name=\"betaProperty\">\n" 110 + "<!-- -->\n" 111 + "</a>\n" 112 + "<ul class=\"blockList\">\n" 113 + "<li class=\"blockList\">\n" 114 + "<h4>beta</h4>\n" 115 + "<pre>public java.lang.Object betaProperty</pre>\n" 116 + "</li>\n" 117 + "</ul>\n" 118 + "<a name=\"deltaProperty\">\n" 119 + "<!-- -->\n" 120 + "</a>\n" 121 + "<ul class=\"blockList\">\n" 122 + "<li class=\"blockList\">\n" 123 + "<h4>delta</h4>\n" 124 + "<pre>public final java.util.List<" 125 + "java.util.Set<? super java.lang.Object>> deltaProperty</pre>\n" 126 + "</li>\n" 127 + "</ul>\n" 128 + "<a name=\"gammaProperty\">\n" 129 + "<!-- -->\n" 130 + "</a>\n" 131 + "<ul class=\"blockListLast\">\n" 132 + "<li class=\"blockList\">\n" 133 + "<h4>gamma</h4>\n" 134 + "<pre>public final java.util.List<" 135 + "java.lang.String> gammaProperty</pre>\n" 136 + "</li>\n" 137 + "</ul>\n" 138 + "</li>"); 139 } 140 141 /* 142 * Test without -javafx option, to ensure property getters and setters 143 * are treated just like any other java method. 144 */ 145 @Test 146 void test3() { 147 javadoc("-d", "out2b", 148 "-sourcepath", testSrc, 149 "-package", 150 "pkg2"); 151 checkExit(Exit.OK); 152 checkOutput("pkg2/Test.html", false, "<h3>Property Summary</h3>"); 153 checkOutput("pkg2/Test.html", true, 154 "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n" 155 + "<th class=\"colLast\" scope=\"col\">Method and Description</th>\n" 156 + "</tr>\n" 157 + "<tr id=\"i0\" class=\"altColor\">\n" 158 + "<td class=\"colFirst\"><code><T> java.lang.Object</code></td>\n" 159 + "<td class=\"colLast\"><code><span class=\"memberNameLink\">" 160 + "<a href=\"../pkg2/Test.html#alphaProperty-java.util.List-\">" 161 + "alphaProperty</a></span>(java.util.List<T> foo)</code> </td>\n" 162 + "</tr>\n" 163 + "<tr id=\"i1\" class=\"rowColor\">\n" 164 + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n" 165 + "<td class=\"colLast\"><code><span class=\"memberNameLink\">" 166 + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>()</code>" 167 + " </td>\n" 168 + "</tr>\n" 169 + "<tr id=\"i2\" class=\"altColor\">\n" 170 + "<td class=\"colFirst\"><code>" 171 + "java.util.List<java.util.Set<? super java.lang.Object>>" 172 + "</code></td>\n" 173 + "<td class=\"colLast\"><code><span class=\"memberNameLink\">" 174 + "<a href=\"../pkg2/Test.html#deltaProperty--\">" 175 + "deltaProperty</a></span>()</code> </td>\n" 176 + "</tr>\n" 177 + "<tr id=\"i3\" class=\"rowColor\">\n" 178 + "<td class=\"colFirst\"><code>java.util.List<java.lang.String>" 179 + "</code></td>\n" 180 + "<td class=\"colLast\"><code><span class=\"memberNameLink\">" 181 + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a>" 182 + "</span>()</code> </td>" 183 ); 184 } 185 186 /* 187 * Force the doclet to emit a warning when processing a synthesized, 188 * DocComment, and ensure that the run succeeds. 189 */ 190 @Test 191 void test4() { 192 javadoc("-d", "out4", 193 "-javafx", 194 "-Xdoclint:none", 195 "-sourcepath", testSrc, 196 "-package", 197 "pkg4"); 198 checkExit(Exit.OK); 199 200 // make sure the doclet indeed emits the warning 201 checkOutput(Output.OUT, true, "C.java:0: warning - invalid usage of tag >"); 202 } 203} 204