< prev index next >

tests/system/src/test/java/test/robot/javafx/scene/layout/RegionBackgroundFillUITest.java

Print this page




  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  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 package test.robot.javafx.scene.layout;
  26 
  27 import javafx.scene.layout.BackgroundFill;
  28 import javafx.scene.paint.Color;
  29 import org.junit.Ignore;
  30 import org.junit.Test;
  31 
  32 import static org.junit.Assume.assumeTrue;
  33 
  34 /**
  35  */
  36 public class RegionBackgroundFillUITest extends RegionUITestBase {
  37 
  38     static {
  39         System.setProperty("glass.win.uiScale", "100%");
  40     }
  41 
  42     /**************************************************************************
  43      *                                                                        *
  44      * Tests for background fills. We start with a series of simple tests     *
  45      * with a single solid fill, including exercising different insets and    *
  46      * corner radii.                                                          *
  47      *                                                                        *
  48      *************************************************************************/
  49 
  50     @Test(timeout=20000)
  51     public void basicFill() {
  52         setStyle("-fx-background-color: red;");
  53         checkRegionCornersAndBoundariesForFills();
  54     }
  55 
  56     @Test(timeout=20000)
  57     public void translucentFill() {
  58         setStyle("-fx-background-color: rgba(255, 0, 0, .2);");
  59         // multiply through the alpha
  60         checkRegionCornersAndBoundariesOfBackgroundFill(
  61                 region.getBackground().getFills().get(0), Color.rgb(255, 204, 204), SCENE_FILL);


 118     }
 119 
 120     @Test(timeout=20000)
 121     public void basicFill_NegativeInsets4() {
 122         setStyle(
 123                 "-fx-background-color: red;" +
 124                 "-fx-background-insets: -5 -10 -15 -20");
 125         checkRegionCornersAndBoundariesForFills();
 126     }
 127 
 128     @Test(timeout=20000)
 129     public void basicFill_MixedInsets() {
 130         setStyle(
 131                 "-fx-background-color: red;" +
 132                 "-fx-background-insets: 10 10 -10 10");
 133         checkRegionCornersAndBoundariesForFills();
 134     }
 135 
 136     @Test(timeout=20000)
 137     public void basicFill_Radius1() {
 138         assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8170026
 139         setStyle(
 140                 "-fx-background-color: red;" +
 141                 "-fx-background-radius: 10");
 142         checkRegionCornersAndBoundariesForFills();
 143     }
 144 
 145     @Test(timeout=20000)
 146     public void basicFill_Radius2() {
 147         setStyle(
 148                 "-fx-background-color: red;" +
 149                 "-fx-background-radius: 10 20");
 150         checkRegionCornersAndBoundariesForFills();
 151     }
 152 
 153     @Test(timeout=20000)
 154     public void basicFill_Radius3() {
 155         setStyle(
 156                 "-fx-background-color: red;" +
 157                 "-fx-background-radius: 10 20 30");
 158         checkRegionCornersAndBoundariesForFills();


 165                 "-fx-background-radius: 10 20 30 40");
 166         checkRegionCornersAndBoundariesForFills();
 167     }
 168 
 169     // TODO need to write tests for percentage based radii
 170 //    public void basicFill_PercentageRadius() {
 171 //        setStyle(
 172 //                "-fx-background-color: red;" +
 173 //                "-fx-background-radius: 5% 10% 15% 20%");
 174 //    }
 175 
 176     // TODO need to check on the syntax for the 8 independent corner radii...
 177 //    public void basicFill_Radius8() {
 178 //        setStyle(
 179 //                "-fx-background-color: red;" +
 180 //                "-fx-background-radius: 10 20 30 40 50 60 70 80");
 181 //    }
 182 
 183     @Test(timeout=20000)
 184     public void basicFill_RadiusAndInsets() {
 185         assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8170026
 186         setStyle(
 187                 "-fx-background-color: red;" +
 188                 "-fx-background-radius: 10 20 30 40;" +
 189                 "-fx-background-insets: 5 10 15 20");
 190         checkRegionCornersAndBoundariesForFills();
 191     }
 192 
 193     // NOTE: A negative radius from CSS is treated as 0.
 194     @Test(timeout=20000)
 195     public void basicFill_NegativeRadius1() {
 196         setStyle(
 197                 "-fx-background-color: red;" +
 198                 "-fx-background-radius: -10");
 199         checkRegionCornersAndBoundariesForFills();
 200     }
 201 
 202     // NOTE: A negative radius from CSS is treated as 0.
 203     @Test(timeout=20000)
 204     public void basicFill_NegativeRadius2() {
 205         setStyle(


 356         checkRegionRightBoundary(red, Color.GREEN, SCENE_FILL);
 357         checkRegionBottomRightCorner(red, SCENE_FILL);
 358         checkRegionBottomBoundary(red, SCENE_FILL);
 359         checkRegionBottomLeftCorner(red, SCENE_FILL);
 360 
 361         checkRegionLeftBoundary(green, SCENE_FILL);
 362         checkRegionTopLeftCorner(green, Color.RED);
 363         checkRegionTopBoundary(green, SCENE_FILL);
 364         checkRegionTopRightCorner(green, Color.RED);
 365         checkRegionRightBoundary(green, SCENE_FILL);
 366         checkRegionBottomRightCorner(green, Color.RED);
 367         checkRegionBottomBoundary(green, Color.RED);
 368         checkRegionBottomLeftCorner(green, Color.RED);
 369 
 370         checkRegionCornersAndBoundariesOfBackgroundFill(blue, Color.GREEN);
 371         checkRegionCornersAndBoundariesOfBackgroundFill(grey, Color.BLUE);
 372     }
 373 
 374     @Test(timeout=20000)
 375     public void testScenario3() {
 376         assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8170026
 377         setStyle(
 378                 "-fx-background-color: red, green, blue, grey;" +
 379                 "-fx-background-insets: 0 0 -10 0, 0, 10, 20;" +
 380                 "-fx-background-radius: 10 20 30 40;" +
 381                 "-fx-padding: 10 20 30 40;");
 382 
 383         BackgroundFill red = region.getBackground().getFills().get(0);
 384         BackgroundFill green = region.getBackground().getFills().get(1);
 385         BackgroundFill blue = region.getBackground().getFills().get(2);
 386         BackgroundFill grey = region.getBackground().getFills().get(3);
 387 
 388         checkRegionLeftBoundary(red, Color.GREEN, SCENE_FILL);
 389         checkRegionTopLeftCorner(red, Color.GREEN, SCENE_FILL);
 390         checkRegionTopBoundary(red, Color.GREEN, SCENE_FILL);
 391         checkRegionTopRightCorner(red, Color.GREEN, SCENE_FILL);
 392         checkRegionRightBoundary(red, Color.GREEN, SCENE_FILL);
 393         checkRegionBottomRightCorner(red, SCENE_FILL);
 394         checkRegionBottomBoundary(red, SCENE_FILL);
 395         checkRegionBottomLeftCorner(red, SCENE_FILL);
 396 
 397         checkRegionLeftBoundary(green, SCENE_FILL);
 398         checkRegionTopLeftCorner(green, SCENE_FILL);
 399         checkRegionTopBoundary(green, SCENE_FILL);
 400         checkRegionTopRightCorner(green, SCENE_FILL);
 401         checkRegionRightBoundary(green, SCENE_FILL);
 402         checkRegionBottomRightCorner(green, Color.RED);
 403         checkRegionBottomBoundary(green, Color.RED);
 404         checkRegionBottomLeftCorner(green, Color.RED);
 405 
 406         checkRegionCornersAndBoundariesOfBackgroundFill(blue, Color.GREEN);
 407         checkRegionCornersAndBoundariesOfBackgroundFill(grey, Color.BLUE);
 408     }
 409 
 410     @Test(timeout=20000)
 411     public void testScenario4() {
 412         assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8170026
 413         setStyle(
 414                 "-fx-background-color: red, green, blue, repeating-image-pattern('test/robot/javafx/scene/layout/test20x20.png');" +
 415                 "-fx-background-insets: 0 0 -10 0, 0, 10, 20;" +
 416                 "-fx-background-radius: 10 20 30 40;" +
 417                 "-fx-padding: 10 20 30 40;");
 418 
 419         BackgroundFill red = region.getBackground().getFills().get(0);
 420         BackgroundFill green = region.getBackground().getFills().get(1);
 421         BackgroundFill blue = region.getBackground().getFills().get(2);
 422         BackgroundFill image = region.getBackground().getFills().get(3);
 423 
 424         checkRegionLeftBoundary(red, Color.GREEN, SCENE_FILL);
 425         checkRegionTopLeftCorner(red, Color.GREEN, SCENE_FILL);
 426         checkRegionTopBoundary(red, Color.GREEN, SCENE_FILL);
 427         checkRegionTopRightCorner(red, Color.GREEN, SCENE_FILL);
 428         checkRegionRightBoundary(red, Color.GREEN, SCENE_FILL);
 429         checkRegionBottomRightCorner(red, SCENE_FILL);
 430         checkRegionBottomBoundary(red, SCENE_FILL);
 431         checkRegionBottomLeftCorner(red, SCENE_FILL);
 432 


 479     }
 480 
 481     @Test(timeout=20000)
 482     public void testExample1() {
 483         setStyle(
 484                 "-fx-background-color: red, green, blue;" +
 485                 "-fx-background-insets: 4, 8, 12, 16;" + // An extra value here, which should be ignored
 486                 "-fx-background-radius: 14;");
 487 
 488         checkRegionCornersAndBoundariesForFills();
 489     }
 490 
 491     /**************************************************************************
 492      *                                                                        *
 493      * Tests for odd edge cases                                               *
 494      *                                                                        *
 495      *************************************************************************/
 496 
 497     @Test(timeout=20000)
 498     public void testOnePixelTopInset() {
 499         assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8170026
 500         setStyle(
 501                 "-fx-background-color: red, yellow;" +
 502                 "-fx-background-insets: 0, 1 0 0 0;");
 503 
 504         BackgroundFill red = region.getBackground().getFills().get(0);
 505         BackgroundFill yellow = region.getBackground().getFills().get(1);
 506 
 507         checkRegionLeftBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 508         checkRegionTopLeftCorner(red, Color.RED, SCENE_FILL, 0, .2);
 509         checkRegionTopBoundary(red, Color.RED, SCENE_FILL, 0, .2);
 510         checkRegionTopRightCorner(red, Color.RED, SCENE_FILL, 0, .2);
 511         checkRegionRightBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 512         checkRegionBottomRightCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 513         checkRegionBottomBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 514         checkRegionBottomLeftCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 515 
 516         checkRegionLeftBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 517         checkRegionTopLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 518         checkRegionTopBoundary(yellow, Color.YELLOW, Color.RED, 0, .2);
 519         checkRegionTopRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 520         checkRegionRightBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 521         checkRegionBottomRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 522         checkRegionBottomBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 523         checkRegionBottomLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 524     }
 525 
 526     @Test(timeout=20000)
 527     public void testOnePixelRightInset() {
 528         assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8170026
 529         setStyle(
 530                 "-fx-background-color: red, yellow;" +
 531                 "-fx-background-insets: 0, 0 1 0 0;");
 532 
 533         BackgroundFill red = region.getBackground().getFills().get(0);
 534         BackgroundFill yellow = region.getBackground().getFills().get(1);
 535 
 536         checkRegionLeftBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 537         checkRegionTopLeftCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 538         checkRegionTopBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 539         checkRegionTopRightCorner(red, Color.RED, SCENE_FILL, 0, .2);
 540         checkRegionRightBoundary(red, Color.RED, SCENE_FILL, 0, .2);
 541         checkRegionBottomRightCorner(red, Color.RED, SCENE_FILL, 0, .2);
 542         checkRegionBottomBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 543         checkRegionBottomLeftCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 544 
 545         checkRegionLeftBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 546         checkRegionTopLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 547         checkRegionTopBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 548         checkRegionTopRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 549         checkRegionRightBoundary(yellow, Color.YELLOW, Color.RED, 0, .2);
 550         checkRegionBottomRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 551         checkRegionBottomBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 552         checkRegionBottomLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 553     }
 554 
 555     @Test(timeout=20000)
 556     public void testOnePixelBottomInset() {
 557         assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8170026
 558         setStyle(
 559                 "-fx-background-color: red, yellow;" +
 560                 "-fx-background-insets: 0, 0 0 1 0;");
 561 
 562         BackgroundFill red = region.getBackground().getFills().get(0);
 563         BackgroundFill yellow = region.getBackground().getFills().get(1);
 564 
 565         checkRegionLeftBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 566         checkRegionTopLeftCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 567         checkRegionTopBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 568         checkRegionTopRightCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 569         checkRegionRightBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 570         checkRegionBottomRightCorner(red, Color.RED, SCENE_FILL, 0, .2);
 571         checkRegionBottomBoundary(red, Color.RED, SCENE_FILL, 0, .2);
 572         checkRegionBottomLeftCorner(red, Color.RED, SCENE_FILL, 0, .2);
 573 
 574         checkRegionLeftBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 575         checkRegionTopLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 576         checkRegionTopBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 577         checkRegionTopRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 578         checkRegionRightBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 579         checkRegionBottomRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 580         checkRegionBottomBoundary(yellow, Color.YELLOW, Color.RED, 0, .2);
 581         checkRegionBottomLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 582     }
 583 
 584     @Test(timeout=20000)
 585     public void testOnePixelLeftInset() {
 586         assumeTrue(Boolean.getBoolean("unstable.test")); // JDK-8170026
 587         setStyle(
 588                 "-fx-background-color: red, yellow;" +
 589                 "-fx-background-insets: 0, 0 0 0 1;");
 590 
 591         BackgroundFill red = region.getBackground().getFills().get(0);
 592         BackgroundFill yellow = region.getBackground().getFills().get(1);
 593 
 594         checkRegionLeftBoundary(red, Color.RED, SCENE_FILL, 0, .2);
 595         checkRegionTopLeftCorner(red, Color.RED, SCENE_FILL, 0, .2);
 596         checkRegionTopBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 597         checkRegionTopRightCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 598         checkRegionRightBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 599         checkRegionBottomRightCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 600         checkRegionBottomBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 601         checkRegionBottomLeftCorner(red, Color.RED, SCENE_FILL, 0, .2);
 602 
 603         checkRegionLeftBoundary(yellow, Color.YELLOW, Color.RED, 0, .2);
 604         checkRegionTopLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 605         checkRegionTopBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 606         checkRegionTopRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);




  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  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 package test.robot.javafx.scene.layout;
  26 
  27 import javafx.scene.layout.BackgroundFill;
  28 import javafx.scene.paint.Color;
  29 import org.junit.Ignore;
  30 import org.junit.Test;
  31 
  32 import static org.junit.Assume.assumeTrue;
  33 
  34 /**
  35  */
  36 public class RegionBackgroundFillUITest extends RegionUITestBase {
  37 




  38     /**************************************************************************
  39      *                                                                        *
  40      * Tests for background fills. We start with a series of simple tests     *
  41      * with a single solid fill, including exercising different insets and    *
  42      * corner radii.                                                          *
  43      *                                                                        *
  44      *************************************************************************/
  45 
  46     @Test(timeout=20000)
  47     public void basicFill() {
  48         setStyle("-fx-background-color: red;");
  49         checkRegionCornersAndBoundariesForFills();
  50     }
  51 
  52     @Test(timeout=20000)
  53     public void translucentFill() {
  54         setStyle("-fx-background-color: rgba(255, 0, 0, .2);");
  55         // multiply through the alpha
  56         checkRegionCornersAndBoundariesOfBackgroundFill(
  57                 region.getBackground().getFills().get(0), Color.rgb(255, 204, 204), SCENE_FILL);


 114     }
 115 
 116     @Test(timeout=20000)
 117     public void basicFill_NegativeInsets4() {
 118         setStyle(
 119                 "-fx-background-color: red;" +
 120                 "-fx-background-insets: -5 -10 -15 -20");
 121         checkRegionCornersAndBoundariesForFills();
 122     }
 123 
 124     @Test(timeout=20000)
 125     public void basicFill_MixedInsets() {
 126         setStyle(
 127                 "-fx-background-color: red;" +
 128                 "-fx-background-insets: 10 10 -10 10");
 129         checkRegionCornersAndBoundariesForFills();
 130     }
 131 
 132     @Test(timeout=20000)
 133     public void basicFill_Radius1() {
 134         assumeTrue(checkIntegralUIScale());
 135         setStyle(
 136                 "-fx-background-color: red;" +
 137                 "-fx-background-radius: 10");
 138         checkRegionCornersAndBoundariesForFills();
 139     }
 140 
 141     @Test(timeout=20000)
 142     public void basicFill_Radius2() {
 143         setStyle(
 144                 "-fx-background-color: red;" +
 145                 "-fx-background-radius: 10 20");
 146         checkRegionCornersAndBoundariesForFills();
 147     }
 148 
 149     @Test(timeout=20000)
 150     public void basicFill_Radius3() {
 151         setStyle(
 152                 "-fx-background-color: red;" +
 153                 "-fx-background-radius: 10 20 30");
 154         checkRegionCornersAndBoundariesForFills();


 161                 "-fx-background-radius: 10 20 30 40");
 162         checkRegionCornersAndBoundariesForFills();
 163     }
 164 
 165     // TODO need to write tests for percentage based radii
 166 //    public void basicFill_PercentageRadius() {
 167 //        setStyle(
 168 //                "-fx-background-color: red;" +
 169 //                "-fx-background-radius: 5% 10% 15% 20%");
 170 //    }
 171 
 172     // TODO need to check on the syntax for the 8 independent corner radii...
 173 //    public void basicFill_Radius8() {
 174 //        setStyle(
 175 //                "-fx-background-color: red;" +
 176 //                "-fx-background-radius: 10 20 30 40 50 60 70 80");
 177 //    }
 178 
 179     @Test(timeout=20000)
 180     public void basicFill_RadiusAndInsets() {
 181         assumeTrue(checkIntegralUIScale());
 182         setStyle(
 183                 "-fx-background-color: red;" +
 184                 "-fx-background-radius: 10 20 30 40;" +
 185                 "-fx-background-insets: 5 10 15 20");
 186         checkRegionCornersAndBoundariesForFills();
 187     }
 188 
 189     // NOTE: A negative radius from CSS is treated as 0.
 190     @Test(timeout=20000)
 191     public void basicFill_NegativeRadius1() {
 192         setStyle(
 193                 "-fx-background-color: red;" +
 194                 "-fx-background-radius: -10");
 195         checkRegionCornersAndBoundariesForFills();
 196     }
 197 
 198     // NOTE: A negative radius from CSS is treated as 0.
 199     @Test(timeout=20000)
 200     public void basicFill_NegativeRadius2() {
 201         setStyle(


 352         checkRegionRightBoundary(red, Color.GREEN, SCENE_FILL);
 353         checkRegionBottomRightCorner(red, SCENE_FILL);
 354         checkRegionBottomBoundary(red, SCENE_FILL);
 355         checkRegionBottomLeftCorner(red, SCENE_FILL);
 356 
 357         checkRegionLeftBoundary(green, SCENE_FILL);
 358         checkRegionTopLeftCorner(green, Color.RED);
 359         checkRegionTopBoundary(green, SCENE_FILL);
 360         checkRegionTopRightCorner(green, Color.RED);
 361         checkRegionRightBoundary(green, SCENE_FILL);
 362         checkRegionBottomRightCorner(green, Color.RED);
 363         checkRegionBottomBoundary(green, Color.RED);
 364         checkRegionBottomLeftCorner(green, Color.RED);
 365 
 366         checkRegionCornersAndBoundariesOfBackgroundFill(blue, Color.GREEN);
 367         checkRegionCornersAndBoundariesOfBackgroundFill(grey, Color.BLUE);
 368     }
 369 
 370     @Test(timeout=20000)
 371     public void testScenario3() {
 372         assumeTrue(checkIntegralUIScale());
 373         setStyle(
 374                 "-fx-background-color: red, green, blue, grey;" +
 375                 "-fx-background-insets: 0 0 -10 0, 0, 10, 20;" +
 376                 "-fx-background-radius: 10 20 30 40;" +
 377                 "-fx-padding: 10 20 30 40;");
 378 
 379         BackgroundFill red = region.getBackground().getFills().get(0);
 380         BackgroundFill green = region.getBackground().getFills().get(1);
 381         BackgroundFill blue = region.getBackground().getFills().get(2);
 382         BackgroundFill grey = region.getBackground().getFills().get(3);
 383 
 384         checkRegionLeftBoundary(red, Color.GREEN, SCENE_FILL);
 385         checkRegionTopLeftCorner(red, Color.GREEN, SCENE_FILL);
 386         checkRegionTopBoundary(red, Color.GREEN, SCENE_FILL);
 387         checkRegionTopRightCorner(red, Color.GREEN, SCENE_FILL);
 388         checkRegionRightBoundary(red, Color.GREEN, SCENE_FILL);
 389         checkRegionBottomRightCorner(red, SCENE_FILL);
 390         checkRegionBottomBoundary(red, SCENE_FILL);
 391         checkRegionBottomLeftCorner(red, SCENE_FILL);
 392 
 393         checkRegionLeftBoundary(green, SCENE_FILL);
 394         checkRegionTopLeftCorner(green, SCENE_FILL);
 395         checkRegionTopBoundary(green, SCENE_FILL);
 396         checkRegionTopRightCorner(green, SCENE_FILL);
 397         checkRegionRightBoundary(green, SCENE_FILL);
 398         checkRegionBottomRightCorner(green, Color.RED);
 399         checkRegionBottomBoundary(green, Color.RED);
 400         checkRegionBottomLeftCorner(green, Color.RED);
 401 
 402         checkRegionCornersAndBoundariesOfBackgroundFill(blue, Color.GREEN);
 403         checkRegionCornersAndBoundariesOfBackgroundFill(grey, Color.BLUE);
 404     }
 405 
 406     @Test(timeout=20000)
 407     public void testScenario4() {
 408         assumeTrue(checkIntegralUIScale());
 409         setStyle(
 410                 "-fx-background-color: red, green, blue, repeating-image-pattern('test/robot/javafx/scene/layout/test20x20.png');" +
 411                 "-fx-background-insets: 0 0 -10 0, 0, 10, 20;" +
 412                 "-fx-background-radius: 10 20 30 40;" +
 413                 "-fx-padding: 10 20 30 40;");
 414 
 415         BackgroundFill red = region.getBackground().getFills().get(0);
 416         BackgroundFill green = region.getBackground().getFills().get(1);
 417         BackgroundFill blue = region.getBackground().getFills().get(2);
 418         BackgroundFill image = region.getBackground().getFills().get(3);
 419 
 420         checkRegionLeftBoundary(red, Color.GREEN, SCENE_FILL);
 421         checkRegionTopLeftCorner(red, Color.GREEN, SCENE_FILL);
 422         checkRegionTopBoundary(red, Color.GREEN, SCENE_FILL);
 423         checkRegionTopRightCorner(red, Color.GREEN, SCENE_FILL);
 424         checkRegionRightBoundary(red, Color.GREEN, SCENE_FILL);
 425         checkRegionBottomRightCorner(red, SCENE_FILL);
 426         checkRegionBottomBoundary(red, SCENE_FILL);
 427         checkRegionBottomLeftCorner(red, SCENE_FILL);
 428 


 475     }
 476 
 477     @Test(timeout=20000)
 478     public void testExample1() {
 479         setStyle(
 480                 "-fx-background-color: red, green, blue;" +
 481                 "-fx-background-insets: 4, 8, 12, 16;" + // An extra value here, which should be ignored
 482                 "-fx-background-radius: 14;");
 483 
 484         checkRegionCornersAndBoundariesForFills();
 485     }
 486 
 487     /**************************************************************************
 488      *                                                                        *
 489      * Tests for odd edge cases                                               *
 490      *                                                                        *
 491      *************************************************************************/
 492 
 493     @Test(timeout=20000)
 494     public void testOnePixelTopInset() {
 495         assumeTrue(checkIntegralUIScale());
 496         setStyle(
 497                 "-fx-background-color: red, yellow;" +
 498                 "-fx-background-insets: 0, 1 0 0 0;");
 499 
 500         BackgroundFill red = region.getBackground().getFills().get(0);
 501         BackgroundFill yellow = region.getBackground().getFills().get(1);
 502 
 503         checkRegionLeftBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 504         checkRegionTopLeftCorner(red, Color.RED, SCENE_FILL, 0, .2);
 505         checkRegionTopBoundary(red, Color.RED, SCENE_FILL, 0, .2);
 506         checkRegionTopRightCorner(red, Color.RED, SCENE_FILL, 0, .2);
 507         checkRegionRightBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 508         checkRegionBottomRightCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 509         checkRegionBottomBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 510         checkRegionBottomLeftCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 511 
 512         checkRegionLeftBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 513         checkRegionTopLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 514         checkRegionTopBoundary(yellow, Color.YELLOW, Color.RED, 0, .2);
 515         checkRegionTopRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 516         checkRegionRightBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 517         checkRegionBottomRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 518         checkRegionBottomBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 519         checkRegionBottomLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 520     }
 521 
 522     @Test(timeout=20000)
 523     public void testOnePixelRightInset() {
 524         assumeTrue(checkIntegralUIScale());
 525         setStyle(
 526                 "-fx-background-color: red, yellow;" +
 527                 "-fx-background-insets: 0, 0 1 0 0;");
 528 
 529         BackgroundFill red = region.getBackground().getFills().get(0);
 530         BackgroundFill yellow = region.getBackground().getFills().get(1);
 531 
 532         checkRegionLeftBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 533         checkRegionTopLeftCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 534         checkRegionTopBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 535         checkRegionTopRightCorner(red, Color.RED, SCENE_FILL, 0, .2);
 536         checkRegionRightBoundary(red, Color.RED, SCENE_FILL, 0, .2);
 537         checkRegionBottomRightCorner(red, Color.RED, SCENE_FILL, 0, .2);
 538         checkRegionBottomBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 539         checkRegionBottomLeftCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 540 
 541         checkRegionLeftBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 542         checkRegionTopLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 543         checkRegionTopBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 544         checkRegionTopRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 545         checkRegionRightBoundary(yellow, Color.YELLOW, Color.RED, 0, .2);
 546         checkRegionBottomRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 547         checkRegionBottomBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 548         checkRegionBottomLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 549     }
 550 
 551     @Test(timeout=20000)
 552     public void testOnePixelBottomInset() {
 553         assumeTrue(checkIntegralUIScale());
 554         setStyle(
 555                 "-fx-background-color: red, yellow;" +
 556                 "-fx-background-insets: 0, 0 0 1 0;");
 557 
 558         BackgroundFill red = region.getBackground().getFills().get(0);
 559         BackgroundFill yellow = region.getBackground().getFills().get(1);
 560 
 561         checkRegionLeftBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 562         checkRegionTopLeftCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 563         checkRegionTopBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 564         checkRegionTopRightCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 565         checkRegionRightBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 566         checkRegionBottomRightCorner(red, Color.RED, SCENE_FILL, 0, .2);
 567         checkRegionBottomBoundary(red, Color.RED, SCENE_FILL, 0, .2);
 568         checkRegionBottomLeftCorner(red, Color.RED, SCENE_FILL, 0, .2);
 569 
 570         checkRegionLeftBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 571         checkRegionTopLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 572         checkRegionTopBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 573         checkRegionTopRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 574         checkRegionRightBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 575         checkRegionBottomRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 576         checkRegionBottomBoundary(yellow, Color.YELLOW, Color.RED, 0, .2);
 577         checkRegionBottomLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 578     }
 579 
 580     @Test(timeout=20000)
 581     public void testOnePixelLeftInset() {
 582         assumeTrue(checkIntegralUIScale());
 583         setStyle(
 584                 "-fx-background-color: red, yellow;" +
 585                 "-fx-background-insets: 0, 0 0 0 1;");
 586 
 587         BackgroundFill red = region.getBackground().getFills().get(0);
 588         BackgroundFill yellow = region.getBackground().getFills().get(1);
 589 
 590         checkRegionLeftBoundary(red, Color.RED, SCENE_FILL, 0, .2);
 591         checkRegionTopLeftCorner(red, Color.RED, SCENE_FILL, 0, .2);
 592         checkRegionTopBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 593         checkRegionTopRightCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 594         checkRegionRightBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 595         checkRegionBottomRightCorner(red, Color.YELLOW, SCENE_FILL, 0, .2);
 596         checkRegionBottomBoundary(red, Color.YELLOW, SCENE_FILL, 0, .2);
 597         checkRegionBottomLeftCorner(red, Color.RED, SCENE_FILL, 0, .2);
 598 
 599         checkRegionLeftBoundary(yellow, Color.YELLOW, Color.RED, 0, .2);
 600         checkRegionTopLeftCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 601         checkRegionTopBoundary(yellow, Color.YELLOW, SCENE_FILL, 0, .2);
 602         checkRegionTopRightCorner(yellow, Color.YELLOW, SCENE_FILL, 0, .2);


< prev index next >