@Override protected void tearDown() throws Exception { TestUtils.clearProject(currentProjectName); if (testImage != null && testImage.exists()) { testImage.delete(); } if (testSound != null && testSound.exists()) { testSound.delete(); } super.tearDown(); }
@Override protected void setUp() throws Exception { TestUtils.clearProject(currentProjectName); storageHandler = StorageHandler.getInstance(); Project testCopyFile = new Project(null, currentProjectName); testCopyFile.getXmlHeader().virtualScreenHeight = 1000; testCopyFile.getXmlHeader().virtualScreenWidth = 1000; projectManager = ProjectManager.getInstance(); storageHandler.saveProject(testCopyFile); projectManager.setProject(testCopyFile); final String imagePath = Constants.DEFAULT_ROOT + "/testImage.png"; testImage = new File(imagePath); if (!testImage.exists()) { testImage.createNewFile(); } InputStream in = getInstrumentation().getContext().getResources().openRawResource(IMAGE_FILE_ID); OutputStream out = new BufferedOutputStream(new FileOutputStream(testImage), Constants.BUFFER_8K); byte[] buffer = new byte[Constants.BUFFER_8K]; int length = 0; while ((length = in.read(buffer)) > 0) { out.write(buffer, 0, length); } in.close(); out.flush(); out.close(); final String soundPath = Constants.DEFAULT_ROOT + "/testsound.mp3"; testSound = new File(soundPath); if (!testSound.exists()) { testSound.createNewFile(); } in = getInstrumentation().getContext().getResources().openRawResource(R.raw.testsound); out = new BufferedOutputStream(new FileOutputStream(testSound), Constants.BUFFER_8K); buffer = new byte[Constants.BUFFER_8K]; length = 0; while ((length = in.read(buffer)) > 0) { out.write(buffer, 0, length); } in.close(); out.flush(); out.close(); }
@Override public void tearDown() throws Exception { TestUtils.clearProject(getContext().getString(R.string.default_project_name)); TestUtils.clearProject("testProject"); super.tearDown(); }
@Override public void tearDown() throws Exception { TestUtils.clearProject("testProject"); super.tearDown(); }