From: David Gilbert <david.gilbert@object-refinery.com>
To: mauve-patches <mauve-patches@sources.redhat.com>
Subject: FYI: Component.setComponentOrientation() and Container.applyComponentOrientation() tests
Date: Tue, 27 Jun 2006 09:42:00 -0000 [thread overview]
Message-ID: <44A0FD68.5030700@object-refinery.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
This patch (committed) adds a couple of new tests for the Component and
Container classes:
2006-06-27 David Gilbert <david.gilbert@object-refinery.com>
* gnu/testlet/java/awt/Component/setComponentOrientation.java:
New test,
* gnu/testlet/java/awt/Container/applyComponentOrientation.java:
New test.
Some of the checks currently fail in GNU Classpath.
Regards,
Dave
[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 9014 bytes --]
Index: gnu/testlet/java/awt/Component/setComponentOrientation.java
===================================================================
RCS file: gnu/testlet/java/awt/Component/setComponentOrientation.java
diff -N gnu/testlet/java/awt/Component/setComponentOrientation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Component/setComponentOrientation.java 27 Jun 2006 09:35:41 -0000
@@ -0,0 +1,76 @@
+/* setComponentOrientation.java -- some checks for the
+ setComponentOrientation() method in the Component 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.4
+
+package gnu.testlet.java.awt.Component;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.Label;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+public class setComponentOrientation implements Testlet, PropertyChangeListener
+{
+ List events = new java.util.ArrayList();
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ events.add(e);
+ }
+
+ public void test(TestHarness harness)
+ {
+ Component c = new Label("ABC");
+ harness.check(c.getComponentOrientation(), ComponentOrientation.UNKNOWN);
+ c.addPropertyChangeListener(this);
+ c.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(c.getComponentOrientation(), ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(events.size(), 1);
+ PropertyChangeEvent e = (PropertyChangeEvent) events.get(0);
+ harness.check(e.getSource(), c);
+ harness.check(e.getPropertyName(), "componentOrientation");
+ harness.check(e.getOldValue(), ComponentOrientation.UNKNOWN);
+ harness.check(e.getNewValue(), ComponentOrientation.LEFT_TO_RIGHT);
+
+ // setting the same value again generates no event
+ events.clear();
+ c.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(events.size(), 0);
+
+ // try null
+ c.setComponentOrientation(null);
+ harness.check(c.getComponentOrientation(), null);
+ harness.check(events.size(), 1);
+ e = (PropertyChangeEvent) events.get(0);
+ harness.check(e.getSource(), c);
+ harness.check(e.getPropertyName(), "componentOrientation");
+ harness.check(e.getOldValue(), ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(e.getNewValue(), null);
+ }
+
+}
Index: gnu/testlet/java/awt/Container/applyComponentOrientation.java
===================================================================
RCS file: gnu/testlet/java/awt/Container/applyComponentOrientation.java
diff -N gnu/testlet/java/awt/Container/applyComponentOrientation.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/java/awt/Container/applyComponentOrientation.java 27 Jun 2006 09:35:41 -0000
@@ -0,0 +1,138 @@
+/* applyComponentOrientation.java -- some checks for the
+ applyComponentOrientation() method in the Container 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.4
+
+package gnu.testlet.java.awt.Container;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+import java.awt.ComponentOrientation;
+import java.awt.Container;
+import java.awt.Label;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.List;
+
+public class applyComponentOrientation
+ implements Testlet, PropertyChangeListener
+{
+ List events = new java.util.ArrayList();
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ events.add(e);
+ }
+
+ public void test(TestHarness harness)
+ {
+ Container c = new Container();
+ Label l1 = new Label("ABC");
+ Container c1 = new Container();
+ Label l2 = new Label("DEF");
+ Container c2 = new Container();
+ Label l3 = new Label("GHI");
+ c.add(l1);
+ c.add(c1);
+ c1.add(l2);
+ c1.add(c2);
+ c2.add(l3);
+ harness.check(c.getComponentOrientation(), ComponentOrientation.UNKNOWN);
+ harness.check(c1.getComponentOrientation(), ComponentOrientation.UNKNOWN);
+ harness.check(c2.getComponentOrientation(), ComponentOrientation.UNKNOWN);
+ harness.check(l1.getComponentOrientation(), ComponentOrientation.UNKNOWN);
+ harness.check(l2.getComponentOrientation(), ComponentOrientation.UNKNOWN);
+ harness.check(l3.getComponentOrientation(), ComponentOrientation.UNKNOWN);
+
+ c.addPropertyChangeListener(this);
+ c1.addPropertyChangeListener(this);
+ c2.addPropertyChangeListener(this);
+ l1.addPropertyChangeListener(this);
+ l2.addPropertyChangeListener(this);
+ l3.addPropertyChangeListener(this);
+ c.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(c.getComponentOrientation(),
+ ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(c1.getComponentOrientation(),
+ ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(c2.getComponentOrientation(),
+ ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(l1.getComponentOrientation(),
+ ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(l2.getComponentOrientation(),
+ ComponentOrientation.LEFT_TO_RIGHT);
+ harness.check(l3.getComponentOrientation(),
+ ComponentOrientation.LEFT_TO_RIGHT);
+
+ harness.check(events.size(), 6);
+ PropertyChangeEvent e0 = (PropertyChangeEvent) events.get(0);
+ harness.check(e0.getSource(), c);
+ harness.check(e0.getPropertyName(), "componentOrientation");
+ harness.check(e0.getOldValue(), ComponentOrientation.UNKNOWN);
+ harness.check(e0.getNewValue(), ComponentOrientation.LEFT_TO_RIGHT);
+
+ PropertyChangeEvent e1 = (PropertyChangeEvent) events.get(1);
+ harness.check(e1.getSource(), l1);
+ harness.check(e1.getPropertyName(), "componentOrientation");
+ harness.check(e1.getOldValue(), ComponentOrientation.UNKNOWN);
+ harness.check(e1.getNewValue(), ComponentOrientation.LEFT_TO_RIGHT);
+
+ PropertyChangeEvent e2 = (PropertyChangeEvent) events.get(2);
+ harness.check(e2.getSource(), c1);
+ harness.check(e2.getPropertyName(), "componentOrientation");
+ harness.check(e2.getOldValue(), ComponentOrientation.UNKNOWN);
+ harness.check(e2.getNewValue(), ComponentOrientation.LEFT_TO_RIGHT);
+
+ PropertyChangeEvent e3 = (PropertyChangeEvent) events.get(3);
+ harness.check(e3.getSource(), l2);
+ harness.check(e3.getPropertyName(), "componentOrientation");
+ harness.check(e3.getOldValue(), ComponentOrientation.UNKNOWN);
+ harness.check(e3.getNewValue(), ComponentOrientation.LEFT_TO_RIGHT);
+
+ PropertyChangeEvent e4 = (PropertyChangeEvent) events.get(4);
+ harness.check(e4.getSource(), c2);
+ harness.check(e4.getPropertyName(), "componentOrientation");
+ harness.check(e4.getOldValue(), ComponentOrientation.UNKNOWN);
+ harness.check(e4.getNewValue(), ComponentOrientation.LEFT_TO_RIGHT);
+
+ PropertyChangeEvent e5 = (PropertyChangeEvent) events.get(5);
+ harness.check(e5.getSource(), l3);
+ harness.check(e5.getPropertyName(), "componentOrientation");
+ harness.check(e5.getOldValue(), ComponentOrientation.UNKNOWN);
+ harness.check(e5.getNewValue(), ComponentOrientation.LEFT_TO_RIGHT);
+
+ // try null
+ boolean pass = false;
+ try
+ {
+ c.applyComponentOrientation(null);
+ }
+ catch (NullPointerException e)
+ {
+ pass = true;
+ }
+ harness.check(pass);
+
+ }
+
+}
reply other threads:[~2006-06-27 9:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44A0FD68.5030700@object-refinery.com \
--to=david.gilbert@object-refinery.com \
--cc=mauve-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).