1 /* 2 * Copyright (c) 2010, 2013, 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. Oracle designates this 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.tk.Toolkit; 33 import javafx.beans.property.BooleanProperty; 34 import javafx.beans.property.DoubleProperty; 35 import javafx.beans.property.ObjectProperty; 36 import javafx.beans.property.SimpleBooleanProperty; 37 import javafx.beans.property.SimpleDoubleProperty; 38 import javafx.beans.property.SimpleObjectProperty; 39 import javafx.css.StyleableProperty; 40 import javafx.geometry.BoundingBox; 41 import javafx.geometry.Bounds; 42 import static org.junit.Assert.*; 43 44 45 import org.junit.Before; 46 import org.junit.Test; 47 48 /** 49 * 50 * @author srikalyc 51 */ 52 public class ScrollPaneTest { 53 private ScrollPane scrollPane;//Empty string 54 private Toolkit tk; 55 56 @Before public void setup() { 57 tk = (StubToolkit)Toolkit.getToolkit();//This step is not needed (Just to make sure StubToolkit is loaded into VM) 58 scrollPane = new ScrollPane(); 59 } 60 61 62 63 /********************************************************************* 64 * Tests for default values * 65 ********************************************************************/ 66 67 @Test public void defaultConstructorShouldSetStyleClassTo_scrollpane() { 68 assertStyleClassContains(scrollPane, "scroll-pane"); 69 } 70 71 @Test public void defaultFocusTraversibleIsFalse() { 72 assertFalse(scrollPane.isFocusTraversable()); 73 } 74 75 @Test public void defaultHBarPolicy() { 76 assertSame(scrollPane.getHbarPolicy(), ScrollPane.ScrollBarPolicy.AS_NEEDED); 77 } 78 79 @Test public void defaultVBarPolicy() { 80 assertSame(scrollPane.getVbarPolicy(), ScrollPane.ScrollBarPolicy.AS_NEEDED); 81 } 82 83 @Test public void defaultHvalue() { 84 assertEquals(scrollPane.getHvalue(), 0.0 , 0.0); 85 } 86 87 @Test public void defaultHmin() { 88 assertEquals(scrollPane.getHmin(), 0.0 , 0.0); 89 } 90 91 @Test public void defaultHmax() { 92 assertEquals(scrollPane.getHmax(), 1.0 , 0.0); 93 } 94 95 @Test public void defaultVvalue() { 96 assertEquals(scrollPane.getVvalue(), 0.0 , 0.0); 97 } 98 99 @Test public void defaultVmin() { 100 assertEquals(scrollPane.getVmin(), 0.0 , 0.0); 101 } 102 103 @Test public void defaultVmax() { 104 assertEquals(scrollPane.getVmax(), 1.0 , 0.0); 105 } 106 107 @Test public void defaultFitToWidth() { 108 assertEquals(scrollPane.isFitToWidth(), false); 109 } 110 111 @Test public void defaultFitToHeight() { 112 assertEquals(scrollPane.isFitToHeight(), false); 113 } 114 115 @Test public void defaultPannable() { 116 assertEquals(scrollPane.isPannable(), false); 117 } 118 119 @Test public void defaultPreferredViewportWidth() { 120 assertEquals(scrollPane.getPrefViewportWidth(), 0.0, 0.0); 121 } 122 123 @Test public void defaultPreferredViewportHeight() { 124 assertEquals(scrollPane.getPrefViewportHeight(), 0.0, 0.0); 125 } 126 127 @Test public void defaultViewportBounds() { 128 assertEquals(scrollPane.getViewportBounds(), new BoundingBox(0.0, 0.0, 0.0, 0.0)); 129 } 130 131 /********************************************************************* 132 * Tests for property binding * 133 ********************************************************************/ 134 135 @Test public void checkHBarPolicyPropertyBind() { 136 ObjectProperty objPr = new SimpleObjectProperty<ScrollPane.ScrollBarPolicy>(ScrollPane.ScrollBarPolicy.ALWAYS); 137 scrollPane.hbarPolicyProperty().bind(objPr); 138 assertSame("HBarPolicyProperty cannot be bound", scrollPane.hbarPolicyProperty().getValue(), ScrollPane.ScrollBarPolicy.ALWAYS); 139 objPr.setValue(ScrollPane.ScrollBarPolicy.NEVER); 140 assertSame("HBarPolicyProperty cannot be bound", scrollPane.hbarPolicyProperty().getValue(), ScrollPane.ScrollBarPolicy.NEVER); 141 } 142 143 @Test public void checkVBarPolicyPropertyBind() { 144 ObjectProperty objPr = new SimpleObjectProperty<ScrollPane.ScrollBarPolicy>(ScrollPane.ScrollBarPolicy.ALWAYS); 145 scrollPane.vbarPolicyProperty().bind(objPr); 146 assertSame("VBarPolicyProperty cannot be bound", scrollPane.vbarPolicyProperty().getValue(), ScrollPane.ScrollBarPolicy.ALWAYS); 147 objPr.setValue(ScrollPane.ScrollBarPolicy.NEVER); 148 assertSame("VBarPolicyProperty cannot be bound", scrollPane.vbarPolicyProperty().getValue(), ScrollPane.ScrollBarPolicy.NEVER); 149 } 150 151 @Test public void checkHValuePropertyBind() { 152 DoubleProperty objPr = new SimpleDoubleProperty(2.0); 153 scrollPane.hvalueProperty().bind(objPr); 154 assertEquals("hvalueProperty cannot be bound", scrollPane.hvalueProperty().getValue(), 2.0, 0.0); 155 objPr.setValue(5.0); 156 assertEquals("hvalueProperty cannot be bound", scrollPane.hvalueProperty().getValue(), 5.0, 0.0); 157 } 158 159 @Test public void checkHminPropertyBind() { 160 DoubleProperty objPr = new SimpleDoubleProperty(2.0); 161 scrollPane.hminProperty().bind(objPr); 162 assertEquals("hminProperty cannot be bound", scrollPane.hminProperty().getValue(), 2.0, 0.0); 163 objPr.setValue(5.0); 164 assertEquals("hminProperty cannot be bound", scrollPane.hminProperty().getValue(), 5.0, 0.0); 165 } 166 167 @Test public void checkHmaxPropertyBind() { 168 DoubleProperty objPr = new SimpleDoubleProperty(2.0); 169 scrollPane.hmaxProperty().bind(objPr); 170 assertEquals("hmaxProperty cannot be bound", scrollPane.hmaxProperty().getValue(), 2.0, 0.0); 171 objPr.setValue(5.0); 172 assertEquals("hmaxProperty cannot be bound", scrollPane.hmaxProperty().getValue(), 5.0, 0.0); 173 } 174 175 @Test public void checkVValuePropertyBind() { 176 DoubleProperty objPr = new SimpleDoubleProperty(2.0); 177 scrollPane.vvalueProperty().bind(objPr); 178 assertEquals("vvalueProperty cannot be bound", scrollPane.vvalueProperty().getValue(), 2.0, 0.0); 179 objPr.setValue(5.0); 180 assertEquals("vvalueProperty cannot be bound", scrollPane.vvalueProperty().getValue(), 5.0, 0.0); 181 } 182 183 @Test public void checkVminPropertyBind() { 184 DoubleProperty objPr = new SimpleDoubleProperty(2.0); 185 scrollPane.vminProperty().bind(objPr); 186 assertEquals("vminProperty cannot be bound", scrollPane.vminProperty().getValue(), 2.0, 0.0); 187 objPr.setValue(5.0); 188 assertEquals("vminProperty cannot be bound", scrollPane.vminProperty().getValue(), 5.0, 0.0); 189 } 190 191 @Test public void checkVmaxPropertyBind() { 192 DoubleProperty objPr = new SimpleDoubleProperty(2.0); 193 scrollPane.vmaxProperty().bind(objPr); 194 assertEquals("vmaxProperty cannot be bound", scrollPane.vmaxProperty().getValue(), 2.0, 0.0); 195 objPr.setValue(5.0); 196 assertEquals("vmaxProperty cannot be bound", scrollPane.vmaxProperty().getValue(), 5.0, 0.0); 197 } 198 199 @Test public void checkFitToWidthPropertyBind() { 200 BooleanProperty objPr = new SimpleBooleanProperty(true); 201 scrollPane.fitToWidthProperty().bind(objPr); 202 assertEquals("FitToWidth cannot be bound", scrollPane.fitToWidthProperty().getValue(), true); 203 objPr.setValue(false); 204 assertEquals("FitToWidth cannot be bound", scrollPane.fitToWidthProperty().getValue(), false); 205 } 206 207 @Test public void checkFitToHeigtPropertyBind() { 208 BooleanProperty objPr = new SimpleBooleanProperty(true); 209 scrollPane.fitToHeightProperty().bind(objPr); 210 assertEquals("FitToHeigt cannot be bound", scrollPane.fitToHeightProperty().getValue(), true); 211 objPr.setValue(false); 212 assertEquals("FitToHeigt cannot be bound", scrollPane.fitToHeightProperty().getValue(), false); 213 } 214 215 @Test public void checkPannablePropertyBind() { 216 BooleanProperty objPr = new SimpleBooleanProperty(true); 217 scrollPane.pannableProperty().bind(objPr); 218 assertEquals("Pannable cannot be bound", scrollPane.pannableProperty().getValue(), true); 219 objPr.setValue(false); 220 assertEquals("Pannable cannot be bound", scrollPane.pannableProperty().getValue(), false); 221 } 222 223 @Test public void checkPreferredViewportWidthBind() { 224 DoubleProperty objPr = new SimpleDoubleProperty(2.0); 225 scrollPane.prefViewportWidthProperty().bind(objPr); 226 assertEquals("prefViewportWidthProperty cannot be bound", scrollPane.prefViewportWidthProperty().getValue(), 2.0, 0.0); 227 objPr.setValue(5.0); 228 assertEquals("prefViewportWidthProperty cannot be bound", scrollPane.prefViewportWidthProperty().getValue(), 5.0, 0.0); 229 } 230 231 @Test public void checkPreferredViewportHeightBind() { 232 DoubleProperty objPr = new SimpleDoubleProperty(2.0); 233 scrollPane.prefViewportHeightProperty().bind(objPr); 234 assertEquals("prefViewportHeightProperty cannot be bound", scrollPane.prefViewportHeightProperty().getValue(), 2.0, 0.0); 235 objPr.setValue(5.0); 236 assertEquals("prefViewportHeightProperty cannot be bound", scrollPane.prefViewportHeightProperty().getValue(), 5.0, 0.0); 237 } 238 239 @Test public void checkViewportBoundsBind() { 240 Bounds b = null; 241 ObjectProperty objPr = new SimpleObjectProperty<Bounds>(b); 242 scrollPane.viewportBoundsProperty().bind(objPr); 243 assertNull("viewportBoundsProperty cannot be bound", scrollPane.viewportBoundsProperty().getValue()); 244 b = new BoundingBox(0.0, 0.0, 0.0, 0.0); 245 objPr.setValue(b); 246 assertSame("viewportBoundsProperty cannot be bound", scrollPane.viewportBoundsProperty().getValue(), b); 247 } 248 249 250 @Test public void hbarPolicyPropertyHasBeanReference() { 251 assertSame(scrollPane, scrollPane.hbarPolicyProperty().getBean()); 252 } 253 254 @Test public void hbarPolicyPropertyHasName() { 255 assertEquals("hbarPolicy", scrollPane.hbarPolicyProperty().getName()); 256 } 257 258 @Test public void vbarPolicyPropertyHasBeanReference() { 259 assertSame(scrollPane, scrollPane.vbarPolicyProperty().getBean()); 260 } 261 262 @Test public void vbarPolicyPropertyHasName() { 263 assertEquals("vbarPolicy", scrollPane.vbarPolicyProperty().getName()); 264 } 265 266 @Test public void hvaluePropertyHasBeanReference() { 267 assertSame(scrollPane, scrollPane.hvalueProperty().getBean()); 268 } 269 270 @Test public void hvaluePropertyHasName() { 271 assertEquals("hvalue", scrollPane.hvalueProperty().getName()); 272 } 273 274 @Test public void hminPropertyHasBeanReference() { 275 assertSame(scrollPane, scrollPane.hminProperty().getBean()); 276 } 277 278 @Test public void hminPropertyHasName() { 279 assertEquals("hmin", scrollPane.hminProperty().getName()); 280 } 281 282 @Test public void hmaxPropertyHasBeanReference() { 283 assertSame(scrollPane, scrollPane.hmaxProperty().getBean()); 284 } 285 286 @Test public void hmaxPropertyHasName() { 287 assertEquals("hmax", scrollPane.hmaxProperty().getName()); 288 } 289 290 @Test public void vvaluePropertyHasBeanReference() { 291 assertSame(scrollPane, scrollPane.vvalueProperty().getBean()); 292 } 293 294 @Test public void vvaluePropertyHasName() { 295 assertEquals("vvalue", scrollPane.vvalueProperty().getName()); 296 } 297 298 @Test public void vminPropertyHasBeanReference() { 299 assertSame(scrollPane, scrollPane.vminProperty().getBean()); 300 } 301 302 @Test public void vminPropertyHasName() { 303 assertEquals("vmin", scrollPane.vminProperty().getName()); 304 } 305 306 @Test public void vmaxPropertyHasBeanReference() { 307 assertSame(scrollPane, scrollPane.vmaxProperty().getBean()); 308 } 309 310 @Test public void vmaxPropertyHasName() { 311 assertEquals("vmax", scrollPane.vmaxProperty().getName()); 312 } 313 314 @Test public void fitToWidthPropertyHasBeanReference() { 315 assertSame(scrollPane, scrollPane.fitToWidthProperty().getBean()); 316 } 317 318 @Test public void fitToWidthPropertyHasName() { 319 assertEquals("fitToWidth", scrollPane.fitToWidthProperty().getName()); 320 } 321 322 @Test public void fitToHeightPropertyHasBeanReference() { 323 assertSame(scrollPane, scrollPane.fitToHeightProperty().getBean()); 324 } 325 326 @Test public void fitToHeightPropertyHasName() { 327 assertEquals("fitToHeight", scrollPane.fitToHeightProperty().getName()); 328 } 329 330 @Test public void pannablePropertyHasBeanReference() { 331 assertSame(scrollPane, scrollPane.pannableProperty().getBean()); 332 } 333 334 @Test public void pannablePropertyHasName() { 335 assertEquals("pannable", scrollPane.pannableProperty().getName()); 336 } 337 338 @Test public void prefViewportWidthPropertyHasBeanReference() { 339 assertSame(scrollPane, scrollPane.prefViewportWidthProperty().getBean()); 340 } 341 342 @Test public void prefViewportWidthPropertyHasName() { 343 assertEquals("prefViewportWidth", scrollPane.prefViewportWidthProperty().getName()); 344 } 345 346 @Test public void prefViewportHeightPropertyHasBeanReference() { 347 assertSame(scrollPane, scrollPane.prefViewportHeightProperty().getBean()); 348 } 349 350 @Test public void prefViewportHeightPropertyHasName() { 351 assertEquals("prefViewportHeight", scrollPane.prefViewportHeightProperty().getName()); 352 } 353 354 @Test public void viewportBoundsPropertyHasBeanReference() { 355 assertSame(scrollPane, scrollPane.viewportBoundsProperty().getBean()); 356 } 357 358 @Test public void viewportBoundsPropertyHasName() { 359 assertEquals("viewportBounds", scrollPane.viewportBoundsProperty().getName()); 360 } 361 362 363 364 /********************************************************************* 365 * Check for Pseudo classes * 366 ********************************************************************/ 367 @Test public void settingFitToWidthSetsPseudoClass() { 368 scrollPane.setFitToWidth(true); 369 assertPseudoClassExists(scrollPane, "fitToWidth"); 370 } 371 372 @Test public void clearingFitToWidthClearsPseudoClass() { 373 scrollPane.setFitToWidth(true); 374 scrollPane.setFitToWidth(false); 375 assertPseudoClassDoesNotExist(scrollPane, "fitToWidth"); 376 } 377 378 @Test public void settingFitToHeightSetsPseudoClass() { 379 scrollPane.setFitToHeight(true); 380 assertPseudoClassExists(scrollPane, "fitToHeight"); 381 } 382 383 @Test public void clearingFitToHeightClearsPseudoClass() { 384 scrollPane.setFitToHeight(true); 385 scrollPane.setFitToHeight(false); 386 assertPseudoClassDoesNotExist(scrollPane, "fitToHeight"); 387 } 388 389 @Test public void settingPannableSetsPseudoClass() { 390 scrollPane.setPannable(true); 391 assertPseudoClassExists(scrollPane, "pannable"); 392 } 393 394 @Test public void clearingPannableClearsPseudoClass() { 395 scrollPane.setPannable(true); 396 scrollPane.setPannable(false); 397 assertPseudoClassDoesNotExist(scrollPane, "pannable"); 398 } 399 400 401 /********************************************************************* 402 * CSS related Tests * 403 ********************************************************************/ 404 @Test public void whenHbarPolicyIsBound_impl_cssSettable_ReturnsFalse() { 405 CssMetaData styleable = ((StyleableProperty)scrollPane.hbarPolicyProperty()).getCssMetaData(); 406 assertTrue(styleable.isSettable(scrollPane)); 407 ObjectProperty<ScrollPane.ScrollBarPolicy> other = new SimpleObjectProperty<ScrollPane.ScrollBarPolicy>(ScrollPane.ScrollBarPolicy.AS_NEEDED); 408 scrollPane.hbarPolicyProperty().bind(other); 409 assertFalse(styleable.isSettable(scrollPane)); 410 } 411 412 @Test public void whenHbarPolicyIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() { 413 CssMetaData styleable = ((StyleableProperty)scrollPane.hbarPolicyProperty()).getCssMetaData(); 414 assertTrue(styleable.isSettable(scrollPane)); 415 } 416 417 @Test public void canSpecifyHbarPolicyViaCSS() { 418 ((StyleableProperty)scrollPane.hbarPolicyProperty()).applyStyle(null, ScrollPane.ScrollBarPolicy.NEVER); 419 assertSame(ScrollPane.ScrollBarPolicy.NEVER, scrollPane.hbarPolicyProperty().get()); 420 } 421 422 @Test public void whenVbarPolicyIsBound_impl_cssSettable_ReturnsFalse() { 423 CssMetaData styleable = ((StyleableProperty)scrollPane.vbarPolicyProperty()).getCssMetaData(); 424 assertTrue(styleable.isSettable(scrollPane)); 425 ObjectProperty<ScrollPane.ScrollBarPolicy> other = new SimpleObjectProperty<ScrollPane.ScrollBarPolicy>(ScrollPane.ScrollBarPolicy.AS_NEEDED); 426 scrollPane.vbarPolicyProperty().bind(other); 427 assertFalse(styleable.isSettable(scrollPane)); 428 } 429 430 @Test public void whenVbarPolicyIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() { 431 CssMetaData styleable = ((StyleableProperty)scrollPane.vbarPolicyProperty()).getCssMetaData(); 432 assertTrue(styleable.isSettable(scrollPane)); 433 } 434 435 @Test public void canSpecifyVbarPolicyViaCSS() { 436 ((StyleableProperty)scrollPane.vbarPolicyProperty()).applyStyle(null, ScrollPane.ScrollBarPolicy.NEVER); 437 assertSame(ScrollPane.ScrollBarPolicy.NEVER, scrollPane.getVbarPolicy()); 438 } 439 440 @Test public void whenFitToWidthIsBound_impl_cssSettable_ReturnsFalse() { 441 CssMetaData styleable = ((StyleableProperty)scrollPane.fitToWidthProperty()).getCssMetaData(); 442 assertTrue(styleable.isSettable(scrollPane)); 443 BooleanProperty other = new SimpleBooleanProperty(); 444 scrollPane.fitToWidthProperty().bind(other); 445 assertFalse(styleable.isSettable(scrollPane)); 446 } 447 448 @Test public void whenFitToWidthIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() { 449 CssMetaData styleable = ((StyleableProperty)scrollPane.fitToWidthProperty()).getCssMetaData(); 450 assertTrue(styleable.isSettable(scrollPane)); 451 } 452 453 @Test public void canSpecifyFitToWidthViaCSS() { 454 ((StyleableProperty)scrollPane.fitToWidthProperty()).applyStyle(null, Boolean.TRUE); 455 assertSame(true, scrollPane.isFitToWidth()); 456 } 457 458 @Test public void whenFitToHeightIsBound_impl_cssSettable_ReturnsFalse() { 459 CssMetaData styleable = ((StyleableProperty)scrollPane.fitToHeightProperty()).getCssMetaData(); 460 assertTrue(styleable.isSettable(scrollPane)); 461 BooleanProperty other = new SimpleBooleanProperty(); 462 scrollPane.fitToHeightProperty().bind(other); 463 assertFalse(styleable.isSettable(scrollPane)); 464 } 465 466 @Test public void whenFitToHeightIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() { 467 CssMetaData styleable = ((StyleableProperty)scrollPane.fitToHeightProperty()).getCssMetaData(); 468 assertTrue(styleable.isSettable(scrollPane)); 469 } 470 471 @Test public void canSpecifyFitToHeightViaCSS() { 472 ((StyleableProperty)scrollPane.fitToHeightProperty()).applyStyle(null, Boolean.TRUE); 473 assertSame(true, scrollPane.isFitToHeight()); 474 } 475 476 @Test public void whenPannableIsBound_impl_cssSettable_ReturnsFalse() { 477 CssMetaData styleable = ((StyleableProperty)scrollPane.pannableProperty()).getCssMetaData(); 478 assertTrue(styleable.isSettable(scrollPane)); 479 BooleanProperty other = new SimpleBooleanProperty(); 480 scrollPane.pannableProperty().bind(other); 481 assertFalse(styleable.isSettable(scrollPane)); 482 } 483 484 @Test public void whenPannableIsSpecifiedViaCSSAndIsNotBound_impl_cssSettable_ReturnsTrue() { 485 CssMetaData styleable = ((StyleableProperty)scrollPane.pannableProperty()).getCssMetaData(); 486 assertTrue(styleable.isSettable(scrollPane)); 487 } 488 489 @Test public void canSpecifyPannableViaCSS() { 490 ((StyleableProperty)scrollPane.pannableProperty()).applyStyle(null, Boolean.TRUE); 491 assertSame(true, scrollPane.isPannable()); 492 } 493 494 495 /********************************************************************* 496 * Miscellaneous Tests * 497 ********************************************************************/ 498 @Test public void setHbarPolicyAndSeeValueIsReflectedInModel() { 499 scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); 500 assertSame(scrollPane.hbarPolicyProperty().getValue(), ScrollPane.ScrollBarPolicy.NEVER); 501 } 502 503 @Test public void setHbarPolicyAndSeeValue() { 504 scrollPane.setHbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS); 505 assertSame(scrollPane.getHbarPolicy(), ScrollPane.ScrollBarPolicy.ALWAYS); 506 } 507 508 @Test public void setVbarPolicyAndSeeValueIsReflectedInModel() { 509 scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); 510 assertSame(scrollPane.vbarPolicyProperty().getValue(), ScrollPane.ScrollBarPolicy.NEVER); 511 } 512 513 @Test public void setVbarPolicyAndSeeValue() { 514 scrollPane.setVbarPolicy(ScrollPane.ScrollBarPolicy.ALWAYS); 515 assertSame(scrollPane.getVbarPolicy(), ScrollPane.ScrollBarPolicy.ALWAYS); 516 } 517 518 @Test public void setHvalueAndSeeValueIsReflectedInModel() { 519 scrollPane.setHvalue(30.0); 520 assertEquals(scrollPane.hvalueProperty().getValue(), 30.0, 0.0); 521 } 522 523 @Test public void setHvalueAndSeeValue() { 524 scrollPane.setHvalue(30.0); 525 assertEquals(scrollPane.getHvalue(), 30.0, 0.0); 526 } 527 528 @Test public void setHminAndSeeValueIsReflectedInModel() { 529 scrollPane.setHmin(30.0); 530 assertEquals(scrollPane.hminProperty().getValue(), 30.0, 0.0); 531 } 532 533 @Test public void setHminAndSeeValue() { 534 scrollPane.setHmin(30.0); 535 assertEquals(scrollPane.getHmin(), 30.0, 0.0); 536 } 537 538 @Test public void setHmaxAndSeeValueIsReflectedInModel() { 539 scrollPane.setHmax(30.0); 540 assertEquals(scrollPane.hmaxProperty().getValue(), 30.0, 0.0); 541 } 542 543 @Test public void setHmaxAndSeeValue() { 544 scrollPane.setHmax(30.0); 545 assertEquals(scrollPane.getHmax(), 30.0, 0.0); 546 } 547 548 @Test public void setVvalueAndSeeValueIsReflectedInModel() { 549 scrollPane.setVvalue(30.0); 550 assertEquals(scrollPane.vvalueProperty().getValue(), 30.0, 0.0); 551 } 552 553 @Test public void setVvalueAndSeeValue() { 554 scrollPane.setVvalue(30.0); 555 assertEquals(scrollPane.getVvalue(), 30.0, 0.0); 556 } 557 558 @Test public void setVminAndSeeValueIsReflectedInModel() { 559 scrollPane.setVmin(30.0); 560 assertEquals(scrollPane.vminProperty().getValue(), 30.0, 0.0); 561 } 562 563 @Test public void setVminAndSeeValue() { 564 scrollPane.setVmin(30.0); 565 assertEquals(scrollPane.getVmin(), 30.0, 0.0); 566 } 567 568 @Test public void setVmaxAndSeeValueIsReflectedInModel() { 569 scrollPane.setVmax(30.0); 570 assertEquals(scrollPane.vmaxProperty().getValue(), 30.0, 0.0); 571 } 572 573 @Test public void setVmaxAndSeeValue() { 574 scrollPane.setVmax(30.0); 575 assertEquals(scrollPane.getVmax(), 30.0, 0.0); 576 } 577 578 @Test public void setFitToWidthAndSeeValueIsReflectedInModel() { 579 scrollPane.setFitToWidth(true); 580 assertSame(scrollPane.fitToWidthProperty().getValue(), true); 581 } 582 583 @Test public void setFitToWidthAndSeeValue() { 584 scrollPane.setFitToWidth(true); 585 assertSame(scrollPane.isFitToWidth(), true); 586 } 587 588 @Test public void setFitToHeightAndSeeValueIsReflectedInModel() { 589 scrollPane.setFitToHeight(true); 590 assertSame(scrollPane.fitToHeightProperty().getValue(), true); 591 } 592 593 @Test public void setFitToHeightAndSeeValue() { 594 scrollPane.setFitToHeight(true); 595 assertSame(scrollPane.isFitToHeight(), true); 596 } 597 598 @Test public void setPannableAndSeeValueIsReflectedInModel() { 599 scrollPane.setPannable(true); 600 assertSame(scrollPane.pannableProperty().getValue(), true); 601 } 602 603 @Test public void setPannableAndSeeValue() { 604 scrollPane.setPannable(true); 605 assertSame(scrollPane.isPannable(), true); 606 } 607 608 @Test public void setPrefViewportWidthAndSeeValueIsReflectedInModel() { 609 scrollPane.setPrefViewportWidth(46.0); 610 assertEquals(scrollPane.prefViewportWidthProperty().getValue(), 46.0, 0.0); 611 } 612 613 @Test public void setPrefViewportWidthAndSeeValue() { 614 scrollPane.setPrefViewportWidth(54.0); 615 assertEquals(scrollPane.getPrefViewportWidth(), 54.0, 0.0); 616 } 617 618 @Test public void setPrefViewportHeightAndSeeValueIsReflectedInModel() { 619 scrollPane.setPrefViewportHeight(46.0); 620 assertEquals(scrollPane.prefViewportHeightProperty().getValue(), 46.0, 0.0); 621 } 622 623 @Test public void setPrefViewportHeightAndSeeValue() { 624 scrollPane.setPrefViewportHeight(54.0); 625 assertEquals(scrollPane.getPrefViewportHeight(), 54.0, 0.0); 626 } 627 628 }