modules/graphics/src/test/java/test/com/sun/javafx/sg/prism/NGCircleTest.java
Print this page
rev 9250 : 8134762: Refactor Javafx graphics module tests for clear separation of tests
Reviewed-by:
@@ -21,13 +21,15 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-package com.sun.javafx.sg.prism;
+package test.com.sun.javafx.sg.prism;
import com.sun.javafx.geom.RectBounds;
+import com.sun.javafx.sg.prism.NGCircle;
+import com.sun.javafx.sg.prism.NGNodeShim;
import com.sun.prism.paint.Color;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -46,20 +48,20 @@
circle.updateCircle(10, 10, 5);
}
@Test
public void testSupportsOpaqueRegion() {
- assertTrue(circle.supportsOpaqueRegions());
+ assertTrue(NGNodeShim.supportsOpaqueRegions(circle));
}
@Test
public void hasOpaqueRegionIfRadiusIsGreaterThanZero() {
- assertTrue(circle.hasOpaqueRegion());
+ assertTrue(NGNodeShim.hasOpaqueRegion(circle));
circle.updateCircle(10, 10, 0);
- assertFalse(circle.hasOpaqueRegion());
+ assertFalse(NGNodeShim.hasOpaqueRegion(circle));
circle.updateCircle(10, 10, .0001f);
- assertTrue(circle.hasOpaqueRegion());
+ assertTrue(NGNodeShim.hasOpaqueRegion(circle));
}
@Test
public void opaqueRegionLiesWithinCircle() {
RectBounds or = new RectBounds();
@@ -72,11 +74,11 @@
10f,
13.321f // some random number
};
for (float r : radiusValues) {
circle.updateCircle(10, 10, r);
- or = circle.computeOpaqueRegion(or);
+ or = NGNodeShim.computeOpaqueRegion(circle, or);
assertNotNull(or);
assertTrue(circle.getShape().contains(or.getMinX(), or.getMinY(), or.getWidth(), or.getHeight()));
}
}
@@ -88,11 +90,11 @@
* than what the implementation uses. So I will compute the wider box
* and a narrower box and make sure the implementation is between the two.
*/
@Test
public void testComputeOpaqueRegion() {
- RectBounds or = circle.computeOpaqueRegion(new RectBounds());
+ RectBounds or = NGNodeShim.computeOpaqueRegion(circle, new RectBounds());
// First we will compute with the highest precision we can.
float r = 5; // same as the ellipse
float side = 2*r / (float) Math.sqrt(2);
float halfSide = side / 2f;