* FYI: New test for Component's invalidate()
@ 2006-07-13 16:04 Tania Bento
0 siblings, 0 replies; only message in thread
From: Tania Bento @ 2006-07-13 16:04 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 222 bytes --]
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.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 1488 bytes --]
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();
}
+
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-07-13 16:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-13 16:04 FYI: New test for Component's invalidate() Tania Bento
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).