Package com.google.gdt.eclipse.designer.smart.model

Examples of com.google.gdt.eclipse.designer.smart.model.CanvasInfo


            "    rootPanel.add(canvas, 10, 10);",
            "    canvas.setSize('250px', '200px');",
            "  }",
            "}");
    rootPanel.refresh();
    CanvasInfo canvas = rootPanel.getChildren(CanvasInfo.class).get(0);
    assertThat(canvas.getBounds()).isEqualTo(new Rectangle(10, 10, 250, 200));
  }
View Full Code Here


        "      rootPanel.add(button);",
        "    }",
        "  }",
        "}");
    refresh();
    CanvasInfo button = getJavaInfoByName("button");
    // assert that correct path to background image is used
    String elementString = button.getElement().toString();
    assertThat(elementString).contains("/myModuleName/sc/skins/");
  }
View Full Code Here

  /**
   * Test parse with Canvas.draw().
   */
  public void test_parse_draw() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test implements EntryPoint {",
            "  public void onModuleLoad() {",
            "    Canvas canvas = new Canvas();",
            "    canvas.setWidth(250);",
            "    canvas.setHeight(200);",
            "    canvas.draw();",
            "  }",
            "}"});
    canvas.refresh();
    assertThat(canvas.getBounds()).isEqualTo(new Rectangle(0, 0, 250, 200));
  }
View Full Code Here

  /**
   * Test parse 'this'.
   */
  public void test_parse_this() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(new String[]{
            "public class Test extends Canvas {",
            "  public Test() {",
            "    setWidth(250);",
            "    setHeight(200);",
            "  }",
            "}"});
    canvas.refresh();
    assertThat(canvas.getBounds()).isEqualTo(new Rectangle(0, 0, 250, 200));
  }
View Full Code Here

        "    }",
        "  }",
        "}");
    refresh();
    HTMLTableInfo grid = getJavaInfoByName("grid");
    CanvasInfo button = getJavaInfoByName("button");
    //
    IGridInfo gridInfo = grid.getGridInfo();
    assertEquals(new Rectangle(0, 0, 0, 0), gridInfo.getComponentCells(button));
  }
View Full Code Here

  /**
   * Test for {@link CanvasInfo#getWidgets()}.
   */
  public void test_getWidgets() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Button button_1 = new Button();",
            "      addChild(button_1);",
            "    }",
            "    {",
            "      Button button_2 = new Button();",
            "      addChild(button_2);",
            "    }",
            "  }",
            "}");
    canvas.refresh();
    CanvasInfo button_1 = getJavaInfoByName("button_1");
    CanvasInfo button_2 = getJavaInfoByName("button_2");
    assertThat(canvas.getWidgets()).containsExactly(button_1, button_2);
  }
View Full Code Here

  /**
   * Test for {@link CanvasInfo#isExactlyCanvas()}.
   */
  public void test_isExactlyCanvas() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Button button = new Button();",
            "      addChild(button);",
            "    }",
            "  }",
            "}");
    CanvasInfo button = getJavaInfoByName("button");
    assertTrue(canvas.isExactlyCanvas());
    assertFalse(button.isExactlyCanvas());
  }
View Full Code Here

  ////////////////////////////////////////////////////////////////////////////
  /**
   * In GWT2 we need to update absolute bounds on "2px" to reflect border of "RootPanel".
   */
  public void test_absoluteBounds_inGWT2() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    setBorder('1px solid red');",
            "  }",
            "}");
    canvas.refresh();
    // "red" border should be at (0,0)
    {
      Image image = canvas.getImage();
      RGB rgb = getPixelRGB(image, 0, 0);
      assertRGB(rgb, 0xFF, 0x00, 0x00);
    }
  }
View Full Code Here

      assertRGB(rgb, 0xFF, 0x00, 0x00);
    }
  }

  public void test_onCanvas_setLeft_setTop() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Button button = new Button('My Button');",
            "      button.setLeft(100);",
            "      button.setTop(50);",
            "      addChild(button);",
            "    }",
            "  }",
            "}");
    canvas.refresh();
    CanvasInfo button = getJavaInfoByName("button");
    // check that location applied
    Rectangle bounds = button.getBounds();
    assertThat(bounds.x).isEqualTo(100);
    assertThat(bounds.y).isEqualTo(50);
    assertThat(bounds.width).isEqualTo(BUTTON_WIDTH);
    assertThat(bounds.height).isEqualTo(BUTTON_HEIGHT);
  }
View Full Code Here

    assertThat(bounds.width).isEqualTo(BUTTON_WIDTH);
    assertThat(bounds.height).isEqualTo(BUTTON_HEIGHT);
  }

  public void test_onCanvas_moveTo() throws Exception {
    CanvasInfo canvas =
        parseJavaInfo(
            "public class Test extends Canvas {",
            "  public Test() {",
            "    {",
            "      Button button = new Button('My Button');",
            "      addChild(button);",
            "      button.moveTo(100, 50);",
            "    }",
            "  }",
            "}");
    canvas.refresh();
    CanvasInfo button = getJavaInfoByName("button");
    // check that location applied
    Rectangle bounds = button.getBounds();
    assertThat(bounds.x).isEqualTo(100);
    assertThat(bounds.y).isEqualTo(50);
    assertThat(bounds.width).isEqualTo(BUTTON_WIDTH);
    assertThat(bounds.height).isEqualTo(BUTTON_HEIGHT);
  }
View Full Code Here

TOP

Related Classes of com.google.gdt.eclipse.designer.smart.model.CanvasInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.