コード例 #1
0
 @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();
 }
コード例 #2
0
  @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();
  }
コード例 #3
0
 @Override
 public void tearDown() throws Exception {
   TestUtils.clearProject(getContext().getString(R.string.default_project_name));
   TestUtils.clearProject("testProject");
   super.tearDown();
 }
コード例 #4
0
 @Override
 public void tearDown() throws Exception {
   TestUtils.clearProject("testProject");
   super.tearDown();
 }