TestJavaFX.java revision 3233:b5d08bc0d224
1/*
2 * Copyright (c) 2012, 2015, 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
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&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                "<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>&nbsp;</td>",
77                "<h4>isPaused</h4>\n"
78                    + "<pre>public final&nbsp;double&nbsp;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&nbsp;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&nbsp;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&nbsp;java.util.List&lt;"
125                + "java.util.Set&lt;? super java.lang.Object&gt;&gt; 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&nbsp;java.util.List&lt;"
135                + "java.lang.String&gt; gammaProperty</pre>\n"
136                + "</li>\n"
137                + "</ul>\n"
138                + "</li>");
139    }
140    /*
141     * Test without -javafx option, to ensure property getters and setters
142     * are treated just like any other java method.
143     */
144    @Test
145    void test3() {
146        javadoc("-d", "out2b",
147                "-sourcepath", testSrc,
148                "-package",
149                "pkg2");
150        checkExit(Exit.OK);
151        checkOutput("pkg2/Test.html", false, "<h3>Property Summary</h3>");
152        checkOutput("pkg2/Test.html", true,
153                "<th class=\"colFirst\" scope=\"col\">Modifier and Type</th>\n"
154                + "<th class=\"colLast\" scope=\"col\">Method and 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                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
159                + "<a href=\"../pkg2/Test.html#alphaProperty-java.util.List-\">"
160                + "alphaProperty</a></span>(java.util.List&lt;T&gt;&nbsp;foo)</code>&nbsp;</td>\n"
161                + "</tr>\n"
162                + "<tr id=\"i1\" class=\"rowColor\">\n"
163                + "<td class=\"colFirst\"><code>java.lang.Object</code></td>\n"
164                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
165                + "<a href=\"../pkg2/Test.html#betaProperty--\">betaProperty</a></span>()</code>"
166                + "&nbsp;</td>\n"
167                + "</tr>\n"
168                + "<tr id=\"i2\" class=\"altColor\">\n"
169                + "<td class=\"colFirst\"><code>"
170                + "java.util.List&lt;java.util.Set&lt;? super java.lang.Object&gt;&gt;"
171                + "</code></td>\n"
172                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
173                + "<a href=\"../pkg2/Test.html#deltaProperty--\">"
174                + "deltaProperty</a></span>()</code>&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;"
178                + "</code></td>\n"
179                + "<td class=\"colLast\"><code><span class=\"memberNameLink\">"
180                + "<a href=\"../pkg2/Test.html#gammaProperty--\">gammaProperty</a>"
181                + "</span>()</code>&nbsp;</td>"
182        );
183    }
184}
185