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