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]

FYI: JInternalFrame - new tests


This patch (committed) adds some new tests for the JInternalFrame class:

2006-05-31 David Gilbert <david.gilbert@object-refinery.com>

   * gnu/testlet/javax/swing/JInternalFrame/constructors.java: New file,
   * gnu/testlet/javax/swing/JInternalFrame/dispose.java: New file,
   * gnu/testlet/javax/swing/JInternalFrame/getDesktopIcon.java: New file,
   * gnu/testlet/javax/swing/JInternalFrame/getNormalBounds.java:
   New file,
   * gnu/testlet/javax/swing/JInternalFrame/isIconifiable.java: New file,
   * gnu/testlet/javax/swing/JInternalFrame/isResizable.java: New file,
   * gnu/testlet/javax/swing/JInternalFrame/MyJInternalFrame.java:
   New file,
   * gnu/testlet/javax/swing/JInternalFrame/paramString.java: New file,
   * gnu/testlet/javax/swing/JInternalFrame/setDefaultCloseOperation.java:
   New file,
   * gnu/testlet/javax/swing/JInternalFrame/setDesktopIcon.java: New file,
   * gnu/testlet/javax/swing/JInternalFrame/setFrameIcon.java: New file,
   * gnu/testlet/javax/swing/JInternalFrame/setNormalBounds.java:
   New file,
   * gnu/testlet/javax/swing/JInternalFrame/setTitle.java: New file.

Regards,

