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] |
I committed the attached test for JRootPane.RootLayout. 2006-01-30 Roman Kennke <kennke@aicas.com> * gnu/testlet/javax/swing/JRootPane/RootLayout/preferredLayoutSize.java: New test /Roman
Index: gnu/testlet/javax/swing/JRootPane/RootLayout/preferredLayoutSize.java =================================================================== RCS file: gnu/testlet/javax/swing/JRootPane/RootLayout/preferredLayoutSize.java diff -N gnu/testlet/javax/swing/JRootPane/RootLayout/preferredLayoutSize.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gnu/testlet/javax/swing/JRootPane/RootLayout/preferredLayoutSize.java 30 Jan 2006 21:08:01 -0000 1.1 @@ -0,0 +1,64 @@ +/* preferredLayoutSize.java -- FIXME: describe + Copyright (C) 2006 FIXME: your info here +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. + +*/ + +// Tags: FIXME + +package gnu.testlet.javax.swing.JRootPane.RootLayout; + +import java.awt.Dimension; +import java.awt.LayoutManager; + +import javax.swing.JPanel; +import javax.swing.JRootPane; + +import gnu.testlet.TestHarness; +import gnu.testlet.Testlet; + +public class preferredLayoutSize implements Testlet +{ + + public void test(TestHarness harness) + { + testInvalidLayout(harness); + } + + /** + * Tests the preferredLayoutSize() method when the layout is in an invalid + * state. In particular this tests if the preferredSize is cached or not. + * This is inspired by a bug where a JRootPane is asked for it's + * preferredSize (thus storing a cached value of it), then the contentPane + * changes (and so the parameters for calculating the preferredSize) and then + * it is asked again and then returns the incorrect cached value. + * + * @param h the test harness to use + */ + private void testInvalidLayout(TestHarness h) + { + JRootPane rp = new JRootPane(); + LayoutManager l = rp.getLayout(); + JPanel p = new JPanel(); + p.setPreferredSize(new Dimension(100, 100)); + rp.setContentPane(p); + h.check(l.preferredLayoutSize(rp), new Dimension(100, 100)); + p.setPreferredSize(new Dimension(200, 200)); + h.check(l.preferredLayoutSize(rp), new Dimension(200, 200)); + } +}
Attachment:
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |