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]

new FileDialog and Dialog tests


Hey,

This patch  adds tests for java.awt.Dialog and java.awt.FileDialog.

Cheers,
Tania

2006-10-25  Tania Bento  <tbento@redhat.com>

        * gnu/testlet/java/awt/Dialog/defaultProperties.java: New test.
        * gnu/testlet/java/awt/FileDialog/defaultProperties.java: New
test.
        * gnu/testlet/java/awt/FileDialog/setFile.java: New test.

Index: gnu/testlet/java/awt/Dialog/defaultProperties.java
===================================================================
RCS file: gnu/testlet/java/awt/Dialog/defaultProperties.java
diff -N gnu/testlet/java/awt/Dialog/defaultProperties.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Dialog/defaultProperties.java	25 Oct 2006 18:42:56 -0000
@@ -0,0 +1,105 @@
+/* defaultProperties.java 
+   Copyright (C) 2006 Red Hat
+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: 1.4
+
+package gnu.testlet.java.awt.Dialog;
+
+import java.awt.Dialog;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class defaultProperties implements Testlet
+{
+
+  public void test(TestHarness harness)
+  {
+    // This test ensures that all properties are set
+    // to the default values.
+    Dialog dialog = new Dialog(new Frame());
+    harness.check(dialog.getAlignmentX(), 0.5);
+    harness.check(dialog.getAlignmentY(), 0.5);
+    harness.check(dialog.getComponentCount(), 0);
+    harness.check(dialog.getFocusableWindowState(), true);
+    harness.check(dialog.getFocusTraversalKeysEnabled(), true);
+    harness.check(dialog.getHeight(), 0);
+    harness.check(dialog.getIgnoreRepaint(), false);
+    harness.check(dialog.getWidth(), 0);
+    harness.check(dialog.getX(), 0);
+    harness.check(dialog.getY(), 0);
+    harness.check(dialog.getBackground(), null);
+    harness.check(dialog.getBounds(), new Rectangle());
+    harness.check(dialog.getDropTarget(), null);
+    harness.check(dialog.getFocusCycleRootAncestor(), null);
+    harness.check(dialog.getFocusOwner(), null);
+    harness.check(dialog.getFont(), null);
+    harness.check(dialog.getForeground(), null);
+    harness.check(dialog.getGraphics(), null);
+    harness.check(dialog.getInputMethodRequests(), null);
+    harness.check(dialog.getInsets(), new Insets(0, 0, 0, 0));
+    harness.check(dialog.getLayout().toString(), 
+                      "java.awt.BorderLayout[hgap=0,vgap=0]");
+    harness.check(dialog.getLocation(), new Point());
+    harness.check(dialog.getMaximumSize(),
+                       new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
+    harness.check(dialog.getMinimumSize(), new Dimension());
+    harness.check(dialog.getName(), "dialog0");
+    harness.check(dialog.getPreferredSize(), new Dimension());
+    harness.check(dialog.getSize(), new Dimension());
+    harness.check(dialog.getTitle(), "");
+    harness.check(dialog.getWarningString(), null);
+    
+    harness.check(dialog.isActive(), false);
+    harness.check(dialog.isAlwaysOnTop(), false);
+    harness.check(dialog.isBackgroundSet(), false);
+    harness.check(dialog.isCursorSet(), true);
+    harness.check(dialog.isDisplayable(), false);
+    harness.check(dialog.isDoubleBuffered(), false);
+    harness.check(dialog.isEnabled(), true);
+    harness.check(dialog.isFocusable(), true);
+    harness.check(dialog.isFocusableWindow(), true);
+    harness.check(dialog.isFocusCycleRoot(), true);
+    harness.check(dialog.isFocused(), false);
+    harness.check(dialog.isFocusOwner(), false);
+    harness.check(dialog.isFocusTraversalPolicyProvider(), false);
+    harness.check(dialog.isFocusTraversalPolicySet(), true);
+    harness.check(dialog.isFontSet(), false);
+    harness.check(dialog.isForegroundSet(), false);
+    harness.check(dialog.isLightweight(), false);
+    harness.check(dialog.isMaximumSizeSet(), false);
+    harness.check(dialog.isMinimumSizeSet(), false);
+    harness.check(dialog.isModal(), false);
+    harness.check(dialog.isOpaque(), false); // Currently fails on Classpath
+    harness.check(dialog.isPreferredSizeSet(), false);
+    harness.check(dialog.isResizable(), true);
+    harness.check(dialog.isShowing(), false);
+    harness.check(dialog.isUndecorated(), false);
+    harness.check(dialog.isValid(), false);
+    harness.check(dialog.isVisible(), false);
+  }
+  
+}
Index: gnu/testlet/java/awt/FileDialog/defaultProperties.java
===================================================================
RCS file: gnu/testlet/java/awt/FileDialog/defaultProperties.java
diff -N gnu/testlet/java/awt/FileDialog/defaultProperties.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/FileDialog/defaultProperties.java	25 Oct 2006 18:42:56 -0000
@@ -0,0 +1,105 @@
+/* defaultProperties.java
+   Copyright (C) 2006 Red Hat
+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: 1.4
+
+package gnu.testlet.java.awt.FileDialog;
+
+import java.awt.FileDialog;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Insets;
+import java.awt.Point;
+import java.awt.Rectangle;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class defaultProperties implements Testlet
+{
+
+  public void test(TestHarness harness)
+  {
+    // This test ensures that all properties are set
+    // to the default values.
+    FileDialog dialog = new FileDialog(new Frame());
+    harness.check(dialog.getAlignmentX(), 0.5);
+    harness.check(dialog.getAlignmentY(), 0.5);
+    harness.check(dialog.getComponentCount(), 0);
+    harness.check(dialog.getFocusableWindowState(), true);
+    harness.check(dialog.getFocusTraversalKeysEnabled(), true);
+    harness.check(dialog.getHeight(), 0);
+    harness.check(dialog.getIgnoreRepaint(), false);
+    harness.check(dialog.getWidth(), 0);
+    harness.check(dialog.getX(), 0);
+    harness.check(dialog.getY(), 0);
+    harness.check(dialog.getBackground(), null);
+    harness.check(dialog.getBounds(), new Rectangle());
+    harness.check(dialog.getDropTarget(), null);
+    harness.check(dialog.getFocusCycleRootAncestor(), null);
+    harness.check(dialog.getFocusOwner(), null);
+    harness.check(dialog.getFont(), null);
+    harness.check(dialog.getForeground(), null);
+    harness.check(dialog.getGraphics(), null);
+    harness.check(dialog.getInputMethodRequests(), null);
+    harness.check(dialog.getInsets(), new Insets(0, 0, 0, 0));
+    harness.check(dialog.getLayout(), null);
+    harness.check(dialog.getLocation(), new Point());
+    harness.check(dialog.getMaximumSize(), 
+                       new Dimension(32767, 32767));
+    harness.check(dialog.getMinimumSize(), new Dimension());
+    harness.check(dialog.getName(), "filedlg0");
+    harness.check(dialog.getPreferredSize(), new Dimension());
+    harness.check(dialog.getSize(), new Dimension());
+    harness.check(dialog.getTitle(), "");
+    harness.check(dialog.getWarningString(), null);
+    
+    harness.check(dialog.isActive(), false);
+    harness.check(dialog.isAlwaysOnTop(), false);
+    harness.check(dialog.isBackgroundSet(), false);
+    harness.check(dialog.isCursorSet(), true);
+    harness.check(dialog.isDisplayable(), false);
+    harness.check(dialog.isDoubleBuffered(), false);
+    harness.check(dialog.isEnabled(), true);
+    harness.check(dialog.isFocusable(), true);
+    harness.check(dialog.isFocusableWindow(), true);
+    harness.check(dialog.isFocusCycleRoot(), true);
+    harness.check(dialog.isFocused(), false);
+    harness.check(dialog.isFocusOwner(), false);
+    harness.check(dialog.isFocusTraversalPolicyProvider(), false);
+    harness.check(dialog.isFocusTraversalPolicySet(), true);
+    harness.check(dialog.isFontSet(), false);
+    harness.check(dialog.isForegroundSet(), false);
+    harness.check(dialog.isLightweight(), false);
+    harness.check(dialog.isMaximumSizeSet(), false);
+    harness.check(dialog.isMinimumSizeSet(), false);
+    harness.check(dialog.isModal(), true);
+    harness.check(dialog.isOpaque(), false); // Currently fails on Classpath
+    harness.check(dialog.isPreferredSizeSet(), false);
+    harness.check(dialog.isResizable(), true);
+    harness.check(dialog.isShowing(), false);
+    harness.check(dialog.isUndecorated(), false);
+    harness.check(dialog.isValid(), false);
+    harness.check(dialog.isVisible(), false);
+    
+  }
+
+}
Index: gnu/testlet/java/awt/FileDialog/setFile.java
===================================================================
RCS file: gnu/testlet/java/awt/FileDialog/setFile.java
diff -N gnu/testlet/java/awt/FileDialog/setFile.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/FileDialog/setFile.java	25 Oct 2006 18:42:56 -0000
@@ -0,0 +1,63 @@
+/* testSetFile.java 
+   Copyright (C) 2006 Red Hat
+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: 1.4
+
+package gnu.testlet.java.awt.FileDialog;
+
+import java.awt.FileDialog;
+import java.awt.Frame;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class setFile implements Testlet 
+{
+
+  public void test(TestHarness harness)
+  {
+    test1(harness);
+    test2(harness);
+    test3(harness);
+  }
+  
+  public void test1(TestHarness harness)
+  {
+    FileDialog fd = new FileDialog(new Frame());
+    fd.setFile("String");
+    harness.check(fd.getFile(), "String");
+  }
+  
+  public void test2(TestHarness harness)
+  {
+    FileDialog fd = new FileDialog(new Frame());
+    fd.setFile(null);
+    harness.check(fd.getFile(), null);
+  }
+  
+  public void test3(TestHarness harness)
+  {
+    FileDialog fd = new FileDialog(new Frame());
+    fd.setFile("");
+    harness.check(fd.getFile(), null);
+  }
+
+}

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