public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: New BoxLayout test
@ 2005-11-04 11:05 Roman Kennke
  0 siblings, 0 replies; only message in thread
From: Roman Kennke @ 2005-11-04 11:05 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 269 bytes --]

I added a new test to the BoxLayout testsuite which covers an overflow
case that I have here.

2005-11-04  Roman Kennke  <kennke@aicas.com>

        * gnu/testlet/javax/swing/BoxLayout/layoutContainer.java: Added
new
        test for overflow case.


/Roman

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: BoxLayout.diff --]
[-- Type: text/x-patch; name="BoxLayout.diff", Size: 1639 bytes --]

Index: javax/swing/BoxLayout.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/BoxLayout.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- javax/swing/BoxLayout.java	24 Oct 2005 08:59:54 -0000	1.24
+++ javax/swing/BoxLayout.java	2 Nov 2005 11:47:57 -0000	1.25
@@ -141,6 +141,9 @@
    */
   public BoxLayout(Container container, int way)
   {
+    if (way != X_AXIS && way != Y_AXIS && way != LINE_AXIS && way != PAGE_AXIS)
+      throw new AWTError("Invalid axis");
+
     int width = 0;
     int height = 0;
     this.container = container;
@@ -216,7 +219,9 @@
           throw new AWTError("BoxLayout can't be shared");
 
         checkTotalRequirements();
-        return new Dimension(xTotal.minimum, yTotal.minimum);
+        Insets i = container.getInsets();
+        return new Dimension(xTotal.minimum + i.left + i.right,
+                             yTotal.minimum + i.top + i.bottom);
       }
   }
 
@@ -297,6 +302,9 @@
    */
   public void invalidateLayout(Container parent)
   {
+    if (container != parent)
+      throw new AWTError("BoxLayout can't be shared");
+
     synchronized (container.getTreeLock())
       {
         xChildren = null;
@@ -326,7 +334,9 @@
           throw new AWTError("BoxLayout can't be shared");
 
         checkTotalRequirements();
-        return new Dimension(xTotal.maximum, yTotal.maximum);
+        Insets i = container.getInsets();
+        return new Dimension(xTotal.maximum + i.left + i.right,
+                             yTotal.maximum + i.top + i.bottom);
       }
   }
 

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

only message in thread, other threads:[~2005-11-04 11:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-04 11:05 FYI: New BoxLayout test Roman Kennke

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).