< prev index next >
modules/javafx.graphics/src/test/java/test/javafx/css/StylesheetTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -75,10 +75,12 @@
public class StylesheetTest {
String testURL = null;
+ final String EXPECTED_WARNING = "EXPECTED WARNING: This is a negative test"
+ + " to verify loop detection in CSS. A Loop detected warning message is expected.";
public StylesheetTest() {
testURL = getClass().getResource("HonorDeveloperSettingsTest_UA.css").toExternalForm();
}
@@ -318,10 +320,12 @@
assertEquals(Color.RED, rect.getFill());
// reset fill
((StyleableProperty<Paint>)rect.fillProperty()).applyStyle(null, null);
+ System.err.println(EXPECTED_WARNING);
+
// loop in style!
rect.setStyle("-fx-base: -fx-fill; -fx-fill: -fx-base;");
root.applyCss();
// Shows value was left alone
@@ -353,10 +357,12 @@
assertTrue(rect.getFill() instanceof RadialGradient);
// reset fill
((StyleableProperty<Paint>)rect.fillProperty()).applyStyle(null, null);
+ System.err.println(EXPECTED_WARNING);
+
// loop in style!
rect.setStyle("-fx-base: -fx-color; -fx-color: -fx-base; -fx-fill: radial-gradient(radius 100%, red, -fx-color);");
root.applyCss();
@@ -394,10 +400,12 @@
assertTrue(rect.getFill() instanceof RadialGradient);
// reset fill
((StyleableProperty<Paint>)rect.fillProperty()).applyStyle(null, null);
+ System.err.println(EXPECTED_WARNING);
+
// loop in style
root.setStyle("-fx-base: -fx-color;");
root.applyCss();
@@ -429,10 +437,12 @@
assertTrue(rect.getFill() instanceof RadialGradient);
// reset fill
((StyleableProperty<Paint>)rect.fillProperty()).applyStyle(null, null);
+ System.err.println(EXPECTED_WARNING);
+
// loop in style!
root.setStyle("-fx-base: -fx-fill;");
rect.setStyle("-fx-fill: radial-gradient(radius 100%, derive(-fx-base, -25%), derive(-fx-base, 25%));");
< prev index next >