This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: New DropTarget and DragSource tests
- From: Lillian Angel <langel at redhat dot com>
- To: mauve-patches <mauve-patches at sources dot redhat dot com>
- Date: Wed, 02 Aug 2006 16:00:46 -0400
- Subject: FYI: New DropTarget and DragSource tests
A bunch of new tests for DropTarget and DragSource classes.
2006-08-02 Lillian Angel <langel@redhat.com>
* gnu/testlet/java/awt/dnd/DragSource/Constructors.java,
*
gnu/testlet/java/awt/dnd/DragSource/CreateDragGestureRecognizerTest.java,
* gnu/testlet/java/awt/dnd/DragSource/FlavourMapTest.java,
* gnu/testlet/java/awt/dnd/DragSource/getDragThresholdTest.java,
*
gnu/testlet/java/awt/dnd/DragSource/isDragImageSupportedTest.java,
* gnu/testlet/java/awt/dnd/DropTarget/Constructors.java:
New tests.
Index: gnu/testlet/java/awt/dnd/DragSource/Constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/dnd/DragSource/Constructors.java
diff -N gnu/testlet/java/awt/dnd/DragSource/Constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/dnd/DragSource/Constructors.java 2 Aug 2006 19:57:53 -0000
@@ -0,0 +1,48 @@
+/* Constructors.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.
+
+*/
+
+package gnu.testlet.java.awt.dnd.DragSource;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.HeadlessException;
+import java.awt.dnd.DragSource;
+
+public class Constructors implements Testlet
+{
+
+ public void test(TestHarness h)
+ {
+ boolean caught = false;
+ try
+ {
+ DragSource ds = new DragSource();
+ h.check(!ds.equals(DragSource.getDefaultDragSource()));
+ }
+ catch (HeadlessException he)
+ {
+ caught = true;
+ }
+
+ h.check(!caught);
+ }
+}
Index: gnu/testlet/java/awt/dnd/DragSource/CreateDragGestureRecognizerTest.java
===================================================================
RCS file: gnu/testlet/java/awt/dnd/DragSource/CreateDragGestureRecognizerTest.java
diff -N gnu/testlet/java/awt/dnd/DragSource/CreateDragGestureRecognizerTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/dnd/DragSource/CreateDragGestureRecognizerTest.java 2 Aug 2006 19:57:53 -0000
@@ -0,0 +1,44 @@
+/* CreateDragGestureRecognizerTest.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.
+
+*/
+
+package gnu.testlet.java.awt.dnd.DragSource;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Label;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DragGestureRecognizer;
+import java.awt.dnd.DragSource;
+
+public class CreateDragGestureRecognizerTest implements Testlet
+{
+
+ public void test(TestHarness h)
+ {
+ DragSource ds = new DragSource();
+
+ DragGestureRecognizer dgr =
+ ds.createDefaultDragGestureRecognizer(
+ new Label("label"), DnDConstants.ACTION_COPY, null);
+ h.check(dgr != null);
+ }
+}
Index: gnu/testlet/java/awt/dnd/DragSource/FlavourMapTest.java
===================================================================
RCS file: gnu/testlet/java/awt/dnd/DragSource/FlavourMapTest.java
diff -N gnu/testlet/java/awt/dnd/DragSource/FlavourMapTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/dnd/DragSource/FlavourMapTest.java 2 Aug 2006 19:57:53 -0000
@@ -0,0 +1,38 @@
+/* FlavourMapTest.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.
+
+*/
+
+package gnu.testlet.java.awt.dnd.DragSource;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.datatransfer.SystemFlavorMap;
+import java.awt.dnd.DragSource;
+
+public class FlavourMapTest implements Testlet
+{
+
+ public void test(TestHarness h)
+ {
+ DragSource ds = new DragSource();
+ h.check((ds.getFlavorMap() instanceof SystemFlavorMap));
+ }
+}
Index: gnu/testlet/java/awt/dnd/DragSource/getDragThresholdTest.java
===================================================================
RCS file: gnu/testlet/java/awt/dnd/DragSource/getDragThresholdTest.java
diff -N gnu/testlet/java/awt/dnd/DragSource/getDragThresholdTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/dnd/DragSource/getDragThresholdTest.java 2 Aug 2006 19:57:53 -0000
@@ -0,0 +1,38 @@
+/* getDragThresholdTest.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: JDK 1.5
+
+package gnu.testlet.java.awt.dnd.DragSource;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.dnd.DragSource;
+
+public class getDragThresholdTest implements Testlet
+{
+
+ public void test(TestHarness h)
+ {
+ h.check(DragSource.getDragThreshold() == 8);
+ }
+}
Index: gnu/testlet/java/awt/dnd/DragSource/isDragImageSupportedTest.java
===================================================================
RCS file: gnu/testlet/java/awt/dnd/DragSource/isDragImageSupportedTest.java
diff -N gnu/testlet/java/awt/dnd/DragSource/isDragImageSupportedTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/dnd/DragSource/isDragImageSupportedTest.java 2 Aug 2006 19:57:53 -0000
@@ -0,0 +1,36 @@
+/* isDragImageSupportedTest.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.
+
+*/
+
+package gnu.testlet.java.awt.dnd.DragSource;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.dnd.DragSource;
+
+public class isDragImageSupportedTest implements Testlet
+{
+
+ public void test(TestHarness h)
+ {
+ h.check(!DragSource.isDragImageSupported());
+ }
+}
Index: gnu/testlet/java/awt/dnd/DropTarget/Constructors.java
===================================================================
RCS file: gnu/testlet/java/awt/dnd/DropTarget/Constructors.java
diff -N gnu/testlet/java/awt/dnd/DropTarget/Constructors.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/dnd/DropTarget/Constructors.java 2 Aug 2006 19:57:53 -0000
@@ -0,0 +1,232 @@
+/* Constructors.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.
+
+*/
+
+package gnu.testlet.java.awt.dnd.DropTarget;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Button;
+import java.awt.datatransfer.FlavorMap;
+import java.awt.datatransfer.SystemFlavorMap;
+import java.awt.dnd.DnDConstants;
+import java.awt.dnd.DropTarget;
+import java.util.TooManyListenersException;
+
+public class Constructors implements Testlet
+{
+ TestHarness h;
+ boolean caught = false;
+ DropTarget dt;
+ DropTarget oldDt;
+ FlavorMap fm;
+ Button b = new Button();
+
+ public void test(TestHarness harness)
+ {
+ h = harness;
+ testNoParam();
+ testTwoParams();
+ testThreeParams();
+ testFourParams();
+ testFiveParams();
+ }
+
+ public void testNoParam()
+ {
+ dt = new DropTarget();
+ oldDt = dt;
+ h.check(dt.getComponent() == null);
+ h.check(dt.getDefaultActions() == DnDConstants.ACTION_COPY_OR_MOVE);
+
+ try
+ {
+ dt.addDropTargetListener(null);
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = true;
+ }
+
+ h.check(!caught);
+ h.check(dt.isActive());
+
+ fm = dt.getFlavorMap();
+ h.check(fm != null);
+ h.check((fm instanceof SystemFlavorMap));
+
+ caught = false;
+ }
+
+ public void testTwoParams()
+ {
+ dt = new DropTarget(b, oldDt);
+ h.check(dt.getComponent().equals(b));
+ h.check(dt.getDefaultActions() == DnDConstants.ACTION_COPY_OR_MOVE);
+
+ try
+ {
+ dt.addDropTargetListener(dt);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ caught = true;
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = false;
+ }
+ h.check(caught);
+ caught = false;
+
+ try
+ {
+ dt.addDropTargetListener(oldDt);
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = true;
+ }
+ h.check(caught);
+ caught = false;
+
+ h.check(dt.isActive());
+
+ fm = dt.getFlavorMap();
+ h.check(fm != null);
+ h.check((fm instanceof SystemFlavorMap));
+ }
+
+ public void testThreeParams()
+ {
+ dt = new DropTarget(b, DnDConstants.ACTION_COPY_OR_MOVE, oldDt);
+ h.check(dt.getComponent().equals(b));
+ h.check(dt.getDefaultActions() == DnDConstants.ACTION_COPY_OR_MOVE);
+
+ try
+ {
+ dt.addDropTargetListener(dt);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ caught = true;
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = false;
+ }
+ h.check(caught);
+ caught = false;
+
+ try
+ {
+ dt.addDropTargetListener(oldDt);
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = true;
+ }
+ h.check(caught);
+ caught = false;
+
+ h.check(dt.isActive());
+
+ fm = dt.getFlavorMap();
+ h.check(fm != null);
+ h.check((fm instanceof SystemFlavorMap));
+ }
+
+ public void testFourParams()
+ {
+ dt = new DropTarget(b, DnDConstants.ACTION_COPY_OR_MOVE, oldDt, false);
+ h.check(dt.getComponent().equals(b));
+ h.check(dt.getDefaultActions() == DnDConstants.ACTION_COPY_OR_MOVE);
+
+ try
+ {
+ dt.addDropTargetListener(dt);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ caught = true;
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = false;
+ }
+ h.check(caught);
+ caught = false;
+
+ try
+ {
+ dt.addDropTargetListener(oldDt);
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = true;
+ }
+ h.check(caught);
+ caught = false;
+
+ h.check(!dt.isActive());
+
+ fm = dt.getFlavorMap();
+ h.check(fm != null);
+ h.check((fm instanceof SystemFlavorMap));
+ }
+
+ public void testFiveParams()
+ {
+ fm = SystemFlavorMap.getDefaultFlavorMap();
+ dt = new DropTarget(b, DnDConstants.ACTION_COPY_OR_MOVE, oldDt, false, fm);
+ h.check(dt.getComponent().equals(b));
+ h.check(dt.getDefaultActions() == DnDConstants.ACTION_COPY_OR_MOVE);
+
+ try
+ {
+ dt.addDropTargetListener(dt);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ caught = true;
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = false;
+ }
+ h.check(caught);
+ caught = false;
+
+ try
+ {
+ dt.addDropTargetListener(oldDt);
+ }
+ catch (TooManyListenersException tmle)
+ {
+ caught = true;
+ }
+ h.check(caught);
+ caught = false;
+
+ h.check(!dt.isActive());
+ h.check(dt.getFlavorMap().equals(fm));
+ }
+}