This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
New test for JTextArea
- From: Anthony Balkissoon <abalkiss at redhat dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Wed, 07 Dec 2005 14:25:37 -0500
- Subject: New test for JTextArea
There are 11 tests, classpath currently fails the first 7 and then
causes an unexpected exception.
2005-12-07 Anthony Balkissoon <abalkiss@redhat.com>
* gnu/testlet/javax/swing/JTextArea/preferredSize.java: New test.
--Tony
Index: gnu/testlet/javax/swing/JTextArea/preferredSize.java
===================================================================
RCS file: gnu/testlet/javax/swing/JTextArea/preferredSize.java
diff -N gnu/testlet/javax/swing/JTextArea/preferredSize.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gnu/testlet/javax/swing/JTextArea/preferredSize.java 7 Dec 2005 19:21:19 -0000
@@ -0,0 +1,70 @@
+//Tags: JDK1.2
+
+//Copyright (C) 2005 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.javax.swing.JTextArea;
+
+import javax.swing.JTextArea;
+import javax.swing.text.View;
+
+import gnu.testlet.TestHarness;
+import gnu.testlet.Testlet;
+
+public class preferredSize implements Testlet
+{
+ public static String markup =
+ "Questions are <font size=\"+1\" color=\"blue\">a burden</font> to others,\n" +
+ "answers <font size=\"+2\" color=\"red\">a prison</font> for oneself.";
+ public static JTextArea ta2 = new JTextArea(markup);
+
+ public void test(TestHarness harness)
+ {
+ View view = ta2.getUI().getRootView(ta2);
+ try
+ {
+ harness.check (view.getPreferredSpan(View.HORIZONTAL) >
+ view.getPreferredSpan(View.VERTICAL));
+ ta2.setText("");
+ harness.check (ta2.getPreferredSize().width == 0);
+ harness.check (view.getPreferredSpan(View.HORIZONTAL) == 0);
+ ta2.setText("\n\n\n\n\n\n\n\n\n");
+ harness.check (ta2.getPreferredSize().width == 0);
+ harness.check (view.getPreferredSpan(View.HORIZONTAL) == 0);
+
+ ta2.setLineWrap(true);
+ ta2.setWrapStyleWord(true);
+
+ harness.check (ta2.getPreferredSize().width == 100);
+ harness.check (view.getPreferredSpan(View.HORIZONTAL) == 100);
+ ta2.setText("");
+ harness.check (ta2.getPreferredSize().width == 100);
+ harness.check (view.getPreferredSpan(View.HORIZONTAL) == 100);
+ ta2.setText("\n\n\n\n\n\n\n\n\n");
+ harness.check (ta2.getPreferredSize().width == 100);
+ harness.check (view.getPreferredSpan(View.HORIZONTAL) == 100);
+ }
+ catch (Exception e)
+ {
+ // There shouldn't be an exception thrown. At the time of writing of
+ // this test case, GNU Classpath 0.19 + CVS does fall into this block.
+ harness.debug(e);
+ }
+ }
+}