public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* RFC: Fix for Mauve test gnu/testlet/java/awt/Canvas/PaintTest.java
@ 2011-09-26 15:30 Pavel Tisnovsky
  2011-09-27  8:46 ` Mark Wielaard
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Tisnovsky @ 2011-09-26 15:30 UTC (permalink / raw)
  To: mauve-discuss; +Cc: Omair Majid

Greetings,

I've made a simple patch for the Mauve test gnu/testlet/java/awt/Canvas/PaintTest.java

This patch adds a small delay before computation of canvas size and its
absolute position on the screen is done. There's also added a test for
a color of a pixel located inside the canvas.


--- gnu/testlet/java/awt/Canvas/PaintTest.java.old      2008-05-21 16:17:54.000000000 +0200
+++ gnu/testlet/java/awt/Canvas/PaintTest.java  2011-09-26 16:31:01.000000000 +0200
@@ -1,5 +1,5 @@
 /* PaintTest.java --
-   Copyright (C) 2006 Red Hat
+   Copyright (C) 2006, 2011 Red Hat
 This file is part of Mauve.

 Mauve is free software; you can redistribute it and/or modify
@@ -60,13 +60,24 @@
     f.add(this);
     f.pack();
     f.show();
+
+    Robot r = harness.createRobot();
+
+    // we should wait a moment before the computations
+    // and pixel checks is done
+    r.waitForIdle();
+
     Point loc = f.getLocationOnScreen();
     Rectangle bounds = c.getBounds();
     Insets i = f.getInsets();
     bounds.x += i.left + loc.x;
     bounds.y += i.top + loc.y;

-    Robot r = harness.createRobot();
+    // check the color of a pixel located in the canvas centre
+    Color but = r.getPixelColor(bounds.x + bounds.width/2, bounds.y + bounds.height/2);
+    harness.check(but.equals(Color.blue));
+
+    // and also check color in all four canvas corners
     LocationTests.checkRectangleCornerColors(harness, r, bounds, Color.blue, true);

     // There is a delay to avoid any race conditions



Can anybody please review this change?

Thank you in advance,
Pavel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFC: Fix for Mauve test gnu/testlet/java/awt/Canvas/PaintTest.java
  2011-09-26 15:30 RFC: Fix for Mauve test gnu/testlet/java/awt/Canvas/PaintTest.java Pavel Tisnovsky
@ 2011-09-27  8:46 ` Mark Wielaard
  2011-09-29  9:40   ` Pavel Tisnovsky
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Wielaard @ 2011-09-27  8:46 UTC (permalink / raw)
  To: Pavel Tisnovsky; +Cc: mauve-discuss, Omair Majid

Hi Pavel,

On Mon, 2011-09-26 at 17:32 +0200, Pavel Tisnovsky wrote:
> I've made a simple patch for the Mauve test gnu/testlet/java/awt/Canvas/PaintTest.java
> 
> This patch adds a small delay before computation of canvas size and its
> absolute position on the screen is done. There's also added a test for
> a color of a pixel located inside the canvas.

Yes, looks fine to me. You probably always need a Robot.waitForIdle()
after a pack()/show().

Thanks,

Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RFC: Fix for Mauve test gnu/testlet/java/awt/Canvas/PaintTest.java
  2011-09-27  8:46 ` Mark Wielaard
@ 2011-09-29  9:40   ` Pavel Tisnovsky
  0 siblings, 0 replies; 3+ messages in thread
From: Pavel Tisnovsky @ 2011-09-29  9:40 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: mauve-discuss, Omair Majid

Mark Wielaard wrote:
> Hi Pavel,
> 
> On Mon, 2011-09-26 at 17:32 +0200, Pavel Tisnovsky wrote:
>> I've made a simple patch for the Mauve test gnu/testlet/java/awt/Canvas/PaintTest.java
>>
>> This patch adds a small delay before computation of canvas size and its
>> absolute position on the screen is done. There's also added a test for
>> a color of a pixel located inside the canvas.
> 
> Yes, looks fine to me. You probably always need a Robot.waitForIdle()
> after a pack()/show().
> 
> Thanks,
> 
> Mark

Hi Mark,

thank you for your review. I've found, that similar issue
should be fixed in some other tests. Fixes for such tests were pushed today:

2011-09-29  Pavel Tisnovsky  <ptisnovs@redhat.com>

        * gnu/testlet/java/awt/Button/PaintTest.java:
        * gnu/testlet/java/awt/Canvas/PaintTest.java:
        * gnu/testlet/java/awt/Checkbox/PaintTest.java:
        * gnu/testlet/java/awt/Choice/PaintTest.java:
        * gnu/testlet/java/awt/Label/PaintTest.java:
        * gnu/testlet/java/awt/TextField/PaintTest.java:
        Fixed these tests: added calling of robot.waitForIdle() method before
        all checks, added more accurate checking of pixel colors in some cases,
        comments for a new code.

Pavel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-29  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-26 15:30 RFC: Fix for Mauve test gnu/testlet/java/awt/Canvas/PaintTest.java Pavel Tisnovsky
2011-09-27  8:46 ` Mark Wielaard
2011-09-29  9:40   ` Pavel Tisnovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).