示例#1
0
  public void testDeleteScript() {
    UiTestUtils.addNewBrick(solo, R.string.brick_broadcast_receive);

    solo.sleep(500);
    UiTestUtils.dragFloatingBrick(solo, 0);
    solo.sleep(500);

    int numberOfScripts = ProjectManager.getInstance().getCurrentSprite().getNumberOfScripts();
    assertEquals("Incorrect number of scripts in list", 2, numberOfScripts);

    solo.waitForText(solo.getString(R.string.brick_when_started));
    solo.clickOnText(solo.getString(R.string.brick_when_started));
    solo.waitForText(solo.getString(R.string.brick_context_dialog_delete_script));
    solo.clickOnText(solo.getString(R.string.brick_context_dialog_delete_script));

    solo.waitForText(solo.getString(R.string.yes));
    solo.clickOnButton(solo.getString(R.string.yes));
    solo.waitForText(solo.getString(R.string.brick_broadcast_receive));

    numberOfScripts = ProjectManager.getInstance().getCurrentSprite().getNumberOfScripts();
    assertEquals("Incorrect number of scripts in scriptList", 1, numberOfScripts);
    assertEquals(
        "Incorrect number of elements in listView",
        3,
        UiTestUtils.getScriptListView(solo).getChildCount());

    solo.waitForText(solo.getString(R.string.brick_broadcast_receive));
    solo.clickOnText(solo.getString(R.string.brick_broadcast_receive));
    solo.waitForText(solo.getString(R.string.brick_context_dialog_delete_script));
    solo.clickOnText(solo.getString(R.string.brick_context_dialog_delete_script));
    solo.waitForText(solo.getString(R.string.yes));
    solo.clickOnButton(solo.getString(R.string.yes));
    solo.waitForText(solo.getString(R.string.brick_when_started));

    numberOfScripts = ProjectManager.getInstance().getCurrentSprite().getNumberOfScripts();
    assertEquals("Incorrect number of scripts in list", 0, numberOfScripts);
    assertEquals(
        "Incorrect number of elements in listView",
        0,
        UiTestUtils.getScriptListView(solo).getChildCount());

    UiTestUtils.addNewBrick(solo, R.string.brick_hide);

    solo.sleep(500);
    UiTestUtils.dragFloatingBrickDownwards(solo);
    solo.sleep(500);

    solo.waitForText(solo.getString(R.string.brick_when_started));

    numberOfScripts = ProjectManager.getInstance().getCurrentSprite().getNumberOfScripts();
    assertEquals("Incorrect number of scripts in scriptList", 1, numberOfScripts);
    assertEquals(
        "Incorrect number of elements in listView",
        2,
        UiTestUtils.getScriptListView(solo).getChildCount());
  }
示例#2
0
  public void testAddLooksCategoryBrick() {
    String brickSetLookText = solo.getString(R.string.brick_set_look);
    UiTestUtils.addNewBrick(solo, R.string.brick_set_look);

    solo.sleep(500);
    UiTestUtils.dragFloatingBrickDownwards(solo);
    solo.sleep(500);

    assertTrue("Set look brick was not added", solo.searchText(brickSetLookText));

    UiTestUtils.addNewBrick(solo, R.string.brick_set_size_to);

    solo.sleep(500);
    UiTestUtils.dragFloatingBrickDownwards(solo);
    solo.sleep(500);

    assertTrue(
        "Set size to brick was not added",
        solo.searchText(solo.getString(R.string.brick_set_size_to)));
  }