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]

Re: Don't pass null String to LayoutManager#addLayoutComponent(String, Component)


Hi James,

On Thu, 2006-01-19 at 11:42 -0500, James Damour wrote:
> Beware!!  I don't have a working mauve test suite so this patch is 
> completely untested!!!
>
> 2006-01-19  James Damour  <James.Damour@corp.request.com>
> 
> 	* java/awt/Container/addImpl.java
> 	(test): Added check for non-null String passed to addLayoutComponent.

Thanks, checked in as attached.
I'll also commit a fix to GNU Classpath for this.

BTW you can just run one test as follows:
jikes gnu/testlet/*.java gnu/testlet/java/awt/Container/addImpl.java
echo gnu.testlet.java.awt.Container.addImpl | jamvm gnu.testlet.SimpleTestHarness

cheers,

Mark
Index: gnu/testlet/java/awt/Container/addImpl.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/Container/addImpl.java,v
retrieving revision 1.1
diff -u -r1.1 addImpl.java
--- gnu/testlet/java/awt/Container/addImpl.java	2 Nov 2005 15:16:38 -0000	1.1
+++ gnu/testlet/java/awt/Container/addImpl.java	22 Jan 2006 20:12:01 -0000
@@ -22,6 +22,8 @@
 
 import java.awt.Component;
 import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.LayoutManager;
 import java.awt.Toolkit;
 import java.awt.event.ContainerEvent;
 import java.awt.event.ContainerListener;
@@ -95,6 +97,32 @@
     componentAddedCalled = false;
     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)
+	{
+	  boolean pass = (name != null);
+	  harness.check(pass, true);
+	}
+      });
+    two.add(new Component() {});
   }
 
 }

Attachment: signature.asc
Description: This is a digitally signed message part


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