public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* RFC: fix for a test gnu/testlet/java/awt/Container/addImpl.java & its helper class gnu/testlet/java/awt/Container/DisabledEventQueue.java
@ 2011-09-30 12:57 Pavel Tisnovsky
  0 siblings, 0 replies; only message in thread
From: Pavel Tisnovsky @ 2011-09-30 12:57 UTC (permalink / raw)
  To: mauve-discuss

Greetings,

the Mauve test gnu/testlet/java/awt/Container/addImpl.java in its current implementation
left opened frame on the desktop, which caused some other AWT-related tests to fail. Here's
a (quite obvious) fix for this test:

--- mauve/gnu/testlet/java/awt/Container/addImpl.java_old       2006-03-15 16:22:05.000000000 +0100
+++ mauve/gnu/testlet/java/awt/Container/addImpl.java   2011-09-30 13:46:05.000000000 +0200
@@ -233,7 +233,8 @@
     c.setSize(100,100);
     f.add(a);
     f.pack();
-    f.show();
+    f.show();
+
     harness.check(a.isShowing(), true);
     harness.check(c.isShowing(), true);
     harness.check(l.isShowing(), true);
@@ -241,5 +242,8 @@
     harness.check(c.isLightweight(), true);
     harness.check(a.isLightweight(), false);
     harness.check(l.isLightweight(), false);
+
+    // clean up the frame from desktop
+    f.dispose();
   }
 }

However the mentioned test uses its own implementation of EventQueue named DisabledEventQueue. This implementation
"eats" all events, including events sent by X Window system during disposing frame which means that the method
f.dispose() lock up (because the X Window can not cooperate with the frame in both directions).
As a result also DisableEventQueue class should be updated, which is quite easy because we only want to "eat" paint
events, not other events (and this class is not used by other test). Here's proposed fix:

--- mauve/gnu/testlet/java/awt/Container/DisabledEventQueue.java_old    2005-11-02 16:16:38.000000000 +0100
+++ mauve/gnu/testlet/java/awt/Container/DisabledEventQueue.java        2011-09-30 12:51:40.000000000 +0200
@@ -36,7 +36,14 @@
    */
   protected void dispatchEvent(AWTEvent ev)
   {
-    // Do nothing.
+    if (ev instanceof java.awt.event.PaintEvent)
+      {
+        // Do nothing.
+      }
+    else
+      {
+        super.dispatchEvent(ev);
+      }
   }

   /**
@@ -44,6 +51,13 @@
    */
   public void postEvent(AWTEvent ev)
   {
-    // Do nothing.
+    if (ev instanceof java.awt.event.PaintEvent)
+      {
+        // Do nothing.
+      }
+    else
+      {
+        super.postEvent(ev);
+      }
   }
 }

Can anybody please review this change? (it's been tested, of course ;)

Pavel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-09-30 12:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-30 12:57 RFC: fix for a test gnu/testlet/java/awt/Container/addImpl.java & its helper class gnu/testlet/java/awt/Container/DisabledEventQueue.java 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).