GoogleCodeArchive / piccolo2d

Automatically exported from code.google.com/p/piccolo2d
0 stars 0 forks source link

testPSwingDelegatesPaintingToItsComponent(edu.umd.cs.piccolox.pswing.PSwingTest) fails on release-1.3 branch #195

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On windows,

$ java -version
java version "1.5.0_21"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_21-b01)
Java HotSpot(TM) Client VM (build 1.5.0_21-b01, mixed mode, sharing)

or

$ java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)

$ mvn install

...
-------------------------------------------------------------------------------
Test set: edu.umd.cs.piccolox.pswing.PSwingTest
-------------------------------------------------------------------------------
Tests run: 17, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.031 sec <<< 
FAILURE!
testPSwingDelegatesPaintingToItsComponent(edu.umd.cs.piccolox.pswing.PSwingTest)
  Time elapsed: 0 sec  <<< ERROR!
java.lang.ArrayIndexOutOfBoundsException: Coordinate out of bounds!
        at sun.awt.image.IntegerInterleavedRaster.getDataElements(IntegerInterleavedRaster.java:202)
        at java.awt.image.BufferedImage.getRGB(BufferedImage.java:871)
        at edu.umd.cs.piccolox.pswing.PSwingTest.testPSwingDelegatesPaintingToItsComponent(PSwingTest.java:95)

Original issue reported on code.google.com by heue...@gmail.com on 21 Dec 2010 at 6:14

GoogleCodeExporter commented 9 years ago
fails on linux too

$ java -version
java version "1.6.0_20"
OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu1~10.04.1)
OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)

Original comment by heue...@gmail.com on 21 Dec 2010 at 6:37

GoogleCodeExporter commented 9 years ago
The following fix to the unit test makes the test pass

$ svn diff .
Index: src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java
===================================================================
--- src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java    (revision 1085)
+++ src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java    (working copy)
@@ -90,6 +90,7 @@
                panel.setBackground(Color.RED);
                panel.setPreferredSize(new Dimension(100, 100));

+                pSwing.updateBounds();
                final BufferedImage img = pSwing.paintComponent();

                assertEquals(Color.RED.getRGB(), img.getRGB(50, 50));

Probably has something to do with this commit

http://code.google.com/p/piccolo2d/source/diff?spec=svn1085&r=1045&format=side&p
ath=/piccolo2d.java/branches/release-1.3/extras/src/main/java/edu/umd/cs/piccolo
x/pswing/PSwing.java&old_path=/piccolo2d.java/branches/release-1.3/extras/src/ma
in/java/edu/umd/cs/piccolox/pswing/PSwing.java&old=983

Original comment by heue...@gmail.com on 21 Dec 2010 at 7:17

GoogleCodeExporter commented 9 years ago
Looks to me like the problem is with the mock painting methods in 
MockPaintingPSwing.  They don't call PSwing.paint(PPaintContext) which contains 
logic for updating component size.

$ svn commit -m "Issue 195 ; mock painting methods were missing logic in 
PSwing.paint(PPaintContext)" .
Committed revision 1086.

Please review.

Original comment by heue...@gmail.com on 21 Dec 2010 at 7:51

GoogleCodeExporter commented 9 years ago
Reopening this issue, these test failures have returned for me with svn trunk 
on linux & windows after r1112.

Original comment by heue...@gmail.com on 16 Mar 2011 at 4:46

GoogleCodeExporter commented 9 years ago
Committed against trunk

$ svn commit -m "Issue 195 ; mock painting methods were missing logic in 
PSwing.paint(PPaintContext)" .
Committed revision 1119.

Original comment by heue...@gmail.com on 16 Mar 2011 at 4:56

GoogleCodeExporter commented 9 years ago

Original comment by heue...@gmail.com on 16 Mar 2011 at 4:56

GoogleCodeExporter commented 9 years ago
Verified on Windows (j2sdk1.4.2_19), Ubuntu (j2sdk1.4.2_19)

Original comment by atdi...@gmail.com on 19 Mar 2011 at 11:01