Fix AvatarPhotoControllerTest.
This fixes a test issue with internalCropUsedIfNoSystemCropperFound. A bitmap must be created or the internal cropping will fail. This wasn't picked up before because files from previous tests were not being cleared properly - this also corrects that behaviour. Bug: 223498130 Test: atest AvatarPhotoControllerTest Change-Id: I3b550e94bea5894f984122bce420144355ea1cb4
This commit is contained in:
parent
af4514e549
commit
046d339d78
@ -89,6 +89,10 @@ public class AvatarPhotoControllerTest {
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
String[] entries = mImagesDir.list();
|
||||
for (String entry : entries) {
|
||||
new File(mImagesDir, entry).delete();
|
||||
}
|
||||
mImagesDir.delete();
|
||||
}
|
||||
|
||||
@ -233,7 +237,8 @@ public class AvatarPhotoControllerTest {
|
||||
public void internalCropUsedIfNoSystemCropperFound() throws IOException {
|
||||
when(mMockAvatarUi.startSystemActivityForResult(any(), anyInt())).thenReturn(false);
|
||||
|
||||
new File(mImagesDir, "file.txt").createNewFile();
|
||||
File file = new File(mImagesDir, "file.txt");
|
||||
saveBitmapToFile(file);
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setData(Uri.parse(
|
||||
@ -241,10 +246,6 @@ public class AvatarPhotoControllerTest {
|
||||
mController.onActivityResult(
|
||||
REQUEST_CODE_TAKE_PHOTO, Activity.RESULT_OK, intent);
|
||||
|
||||
Intent startIntent = verifyStartSystemActivityForResult(
|
||||
"com.android.camera.action.CROP", REQUEST_CODE_CROP_PHOTO);
|
||||
assertThat(startIntent.getData()).isNotEqualTo(mTakePhotoUri);
|
||||
|
||||
verify(mMockAvatarUi, timeout(TIMEOUT_MILLIS)).returnUriResult(mCropPhotoUri);
|
||||
|
||||
InputStream imageStream = mContext.getContentResolver().openInputStream(mCropPhotoUri);
|
||||
|
Loading…
x
Reference in New Issue
Block a user