private void createProject() { Values.SCREEN_HEIGHT = 20; Values.SCREEN_WIDTH = 20; ProjectManager projectManager = ProjectManager.getInstance(); Project project = new Project(null, UiTestUtils.DEFAULT_TEST_PROJECT_NAME); Sprite firstSprite = new Sprite("cat"); testScript = new StartScript(firstSprite); ArrayList<Brick> brickList = new ArrayList<Brick>(); brickList.add(new SpeakBrick(firstSprite, "ich bin der erste text")); brickList.add(new SpeakBrick(firstSprite, "und ich bin der zweite text")); for (Brick brick : brickList) { testScript.addBrick(brick); } firstSprite.addScript(testScript); project.addSprite(firstSprite); projectManager.setFileChecksumContainer(new FileChecksumContainer()); projectManager.setProject(project); projectManager.setCurrentSprite(firstSprite); projectManager.setCurrentScript(testScript); projectManager.setProject(project); StorageHandler.getInstance().saveProject(project); }
@Override public void setUp() throws Exception { super.setUp(); UiTestUtils.clearAllUtilTestProjects(); ProjectManager projectManager = ProjectManager.getInstance(); Project project = new Project(null, UiTestUtils.DEFAULT_TEST_PROJECT_NAME); Sprite firstSprite = new Sprite("cat"); Script testScript = new StartScript(firstSprite); SetCostumeBrick setCostumeBrick = new SetCostumeBrick(firstSprite); testScript.addBrick(setCostumeBrick); firstSprite.addScript(testScript); project.addSprite(firstSprite); projectManager.setProject(project); projectManager.setCurrentSprite(firstSprite); projectManager.setCurrentScript(testScript); costumeDataList = projectManager.getCurrentSprite().getCostumeDataList(); costumeFile = UiTestUtils.saveFileToProject( UiTestUtils.DEFAULT_TEST_PROJECT_NAME, "image.png", RESOURCE_COSTUME, getInstrumentation().getContext(), UiTestUtils.FileTypes.IMAGE); CostumeData costumeData = new CostumeData(); costumeData.setCostumeFilename(costumeFile.getName()); costumeData.setCostumeName(costumeName); costumeFile2 = UiTestUtils.saveFileToProject( UiTestUtils.DEFAULT_TEST_PROJECT_NAME, "image2.png", RESOURCE_COSTUME2, getInstrumentation().getContext(), UiTestUtils.FileTypes.IMAGE); CostumeData costumeData2 = new CostumeData(); costumeData2.setCostumeFilename(costumeFile2.getName()); costumeData2.setCostumeName(costumeName2); costumeDataList.add(costumeData); costumeDataList.add(costumeData2); ProjectManager.getInstance() .getFileChecksumContainer() .addChecksum(costumeData.getChecksum(), costumeData.getAbsolutePath()); ProjectManager.getInstance() .getFileChecksumContainer() .addChecksum(costumeData2.getChecksum(), costumeData2.getAbsolutePath()); solo = new Solo(getInstrumentation(), getActivity()); Intent intent = new Intent(getActivity(), ScriptTabActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); getActivity().startActivity(intent); }