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]

FYI: New test for Component's invalidate()


Hey,

I just added one more test for the invalidate() method in
Component.java.  

Cheers,
Tania

2006-07-13  Tania Bento  <tbento@redhat.com>

	* gnu/testlet/java/awt/Component/invalidate.java
	(test2): Added new test.


Index: gnu/testlet/java/awt/Component/invalidate.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/awt/Component/invalidate.java,v
retrieving revision 1.2
diff -u -r1.2 invalidate.java
--- gnu/testlet/java/awt/Component/invalidate.java	8 Nov 2005 11:43:15 -0000	1.2
+++ gnu/testlet/java/awt/Component/invalidate.java	13 Jul 2006 16:04:11 -0000
@@ -74,10 +74,19 @@
       super.invalidate();
     }
   }
+  
+  /**
+   * Subclass of Component to allow  test.
+   */
+  public class myComponent
+      extends Component
+  {
+  }
 
   public void test (TestHarness harness)
   {
     test1(harness);
+    test2(harness);
     testInvalidateInvalidComponent(harness);
   }
 
@@ -106,6 +115,22 @@
 
     frame.dispose();
   }
+  
+  private void test2(TestHarness harness)
+  {
+    myComponent c = new myComponent();
+    harness.check(c.isPreferredSizeSet(), false);
+    
+    c.setPreferredSize(new Dimension(400, 500));
+    Dimension prefSizeOld = c.getPreferredSize();
+    harness.check(c.isPreferredSizeSet(), true);
+    
+    c.invalidate();
+    harness.check(c.isPreferredSizeSet(), true);
+    Dimension prefSizeNew = c.getPreferredSize();
+    harness.check(prefSizeOld != prefSizeNew);
+    harness.check(prefSizeOld.equals(prefSizeNew));
+  }
 
   private void testInvalidateInvalidComponent(TestHarness harness)
   {
@@ -138,4 +163,5 @@
     harness.check(c2.invalidated, true);
     f.dispose();
   }
+
 }

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