public inbox for mauve-patches@sourceware.org
 help / color / mirror / Atom feed
* FYI: Added test for JComponent.getPreferredSize()
@ 2005-12-15 17:46 Roman Kennke
  0 siblings, 0 replies; only message in thread
From: Roman Kennke @ 2005-12-15 17:46 UTC (permalink / raw)
  To: mauve-patches

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

I added a test for the JComponent.getPreferredSize() testsuite that
checks if it is possible to modify a JComponent's preferredSize setting
by modifying the returned Dimension object, or if this should be
protected.

2005-12-15  Roman Kennke  <kennke@aicas.com>

        * gnu/testlet/javax/swing/JComponent/getPreferredSize.java:
        Added test for changing the value of preferred size.

/Roman

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch; name="patch.diff", Size: 1246 bytes --]

Index: gnu/testlet/javax/swing/JComponent/getPreferredSize.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/javax/swing/JComponent/getPreferredSize.java,v
retrieving revision 1.1
diff -u -r1.1 getPreferredSize.java
--- gnu/testlet/javax/swing/JComponent/getPreferredSize.java	12 Dec 2005 13:13:20 -0000	1.1
+++ gnu/testlet/javax/swing/JComponent/getPreferredSize.java	15 Dec 2005 17:42:27 -0000
@@ -120,6 +120,7 @@
     testWithAll(harness);
 
     testSmallerThanMinSize(harness);
+    testChangeValue(harness);
   }
 
   /**
@@ -261,4 +262,21 @@
     c.setPreferredSize(new Dimension(50, 50));
     h.check(c.getPreferredSize(), new Dimension(50, 50));
   }
+
+  /**
+   * Tests if it is possible to change to actual setting or preferredSize by
+   * changing the values of the returned Dimension object.
+   *
+   * @param h the test harness
+   */
+  private void testChangeValue(TestHarness h)
+  {
+    h.checkPoint("changeValue");
+    TestComponent c = new TestComponent();
+    c.setPreferredSize(new Dimension(100, 100));
+    Dimension d = c.getPreferredSize();
+    d.width = 200;
+    d.height = 200;
+    h.check(c.getPreferredSize(), new Dimension(100, 100));
+  }
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-15 17:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-15 17:46 FYI: Added test for JComponent.getPreferredSize() Roman Kennke

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).