aboutsummaryrefslogtreecommitdiffstats
path: root/test/java
diff options
context:
space:
mode:
authorPeter Hancock <phancock@apache.org>2012-10-23 08:54:57 +0000
committerPeter Hancock <phancock@apache.org>2012-10-23 08:54:57 +0000
commit5de50e85027df695f0d3d9356f7f684ba464ed1d (patch)
treedf62b8c3ba2496e55c7b3499f67228c5b6180ec1 /test/java
parent3f8838ef97cc1fc9799be4d1be2ac3a86dae596d (diff)
downloadxmlgraphics-fop-5de50e85027df695f0d3d9356f7f684ba464ed1d.tar.gz
xmlgraphics-fop-5de50e85027df695f0d3d9356f7f684ba464ed1d.zip
Removed a CastTemp_RoundedCorners
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_RoundedCorners@1401202 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'test/java')
-rw-r--r--test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java39
1 files changed, 26 insertions, 13 deletions
diff --git a/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java b/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java
index fab6e0f4c..ab5c18c9e 100644
--- a/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java
+++ b/test/java/org/apache/fop/render/intermediate/BorderPainterTestCase.java
@@ -154,8 +154,6 @@ public class BorderPainterTestCase {
protected final BorderPainter sut;
- private final T thisInstance;
-
private final BorderPropsBuilder<T> beforeBuilder;
private final BorderPropsBuilder<T> afterBuilder;
@@ -165,19 +163,20 @@ public class BorderPainterTestCase {
private final BorderPropsBuilder<T> endBuilder;
public BorderPainterTester(int xOrigin, int yOrigin, int width, int height) {
- this.thisInstance = (T) this;
if (width <= 0 || height <= 0) {
throw new IllegalArgumentException("Cannot test degenerate borders");
}
- beforeBuilder = new BorderPropsBuilder<T>(this.thisInstance);
- afterBuilder = new BorderPropsBuilder<T>(this.thisInstance);
- startBuilder = new BorderPropsBuilder<T>(this.thisInstance);
- endBuilder = new BorderPropsBuilder<T>(this.thisInstance);
+ beforeBuilder = new BorderPropsBuilder<T>(getThis());
+ afterBuilder = new BorderPropsBuilder<T>(getThis());
+ startBuilder = new BorderPropsBuilder<T>(getThis());
+ endBuilder = new BorderPropsBuilder<T>(getThis());
this.borderExtent = new Rectangle(xOrigin, yOrigin, width, height);
this.graphicsPainter = mock(GraphicsPainter.class);
this.sut = new BorderPainter(graphicsPainter);
}
+ protected abstract T getThis();
+
public BorderPropsBuilder<T> beforeBorder() {
return beforeBuilder;
}
@@ -199,7 +198,7 @@ public class BorderPainterTestCase {
endBuilder.setWidth(width);
afterBuilder.setWidth(width);
startBuilder.setWidth(width);
- return thisInstance;
+ return getThis();
}
public T setCornerRadii(int radius) {
@@ -211,31 +210,31 @@ public class BorderPainterTestCase {
setEndBefore(xRadius, yRadius);
setEndAfter(xRadius, yRadius);
setStartAfter(xRadius, yRadius);
- return thisInstance;
+ return getThis();
}
public T setStartBefore(int xRadius, int yRadius) {
startBuilder.setRadiusStart(xRadius);
beforeBuilder.setRadiusStart(yRadius);
- return thisInstance;
+ return getThis();
}
public T setEndBefore(int xRadius, int yRadius) {
endBuilder.setRadiusStart(xRadius);
beforeBuilder.setRadiusEnd(yRadius);
- return thisInstance;
+ return getThis();
}
public T setEndAfter(int xRadius, int yRadius) {
endBuilder.setRadiusEnd(xRadius);
afterBuilder.setRadiusEnd(yRadius);
- return thisInstance;
+ return getThis();
}
public T setStartAfter(int xRadius, int yRadius) {
startBuilder.setRadiusEnd(xRadius);
afterBuilder.setRadiusStart(yRadius);
- return thisInstance;
+ return getThis();
}
public final void test() throws IOException {
@@ -383,7 +382,11 @@ public class BorderPainterTestCase {
verify(graphicsPainter, times(numBorders)).closePath();
verify(graphicsPainter, times(numBorders)).restoreGraphicsState();
verify(graphicsPainter, times(numBorders)).clip();
+ }
+ @Override
+ protected DrawRectangularBordersTester getThis() {
+ return this;
}
}
@@ -462,6 +465,11 @@ public class BorderPainterTestCase {
return yWidth > yRadius ? yWidth : xWidth > 0 ? Math.max(xRadius, xWidth) : 0;
}
+ @Override
+ protected DrawRoundedBordersTester getThis() {
+ return this;
+ }
+
}
private static final class ClipBackgroundTester extends BorderPainterTester<ClipBackgroundTester> {
@@ -559,6 +567,11 @@ public class BorderPainterTestCase {
}
}
}
+
+ @Override
+ protected ClipBackgroundTester getThis() {
+ return this;
+ }
}