8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javafx.scene.control;
27
28 import javafx.css.CssMetaData;
29 import static com.sun.javafx.scene.control.infrastructure.ControlTestUtils.*;
30
31 import com.sun.javafx.pgstub.StubToolkit;
32 import com.sun.javafx.scene.control.skin.ScrollBarSkin;
33 import com.sun.javafx.tk.Toolkit;
34 import javafx.beans.property.DoubleProperty;
35 import javafx.beans.property.ObjectProperty;
36 import javafx.beans.property.SimpleDoubleProperty;
37 import javafx.beans.property.SimpleObjectProperty;
38 import javafx.css.StyleableProperty;
39 import javafx.geometry.Orientation;
40 import static org.junit.Assert.*;
41
42
43 import org.junit.Before;
44 import org.junit.Test;
45
46 /**
47 *
48 * @author srikalyc
49 */
50 public class ScrollBarTest {
51 private ScrollBar scrollBar;//Empty string
52 private Toolkit tk;
54 @Before public void setup() {
55 tk = (StubToolkit)Toolkit.getToolkit();//This step is not needed (Just to make sure StubToolkit is loaded into VM)
56 scrollBar = new ScrollBar();
57 }
58
59
60
61 /*********************************************************************
62 * Tests for default values *
63 ********************************************************************/
64
65 @Test public void defaultConstructorShouldSetStyleClassTo_scrollbar() {
66 assertStyleClassContains(scrollBar, "scroll-bar");
67 }
68
69 @Test public void defaultFocusTraversibleIsFalse() {
70 assertFalse(scrollBar.isFocusTraversable());
71 }
72
73 @Test public void defaultWidth() {
74 assertEquals(scrollBar.getWidth(), ScrollBarSkin.DEFAULT_WIDTH, 0.0);
75 }
76
77 @Test public void defaultHeight() {
78 assertEquals(scrollBar.getHeight(), ScrollBarSkin.DEFAULT_LENGTH, 0.0);
79 }
80
81 @Test public void defaultMin() {
82 assertEquals(scrollBar.getMin(), 0.0 , 0.0);
83 }
84
85 @Test public void defaultMax() {
86 assertEquals(scrollBar.getMax(), 100.0 , 0.0);
87 }
88
89 @Test public void defaultValue() {
90 assertEquals(scrollBar.getValue(), 0.0 , 0.0);
91 }
92
93 @Test public void defaultOrientation() {
94 assertSame(scrollBar.getOrientation(), Orientation.HORIZONTAL);
95 }
96
97 @Test public void defaultUnitIncrement() {
98 assertEquals(scrollBar.getUnitIncrement(), 1.0 , 0.0);
|
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javafx.scene.control;
27
28 import com.sun.javafx.scene.control.Properties;
29 import javafx.css.CssMetaData;
30 import static com.sun.javafx.scene.control.infrastructure.ControlTestUtils.*;
31
32 import com.sun.javafx.pgstub.StubToolkit;
33 import com.sun.javafx.tk.Toolkit;
34 import javafx.beans.property.DoubleProperty;
35 import javafx.beans.property.ObjectProperty;
36 import javafx.beans.property.SimpleDoubleProperty;
37 import javafx.beans.property.SimpleObjectProperty;
38 import javafx.css.StyleableProperty;
39 import javafx.geometry.Orientation;
40 import static org.junit.Assert.*;
41
42
43 import org.junit.Before;
44 import org.junit.Test;
45
46 /**
47 *
48 * @author srikalyc
49 */
50 public class ScrollBarTest {
51 private ScrollBar scrollBar;//Empty string
52 private Toolkit tk;
54 @Before public void setup() {
55 tk = (StubToolkit)Toolkit.getToolkit();//This step is not needed (Just to make sure StubToolkit is loaded into VM)
56 scrollBar = new ScrollBar();
57 }
58
59
60
61 /*********************************************************************
62 * Tests for default values *
63 ********************************************************************/
64
65 @Test public void defaultConstructorShouldSetStyleClassTo_scrollbar() {
66 assertStyleClassContains(scrollBar, "scroll-bar");
67 }
68
69 @Test public void defaultFocusTraversibleIsFalse() {
70 assertFalse(scrollBar.isFocusTraversable());
71 }
72
73 @Test public void defaultWidth() {
74 assertEquals(scrollBar.getWidth(), Properties.DEFAULT_WIDTH, 0.0);
75 }
76
77 @Test public void defaultHeight() {
78 assertEquals(scrollBar.getHeight(), Properties.DEFAULT_LENGTH, 0.0);
79 }
80
81 @Test public void defaultMin() {
82 assertEquals(scrollBar.getMin(), 0.0 , 0.0);
83 }
84
85 @Test public void defaultMax() {
86 assertEquals(scrollBar.getMax(), 100.0 , 0.0);
87 }
88
89 @Test public void defaultValue() {
90 assertEquals(scrollBar.getValue(), 0.0 , 0.0);
91 }
92
93 @Test public void defaultOrientation() {
94 assertSame(scrollBar.getOrientation(), Orientation.HORIZONTAL);
95 }
96
97 @Test public void defaultUnitIncrement() {
98 assertEquals(scrollBar.getUnitIncrement(), 1.0 , 0.0);
|