/* * Test method for 'java.awt.TextArea.minimumSize()' */ @SuppressWarnings("deprecation") public void testMinimumSize() { Dimension minSize = new Dimension(); assertEquals(minSize, area.minimumSize()); minSize.setSize(130, 160); area.setMinimumSize(minSize); assertNotSame(minSize, area.minimumSize()); assertEquals(minSize, area.minimumSize()); area.setMinimumSize(null); assertEquals(new Dimension(), area.minimumSize()); frame = new Frame(); frame.add(area); frame.addNotify(); assertEquals( "By default minimum size is set for 10 rows and 60 columns", area.minimumSize(10, 60), area.minimumSize()); int rows = 15; area.setRows(rows); assertEquals( "By default minimum size is set for 10 rows and 60 columns", area.minimumSize(10, 60), area.minimumSize()); int cols = 80; area.setColumns(cols); assertEquals(area.minimumSize(rows, cols), area.minimumSize()); }
/* * Test method for 'java.awt.TextArea.getMinimumSize(int, int)' */ public void testGetMinimumSizeIntInt() { int rows = 1; int cols = 1; Dimension minSize = new Dimension(); assertEquals(minSize, area.getMinimumSize(rows, cols)); minSize.setSize(12, 13); area.setMinimumSize(minSize); assertEquals(minSize, area.getMinimumSize(rows, cols)); area.setMinimumSize(null); assertEquals(new Dimension(), area.getMinimumSize(rows, cols)); frame = new Frame(); frame.add(area); frame.addNotify(); assertTrue(area.getMinimumSize(rows, cols).width > 0); assertTrue(area.getMinimumSize(rows, cols).height > 0); int dw = (area.getMinimumSize(rows, cols * 2).width - area.getMinimumSize(rows, cols).width); int dw1 = (area.getMinimumSize(rows, cols * 3).width - area.getMinimumSize(rows, cols * 2).width); assertEquals(dw, dw1); int dh = (area.getMinimumSize(rows * 2, cols).height - area.getMinimumSize(rows, cols).height); int dh1 = (area.getMinimumSize(rows * 3, cols).height - area.getMinimumSize(rows * 2, cols).height); assertEquals(dh1, dh); }
/* * Test method for 'java.awt.TextArea.getMinimumSize()' */ public void testGetMinimumSize() { Dimension minSize = new Dimension(); assertEquals(minSize, area.getMinimumSize()); minSize.setSize(13, 16); area.setMinimumSize(minSize); assertNotSame(minSize, area.getMinimumSize()); assertEquals(minSize, area.getMinimumSize()); area.setMinimumSize(null); assertEquals(new Dimension(), area.getMinimumSize()); frame = new Frame(); frame.add(area); frame.addNotify(); assertEquals( "By default minimum size is set for 10 rows and 60 columns", area.getMinimumSize(10, 60), area.getMinimumSize()); }