Dave
Index: gnu/testlet/javax/swing/JInternalFrame/MyJInternalFrame.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/MyJInternalFrame.java
diff -N gnu/testlet/javax/swing/JInternalFrame/MyJInternalFrame.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/MyJInternalFrame.java	31 May 2006 13:13:37 -0000
@@ -0,0 +1,40 @@
+/* MyJInternalFrame.java -- provides access to protected stuff in 
+       JInternalFrame, for testing purposes.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import javax.swing.JInternalFrame;
+
+public class MyJInternalFrame extends JInternalFrame
+{
+  public MyJInternalFrame(String title)
+  {
+    super(title);
+  }
+  
+  public String paramString() 
+  {
+    return super.paramString();
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/constructors.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/constructors.java
diff -N gnu/testlet/javax/swing/JInternalFrame/constructors.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/constructors.java	31 May 2006 13:13:37 -0000
@@ -0,0 +1,155 @@
+/* constructors.java -- some checks for the constructors in the JInternalFrame
+       class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+
+public class constructors implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    testConstructor1(harness);
+    testConstructor2(harness);
+    testConstructor3(harness);
+    testConstructor4(harness);
+    testConstructor5(harness);
+    testConstructor6(harness);
+  }
+  
+  private void testConstructor1(TestHarness harness)
+  {
+    harness.checkPoint("()");
+    JInternalFrame f = new JInternalFrame();
+    harness.check(f.getTitle(), "");
+    harness.check(f.getDesktopPane(), null);
+    harness.check(f.getDefaultCloseOperation(), 
+            JInternalFrame.DISPOSE_ON_CLOSE);
+    harness.check(f.getLayer(), JLayeredPane.DEFAULT_LAYER.intValue());
+    harness.check(!f.isResizable());
+    harness.check(!f.isClosable());
+    harness.check(!f.isMaximizable());
+    harness.check(!f.isIconifiable());
+    f.putClientProperty(JLayeredPane.LAYER_PROPERTY, 
+            JLayeredPane.PALETTE_LAYER);
+    harness.check(f.getLayer(), JLayeredPane.PALETTE_LAYER.intValue());
+    harness.check(f.getClientProperty(JLayeredPane.LAYER_PROPERTY), 
+            JLayeredPane.PALETTE_LAYER);
+  }
+
+  private void testConstructor2(TestHarness harness)
+  {
+    harness.checkPoint("(String)");
+    JInternalFrame f = new JInternalFrame("Title");
+    harness.check(f.getTitle(), "Title");
+    harness.check(f.getDesktopPane(), null);
+    harness.check(f.getDefaultCloseOperation(), 
+            JInternalFrame.DISPOSE_ON_CLOSE);
+    harness.check(f.getLayer(), JLayeredPane.DEFAULT_LAYER.intValue());
+    harness.check(!f.isResizable());
+    harness.check(!f.isClosable());
+    harness.check(!f.isMaximizable());
+    harness.check(!f.isIconifiable());
+    
+    f = new JInternalFrame(null);
+    harness.check(f.getTitle(), null);
+  }
+
+  private void testConstructor3(TestHarness harness)
+  {
+    harness.checkPoint("(String, boolean)");
+    JInternalFrame f = new JInternalFrame("Title", true);
+    harness.check(f.getTitle(), "Title");
+    harness.check(f.getDesktopPane(), null);
+    harness.check(f.getDefaultCloseOperation(), 
+            JInternalFrame.DISPOSE_ON_CLOSE);
+    harness.check(f.getLayer(), JLayeredPane.DEFAULT_LAYER.intValue());
+    harness.check(f.isResizable());
+    harness.check(!f.isClosable());
+    harness.check(!f.isMaximizable());
+    harness.check(!f.isIconifiable());
+
+    f = new JInternalFrame(null, false);
+    harness.check(f.getTitle(), null);
+  }
+
+  private void testConstructor4(TestHarness harness)
+  {
+    harness.checkPoint("(String, boolean, boolean)");
+    JInternalFrame f = new JInternalFrame("Title", false, true);
+    harness.check(f.getTitle(), "Title");
+    harness.check(f.getDesktopPane(), null);
+    harness.check(f.getDefaultCloseOperation(), 
+            JInternalFrame.DISPOSE_ON_CLOSE);
+    harness.check(f.getLayer(), JLayeredPane.DEFAULT_LAYER.intValue());
+    harness.check(!f.isResizable());
+    harness.check(f.isClosable());
+    harness.check(!f.isMaximizable());
+    harness.check(!f.isIconifiable());
+
+    f = new JInternalFrame(null, false, false);
+    harness.check(f.getTitle(), null);
+  }
+
+  private void testConstructor5(TestHarness harness)
+  {
+    harness.checkPoint("(String, boolean, boolean, boolean)");
+    JInternalFrame f = new JInternalFrame("Title", false, false, true);
+    harness.check(f.getTitle(), "Title");
+    harness.check(f.getDesktopPane(), null);
+    harness.check(f.getDefaultCloseOperation(), 
+            JInternalFrame.DISPOSE_ON_CLOSE);
+    harness.check(f.getLayer(), JLayeredPane.DEFAULT_LAYER.intValue());
+    harness.check(!f.isResizable());
+    harness.check(!f.isClosable());
+    harness.check(f.isMaximizable());
+    harness.check(!f.isIconifiable());
+
+    f = new JInternalFrame(null, false, false, false);
+    harness.check(f.getTitle(), null);
+  }
+
+  private void testConstructor6(TestHarness harness)
+  {
+    harness.checkPoint("(String, boolean, boolean, boolean, boolean)");
+    JInternalFrame f = new JInternalFrame("Title", false, false, false, true);
+    harness.check(f.getTitle(), "Title");
+    harness.check(f.getDesktopPane(), null);
+    harness.check(f.getDefaultCloseOperation(), 
+            JInternalFrame.DISPOSE_ON_CLOSE);
+    harness.check(f.getLayer(), JLayeredPane.DEFAULT_LAYER.intValue());
+    harness.check(!f.isResizable());
+    harness.check(!f.isClosable());
+    harness.check(!f.isMaximizable());
+    harness.check(f.isIconifiable());
+
+    f = new JInternalFrame(null, false, false, false, false);
+    harness.check(f.getTitle(), null);
+  }
+
+}
Index: gnu/testlet/javax/swing/JInternalFrame/dispose.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/dispose.java
diff -N gnu/testlet/javax/swing/JInternalFrame/dispose.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/dispose.java	31 May 2006 13:13:37 -0000
@@ -0,0 +1,81 @@
+/* dispose.java -- some checks for the dispose() method in the 
+       JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.util.List;
+
+import javax.swing.JInternalFrame;
+import javax.swing.event.InternalFrameEvent;
+import javax.swing.event.InternalFrameListener;
+
+public class dispose implements Testlet, InternalFrameListener
+{
+  List events = new java.util.ArrayList();
+  
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("F1");
+    f.addInternalFrameListener(this);
+    f.dispose();
+    harness.check(f.isClosed());
+    harness.check(!f.isSelected());
+    harness.check(!f.isVisible());
+    harness.check(events.size(), 1);
+    InternalFrameEvent event = (InternalFrameEvent) events.get(0);
+    harness.check(event.getSource(), f);
+    harness.check(event.getID(), InternalFrameEvent.INTERNAL_FRAME_CLOSED);
+  }
+
+  public void internalFrameActivated(InternalFrameEvent event) {
+    events.add(event);
+  }
+
+  public void internalFrameClosed(InternalFrameEvent event) {
+    events.add(event);
+  }
+
+  public void internalFrameClosing(InternalFrameEvent event) {
+    events.add(event);
+  }
+
+  public void internalFrameDeactivated(InternalFrameEvent event) {
+    events.add(event);
+  }
+
+  public void internalFrameDeiconified(InternalFrameEvent event) {
+    events.add(event);
+  }
+
+  public void internalFrameIconified(InternalFrameEvent event) {
+    events.add(event);
+  }
+
+  public void internalFrameOpened(InternalFrameEvent event) {
+    events.add(event);
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/getDesktopIcon.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/getDesktopIcon.java
diff -N gnu/testlet/javax/swing/JInternalFrame/getDesktopIcon.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/getDesktopIcon.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,45 @@
+/* getDesktopIcon.java -- some checks for the getDesktopIcon() method in 
+       the JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JInternalFrame.JDesktopIcon;
+
+public class getDesktopIcon implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("Title");
+    JDesktopIcon icon = new JDesktopIcon(f);
+    f.setDesktopIcon(icon);
+    harness.check(f.getDesktopIcon(), icon);
+
+    f.setDesktopIcon(null);
+    harness.check(f.getDesktopIcon(), null);
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/getNormalBounds.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/getNormalBounds.java
diff -N gnu/testlet/javax/swing/JInternalFrame/getNormalBounds.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/getNormalBounds.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,45 @@
+/* getNormalBounds.java -- some checks for the getNormalBounds() method in
+       the JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Rectangle;
+
+import javax.swing.JInternalFrame;
+
+public class getNormalBounds implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("Title");
+    f.setBounds(2, 4, 6, 8);
+    harness.check(f.getNormalBounds(), new Rectangle(2, 4, 6, 8));
+    f.setNormalBounds(new Rectangle(1, 2, 3, 4));
+    harness.check(f.getNormalBounds(), new Rectangle(1, 2, 3, 4));
+    harness.check(f.getBounds(), new Rectangle(2, 4, 6, 8));
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/isIconifiable.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/isIconifiable.java
diff -N gnu/testlet/javax/swing/JInternalFrame/isIconifiable.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/isIconifiable.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,42 @@
+/* isIconifiable.java -- some checks for the isIconifiable() method in the
+       JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JInternalFrame;
+
+public class isIconifiable implements Testlet
+{
+  
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("F1");
+    harness.check(!f.isIconifiable());
+    f.setIconifiable(true);
+    harness.check(f.isIconifiable());
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/isResizable.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/isResizable.java
diff -N gnu/testlet/javax/swing/JInternalFrame/isResizable.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/isResizable.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,42 @@
+/* isResizable.java -- some checks for the isResizable() method in the
+       JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import javax.swing.JInternalFrame;
+
+public class isResizable implements Testlet
+{
+  
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("F1");
+    harness.check(!f.isResizable());
+    f.setResizable(true);
+    harness.check(f.isResizable());
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/paramString.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/paramString.java
diff -N gnu/testlet/javax/swing/JInternalFrame/paramString.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/paramString.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,41 @@
+/* paramString.java -- some checks for the paramString() method in the
+       JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+/**
+ * The paramString() method is allowed to return any non-null string,
+ * but we check for a match with the reference implementation anyway.
+ */
+public class paramString implements Testlet
+{
+  public void test(TestHarness harness)
+  {
+    MyJInternalFrame f = new MyJInternalFrame("F1");
+    harness.check(f.paramString().endsWith(",title=F1"));
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setDefaultCloseOperation.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setDefaultCloseOperation.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setDefaultCloseOperation.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setDefaultCloseOperation.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,59 @@
+/* setDefaultCloseOperation.java -- some checks for the 
+       setDefaultCloseOperation() method in the JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JInternalFrame;
+
+public class setDefaultCloseOperation 
+  implements Testlet, PropertyChangeListener
+{
+    
+  PropertyChangeEvent lastEvent;
+  
+  public void propertyChange(PropertyChangeEvent event)
+  {
+    lastEvent = event;
+  }
+  
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("F1");
+    f.addPropertyChangeListener(this);
+    harness.check(f.getDefaultCloseOperation(), 
+            JInternalFrame.DISPOSE_ON_CLOSE);
+    f.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE);
+    harness.check(f.getDefaultCloseOperation(), 
+            JInternalFrame.DO_NOTHING_ON_CLOSE);
+    harness.check(lastEvent, null);
+    f.setDefaultCloseOperation(-999);
+    harness.check(f.getDefaultCloseOperation(), -999);
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setDesktopIcon.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setDesktopIcon.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setDesktopIcon.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setDesktopIcon.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,70 @@
+/* setDesktopIcon.java -- some checks for the setDesktopIcon() method in the
+       JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JInternalFrame.JDesktopIcon;
+
+public class setDesktopIcon implements Testlet, PropertyChangeListener
+{
+  PropertyChangeEvent lastEvent;
+  
+  public void propertyChange(PropertyChangeEvent event)
+  {
+    lastEvent = event;
+  }
+  
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("Title");
+    f.addPropertyChangeListener(this);
+    JDesktopIcon icon = new JDesktopIcon(f);
+    f.setDesktopIcon(icon);
+    harness.check(f.getDesktopIcon(), icon);
+    harness.check(lastEvent.getPropertyName(), "desktopIcon");
+    harness.check(lastEvent.getSource(), f);
+    harness.check(lastEvent.getNewValue(), icon);
+    harness.check(lastEvent.getOldValue() != null);
+    
+    lastEvent = null;
+    f.setDesktopIcon(null);
+    harness.check(f.getDesktopIcon(), null);
+    harness.check(lastEvent.getPropertyName(), "desktopIcon");
+    harness.check(lastEvent.getSource(), f);
+    harness.check(lastEvent.getNewValue(), null);
+    harness.check(lastEvent.getOldValue(), icon);
+    
+    JInternalFrame f2 = new JInternalFrame("F2");
+    JDesktopIcon icon2 = new JDesktopIcon(f2);
+    f.setDesktopIcon(icon);
+    harness.check(icon2.getInternalFrame(), f2);
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setFrameIcon.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setFrameIcon.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setFrameIcon.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setFrameIcon.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,68 @@
+/* setFrameIcon.java -- some checks for the setFrameIcon() method in the
+       JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.Icon;
+import javax.swing.JInternalFrame;
+import javax.swing.plaf.metal.MetalIconFactory;
+
+public class setFrameIcon implements Testlet, PropertyChangeListener
+{
+  PropertyChangeEvent lastEvent;
+  
+  public void propertyChange(PropertyChangeEvent event)
+  {
+    lastEvent = event;
+  }
+  
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("Title");
+    f.addPropertyChangeListener(this);
+    Icon icon = MetalIconFactory.getHorizontalSliderThumbIcon();
+    f.setFrameIcon(icon);
+    harness.check(f.getFrameIcon(), icon);
+    harness.check(lastEvent.getPropertyName(), 
+            JInternalFrame.FRAME_ICON_PROPERTY);
+    harness.check(lastEvent.getSource(), f);
+    harness.check(lastEvent.getNewValue(), icon);
+    harness.check(lastEvent.getOldValue() != null);
+    
+    lastEvent = null;
+    f.setFrameIcon(null);
+    harness.check(f.getFrameIcon(), null);
+    harness.check(lastEvent.getPropertyName(), 
+            JInternalFrame.FRAME_ICON_PROPERTY);
+    harness.check(lastEvent.getSource(), f);
+    harness.check(lastEvent.getNewValue(), null);
+    harness.check(lastEvent.getOldValue(), icon);
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setNormalBounds.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setNormalBounds.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setNormalBounds.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setNormalBounds.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,66 @@
+/* setNormalBounds.java -- some checks for the setNormalBounds() method
+       in the JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JDesktopPane;
+import javax.swing.JInternalFrame;
+
+public class setNormalBounds implements Testlet, PropertyChangeListener
+{
+  PropertyChangeEvent lastEvent;
+  
+  public void propertyChange(PropertyChangeEvent event)
+  {
+    lastEvent = event;
+  }
+  public void test(TestHarness harness)
+  {
+    JDesktopPane desktop = new JDesktopPane();
+    JInternalFrame f = new JInternalFrame("Title");
+    desktop.add(f);
+    f.addPropertyChangeListener(this);
+    harness.check(f.getNormalBounds(), new Rectangle());
+    f.setBounds(4, 3, 2, 1);
+    harness.check(f.getNormalBounds(), new Rectangle(4, 3, 2, 1));
+    
+    Rectangle normalBounds = new Rectangle(1, 2, 3, 4);
+    f.setNormalBounds(normalBounds);
+    harness.check(f.getNormalBounds(), new Rectangle(1, 2, 3, 4));
+    harness.check(f.getNormalBounds() == normalBounds);
+    harness.check(f.getBounds(), new Rectangle(4, 3, 2, 1));
+    harness.check(lastEvent, null);
+    
+    // after setting to null, getNormalBounds() reverts to the component bounds
+    f.setNormalBounds(null);
+    harness.check(f.getNormalBounds(), new Rectangle(4, 3, 2, 1));
+  }
+}
Index: gnu/testlet/javax/swing/JInternalFrame/setTitle.java
===================================================================
RCS file: gnu/testlet/javax/swing/JInternalFrame/setTitle.java
diff -N gnu/testlet/javax/swing/JInternalFrame/setTitle.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JInternalFrame/setTitle.java	31 May 2006 13:13:38 -0000
@@ -0,0 +1,78 @@
+/* setTitle.java -- some checks for the setTitle() method in the 
+       JInternalFrame class.
+   Copyright (C) 2006 David Gilbert <david.gilbert@object-refinery.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.JInternalFrame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.swing.JInternalFrame;
+
+public class setTitle implements Testlet, PropertyChangeListener
+{
+  PropertyChangeEvent lastEvent;
+  
+  public void propertyChange(PropertyChangeEvent e)
+  {
+    lastEvent = e;
+  }
+  
+  public void test(TestHarness harness)
+  {
+    JInternalFrame f = new JInternalFrame("F1");
+    f.addPropertyChangeListener(this);
+    f.setTitle("F2");
+    harness.check(f.getTitle(), "F2");
+    harness.check(lastEvent.getPropertyName(), "title");
+    harness.check(lastEvent.getSource(), f);
+    harness.check(lastEvent.getOldValue(), "F1");
+    harness.check(lastEvent.getNewValue(), "F2");
+    
+    lastEvent = null;
+    f.setTitle(null);
+    harness.check(f.getTitle(), null);
+    harness.check(lastEvent.getPropertyName(), "title");
+    harness.check(lastEvent.getSource(), f);
+    harness.check(lastEvent.getOldValue(), "F2");
+    harness.check(lastEvent.getNewValue(), null);
+    
+    // setting null again generates no event
+    lastEvent = null;
+    f.setTitle(null);
+    harness.check(lastEvent.getPropertyName(), "title");
+    harness.check(lastEvent.getSource(), f);
+    harness.check(lastEvent.getOldValue(), null);
+    harness.check(lastEvent.getNewValue(), null);
+    
+    f.setTitle("F3");
+    harness.check(f.getTitle(), "F3");
+    harness.check(lastEvent.getPropertyName(), "title");
+    harness.check(lastEvent.getSource(), f);
+    harness.check(lastEvent.getOldValue(), null);
+    harness.check(lastEvent.getNewValue(), "F3");    
+  }
+}

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