This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: new tests for addImpl
- From: Lillian Angel <langel at redhat dot com>
- To: mauve-patches <mauve-patches at sources dot redhat dot com>
- Date: Wed, 15 Mar 2006 09:55:29 -0500
- Subject: FYI: new tests for addImpl
Added more tests to show that my Container.addImpl patch is correct.
repaint is not called on Sun when a component is added to a showing or
non-showing container. Right now, with my patch, it works the same.
2006-03-15 Lillian Angel <langel@redhat.com>
* gnu/testlet/java/awt/Container/addImpl.java
(test): Changed to call new functions.
(test1): Moved old test to new function.
(test2): New function to test if repaint is called when a
component is added to a showing component.
Index: gnu/testlet/java/awt/Container/addImpl.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/Container/addImpl.java,v
retrieving revision 1.3
diff -u -r1.3 addImpl.java
--- gnu/testlet/java/awt/Container/addImpl.java 14 Mar 2006 16:56:29 -0000 1.3
+++ gnu/testlet/java/awt/Container/addImpl.java 15 Mar 2006 14:52:06 -0000
@@ -20,17 +20,20 @@
package gnu.testlet.java.awt.Container;
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Label;
import java.awt.LayoutManager;
+import java.awt.Panel;
import java.awt.Toolkit;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
-import gnu.testlet.TestHarness;
-import gnu.testlet.Testlet;
-
/**
* This checks tests if the addImpl method notfies container listeners when
* a container is not showing and if the notification is sent over the event
@@ -85,6 +88,12 @@
*/
public void test(TestHarness harness)
{
+ test1(harness);
+ test2(harness);
+ }
+
+ public void test1(TestHarness harness)
+ {
// We disable the event queue so we can check if this event is delivered
// via the event queue or not.
Toolkit.getDefaultToolkit().getSystemEventQueue().push(new DisabledEventQueue());
@@ -108,14 +117,35 @@
// Pre-condition check.
harness.check(c.isShowing(), false);
componentAddedCalled = false;
- c.add(new Component()
+
+ Component a = new Component()
{
- });
+ };
+
+ Component b = new Component()
+ {
+ };
+
+ c.add(a);
harness.check(componentAddedCalled, true);
-
+
// check that LayoutManager.addLayoutComponent() is called
// with non-null name.
- Container two = new Container();
+ Container two = new Container()
+ {
+ TestHarness harness = transfer;
+
+ public void repaint()
+ {
+ harness.fail("repaint has been called.");
+ }
+
+ public void repaint(long tm, int x, int y, int w, int h)
+ {
+ harness.fail("repaint has been called.");
+ }
+ };
+
two.setLayout(new LayoutManager()
{
TestHarness harness = transfer;
@@ -146,9 +176,36 @@
harness.check(pass, true);
}
});
- two.add(new Component()
+ harness.check(two.isShowing(), false);
+ componentAddedCalled = false;
+ two.addContainerListener(new TestContainerListener());
+ two.add(b);
+ harness.check(componentAddedCalled, true);
+ }
+
+ public void test2(TestHarness harness)
+ {
+ Frame f = new Frame();
+ final TestHarness transfer = harness;
+ Panel a = new Panel()
{
- });
+ TestHarness harness = transfer;
+
+ public void repaint()
+ {
+ harness.fail("repaint has been called.");
+ }
+
+ public void repaint(long tm, int x, int y, int w, int h)
+ {
+ harness.fail("repaint has been called.");
+ }
+ };
+
+ f.add(a);
+ f.show();
+
+ a.add(new Label("AAA"));
+ harness.check(a.isShowing(), true);
}
-
}