コード例 #1
0
  /*
   * Test method for 'java.awt.TextArea.getPreferredSize(int, int)'
   */
  public void testGetPreferredSizeIntInt() {
    int rows = 2;
    int cols = 3;
    Dimension prefSize = new Dimension();
    assertEquals(area.getMinimumSize(rows, cols), area.getPreferredSize(rows, cols));
    prefSize.setSize(12, 13);
    area.setPreferredSize(prefSize);
    assertEquals(prefSize, area.getPreferredSize(rows, cols));
    area.setPreferredSize(null);
    assertEquals(new Dimension(), area.getPreferredSize(rows, cols));
    frame = new Frame();
    frame.add(area);
    frame.addNotify();

    assertEquals(area.getMinimumSize(rows, cols), area.getPreferredSize(rows, cols));
  }
コード例 #2
0
 /*
  * Test method for 'java.awt.TextArea.getPreferredSize()'
  */
 public void testGetPreferredSize() {
   Dimension prefSize = new Dimension();
   assertEquals(prefSize, area.getPreferredSize());
   prefSize.setSize(4, 5);
   area.setPreferredSize(prefSize);
   assertNotSame(prefSize, area.getPreferredSize());
   assertEquals(prefSize, area.getPreferredSize());
   area.setPreferredSize(null);
   assertEquals(new Dimension(), area.getPreferredSize());
   frame = new Frame();
   frame.add(area);
   frame.addNotify();
   assertEquals(
       "By default preferred size is equal to minimum size",
       area.getMinimumSize(),
       area.getPreferredSize());
 }
コード例 #3
0
 /*
  * Test method for 'java.awt.TextArea.preferredSize(int, int)'
  */
 @SuppressWarnings("deprecation")
 public void testPreferredSizeIntInt() {
   frame = new Frame();
   frame.add(area);
   frame.addNotify();
   int rows = 10;
   int cols = 25;
   assertEquals(area.getPreferredSize(rows, cols), area.preferredSize(rows, cols));
 }