public void test2(TestHarness harness)
{
// Test getPreferredSize(int, int) method.
TextArea area = new TextArea();
// Show that if the values passed are <=, ==, >= or negative,
// then no exceptions are thrown.
harness.check(area.getSize(), new Dimension());
harness.check(area.getPreferredSize(6, 7), new Dimension());
harness.check(area.getPreferredSize(0, 0), new Dimension());
harness.check(area.getPreferredSize(-4, -7), new Dimension());
// Check that if preferred size not been set, then a
// Dimension with size (width, height) is returned.
harness.check(area.isPreferredSizeSet(), false);
area.setSize(new Dimension(3, 4));
harness.check(area.getPreferredSize(3, 2), new Dimension(3, 4));
// Check that if preferred size has been set, then a
// those values are returned.
area.setSize(new Dimension(-3, 5));
harness.check(area.getSize(), new Dimension(-3, 5));
area.setPreferredSize(new Dimension(1, 9));
harness.check(area.isPreferredSizeSet());
harness.check(area.getPreferredSize(-1, 1), new Dimension(1, 9));
}