diff -rPNu mauve/gnu/testlet/javax/swing/SpringLayout/Unconstrained.java mauve-roman/gnu/testlet/javax/swing/SpringLayout/Unconstrained.java --- mauve/gnu/testlet/javax/swing/SpringLayout/Unconstrained.java 1970-01-01 01:00:00.000000000 +0100 +++ mauve-roman/gnu/testlet/javax/swing/SpringLayout/Unconstrained.java 2004-06-04 09:51:26.000000000 +0200 @@ -0,0 +1,92 @@ +// Tags: JDK1.4 + +// Copyright (C) 2004 Roman Kennke + +// 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, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +package gnu.testlet.javax.swing.SpringLayout; + +import gnu.testlet.Testlet; +import gnu.testlet.TestHarness; +import java.awt.*; +import javax.swing.*; + +/** + * Tests the layout of unconstrained components. + * + */ +public class Unconstrained implements Testlet +{ + + + public void test(TestHarness harness) + { + + System.err.println("test called"); + Container con = new Container(); + TestComponent comp = new TestComponent(); + comp.setMinimumSize(new Dimension(10, 10)); + comp.setPreferredSize(new Dimension(20, 20)); + comp.setMaximumSize(new Dimension(30, 30)); + + SpringLayout layout = new SpringLayout(); + con.setLayout(layout); + con.add(comp); + layout.layoutContainer(con); + + int width = comp.getSize().width; + int height = comp.getSize().height; + int x = comp.getLocation().x; + int y = comp.getLocation().y; + + harness.check(x, con.getInsets().left); + harness.check(y, con.getInsets().top); + harness.check(width, 20); + harness.check(height, 20); + + return; + } + + class TestComponent extends Component + { + + private Dimension maxSize, prefSize, minSize; + + public void setMaximumSize(Dimension size) + { + maxSize = size; + } + + public Dimension getMaximumSize() + { + return maxSize; + } + + public void setPreferredSize(Dimension size) + { + prefSize = size; + } + + public Dimension getPreferredSize() + { + return prefSize; + } + + public void setMinimumSize(Dimension size) + { + minSize = size; + } + + public Dimension getMinimumSize() + { + return minSize; + } + + } +}