예제 #1
0
  @Device
  public void testVariableBricks() {
    Spinner setVariableSpinner = solo.getCurrentViews(Spinner.class).get(0);
    Spinner changeVariableSpinner = solo.getCurrentViews(Spinner.class).get(1);

    solo.clickOnView(setVariableSpinner);
    solo.clickOnText("p2");
    solo.clickOnView(changeVariableSpinner);
    solo.clickOnText("p2", 1);

    //		UiTestUtils.testBrickWithFormulaEditor(solo, 0, 1, 50, "variable_formula",
    // setVariableBrick);
    solo.clickOnText("0");
    UiTestUtils.insertIntegerIntoEditText(solo, 50);
    solo.goBack();

    //		UiTestUtils.testBrickWithFormulaEditor(solo, 0, 1, -8, "variable_formula",
    // changeVariableBrick);
    solo.clickOnText("1");
    UiTestUtils.insertDoubleIntoEditText(solo, -8.0);
    solo.goBack();

    solo.waitForView(solo.getView(R.id.button_play));
    UiTestUtils.clickOnBottomBar(solo, R.id.button_play);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(1500);

    assertEquals(
        "Variable has the wrong value after stage",
        42.0,
        userVariablesContainer.getUserVariable("p2", sprite).getValue());
  }
예제 #2
0
 @Override
 public void setUp() throws Exception {
   super.setUp();
   createProject();
   UiTestUtils.prepareStageForTest();
   UiTestUtils.getIntoSpritesFromMainMenu(solo);
   UiTestUtils.clickOnBottomBar(solo, R.id.button_play);
 }
예제 #3
0
  public void testSelectLookAndPlay() {
    assertTrue(lookName + " is not selected in Spinner", solo.isSpinnerTextSelected(lookName));

    UiTestUtils.clickOnBottomBar(solo, R.id.button_play);

    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(1000);
    Look look = ProjectManager.getInstance().getCurrentProject().getSpriteList().get(0).look;
    assertEquals("look not set", look.getImagePath(), lookDataList.get(0).getAbsolutePath());
    solo.goBack();
    solo.goBack();
    solo.waitForActivity(ScriptActivity.class.getSimpleName());

    solo.clickOnText(lookName);
    solo.clickOnText(lookName2);
    assertTrue(lookName2 + " is not selected in Spinner", solo.searchText(lookName2));

    UiTestUtils.clickOnBottomBar(solo, R.id.button_play);

    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.sleep(1000);
    look = ProjectManager.getInstance().getCurrentProject().getSpriteList().get(0).look;
    assertEquals("look not set", look.getImagePath(), lookDataList.get(1).getAbsolutePath());
  }
예제 #4
0
 public void selectLook(String newLook, String oldName, String lookImagePath) {
   solo.clickOnText(oldName);
   solo.clickOnText(newLook);
   UiTestUtils.clickOnBottomBar(solo, R.id.button_play);
   solo.sleep(5000);
   solo.waitForActivity(StageActivity.class.getSimpleName());
   solo.sleep(2000);
   String lookPath = ProjectManager.getInstance().getCurrentSprite().look.getImagePath();
   assertEquals(
       "Wrong image shown in stage --> Problem with Adapter update in Script",
       lookImagePath,
       lookPath);
   solo.goBack();
   solo.goBack();
 }
예제 #5
0
  public void testAdapterUpdateInScriptActivity() {
    String look1ImagePath = lookDataList.get(0).getAbsolutePath();
    String look2ImagePath = lookDataList.get(1).getAbsolutePath();
    assertTrue(lookName + " is not selected in Spinner", solo.isSpinnerTextSelected(lookName));

    UiTestUtils.clickOnBottomBar(solo, R.id.button_play);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    String lookPath =
        ProjectManager.getInstance().getCurrentSprite().getLookDataList().get(0).getAbsolutePath();
    assertEquals(
        "Wrong image shown in stage --> Problem with Adapter update in Script",
        look1ImagePath,
        lookPath);
    solo.goBack();
    solo.goBack();

    for (int i = 0; i < 5; ++i) {
      selectLook(lookName2, lookName, look2ImagePath);
      selectLook(lookName, lookName2, look1ImagePath);
    }
  }
  public void testPlayButton() {
    solo.assertMemoryNotLow();
    solo.waitForActivity(MainMenuActivity.class.getSimpleName());
    UiTestUtils.getIntoProgramMenuFromMainMenu(solo, 0);

    assertTrue(
        "Bottombar is not visible", solo.getView(R.id.button_play).getVisibility() == View.VISIBLE);
    assertTrue(
        "Play button is not visible",
        solo.getView(R.id.button_play).getVisibility() == View.VISIBLE);
    assertTrue(
        "Add button is not visible", solo.getView(R.id.button_add).getVisibility() == View.GONE);
    assertTrue(
        "Bottombar separator is not visible",
        solo.getView(R.id.bottom_bar_separator).getVisibility() == View.GONE);

    UiTestUtils.clickOnBottomBar(solo, R.id.button_play);
    solo.waitForActivity(StageActivity.class.getSimpleName());
    solo.assertCurrentActivity("Not in StageActivity", StageActivity.class);
    solo.goBack();
    solo.goBack();
    solo.waitForActivity(ProgramMenuActivity.class.getSimpleName());
    solo.assertCurrentActivity("Not in ProgramMenuActivity", ProgramMenuActivity.class);
  }