public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: New JLayeredPane test
@ 2006-02-01 10:45 Roman Kennke
  0 siblings, 0 replies; 3+ messages in thread
From: Roman Kennke @ 2006-02-01 10:45 UTC (permalink / raw)
  To: mauve-patches

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

I comitted this new test for JLayeredPane.addImpl which Classpath
currently fails. It checks the handling of the position argument within
a layer for position == 0 (top position in a layer).

2006-02-01  Roman Kennke  <kennke@aicas.com>

        * gnu/testlet/javax/swing/JLayeredPane/addImpl.java
        (testAddZeroPosition): New test.

/Roman

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

Index: gnu/testlet/javax/swing/JLayeredPane/addImpl.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JLayeredPane/addImpl.java,v
retrieving revision 1.2
diff -u -r1.2 addImpl.java
--- gnu/testlet/javax/swing/JLayeredPane/addImpl.java	30 Jan 2006 13:03:26 -0000	1.2
+++ gnu/testlet/javax/swing/JLayeredPane/addImpl.java	1 Feb 2006 10:19:01 -0000
@@ -46,6 +46,7 @@
   {
     testAddSameLayer(harness);
     testAddDifferentLayers(harness);
+    testAddZeroPosition(harness);
   }
 
   /**
@@ -87,4 +88,25 @@
     h.check(l.getComponent(1), p2);
     h.check(l.getComponent(2), p1);
   }
+
+  /**
+   * Tests the addition of 3 components into the same layer and with a position
+   * argument of 0. This should add each component as the top component in
+   * that layer.
+   *
+   * @param h the test harness to use
+   */
+  private void testAddZeroPosition(TestHarness h)
+  {
+    JLayeredPane l = new JLayeredPane();
+    JPanel p1 = new JPanel();
+    JPanel p2 = new JPanel();
+    JPanel p3 = new JPanel();
+    l.add(p1, JLayeredPane.FRAME_CONTENT_LAYER, 0);
+    l.add(p2, JLayeredPane.FRAME_CONTENT_LAYER, 0);
+    l.add(p3, JLayeredPane.FRAME_CONTENT_LAYER, 0);
+    h.check(l.getComponent(0), p3);
+    h.check(l.getComponent(1), p2);
+    h.check(l.getComponent(2), p1);
+  }
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* FYI: New JLayeredPane test
@ 2006-01-30 12:43 Roman Kennke
  0 siblings, 0 replies; 3+ messages in thread
From: Roman Kennke @ 2006-01-30 12:43 UTC (permalink / raw)
  To: mauve-patches

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

I committed this new test for JLayeredPane.addImpl.

2006-01-30  Roman Kennke  <kennke@aicas.com>

        * gnu/testlet/javax/swing/JLayeredPane/addImp.java
        New test.

/Roman

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

Index: gnu/testlet/javax/swing/JLayeredPane/addImpl.java
===================================================================
RCS file: gnu/testlet/javax/swing/JLayeredPane/addImpl.java
diff -N gnu/testlet/javax/swing/JLayeredPane/addImpl.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JLayeredPane/addImpl.java	30 Jan 2006 12:40:41 -0000
@@ -0,0 +1,69 @@
+/* addImpl.java -- Tests if addImpl in JLayeredPane works correctly
+   Copyright (C) 2006 Roman Kennke (kennke@aicas.com)
+This file is part of Mauve.
+
+Mauve is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+Mauve is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Mauve; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+*/
+
+// Tags: JDK1.2
+
+package gnu.testlet.javax.swing.JLayeredPane;
+
+import javax.swing.JLayeredPane;
+import javax.swing.JPanel;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+/**
+ * Tests if addImpl in JLayeredPane works correctly.
+ *
+ * @author Roman Kennke (kennke@aicas.com)
+ */
+public class addImpl implements Testlet
+{
+
+  /**
+   * The entry point of this test.
+   *
+   * @param harness the test harness to use
+   */
+  public void test(TestHarness harness)
+  {
+    testAddSameLayer(harness);
+  }
+
+  /**
+   * Tests the addition of components into the same layer with no position
+   * specified.
+   *
+   * @param h the test harness to use
+   */
+  private void testAddSameLayer(TestHarness h)
+  {
+    JLayeredPane l = new JLayeredPane();
+    JPanel p1 = new JPanel();
+    JPanel p2 = new JPanel();
+    JPanel p3 = new JPanel();
+    l.add(p1, JLayeredPane.FRAME_CONTENT_LAYER);
+    l.add(p2, JLayeredPane.FRAME_CONTENT_LAYER);
+    l.add(p3, JLayeredPane.FRAME_CONTENT_LAYER);
+    h.check(l.getComponent(0), p1);
+    h.check(l.getComponent(1), p2);
+    h.check(l.getComponent(2), p3);
+  }
+}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* FYI: New JLayeredPane test
@ 2005-11-08 12:14 Roman Kennke
  0 siblings, 0 replies; 3+ messages in thread
From: Roman Kennke @ 2005-11-08 12:14 UTC (permalink / raw)
  To: mauve-patches

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

Hi,

I committed the attached new test for JLayeredPane which shows a bug in
the current Classpath implementation (for which I'll check in a fix).

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

        * gnu/testlet/javax/swing/JLayeredPane/getComponentsInLayer.java:
        New test.

/Roman

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

//Tags: JDK1.2

//Copyright (C) 2005 Roman Kennke <kennke@aicas.com>

//This file is part of Mauve.

//Mauve is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2, or (at your option)
//any later version.

//Mauve is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with Mauve; see the file COPYING.  If not, write to
//the Free Software Foundation, 59 Temple Place - Suite 330,
//Boston, MA 02111-1307, USA.

package gnu.testlet.javax.swing.JLayeredPane;

import javax.swing.JLabel;
import javax.swing.JLayeredPane;

import gnu.testlet.TestHarness;
import gnu.testlet.Testlet;

/**
 * Checks if the method getComponentsInLayer works as expected.
 *
 * @author Roman Kennke (kennke@aicas.com)
 */
public class getComponentsInLayer implements Testlet
{

  /**
   * Starts the test run.
   *
   * @param harness the test harness to use
   */
  public void test(TestHarness harness)
  {
    testUnknownLayer(harness);
  }

  /**
   * Checks what this method returns for a layer that is not in the
   * JLayeredPane. The method should always return an empty Component[] for
   * all unknown layers (even with negative layer numbers).
   *
   * @param harness the test harness to use
   */
  private void testUnknownLayer(TestHarness harness)
  {
    harness.checkPoint("unknownLayer");
    JLayeredPane l = new JLayeredPane();
    // We add one component to layer 1 and one to layer 3 and check what
    // happens when we request the components in layer -1 (negative), 0
    // (positive and less then the minimum layer), 2 (between the layers),
    // 4 (greater than the maximum layer).
    JLabel l1 = new JLabel("Hello");
    l.setLayer(l1, 1);
    l.add(l1);
    JLabel l2 = new JLabel("World");
    l.setLayer(l2, 3);
    l.add(l2);
    harness.check(l.getComponentsInLayer(-1).length, 0);
    harness.check(l.getComponentsInLayer(-0).length, 0);
    harness.check(l.getComponentsInLayer(-2).length, 0);
    harness.check(l.getComponentsInLayer(-4).length, 0);
  }
}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-02-01 10:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-01 10:45 FYI: New JLayeredPane test Roman Kennke
  -- strict thread matches above, loose matches on Subject: below --
2006-01-30 12:43 Roman Kennke
2005-11-08 12:14 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).