This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
Re: FYI: New Lightweight tests
I fixed up testLoc1 so it fails with Classpath (without my AWT patch).
I also adjusted some of the delays to be longer. It was causing race
conditions with my new test.
2006-02-22 Lillian Angel <langel@redhat.com>
* gnu/testlet/java/awt/Container/LightweightContainer.java
(testLoc1): Fixed up tests so it fails without pending
lightweight patch.
On Wed, 2006-02-22 at 12:47 -0500, Lillian Angel wrote:
> - I added a utility class to gnu/testlet/java/awt/ to take care of the
> location tests using colors.
> - I fixed up the other classes to use this new Class.
> - I also added a new test to LightweightContainer. This test represents
> the testcase that initially found the problem with lightweight
> containers.
> - I added more comments for the delays.
>
> 2006-02-22 Lillian Angel <langel@redhat.com>
>
> * gnu/testlet/TestHarness.java
> (checkColor): Removed.
> (checkRectangleOuterColors): Removed.
> (checkRectangleCornerColors): Removed.
> * gnu/testlet/java/awt/Container/LightweightContainer.java
> (testLoc): Added comment, changed to use LocationTests.
> (testWindow): Likewise.
> (testLoc1): Added new test.
> (test): Added call to testLoc1.
> * gnu/testlet/java/awt/Frame/size1.java
> (test): Added comment, changed to use LocationTests.
> * gnu/testlet/java/awt/LocationTests.java: New class.
>
>
> On Wed, 2006-02-22 at 12:25 -0500, Thomas Fitzsimmons wrote:
> > On Wed, 2006-02-22 at 10:29 +0000, David Gilbert wrote:
> > > Hi Lillian,
> > >
> > > Lillian Angel wrote:
> > >
> > > >
> > > >Index: gnu/testlet/java/awt/Container/LightweightContainer.java
> > > >===================================================================
> > > >
> > > >
> > > >
> > >
> > > >+ harness.checkRectangleOuterColors(r, bounds2, Color.red, true);
> > > >+ harness.checkRectangleCornerColors(r, bounds2, Color.red, false);
> > > >+
> > > >+ r.delay(3000);
> > > >+ }
> > > >
> > > >
> > > Do you know what the delay is for? Is there some other way to write the
> > > test so that the delay isn't required? It's just that it would be nice
> > > if the Mauve test run doesn't take longer than it has to - otherwise
> > > hackers will stop running it.
> >
> > The three second delays are to help the human tester see the result,
> > though we should probably enable or disable them based on if Mauve is
> > running in headless mode. The new AWT utility class that we add could
> > check the SHOW_GUI_TESTS environment variable and cache its value.
> >
> > We require:
> >
> > + r.waitForIdle();
> > + r.delay(300);
> >
> > after showing a frame, before checking pixels in it so that GTK has had
> > time to draw it. I think this is documented in one of the other AWT
> > tests.
> >
> > Tom
> >
> >
Index: gnu/testlet/java/awt/Container/LightweightContainer.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/Container/LightweightContainer.java,v
retrieving revision 1.4
diff -u -r1.4 LightweightContainer.java
--- gnu/testlet/java/awt/Container/LightweightContainer.java 22 Feb 2006 17:45:33 -0000 1.4
+++ gnu/testlet/java/awt/Container/LightweightContainer.java 22 Feb 2006 18:15:54 -0000
@@ -53,7 +53,7 @@
// There is a delay to avoid any race conditions.
r.waitForIdle();
- r.delay(300);
+ r.delay(1000);
// bounds of red rectangle (1 pixel wide border)
Rectangle bounds = tc.getBounds();
@@ -110,7 +110,7 @@
// There is a delay to avoid any race conditions.
r.waitForIdle();
- r.delay(300);
+ r.delay(1000);
Insets i = f.getInsets();
// check the two pixels adjacent to each corner of the fgHW
@@ -169,21 +169,26 @@
gridbag.setConstraints(b3, c);
LW.add(b3);
f.add(LW, BorderLayout.EAST);
-
- // Wait for delay to avoid race conditions
- r.waitForIdle();
- r.delay(300);
-
+
f.setSize(500, 500);
f.show();
+
+ // Wait for delay to avoid race conditions
+ r.waitForIdle();
+ r.delay(2000);
Rectangle bounds = LW.getBounds();
Point loc = f.getLocationOnScreen();
Insets i = f.getInsets();
bounds.x = loc.x + i.left + HW.getWidth();
bounds.y = loc.y + i.top;
- LocationTests.checkRectangleOuterColors(harness, r, bounds, Color.red, false);
- LocationTests.checkRectangleOuterColors(harness, r, bounds, Color.blue, false);
+
+ int x = f.getLocationOnScreen().x + HW.getWidth() + f.getInsets().left;
+ int y = f.getLocationOnScreen().y + f.getHeight()/2 + f.getInsets().top;
+ Color d = r.getPixelColor(x, y);
+ LocationTests.checkColor(harness, d, Color.red, true);
+ Color e = r.getPixelColor(x - 1, y);
+ LocationTests.checkColor(harness, e, Color.green, true);
// There is a delay so the tester can see the result.
r.delay(3000);