コード例 #1
0
 @Test
 public void preferredSize() throws Exception {
   useFrame();
   panel.doLayout();
   assertEquals(58, panel.getWidth());
   assertEquals(14, panel.getHeight());
 }
コード例 #2
0
  @Test
  public void resizesTextWhenSizeChanges() throws Exception {
    panel.setText(
        "Some really long text so that there are multiple lines requiring layout when the size changes.",
        parent);
    panel.doLayout();

    int originalHeight = panel.getHeight();
    parent.setSize(400, 200);
    panel.doLayout();

    int newHeight = panel.getHeight();

    assertEquals(true, 200 - panel.getWidth() < 100);
    assertEquals(true, newHeight < originalHeight);
  }
コード例 #3
0
 @Test
 public void dimensionsWhenLastLineIsLongest() throws Exception {
   useFrame();
   panel.setText("1\n2\n3\nlongest", parent);
   panel.doLayout();
   assertEquals(true, panel.getWidth() >= 39 && panel.getWidth() <= 41);
   assertEquals(55, panel.getHeight());
 }
コード例 #4
0
 @Test
 public void preferredSizeWithBigFontSize() throws Exception {
   useFrame();
   style.setFontSize("40");
   panel.doLayout();
   assertEquals(80, panel.getWidth());
   assertEquals(138, panel.getHeight());
 }
コード例 #5
0
 @Test
 public void preferredSizeWithMoreText() throws Exception {
   useFrame();
   panel.setText(
       "Once upon a time, there was a developer working on a tool called Limelight.", parent);
   panel.doLayout();
   assertEquals(true, panel.getWidth() >= 97 && panel.getWidth() <= 99);
   assertEquals(69, panel.getHeight());
 }