This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
FYI: New ViewportLayout test
- From: "Roman Kennke" <kennke at aicas dot com>
- To: mauve-patches at sources dot redhat dot com
- Date: Mon, 12 Dec 2005 13:03:25 +0000
- Subject: FYI: New ViewportLayout test
- Bounce-to: "Roman Kennke" <kennke@aicas.com>
I committed the attached new test for the javax.swing.ViewportLayout.
2005-12-12 Roman Kennke <kennke@aicas.com>
* gnu/testlet/javax/swing/ViewportLayout/layoutContainer.java
New test for this layout manager.
/Roman
// Tags: JDK1.2
// Copyright (C) 2005 Roman Kennke <kennke@aicas.com>
// 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.ViewportLayout;
import java.awt.Dimension;
import javax.swing.JPanel;
import javax.swing.JViewport;
import javax.swing.ViewportLayout;
import gnu.testlet.TestHarness;
import gnu.testlet.Testlet;
/**
* Checks the functionality of the LayoutManager javax.swing.ViewportLayout.
*
* @author Roman Kennke (kennke@aicas.com)
*/
public class layoutContainer implements Testlet
{
/**
* Starts the test run.
*
* @param harness the test harness to use
*/
public void test(TestHarness harness)
{
test1(harness);
test2(harness);
test3(harness);
}
/**
* A simple test for the layout manager.
*
* @param h the test harness to use
*/
private void test1(TestHarness h)
{
JViewport vp = new JViewport();
ViewportLayout layout = (ViewportLayout) vp.getLayout();
JPanel view = new JPanel(){};
vp.setView(view);
view.setMinimumSize(new Dimension(100, 100));
view.setPreferredSize(new Dimension(200, 200));
view.setMaximumSize(new Dimension(300, 300));
vp.setSize(400, 400);
layout.layoutContainer(vp);
h.check(view.getSize(), vp.getSize());
}
/**
* Another simple test for the layout manager.
*
* @param h the test harness to use
*/
private void test2(TestHarness h)
{
JViewport vp = new JViewport();
ViewportLayout layout = (ViewportLayout) vp.getLayout();
JPanel view = new JPanel(){};
vp.setView(view);
view.setMinimumSize(new Dimension(100, 100));
view.setPreferredSize(new Dimension(200, 200));
view.setMaximumSize(new Dimension(300, 300));
vp.setSize(150, 150);
layout.layoutContainer(vp);
h.check(view.getSize(), view.getPreferredSize());
}
/**
* Another simple test for the layout manager.
*
* @param h the test harness to use
*/
private void test3(TestHarness h)
{
JViewport vp = new JViewport();
ViewportLayout layout = (ViewportLayout) vp.getLayout();
JPanel view = new JPanel(){};
vp.setView(view);
view.setMinimumSize(new Dimension(100, 100));
view.setPreferredSize(new Dimension(10, 10));
view.setMaximumSize(new Dimension(300, 300));
vp.setSize(50, 50);
layout.layoutContainer(vp);
h.check(view.getSize(), vp.getSize());
}
}