This is the mail archive of the mauve-patches@sourceware.org mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: Container addImpl additional checks


Added checks. Repaint should not be called when a component is added to
a Container.

2006-03-14  Lillian Angel  <langel@redhat.com>

        * gnu/testlet/java/awt/Container/addImpl.java
        (test): Formatted function and added repaint functions
        to override repaint in Container. Added fails to these 
	functions, they should not be called.

Index: gnu/testlet/java/awt/Container/addImpl.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/Container/addImpl.java,v
retrieving revision 1.2
diff -u -r1.2 addImpl.java
--- gnu/testlet/java/awt/Container/addImpl.java	22 Jan 2006 20:14:40 -0000	1.2
+++ gnu/testlet/java/awt/Container/addImpl.java	14 Mar 2006 16:54:43 -0000
@@ -87,42 +87,68 @@
   {
     // 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());
+    Toolkit.getDefaultToolkit().getSystemEventQueue().push(new DisabledEventQueue());
 
-    Container c = new Container();
+    final TestHarness transfer = harness;
+    Container c = 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.");
+      }
+    };
     c.addContainerListener(new TestContainerListener());
     // Pre-condition check.
     harness.check(c.isShowing(), false);
     componentAddedCalled = false;
-    c.add(new Component(){});
+    c.add(new Component()
+    {
+    });
     harness.check(componentAddedCalled, true);
 
     // check that LayoutManager.addLayoutComponent() is called
     // with non-null name.
     Container two = new Container();
-    final TestHarness transfer = harness;
     two.setLayout(new LayoutManager()
+    {
+      TestHarness harness = transfer;
+
+      Dimension size = new Dimension();
+
+      public void removeLayoutComponent(Component comp)
+      {
+      }
+
+      public java.awt.Dimension preferredLayoutSize(Container cont)
+      {
+        return size;
+      }
+
+      public Dimension minimumLayoutSize(Container cont)
+      {
+        return size;
+      }
+
+      public void layoutContainer(Container container)
+      {
+      }
+
+      public void addLayoutComponent(String name, Component comp)
       {
-	TestHarness harness = transfer;
-	Dimension size = new Dimension();
-	public void removeLayoutComponent(Component comp) {}
-	public java.awt.Dimension preferredLayoutSize(Container cont)
-	{
-	  return size;
-	}
-	public Dimension minimumLayoutSize(Container cont)
-	{
-	  return size;
-	}
-	public void layoutContainer(Container container) {}
-	public void addLayoutComponent(String name, Component comp)
-	{
-	  boolean pass = (name != null);
-	  harness.check(pass, true);
-	}
-      });
-    two.add(new Component() {});
+        boolean pass = (name != null);
+        harness.check(pass, true);
+      }
+    });
+    two.add(new Component()
+    {
+    });
   }
 
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]