You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/10/19 07:18:24 UTC
svn commit: r465495 [2/5] - in
/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common:
java/awt/ java/awt/color/ java/awt/datatransfer/ java/awt/dnd/
java/awt/event/ java/awt/font/ java/awt/geom/ java/awt/image/
org/apache/harm...
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/InvocationEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/InvocationEventTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/InvocationEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/InvocationEventTest.java Wed Oct 18 22:18:19 2006
@@ -106,6 +106,7 @@
runnableCalled = false;
synchronized (button) {
new Thread() {
+ @Override
public void run() {
event.dispatch();
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/KeyEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/KeyEventTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/KeyEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/KeyEventTest.java Wed Oct 18 22:18:19 2006
@@ -52,13 +52,13 @@
long when = 1000000000;
Button button = new Button("Button");
KeyEvent event = new KeyEvent(button, KeyEvent.KEY_PRESSED, when,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
assertEquals(event.getSource(), button);
assertEquals(event.getID(), KeyEvent.KEY_PRESSED);
assertEquals(event.getWhen(), when);
- assertEquals(event.getModifiers(), KeyEvent.ALT_GRAPH_MASK);
- assertEquals(event.getModifiersEx(), KeyEvent.ALT_GRAPH_DOWN_MASK);
+ assertEquals(event.getModifiers(), InputEvent.ALT_GRAPH_MASK);
+ assertEquals(event.getModifiersEx(), InputEvent.ALT_GRAPH_DOWN_MASK);
assertEquals(event.getKeyCode(), KeyEvent.VK_A);
assertEquals(event.getKeyChar(), 'a');
assertEquals(event.getKeyLocation(), KeyEvent.KEY_LOCATION_UNKNOWN);
@@ -66,7 +66,7 @@
boolean typedKeyCode = false;
try {
event = new KeyEvent(button, KeyEvent.KEY_TYPED, when,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
} catch (Throwable t) {
typedKeyCode = true;
}
@@ -75,7 +75,7 @@
boolean typedUndefinedChar = false;
try {
event = new KeyEvent(button, KeyEvent.KEY_TYPED, when,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_UNDEFINED, KeyEvent.CHAR_UNDEFINED);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_UNDEFINED, KeyEvent.CHAR_UNDEFINED);
} catch (Throwable t) {
typedUndefinedChar = true;
}
@@ -86,13 +86,13 @@
long when = 1000000000;
Button button = new Button("Button");
KeyEvent event = new KeyEvent(button, KeyEvent.KEY_PRESSED, when,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
assertEquals(event.getSource(), button);
assertEquals(event.getID(), KeyEvent.KEY_PRESSED);
assertEquals(event.getWhen(), when);
- assertEquals(event.getModifiers(), KeyEvent.ALT_GRAPH_MASK);
- assertEquals(event.getModifiersEx(), KeyEvent.ALT_GRAPH_DOWN_MASK);
+ assertEquals(event.getModifiers(), InputEvent.ALT_GRAPH_MASK);
+ assertEquals(event.getModifiersEx(), InputEvent.ALT_GRAPH_DOWN_MASK);
assertEquals(event.getKeyCode(), KeyEvent.VK_A);
assertEquals(event.getKeyChar(), 'a');
assertEquals(event.getKeyLocation(), KeyEvent.KEY_LOCATION_NUMPAD);
@@ -100,7 +100,7 @@
boolean typedKeyCode = false;
try {
event = new KeyEvent(button, KeyEvent.KEY_TYPED, when,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
} catch (Throwable t) {
typedKeyCode = true;
}
@@ -109,7 +109,7 @@
boolean typedUndefinedChar = false;
try {
event = new KeyEvent(button, KeyEvent.KEY_TYPED, when,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_UNDEFINED, KeyEvent.CHAR_UNDEFINED,
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_UNDEFINED, KeyEvent.CHAR_UNDEFINED,
KeyEvent.KEY_LOCATION_NUMPAD);
} catch (Throwable t) {
typedUndefinedChar = true;
@@ -120,7 +120,7 @@
public final void testGetSetKeyCode() {
Button button = new Button("Button");
KeyEvent event = new KeyEvent(button, KeyEvent.KEY_PRESSED, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
event.setKeyCode(KeyEvent.VK_1);
assertEquals(event.getKeyCode(), KeyEvent.VK_1);
@@ -128,7 +128,7 @@
assertEquals(event.getKeyCode(), KeyEvent.VK_UNDEFINED);
event = new KeyEvent(button, KeyEvent.KEY_TYPED, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_UNDEFINED, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_UNDEFINED, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
boolean typedKeyCode = false;
try {
event.setKeyCode(KeyEvent.VK_A);
@@ -141,7 +141,7 @@
public final void testGetSetKeyChar() {
Button button = new Button("Button");
KeyEvent event = new KeyEvent(button, KeyEvent.KEY_PRESSED, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
event.setKeyChar('1');
assertEquals(event.getKeyChar(), '1');
@@ -149,7 +149,7 @@
assertEquals(event.getKeyChar(), KeyEvent.CHAR_UNDEFINED);
event = new KeyEvent(button, KeyEvent.KEY_TYPED, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_UNDEFINED, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_UNDEFINED, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
boolean typedKeyChar = false;
try {
event.setKeyChar(KeyEvent.CHAR_UNDEFINED);
@@ -162,11 +162,11 @@
public final void testIsActionKey() {
Button button = new Button("Button");
KeyEvent event = new KeyEvent(button, KeyEvent.KEY_PRESSED, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a');
assertFalse(event.isActionKey());
event = new KeyEvent(button, KeyEvent.KEY_PRESSED, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_DELETE, KeyEvent.CHAR_UNDEFINED);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_DELETE, KeyEvent.CHAR_UNDEFINED);
assertTrue(event.isActionKey());
event.setKeyChar('1');
assertFalse(event.isActionKey());
@@ -181,16 +181,16 @@
public final void testParamString() {
Button button = new Button("Button");
KeyEvent event = new KeyEvent(button, KeyEvent.KEY_PRESSED, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
assertEquals(event.paramString(),
"KEY_PRESSED,keyCode=65,keyChar='a',modifiers=Alt Graph,extModifiers=Alt Graph,keyLocation=KEY_LOCATION_NUMPAD");
event = new KeyEvent(button, KeyEvent.KEY_PRESSED + 1024, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD);
assertEquals(event.paramString(),
"unknown type,keyCode=65,keyChar='a',modifiers=Alt Graph,extModifiers=Alt Graph,keyLocation=KEY_LOCATION_NUMPAD");
event = new KeyEvent(button, KeyEvent.KEY_PRESSED + 1024, 0l,
- KeyEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD + 1024);
+ InputEvent.ALT_GRAPH_MASK, KeyEvent.VK_A, 'a', KeyEvent.KEY_LOCATION_NUMPAD + 1024);
assertEquals(event.paramString(),
"unknown type,keyCode=65,keyChar='a',modifiers=Alt Graph,extModifiers=Alt Graph,keyLocation=unknown type");
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/MouseEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/MouseEventTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/MouseEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/MouseEventTest.java Wed Oct 18 22:18:19 2006
@@ -30,7 +30,7 @@
public final void testMouseEventComponentintlongintintintintboolean() {
Button button = new Button("Button");
MouseEvent event = new MouseEvent(button, MouseEvent.MOUSE_PRESSED, 1000000000,
- MouseEvent.BUTTON2_DOWN_MASK, 100, 200,
+ InputEvent.BUTTON2_DOWN_MASK, 100, 200,
10, true);
assertEquals(event.getSource(), button);
@@ -46,7 +46,7 @@
public final void testMouseEventComponentintlongintintintintbooleanint() {
Button button = new Button("Button");
MouseEvent event = new MouseEvent(button, MouseEvent.MOUSE_PRESSED, 1000000000,
- MouseEvent.BUTTON2_DOWN_MASK, 100, 200,
+ InputEvent.BUTTON2_DOWN_MASK, 100, 200,
10, true, MouseEvent.BUTTON1);
assertEquals(event.getSource(), button);
@@ -62,7 +62,7 @@
public final void testTranslatePoint() {
Button button = new Button("Button");
MouseEvent event = new MouseEvent(button, MouseEvent.MOUSE_PRESSED, 1000000000,
- MouseEvent.BUTTON2_DOWN_MASK, 100, 200,
+ InputEvent.BUTTON2_DOWN_MASK, 100, 200,
10, true);
event.translatePoint(10, 10);
@@ -87,13 +87,13 @@
public final void testParamString() {
Button button = new Button("Button");
MouseEvent event = new MouseEvent(button, MouseEvent.MOUSE_PRESSED, 1000000000,
- MouseEvent.BUTTON2_DOWN_MASK, 100, 200,
+ InputEvent.BUTTON2_DOWN_MASK, 100, 200,
10, true, MouseEvent.BUTTON1);
assertEquals(event.paramString(),
"MOUSE_PRESSED,(100,200),button=1,modifiers=Button2,extModifiers=Button2,clickCount=10");
event = new MouseEvent(button, MouseEvent.MOUSE_PRESSED + 1024, 1000000000,
- MouseEvent.BUTTON2_DOWN_MASK, 100, 200,
+ InputEvent.BUTTON2_DOWN_MASK, 100, 200,
10, true, MouseEvent.BUTTON1);
assertEquals(event.paramString(),
"unknown type,(100,200),button=1,modifiers=Button2,extModifiers=Button2,clickCount=10");
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/MouseWheelEventTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/MouseWheelEventTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/MouseWheelEventTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/event/MouseWheelEventTest.java Wed Oct 18 22:18:19 2006
@@ -29,7 +29,7 @@
public final void testMouseWheelEvent() {
Button button = new Button("Button");
MouseWheelEvent event = new MouseWheelEvent(button, MouseEvent.MOUSE_WHEEL, 1000000000,
- MouseEvent.BUTTON2_DOWN_MASK, 100, 200,
+ InputEvent.BUTTON2_DOWN_MASK, 100, 200,
10, true, MouseWheelEvent.WHEEL_UNIT_SCROLL, 2, 3);
assertEquals(event.getSource(), button);
@@ -43,13 +43,13 @@
public final void testParamString() {
Button button = new Button("Button");
MouseWheelEvent event = new MouseWheelEvent(button, MouseEvent.MOUSE_WHEEL, 1000000000,
- MouseEvent.BUTTON2_DOWN_MASK, 100, 200,
+ InputEvent.BUTTON2_DOWN_MASK, 100, 200,
10, true, MouseWheelEvent.WHEEL_UNIT_SCROLL, 2, 3);
assertEquals(event.paramString(),
"MOUSE_WHEEL,(100,200),button=0,modifiers=Button2,extModifiers=Button2,clickCount=10,scrollType=WHEEL_UNIT_SCROLL,scrollAmount=2,wheelRotation=3");
event = new MouseWheelEvent(button, MouseEvent.MOUSE_WHEEL + 1024, 1000000000,
- MouseEvent.BUTTON2_DOWN_MASK, 100, 200,
+ InputEvent.BUTTON2_DOWN_MASK, 100, 200,
10, true, MouseWheelEvent.WHEEL_UNIT_SCROLL, 2, 3);
assertTrue(event.paramString().startsWith("unknown type"));
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/LineBreakMeasurerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/LineBreakMeasurerTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/LineBreakMeasurerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/LineBreakMeasurerTest.java Wed Oct 18 22:18:19 2006
@@ -34,20 +34,21 @@
{
LineBreakMeasurer measurer;
- private int width = 500;
- private int height = 200;
- private BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
-
- private String s = "I TestItalic TestPlain I";
- private Font f = new Font("times new roman", Font.ITALIC, 24);
- private Font f1 = new Font("serif", Font.PLAIN, 60);
- private FontRenderContext frc = ((Graphics2D) im.getGraphics()).getFontRenderContext();
+ private final int width = 500;
+ private final int height = 200;
+ private final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+
+ private final String s = "I TestItalic TestPlain I";
+ private final Font f = new Font("times new roman", Font.ITALIC, 24);
+ private final Font f1 = new Font("serif", Font.PLAIN, 60);
+ private final FontRenderContext frc = ((Graphics2D) im.getGraphics()).getFontRenderContext();
public LineBreakMeasurerTest(String name)
{
super(name);
}
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -60,6 +61,7 @@
measurer = new LineBreakMeasurer(aci, frc);
}
+ @Override
public void tearDown() throws Exception
{
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextHitInfoTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextHitInfoTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextHitInfoTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextHitInfoTest.java Wed Oct 18 22:18:19 2006
@@ -35,6 +35,7 @@
super(name);
}
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -43,6 +44,7 @@
tm1 = TextHitInfo.trailing(-1);
}
+ @Override
public void tearDown() throws Exception
{
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextLayoutTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextLayoutTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextLayoutTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextLayoutTest.java Wed Oct 18 22:18:19 2006
@@ -36,9 +36,9 @@
public class TextLayoutTest extends TestCase
{
- private int width = 500;
- private int height = 200;
- private BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+ private final int width = 500;
+ private final int height = 200;
+ private final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
TextLayout tl;
String strings[] = new String [] {
@@ -55,13 +55,15 @@
Font f1 = new Font("times new roman", Font.PLAIN, 60);
FontRenderContext frc = ((Graphics2D) im.getGraphics()).getFontRenderContext();
- private int layoutStartX = 1, layoutStartY;
+ private final int layoutStartX = 1;
+ private int layoutStartY;
public TextLayoutTest(String name)
{
super(name);
}
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -89,6 +91,7 @@
tl.draw(g2, 1, layoutStartY);
}
+ @Override
public void tearDown() throws Exception
{
super.tearDown();
@@ -96,12 +99,15 @@
public void testHashCode() throws Exception
{
- for(int i=0; i<strings.length; i++)
- for(int j=0; j<strings.length; j++)
- if(i == j)
+ for(int i=0; i<strings.length; i++) {
+ for(int j=0; j<strings.length; j++) {
+ if(i == j) {
assertTrue("HashCode " + equals[i] + " " + equals[j], equals[i].hashCode() == equals[j].hashCode());
- else
+ } else {
assertTrue("HashCode " + equals[i] + " " + equals[j], equals[i].hashCode() != equals[j].hashCode());
+ }
+ }
+ }
}
public void testClone() throws Exception
@@ -111,12 +117,15 @@
public void testEquals() throws Exception
{
- for(int i=0; i<strings.length; i++)
- for(int j=0; j<strings.length; j++)
- if(i == j)
+ for(int i=0; i<strings.length; i++) {
+ for(int j=0; j<strings.length; j++) {
+ if(i == j) {
assertTrue(equals[i].equals(equals[j]));
- else
+ } else {
assertFalse(equals[i].equals(equals[j]));
+ }
+ }
+ }
}
public void testToString() throws Exception
@@ -133,13 +142,14 @@
{
int left = im.getWidth(), right = 0;
- for(int i=0; i<im.getWidth(); i++)
+ for(int i=0; i<im.getWidth(); i++) {
for(int j=0; j<im.getHeight(); j++) {
if(im.getRGB(i,j) != 0xFFFFFFFF) {
left = Math.min(i, left);
right = Math.max(i, right);
}
}
+ }
assertEquals((int) tl.getAdvance(), right - left, 3);
}
@@ -185,8 +195,9 @@
}
}
// Want to get only first letter
- if(!hasPoint && pointsStarted)
+ if(!hasPoint && pointsStarted) {
break;
+ }
}
return new int[] {left, top, right, bottom};
@@ -210,7 +221,7 @@
{
int left = im.getWidth(), right = 0, top = 0, bottom = im.getHeight();
- for(int i=0; i<im.getWidth(); i++)
+ for(int i=0; i<im.getWidth(); i++) {
for(int j=0; j<im.getHeight(); j++) {
if(im.getRGB(i,j) != 0xFFFFFFFF) {
left = Math.min(i, left);
@@ -219,6 +230,7 @@
bottom = Math.min(j, bottom);
}
}
+ }
Rectangle2D rect = tl.getBounds();
Rectangle2D intRect =
@@ -264,8 +276,9 @@
if(im.getRGB(i, letterBounds[3]) != 0xFFFFFFFF) {
started = true;
} else {
- if(started)
+ if(started) {
break;
+ }
}
}
int bottomRight = i - 1;
@@ -519,10 +532,12 @@
for(int dx=-3; dx<4; dx++) {
for(int dy=-2; dy<3; dy++) {
- if(x+dx < 1 || x+dx > im.getWidth())
+ if(x+dx < 1 || x+dx > im.getWidth()) {
continue;
- if(y+dy < 1 || y+dy > im.getHeight())
+ }
+ if(y+dy < 1 || y+dy > im.getHeight()) {
continue;
+ }
if(im.getRGB(x+dx, y+dy) != 0xFFFFFFFF) {
passed = true;
@@ -531,8 +546,9 @@
}
}
- if(!passed)
+ if(!passed) {
fail("Outline contains point located too far from glyph");
+ }
}
pi.next();
@@ -695,20 +711,20 @@
}
try {
- new TextLayout(null, (Map<? extends Attribute,?>)new HashMap(), (FontRenderContext) null);
+ new TextLayout(null, new HashMap<Attribute, Object>(), (FontRenderContext) null);
} catch (IllegalArgumentException e) {
// as expected
}
try {
- new TextLayout("aa", (Map<? extends Attribute,?>)new HashMap(), (FontRenderContext) null);
+ new TextLayout("aa", new HashMap<Attribute, Object>(), (FontRenderContext) null);
} catch (NullPointerException e) {
// as expected
}
try{
- new TextLayout("", (Map<? extends Attribute,?>)new HashMap(), (FontRenderContext) null);
+ new TextLayout("", new HashMap<Attribute, Object>(), (FontRenderContext) null);
} catch (IllegalArgumentException e) {
// as expected
System.out.println("success: " + e.getMessage());
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextMeasurerTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextMeasurerTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextMeasurerTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/font/TextMeasurerTest.java Wed Oct 18 22:18:19 2006
@@ -34,20 +34,21 @@
{
TextMeasurer measurer;
- private int width = 500;
- private int height = 200;
- private BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
-
- private String s = "I TestItalic TestPlain I";
- private Font f = new Font("times new roman", Font.ITALIC, 24);
- private Font f1 = new Font("serif", Font.PLAIN, 60);
- private FontRenderContext frc = ((Graphics2D) im.getGraphics()).getFontRenderContext();
+ private final int width = 500;
+ private final int height = 200;
+ private final BufferedImage im = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+
+ private final String s = "I TestItalic TestPlain I";
+ private final Font f = new Font("times new roman", Font.ITALIC, 24);
+ private final Font f1 = new Font("serif", Font.PLAIN, 60);
+ private final FontRenderContext frc = ((Graphics2D) im.getGraphics()).getFontRenderContext();
public TextMeasurerTest(String name)
{
super(name);
}
+ @Override
public void setUp() throws Exception
{
super.setUp();
@@ -60,6 +61,7 @@
measurer = new TextMeasurer(aci, frc);
}
+ @Override
public void tearDown() throws Exception
{
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AffineTransformTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AffineTransformTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AffineTransformTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AffineTransformTest.java Wed Oct 18 22:18:19 2006
@@ -105,11 +105,13 @@
serializePath = getSerializePath(AffineTransform.class);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
t = new AffineTransform(2, 3, 4, 5, 6, 7);
}
+ @Override
protected void tearDown() throws Exception {
t = null;
super.tearDown();
@@ -229,11 +231,11 @@
}
public void testGetType() {
- for(int i = 0; i < type.length; i++) {
+ for (double[] element : type) {
assertEquals(
- matrixToStr(type[i]) + " Type",
- (int)type[i][6],
- new AffineTransform(type[i]).getType());
+ matrixToStr(element) + " Type",
+ (int)element[6],
+ new AffineTransform(element).getType());
}
}
@@ -574,39 +576,39 @@
}
public void testConcatenate() {
- for(int i = 0; i < matrix.length; i++) {
- AffineTransform a = new AffineTransform(matrix[i][0]);
- AffineTransform b = new AffineTransform(matrix[i][1]);
- AffineTransform c = new AffineTransform(matrix[i][2]);
+ for (double[][] element : matrix) {
+ AffineTransform a = new AffineTransform(element[0]);
+ AffineTransform b = new AffineTransform(element[1]);
+ AffineTransform c = new AffineTransform(element[2]);
b.concatenate(a);
assertEquals(c, b);
}
}
public void testPreConcatenate() {
- for(int i = 0; i < matrix.length; i++) {
- AffineTransform a = new AffineTransform(matrix[i][0]);
- AffineTransform b = new AffineTransform(matrix[i][1]);
- AffineTransform c = new AffineTransform(matrix[i][2]);
+ for (double[][] element : matrix) {
+ AffineTransform a = new AffineTransform(element[0]);
+ AffineTransform b = new AffineTransform(element[1]);
+ AffineTransform c = new AffineTransform(element[2]);
a.preConcatenate(b);
assertEquals(c, a);
}
}
public void testCreateInvers() {
- for(int i = 0; i < invers.length; i++) {
+ for (double[][] element : invers) {
try {
- AffineTransform at = new AffineTransform(invers[i][0]);
+ AffineTransform at = new AffineTransform(element[0]);
AffineTransform it = at.createInverse();
- if (invers[i][1] == null) {
+ if (element[1] == null) {
fail(at + " Expected exception NoninvertibleTransformException");
} else {
- assertEquals(new AffineTransform(invers[i][1]), it);
+ assertEquals(new AffineTransform(element[1]), it);
}
at.concatenate(it);
assertTrue(at.isIdentity());
} catch(NoninvertibleTransformException e) {
- if (invers[i][1] != null) {
+ if (element[1] != null) {
fail(e.toString());
}
}
@@ -614,13 +616,13 @@
}
public void testTransform1() {
- for(int i = 0; i < points.length; i++) {
- AffineTransform at = new AffineTransform(points[i][0]);
- for(int j = 1; j < points[i].length; j++) {
- float x1 = points[i][j][0];
- float y1 = points[i][j][1];
- float x2 = points[i][j][2];
- float y2 = points[i][j][3];
+ for (float[][] element : points) {
+ AffineTransform at = new AffineTransform(element[0]);
+ for(int j = 1; j < element.length; j++) {
+ float x1 = element[j][0];
+ float y1 = element[j][1];
+ float x2 = element[j][2];
+ float y2 = element[j][3];
assertEquals(
new Point2D.Double(x2, y2),
@@ -690,13 +692,13 @@
}
public void testDeltaTransform1() {
- for(int i = 0; i < points.length; i++) {
- AffineTransform at = new AffineTransform(points[i][0]);
- for(int j = 1; j < points[i].length; j++) {
- float x1 = points[i][j][0];
- float y1 = points[i][j][1];
- float x2 = points[i][j][6];
- float y2 = points[i][j][7];
+ for (float[][] element : points) {
+ AffineTransform at = new AffineTransform(element[0]);
+ for(int j = 1; j < element.length; j++) {
+ float x1 = element[j][0];
+ float y1 = element[j][1];
+ float x2 = element[j][6];
+ float y2 = element[j][7];
assertEquals(
new Point2D.Double(x2, y2),
@@ -732,13 +734,13 @@
} catch(NoninvertibleTransformException e) {
}
- for(int i = 0; i < points.length; i++) {
- AffineTransform at = new AffineTransform(points[i][0]);
- for(int j = 1; j < points[i].length; j++) {
- float x1 = points[i][j][0];
- float y1 = points[i][j][1];
- float x2 = points[i][j][4];
- float y2 = points[i][j][5];
+ for (float[][] element : points) {
+ AffineTransform at = new AffineTransform(element[0]);
+ for(int j = 1; j < element.length; j++) {
+ float x1 = element[j][0];
+ float y1 = element[j][1];
+ float x2 = element[j][4];
+ float y2 = element[j][5];
try {
assertEquals(
@@ -822,6 +824,7 @@
t.toString());
}
+ @Override
public String objToStr(Object obj) {
double[] m = new double[6];
((AffineTransform)obj).getMatrix(m);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DDoubleTest.java Wed Oct 18 22:18:19 2006
@@ -31,11 +31,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
a = new Arc2D.Double(1, 2, 3, 4, 5, 6, Arc2D.PIE);
}
+ @Override
protected void tearDown() throws Exception {
a = null;
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DFloatTest.java Wed Oct 18 22:18:19 2006
@@ -31,11 +31,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
a = new Arc2D.Float(1, 2, 3, 4, 5, 6, Arc2D.PIE);
}
+ @Override
protected void tearDown() throws Exception {
a = null;
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Arc2DTest.java Wed Oct 18 22:18:19 2006
@@ -173,11 +173,13 @@
// filterBounds = createFilter("^(arc).*(bounds).*([.]ico)$", null);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
a = new Arc2D.Double(1, 2, 4, 6, 45, 240 - 45, Arc2D.PIE);
}
+ @Override
protected void tearDown() throws Exception {
a = null;
super.tearDown();
@@ -202,54 +204,54 @@
}
public void testGetStartPoint() {
- for(int i = 0; i < angles.length; i++) {
- double angle = angles[i][0];
+ for (double[] element : angles) {
+ double angle = element[0];
assertEquals(
"[angle=" + doubleToStr(angle) + "] Start point",
- new Point2D.Double(angles[i][1], angles[i][2]),
+ new Point2D.Double(element[1], element[2]),
new Arc2D.Double(1, 2, 4, 6, angle, 10, Arc2D.PIE).getStartPoint(),
DELTA);
}
}
public void testGetEndPoint() {
- for(int i = 0; i < angles.length; i++) {
- double angle = angles[i][0];
+ for (double[] element : angles) {
+ double angle = element[0];
assertEquals(
"[angle=" + doubleToStr(angle) + "] End point",
- new Point2D.Double(angles[i][1], angles[i][2]),
+ new Point2D.Double(element[1], element[2]),
new Arc2D.Double(1, 2, 4, 6, 10, angle - 10, Arc2D.PIE).getEndPoint(),
DELTA);
}
}
public void testGetBounds2D() {
- for(int i = 0; i < bounds.length; i++) {
- int type = (int)bounds[i][0];
- double start = bounds[i][1];
- double extent = bounds[i][2];
+ for (double[] element : bounds) {
+ int type = (int)element[0];
+ double start = element[1];
+ double extent = element[2];
assertEquals(
"[start=" + doubleToStr(start) +
",extent=" + doubleToStr(extent) +
",type=" + type + "] Bounds",
new Rectangle2D.Double(
- bounds[i][3],
- bounds[i][4],
- bounds[i][5] - bounds[i][3],
- bounds[i][6] - bounds[i][4]),
+ element[3],
+ element[4],
+ element[5] - element[3],
+ element[6] - element[4]),
new Arc2D.Double(1, 2, 4, 6, start, extent, type).getBounds2D(),
DELTA);
}
}
public void testContainsAngle() {
- for(int i = 0; i < arcs.length; i++) {
- double start = arcs[i][0];
- double extent = arcs[i][1];
- double angle = arcs[i][2];
+ for (double[] element : arcs) {
+ double start = element[0];
+ double extent = element[1];
+ double angle = element[2];
assertEquals(
"[start=" + doubleToStr(start) + ",extent=" + extent + "] containsAngle(" + angle + ")",
- arcs[i][3] == 1,
+ element[3] == 1,
new Arc2D.Double(1, 2, 4, 6, start, extent, Arc2D.OPEN).containsAngle(angle));
}
}
@@ -283,21 +285,21 @@
}
public void testSetArcByTangent() {
- for(int i = 0; i < tangent.length; i++) {
- double x1 = tangent[i][0];
- double y1 = tangent[i][1];
- double x2 = tangent[i][2];
- double y2 = tangent[i][3];
- double x3 = tangent[i][4];
- double y3 = tangent[i][5];
- double radius = tangent[i][6];
+ for (double[] element : tangent) {
+ double x1 = element[0];
+ double y1 = element[1];
+ double x2 = element[2];
+ double y2 = element[3];
+ double x3 = element[4];
+ double y3 = element[5];
+ double radius = element[6];
a.setArcByTangent(
new Point2D.Double(x1, y1),
new Point2D.Double(x2, y2),
new Point2D.Double(x3, y3),
radius);
Arc2D a2 = new Arc2D.Double();
- a2.setArcByCenter(tangent[i][7], tangent[i][8], radius, tangent[i][9], tangent[i][10], a.getArcType());
+ a2.setArcByCenter(element[7], element[8], radius, element[9], element[10], a.getArcType());
assertEquals(
"Arc2d.setArcByTangent((" +
doubleToStr(x1) + "," +
@@ -314,10 +316,10 @@
}
public void testSetAngleStart() {
- for(int i = 0; i < points1.length; i++) {
- double x = points1[i][0];
- double y = points1[i][1];
- double angle = points1[i][2];
+ for (double[] element : points1) {
+ double x = element[0];
+ double y = element[1];
+ double angle = element[2];
a.setAngleStart(new Point2D.Double(x, y));
assertEquals(
"Arc2d.setAngleStart(" + x + "," + y + ") failed",
@@ -328,13 +330,13 @@
}
public void testSetAngels1() {
- for(int i = 0; i < points2.length; i++) {
- double x1 = points2[i][0];
- double y1 = points2[i][1];
- double x2 = points2[i][2];
- double y2 = points2[i][3];
- double start = points2[i][4];
- double extent = points2[i][5];
+ for (double[] element : points2) {
+ double x1 = element[0];
+ double y1 = element[1];
+ double x2 = element[2];
+ double y2 = element[3];
+ double start = element[4];
+ double extent = element[5];
a.setAngles(x1, y1, x2, y2);
assertEquals(
"Arc2d.setAngles(" + x1 + "," + y1 + "," + x2 + "," + y2 + ") failed. Start angle",
@@ -350,13 +352,13 @@
}
public void testSetAngels2() {
- for(int i = 0; i < points2.length; i++) {
- double x1 = points2[i][0];
- double y1 = points2[i][1];
- double x2 = points2[i][2];
- double y2 = points2[i][3];
- double start = points2[i][4];
- double extent = points2[i][5];
+ for (double[] element : points2) {
+ double x1 = element[0];
+ double y1 = element[1];
+ double x2 = element[2];
+ double y2 = element[3];
+ double start = element[4];
+ double extent = element[5];
a.setAngles(new Point2D.Double(x1, y1), new Point2D.Double(x2, y2));
assertEquals(
"Arc2d.setAngles(" + x1 + "," + y1 + "," + x2 + "," + y2 + ") failed. Start angle",
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java Wed Oct 18 22:18:19 2006
@@ -26,9 +26,11 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
}
+ @Override
protected void tearDown() throws Exception {
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DDoubleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DDoubleTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DDoubleTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DDoubleTest.java Wed Oct 18 22:18:19 2006
@@ -28,11 +28,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
c = new CubicCurve2D.Double(1, 2, 3, 4, 5, 6, 7, 8);
}
+ @Override
protected void tearDown() throws Exception {
c = null;
super.tearDown();
@@ -102,16 +104,16 @@
}
public void testGetBounds2D() {
- for(int i = 0; i < CubicCurve2DTest.bounds.length; i++) {
+ for (double[][] element : CubicCurve2DTest.bounds) {
CubicCurve2D curve = new CubicCurve2D.Double();
- curve.setCurve(CubicCurve2DTest.bounds[i][0], 0);
+ curve.setCurve(element[0], 0);
assertEquals(
cubicToStr(curve),
new Rectangle2D.Double(
- (int)CubicCurve2DTest.bounds[i][1][0],
- (int)CubicCurve2DTest.bounds[i][1][1],
- (int)CubicCurve2DTest.bounds[i][1][2],
- (int)CubicCurve2DTest.bounds[i][1][3]),
+ (int)element[1][0],
+ (int)element[1][1],
+ (int)element[1][2],
+ (int)element[1][3]),
curve.getBounds2D());
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DFloatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DFloatTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DFloatTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DFloatTest.java Wed Oct 18 22:18:19 2006
@@ -28,11 +28,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
c = new CubicCurve2D.Float(1, 2, 3, 4, 5, 6, 7, 8);
}
+ @Override
protected void tearDown() throws Exception {
c = null;
super.tearDown();
@@ -102,16 +104,16 @@
}
public void testGetBounds2D() {
- for(int i = 0; i < CubicCurve2DTest.bounds.length; i++) {
+ for (double[][] element : CubicCurve2DTest.bounds) {
CubicCurve2D curve = new CubicCurve2D.Float();
- curve.setCurve(CubicCurve2DTest.bounds[i][0], 0);
+ curve.setCurve(element[0], 0);
assertEquals(
cubicToStr(curve),
new Rectangle2D.Float(
- (int)CubicCurve2DTest.bounds[i][1][0],
- (int)CubicCurve2DTest.bounds[i][1][1],
- (int)CubicCurve2DTest.bounds[i][1][2],
- (int)CubicCurve2DTest.bounds[i][1][3]),
+ (int)element[1][0],
+ (int)element[1][1],
+ (int)element[1][2],
+ (int)element[1][3]),
curve.getBounds2D());
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/CubicCurve2DTest.java Wed Oct 18 22:18:19 2006
@@ -72,11 +72,13 @@
// filterShape = createFilter("^(quad).*([.]shape)$", null);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
c = new CubicCurve2D.Double(1, 2, 3, 4, 5, 6, 7, 8);
}
+ @Override
protected void tearDown() throws Exception {
c = null;
super.tearDown();
@@ -115,94 +117,94 @@
}
public void testGetFlatnessSq1() {
- for(int i = 0; i < curves3.length; i++) {
+ for (double[] element : curves3) {
CubicCurve2D curve = new CubicCurve2D.Double();
- curve.setCurve(curves3[i], 0);
- assertEquals(cubicToStr(curve), curves3[i][8], curve.getFlatnessSq(), 0.0);
+ curve.setCurve(element, 0);
+ assertEquals(cubicToStr(curve), element[8], curve.getFlatnessSq(), 0.0);
}
}
public void testGetFlatnessSq2() {
- for(int i = 0; i < curves3.length; i++) {
+ for (double[] element : curves3) {
CubicCurve2D curve = new CubicCurve2D.Double();
- curve.setCurve(curves3[i], 0);
+ curve.setCurve(element, 0);
assertEquals(
cubicToStr(curve),
- curves3[i][8],
+ element[8],
CubicCurve2D.getFlatnessSq(
- curves3[i][0],
- curves3[i][1],
- curves3[i][2],
- curves3[i][3],
- curves3[i][4],
- curves3[i][5],
- curves3[i][6],
- curves3[i][7]), 0.0);
+ element[0],
+ element[1],
+ element[2],
+ element[3],
+ element[4],
+ element[5],
+ element[6],
+ element[7]), 0.0);
}
}
public void testGetFlatnessSq3() {
- for(int i = 0; i < curves3.length; i++) {
+ for (double[] element : curves3) {
CubicCurve2D curve = new CubicCurve2D.Double();
- curve.setCurve(curves3[i], 0);
+ curve.setCurve(element, 0);
assertEquals(
cubicToStr(curve),
- curves3[i][8],
- CubicCurve2D.getFlatnessSq(curves3[i], 0), 0.0);
+ element[8],
+ CubicCurve2D.getFlatnessSq(element, 0), 0.0);
}
}
public void testGetFlatness1() {
- for(int i = 0; i < curves3.length; i++) {
+ for (double[] element : curves3) {
CubicCurve2D curve = new CubicCurve2D.Double();
- curve.setCurve(curves3[i], 0);
- assertEquals(cubicToStr(curve), Math.sqrt(curves3[i][8]), curve.getFlatness(), 0.0);
+ curve.setCurve(element, 0);
+ assertEquals(cubicToStr(curve), Math.sqrt(element[8]), curve.getFlatness(), 0.0);
}
}
public void testGetFlatness2() {
- for(int i = 0; i < curves3.length; i++) {
+ for (double[] element : curves3) {
CubicCurve2D curve = new CubicCurve2D.Double();
- curve.setCurve(curves3[i], 0);
+ curve.setCurve(element, 0);
assertEquals(
cubicToStr(curve),
- Math.sqrt(curves3[i][8]),
+ Math.sqrt(element[8]),
CubicCurve2D.getFlatness(
- curves3[i][0],
- curves3[i][1],
- curves3[i][2],
- curves3[i][3],
- curves3[i][4],
- curves3[i][5],
- curves3[i][6],
- curves3[i][7]), 0.0);
+ element[0],
+ element[1],
+ element[2],
+ element[3],
+ element[4],
+ element[5],
+ element[6],
+ element[7]), 0.0);
}
}
public void testGetFlatness3() {
- for(int i = 0; i < curves3.length; i++) {
+ for (double[] element : curves3) {
CubicCurve2D curve = new CubicCurve2D.Double();
- curve.setCurve(curves3[i], 0);
+ curve.setCurve(element, 0);
assertEquals(
cubicToStr(curve),
- Math.sqrt(curves3[i][8]),
- CubicCurve2D.getFlatness(curves3[i], 0), 0.0);
+ Math.sqrt(element[8]),
+ CubicCurve2D.getFlatness(element, 0), 0.0);
}
}
public void testSubdivide1() {
- for(int i = 0; i < curves1.length; i ++) {
+ for (double[][] element : curves1) {
CubicCurve2D src1 = new CubicCurve2D.Double();
CubicCurve2D left1 = new CubicCurve2D.Double();
CubicCurve2D right1 = new CubicCurve2D.Double();
- src1.setCurve(curves1[i][0], 0);
- left1.setCurve(curves1[i][1], 0);
- right1.setCurve(curves1[i][2], 0);
+ src1.setCurve(element[0], 0);
+ left1.setCurve(element[1], 0);
+ right1.setCurve(element[2], 0);
CubicCurve2D src2 = new CubicCurve2D.Double();
CubicCurve2D left2 = new CubicCurve2D.Double();
CubicCurve2D right2 = new CubicCurve2D.Double();
- src2.setCurve(curves1[i][0], 0);
+ src2.setCurve(element[0], 0);
CubicCurve2D.subdivide(src2, left2, right2);
assertEquals(src1, src2, 0.0);
@@ -212,59 +214,59 @@
}
public void testSubdivide2() {
- for(int i = 0; i < curves2.length; i ++) {
- int srcOff = curves2[i][0][0] < 0.0 ? (int)-curves2[i][0][0] : 0;
- int leftOff = curves2[i][1][0] < 0.0 ? (int)-curves2[i][1][0] : 0;
- int rightOff = curves2[i][2][0] < 0.0 ? (int)-curves2[i][2][0] : 0;
+ for (double[][] element : curves2) {
+ int srcOff = element[0][0] < 0.0 ? (int)-element[0][0] : 0;
+ int leftOff = element[1][0] < 0.0 ? (int)-element[1][0] : 0;
+ int rightOff = element[2][0] < 0.0 ? (int)-element[2][0] : 0;
double[] src = new double[20];
double[] left = new double[20];
double[] right = new double[20];
- System.arraycopy(src, 0, curves2[i][0], 0, curves2[i][0].length);
- System.arraycopy(left, 0, curves2[i][1], 0, curves2[i][1].length);
- System.arraycopy(right, 0, curves2[i][2], 0, curves2[i][2].length);
+ System.arraycopy(src, 0, element[0], 0, element[0].length);
+ System.arraycopy(left, 0, element[1], 0, element[1].length);
+ System.arraycopy(right, 0, element[2], 0, element[2].length);
CubicCurve2D.subdivide(src, srcOff, left, leftOff, right, rightOff);
- assertEquals(curves2[i][0], src, curves2[i][0].length, 0.0);
- assertEquals(curves2[i][1], left, curves2[i][1].length, 0.0);
- assertEquals(curves2[i][2], right, curves2[i][2].length, 0.0);
+ assertEquals(element[0], src, element[0].length, 0.0);
+ assertEquals(element[1], left, element[1].length, 0.0);
+ assertEquals(element[2], right, element[2].length, 0.0);
}
}
public void testSolveCubic1() {
- for(int i = 0; i < equations.length; i++) {
+ for (double[][] element : equations) {
double eqn[] = new double[4];
- System.arraycopy(equations[i][0], 0, eqn, 0, 4);
+ System.arraycopy(element[0], 0, eqn, 0, 4);
String seqn =
"[" + doubleToStr(eqn[0]) + "," +
doubleToStr(eqn[1]) + "," +
doubleToStr(eqn[2]) + "," +
doubleToStr(eqn[3]) + "]";
int roots = CubicCurve2D.solveCubic(eqn);
- assertEquals(seqn + " roots count", (int)equations[i][1][0], roots);
+ assertEquals(seqn + " roots count", (int)element[1][0], roots);
for(int j = 0; j < roots; j++) {
- assertEquals(seqn + " root(" + j + ")", equations[i][1][1 + j], eqn[j], ROOT_DELTA);
+ assertEquals(seqn + " root(" + j + ")", element[1][1 + j], eqn[j], ROOT_DELTA);
}
}
}
public void testSolveCubic2() {
- for(int i = 0; i < equations.length; i++) {
+ for (double[][] element : equations) {
double res[] = new double[3];
double eqn[] = new double[4];
- System.arraycopy(equations[i][0], 0, eqn, 0, 4);
+ System.arraycopy(element[0], 0, eqn, 0, 4);
String seqn =
"[" + doubleToStr(eqn[0]) + "," +
doubleToStr(eqn[1]) + "," +
doubleToStr(eqn[2]) + "," +
doubleToStr(eqn[3]) + "]";
int roots = CubicCurve2D.solveCubic(eqn, res);
- assertEquals(seqn + " roots count", (int)equations[i][1][0], roots);
- assertEquals(equations[i][0], eqn, 4, 0.0);
+ assertEquals(seqn + " roots count", (int)element[1][0], roots);
+ assertEquals(element[0], eqn, 4, 0.0);
for(int j = 0; j < roots; j++) {
- assertEquals(seqn + " root(" + j + ")", equations[i][1][1 + j], res[j], ROOT_DELTA);
+ assertEquals(seqn + " root(" + j + ")", element[1][1 + j], res[j], ROOT_DELTA);
}
}
}
@@ -274,16 +276,16 @@
}
public void testGetBounds() {
- for(int i = 0; i < bounds.length; i++) {
+ for (double[][] element : bounds) {
CubicCurve2D curve = new CubicCurve2D.Double();
- curve.setCurve(bounds[i][0], 0);
+ curve.setCurve(element[0], 0);
assertEquals(
cubicToStr(curve),
new Rectangle(
- (int)bounds[i][1][0],
- (int)bounds[i][1][1],
- (int)bounds[i][1][2],
- (int)bounds[i][1][3]),
+ (int)element[1][0],
+ (int)element[1][1],
+ (int)element[1][2],
+ (int)element[1][3]),
curve.getBounds());
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Ellipse2DDoubleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Ellipse2DDoubleTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Ellipse2DDoubleTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Ellipse2DDoubleTest.java Wed Oct 18 22:18:19 2006
@@ -26,10 +26,12 @@
Ellipse2D.Double e;
+ @Override
protected void setUp() throws Exception {
e = new Ellipse2D.Double(1.0, 2.0, 3.0, 4.0);
}
+ @Override
protected void tearDown() throws Exception {
e = null;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Ellipse2DFloatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Ellipse2DFloatTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Ellipse2DFloatTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Ellipse2DFloatTest.java Wed Oct 18 22:18:19 2006
@@ -26,10 +26,12 @@
Ellipse2D.Float e;
+ @Override
protected void setUp() throws Exception {
e = new Ellipse2D.Float(1.0f, 2.0f, 3.0f, 4.0f);
}
+ @Override
protected void tearDown() throws Exception {
e = null;
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/FlatteningPathIteratorTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/FlatteningPathIteratorTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/FlatteningPathIteratorTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/FlatteningPathIteratorTest.java Wed Oct 18 22:18:19 2006
@@ -33,12 +33,14 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
p = new Rectangle(1, 2, 3, 4).getPathIterator(null);
fp = new FlatteningPathIterator(p, 10, 5);
}
+ @Override
protected void tearDown() throws Exception {
fp = null;
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/GeneralPathTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/GeneralPathTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/GeneralPathTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/GeneralPathTest.java Wed Oct 18 22:18:19 2006
@@ -121,11 +121,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
g = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
}
+ @Override
protected void tearDown() throws Exception {
super.tearDown();
}
@@ -291,19 +293,19 @@
GeneralPath createPath(float[][] segments) {
GeneralPath p = new GeneralPath();
if (segments != null) {
- for(int i = 0; i < segments.length; i++) {
- switch((int)segments[i][0]) {
+ for (float[] element : segments) {
+ switch((int)element[0]) {
case PathIterator.SEG_MOVETO:
- p.moveTo(segments[i][1], segments[i][2]);
+ p.moveTo(element[1], element[2]);
break;
case PathIterator.SEG_LINETO:
- p.lineTo(segments[i][1], segments[i][2]);
+ p.lineTo(element[1], element[2]);
break;
case PathIterator.SEG_QUADTO:
- p.quadTo(segments[i][1], segments[i][2], segments[i][3], segments[i][4]);
+ p.quadTo(element[1], element[2], element[3], element[4]);
break;
case PathIterator.SEG_CUBICTO:
- p.curveTo(segments[i][1], segments[i][2], segments[i][3], segments[i][4], segments[i][5], segments[i][6]);
+ p.curveTo(element[1], element[2], element[3], element[4], element[5], element[6]);
break;
case PathIterator.SEG_CLOSE:
p.closePath();
@@ -315,11 +317,11 @@
}
public void testAppendShape() {
- for(int i = 0; i < shapes1.length; i++) {
- GeneralPath src1 = createPath(shapes1[i][0]);
- GeneralPath src2 = createPath(shapes1[i][1]);
- GeneralPath dst = createPath(shapes1[i][2]);
- boolean connect = shapes1[i][3][0][0] == 1;
+ for (float[][][] element : shapes1) {
+ GeneralPath src1 = createPath(element[0]);
+ GeneralPath src2 = createPath(element[1]);
+ GeneralPath dst = createPath(element[2]);
+ boolean connect = element[3][0][0] == 1;
src1.append(src2, connect);
assertEquals(dst, src1, 0.0);
assertEquals(dst, src1, 0.0f);
@@ -327,11 +329,11 @@
}
public void testAppendPath() {
- for(int i = 0; i < shapes1.length; i++) {
- GeneralPath src1 = createPath(shapes1[i][0]);
- GeneralPath src2 = createPath(shapes1[i][1]);
- GeneralPath dst = createPath(shapes1[i][2]);
- boolean connect = shapes1[i][3][0][0] == 1;
+ for (float[][][] element : shapes1) {
+ GeneralPath src1 = createPath(element[0]);
+ GeneralPath src2 = createPath(element[1]);
+ GeneralPath dst = createPath(element[2]);
+ boolean connect = element[3][0][0] == 1;
src1.append(src2.getPathIterator(null), connect);
assertEquals(dst, src1, 0.0);
assertEquals(dst, src1, 0.0f);
@@ -382,10 +384,10 @@
}
public void testTransform() {
- for(int i = 0; i < shapes2.length; i++) {
- GeneralPath src = createPath(shapes2[i][0]);
- GeneralPath dst = createPath(shapes2[i][2]);
- AffineTransform t = new AffineTransform(shapes2[i][1][0]);
+ for (float[][][] element : shapes2) {
+ GeneralPath src = createPath(element[0]);
+ GeneralPath dst = createPath(element[2]);
+ AffineTransform t = new AffineTransform(element[1][0]);
src.transform(t);
assertEquals(dst, src, 0.0);
assertEquals(dst, src, 0.0f);
@@ -393,10 +395,10 @@
}
public void testCreateTransformedShape() {
- for(int i = 0; i < shapes2.length; i++) {
- GeneralPath src = createPath(shapes2[i][0]);
- Shape dst1 = createPath(shapes2[i][2]);
- AffineTransform t = new AffineTransform(shapes2[i][1][0]);
+ for (float[][][] element : shapes2) {
+ GeneralPath src = createPath(element[0]);
+ Shape dst1 = createPath(element[2]);
+ AffineTransform t = new AffineTransform(element[1][0]);
Shape dst2 = src.createTransformedShape(t);
assertTrue(Tools.Shape.equals(dst1, dst2, 0.0));
assertTrue(Tools.Shape.equals(dst1, dst2, 0.0f));
@@ -404,25 +406,25 @@
}
public void testGetBounds2D() {
- for(int i = 0; i < bounds.length; i++) {
- GeneralPath src = createPath(bounds[i][0]);
+ for (float[][][] element : bounds) {
+ GeneralPath src = createPath(element[0]);
Rectangle2D bound = new Rectangle2D.Float(
- bounds[i][1][0][0],
- bounds[i][1][0][1],
- bounds[i][1][0][2],
- bounds[i][1][0][3]);
+ element[1][0][0],
+ element[1][0][1],
+ element[1][0][2],
+ element[1][0][3]);
assertEquals(bound, src.getBounds2D(), 0.0);
}
}
public void testGetBounds() {
- for(int i = 0; i < bounds.length; i++) {
- GeneralPath src = createPath(bounds[i][0]);
+ for (float[][][] element : bounds) {
+ GeneralPath src = createPath(element[0]);
Rectangle2D bound = new Rectangle(
- (int)bounds[i][1][0][0],
- (int)bounds[i][1][0][1],
- (int)bounds[i][1][0][2],
- (int)bounds[i][1][0][3]);
+ (int)element[1][0][0],
+ (int)element[1][0][1],
+ (int)element[1][0][2],
+ (int)element[1][0][3]);
assertEquals(bound, src.getBounds(), 0.0);
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DDoubleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DDoubleTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DDoubleTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DDoubleTest.java Wed Oct 18 22:18:19 2006
@@ -30,11 +30,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
l = new Line2D.Double(1, 2, 3, 4);
}
+ @Override
protected void tearDown() throws Exception {
l = null;
super.tearDown();
@@ -83,18 +85,18 @@
}
public void testGetBounds2D() {
- for(int i = 0; i < Line2DTest.bounds.length; i++) {
+ for (int[][] element : Line2DTest.bounds) {
assertEquals(
new Rectangle2D.Double(
- Line2DTest.bounds[i][1][0],
- Line2DTest.bounds[i][1][1],
- Line2DTest.bounds[i][1][2],
- Line2DTest.bounds[i][1][3]),
+ element[1][0],
+ element[1][1],
+ element[1][2],
+ element[1][3]),
new Line2D.Double(
- Line2DTest.bounds[i][0][0],
- Line2DTest.bounds[i][0][1],
- Line2DTest.bounds[i][0][2],
- Line2DTest.bounds[i][0][3]).getBounds2D());
+ element[0][0],
+ element[0][1],
+ element[0][2],
+ element[0][3]).getBounds2D());
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DFloatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DFloatTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DFloatTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DFloatTest.java Wed Oct 18 22:18:19 2006
@@ -30,11 +30,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
l = new Line2D.Float(1, 2, 3, 4);
}
+ @Override
protected void tearDown() throws Exception {
l = null;
super.tearDown();
@@ -83,18 +85,18 @@
}
public void testGetBounds2D() {
- for(int i = 0; i < Line2DTest.bounds.length; i++) {
+ for (int[][] element : Line2DTest.bounds) {
assertEquals(
new Rectangle2D.Float(
- Line2DTest.bounds[i][1][0],
- Line2DTest.bounds[i][1][1],
- Line2DTest.bounds[i][1][2],
- Line2DTest.bounds[i][1][3]),
+ element[1][0],
+ element[1][1],
+ element[1][2],
+ element[1][3]),
new Line2D.Float(
- Line2DTest.bounds[i][0][0],
- Line2DTest.bounds[i][0][1],
- Line2DTest.bounds[i][0][2],
- Line2DTest.bounds[i][0][3]).getBounds2D());
+ element[0][0],
+ element[0][1],
+ element[0][2],
+ element[0][3]).getBounds2D());
}
}
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Line2DTest.java Wed Oct 18 22:18:19 2006
@@ -121,11 +121,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
l = new Line2D.Double(1, 2, 3, 4);
}
+ @Override
protected void tearDown() throws Exception {
l = null;
super.tearDown();
@@ -142,18 +144,18 @@
}
public void testGetBounds(){
- for(int i = 0; i < bounds.length; i++) {
+ for (int[][] element : bounds) {
assertEquals(
new Rectangle(
- bounds[i][1][0],
- bounds[i][1][1],
- bounds[i][1][2],
- bounds[i][1][3]),
+ element[1][0],
+ element[1][1],
+ element[1][2],
+ element[1][3]),
new Line2D.Double(
- bounds[i][0][0],
- bounds[i][0][1],
- bounds[i][0][2],
- bounds[i][0][3]).getBounds());
+ element[0][0],
+ element[0][1],
+ element[0][2],
+ element[0][3]).getBounds());
}
}
@@ -162,90 +164,90 @@
}
public void testRelativeCCW1() {
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.relativeCCW(" + x + "," + y + ") failed",
- (int)points[i][2],
+ (int)element[2],
Line2D.relativeCCW(l.getX1(), l.getY1(), l.getX2(), l.getY2(), x, y)
);
}
}
public void testRelativeCCW2() {
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.relativeCCW(" + x + "," + y + ") failed",
- (int)points[i][2],
+ (int)element[2],
l.relativeCCW(x, y)
);
}
}
public void testRelativeCCW3() {
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.relativeCCW(" + x + "," + y + ") failed",
- (int)points[i][2],
+ (int)element[2],
l.relativeCCW(new Point(x, y))
);
}
}
public void testLinesIntersect(){
- for(int i = 0; i < lines.length; i++) {
- int x1 = lines[i][0];
- int y1 = lines[i][1];
- int x2 = lines[i][2];
- int y2 = lines[i][3];
+ for (int[] element : lines) {
+ int x1 = element[0];
+ int y1 = element[1];
+ int x2 = element[2];
+ int y2 = element[3];
assertEquals(
"Line2D.intersectsLine(" + x1 + "," + y1 + "," + x2 + "," + y2 + ") failed",
- lines[i][4] == 1,
+ element[4] == 1,
Line2D.linesIntersect(l.getX1(), l.getY1(), l.getX2(), l.getY2(), x1, y1, x2, y2)
);
}
}
public void testIntersectsLine1(){
- for(int i = 0; i < lines.length; i++) {
- int x1 = lines[i][0];
- int y1 = lines[i][1];
- int x2 = lines[i][2];
- int y2 = lines[i][3];
+ for (int[] element : lines) {
+ int x1 = element[0];
+ int y1 = element[1];
+ int x2 = element[2];
+ int y2 = element[3];
assertEquals(
"Line2D.intersectsLine(" + x1 + "," + y1 + "," + x2 + "," + y2 + ") failed",
- lines[i][4] == 1,
+ element[4] == 1,
l.intersectsLine(x1, y1, x2, y2)
);
}
}
public void testIntersectsLine2(){
- for(int i = 0; i < lines.length; i++) {
- int x1 = lines[i][0];
- int y1 = lines[i][1];
- int x2 = lines[i][2];
- int y2 = lines[i][3];
+ for (int[] element : lines) {
+ int x1 = element[0];
+ int y1 = element[1];
+ int x2 = element[2];
+ int y2 = element[3];
assertEquals(
"Line2D.intersectsLine(" + x1 + "," + y1 + "," + x2 + "," + y2 + ") failed",
- lines[i][4] == 1,
+ element[4] == 1,
l.intersectsLine(new Line2D.Double(x1, y1, x2, y2))
);
}
}
public void testPtSegDistSq1(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptSegDistSq(" + x + "," + y + ") failed",
- points[i][3],
+ element[3],
Line2D.ptSegDistSq(l.getX1(), l.getY1(), l.getX2(), l.getY2(), x, y),
DELTA
);
@@ -253,12 +255,12 @@
}
public void testPtSegDistSq2(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptSegDistSq(" + x + "," + y + ") failed",
- points[i][3],
+ element[3],
l.ptSegDistSq(x, y),
DELTA
);
@@ -266,12 +268,12 @@
}
public void testPtSegDistSq3(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptSegDistSq(" + x + "," + y + ") failed",
- points[i][3],
+ element[3],
l.ptSegDistSq(new Point(x, y)),
DELTA
);
@@ -279,12 +281,12 @@
}
public void testPtSegDist1(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptSegDist(" + x + "," + y + ") failed",
- Math.sqrt(points[i][3]),
+ Math.sqrt(element[3]),
Line2D.ptSegDist(l.getX1(), l.getY1(), l.getX2(), l.getY2(), x, y),
DELTA
);
@@ -292,12 +294,12 @@
}
public void testPtSegDist2(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptSegDist(" + x + "," + y + ") failed",
- Math.sqrt(points[i][3]),
+ Math.sqrt(element[3]),
l.ptSegDist(x, y),
DELTA
);
@@ -305,12 +307,12 @@
}
public void testPtSegDist3(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptSegDist(" + x + "," + y + ") failed",
- Math.sqrt(points[i][3]),
+ Math.sqrt(element[3]),
l.ptSegDist(new Point(x, y)),
DELTA
);
@@ -318,12 +320,12 @@
}
public void testPtLineDistSq1(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptLineDistSq(" + x + "," + y + ") failed",
- points[i][4],
+ element[4],
Line2D.ptLineDistSq(l.getX1(), l.getY1(), l.getX2(), l.getY2(), x, y),
DELTA
);
@@ -331,12 +333,12 @@
}
public void testPtLineDistSq2(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptLineDistSq(" + x + "," + y + ") failed",
- points[i][4],
+ element[4],
l.ptLineDistSq(x, y),
DELTA
);
@@ -344,12 +346,12 @@
}
public void testPtLineDistSq3(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptLineDistSq(" + x + "," + y + ") failed",
- points[i][4],
+ element[4],
l.ptLineDistSq(new Point(x, y)),
DELTA
);
@@ -357,12 +359,12 @@
}
public void testPtLineDist1(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptLineDist(" + x + "," + y + ") failed",
- Math.sqrt(points[i][4]),
+ Math.sqrt(element[4]),
Line2D.ptLineDist(l.getX1(), l.getY1(), l.getX2(), l.getY2(), x, y),
DELTA
);
@@ -370,12 +372,12 @@
}
public void testPtLineDist2(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptLineDist(" + x + "," + y + ") failed",
- Math.sqrt(points[i][4]),
+ Math.sqrt(element[4]),
l.ptLineDist(x, y),
DELTA
);
@@ -383,12 +385,12 @@
}
public void testPtLineDist3(){
- for(int i = 0; i < points.length; i++) {
- int x = (int)points[i][0];
- int y = (int)points[i][1];
+ for (double[] element : points) {
+ int x = (int)element[0];
+ int y = (int)element[1];
assertEquals(
"Line2D.ptLineDist(" + x + "," + y + ") failed",
- Math.sqrt(points[i][4]),
+ Math.sqrt(element[4]),
l.ptLineDist(new Point(x, y)),
DELTA
);
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DDoubleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DDoubleTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DDoubleTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DDoubleTest.java Wed Oct 18 22:18:19 2006
@@ -30,11 +30,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
p = new Point2D.Double(1, 2);
}
+ @Override
protected void tearDown() throws Exception {
p = null;
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DFloatTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DFloatTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DFloatTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DFloatTest.java Wed Oct 18 22:18:19 2006
@@ -30,11 +30,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
p = new Point2D.Float(1, 2);
}
+ @Override
protected void tearDown() throws Exception {
p = null;
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/Point2DTest.java Wed Oct 18 22:18:19 2006
@@ -34,11 +34,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
p = new Point(1, 2);
}
+ @Override
protected void tearDown() throws Exception {
p = null;
super.tearDown();
Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/QuadCurve2DDoubleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/QuadCurve2DDoubleTest.java?view=diff&rev=465495&r1=465494&r2=465495
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/QuadCurve2DDoubleTest.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/QuadCurve2DDoubleTest.java Wed Oct 18 22:18:19 2006
@@ -28,11 +28,13 @@
super(name);
}
+ @Override
protected void setUp() throws Exception {
super.setUp();
q = new QuadCurve2D.Double(1, 2, 3, 4, 5, 6);
}
+ @Override
protected void tearDown() throws Exception {
q = null;
super.tearDown();
@@ -89,16 +91,16 @@
}
public void testGetBounds2D() {
- for(int i = 0; i < QuadCurve2DTest.bounds.length; i++) {
+ for (double[][] element : QuadCurve2DTest.bounds) {
QuadCurve2D curve = new QuadCurve2D.Double();
- curve.setCurve(QuadCurve2DTest.bounds[i][0], 0);
+ curve.setCurve(element[0], 0);
assertEquals(
quadToStr(curve),
new Rectangle2D.Double(
- (int)QuadCurve2DTest.bounds[i][1][0],
- (int)QuadCurve2DTest.bounds[i][1][1],
- (int)QuadCurve2DTest.bounds[i][1][2],
- (int)QuadCurve2DTest.bounds[i][1][3]),
+ (int)element[1][0],
+ (int)element[1][1],
+ (int)element[1][2],
+ (int)element[1][3]),
curve.getBounds2D());
}
}