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]

Patch: additions to JFormattedTextField tests


I'm still working on this class and as I was working I added 3 more
tests to this file.

2005-12-02  Anthony Balkissoon  <abalkiss@redhat.com>

	*
gnu/testlet/javax/swing/JFormattedTextField/JFormattedTextFieldTests.java:
	Added 3 new tests to this file.

--Tony
? .TONYtemp.txt
? LineRemover.java
? temp.txt
Index: gnu/testlet/javax/swing/JFormattedTextField/JFormattedTextFieldTests.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JFormattedTextField/JFormattedTextFieldTests.java,v
retrieving revision 1.1
diff -u -r1.1 JFormattedTextFieldTests.java
--- gnu/testlet/javax/swing/JFormattedTextField/JFormattedTextFieldTests.java	30 Nov 2005 22:46:29 -0000	1.1
+++ gnu/testlet/javax/swing/JFormattedTextField/JFormattedTextFieldTests.java	2 Dec 2005 16:06:45 -0000
@@ -25,8 +25,12 @@
 
 import java.text.ParseException;
 
+import javax.swing.Action;
 import javax.swing.JFormattedTextField;
+import javax.swing.JTextField;
+import javax.swing.text.AbstractDocument;
 import javax.swing.text.DefaultFormatter;
+import javax.swing.text.DefaultFormatter.DefaultDocumentFilter;
 import javax.swing.text.DefaultFormatterFactory;
 import javax.swing.text.MaskFormatter;
 
@@ -36,7 +40,6 @@
  */
 public class JFormattedTextFieldTests implements Testlet
 {
-
   /**
    * Runs the test using the specified harness.
    * 
@@ -47,16 +50,19 @@
     JFormattedTextField field = new JFormattedTextField();
 
     harness.checkPoint ("defaults");
+    harness.check (((AbstractDocument)field.getDocument()).getDocumentFilter() == null);
     harness.check (field.getFormatterFactory() == null);
     harness.check (field.getFormatter() == null);
 
+
     harness.checkPoint ("implicit creation of formatter and factory");
     field.setValue("aBcDeFg");
+    harness.check (((AbstractDocument)field.getDocument()).getDocumentFilter() != null);
     harness.check (field.getFormatterFactory().getClass(), 
                    DefaultFormatterFactory.class);
     harness.check (field.getFormatter().getClass(), DefaultFormatter.class);
-
     
+
     harness.checkPoint ("setting formatter changes the text");
     MaskFormatter mask = null;
     DefaultFormatter nullFormatter = new DefaultFormatter();
@@ -75,7 +81,10 @@
 
     harness.checkPoint ("field value going to null brings in nullFormatter");
     field.setValue(null);
-    harness.check (field.getFormatter().getClass(), DefaultFormatter.class);
-    
+    harness.check (field.getFormatter().getClass(), DefaultFormatter.class);        
+
+    harness.checkPoint ("removing the DocumentFilter");
+    field.getFormatter().uninstall();
+    harness.check (((AbstractDocument)field.getDocument()).getDocumentFilter() == null);    
   }
 }

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