5204: Fix unit test UploadMediaPresenterTest.handleImageResult (#5206)

* UploadMediaPresenterTest: fix failing unit tests

* change else if to if condition to handle all cases

* include errorCodes 68 for duplicate image and 96 for image without exif

* optimise if statements

* remove redundant cases

* modify if statements to cover all cases

* simplify all if statements

* add removed comment again

* remove unused imports
This commit is contained in:
Ritika Pahwa 2023-04-18 11:31:20 +05:30 committed by GitHub
parent 2c7f2d05cd
commit a116a17e7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

View file

@ -3,12 +3,7 @@ package fr.free.nrw.commons.upload.mediaDetails;
import static fr.free.nrw.commons.di.CommonsApplicationModule.IO_THREAD;
import static fr.free.nrw.commons.di.CommonsApplicationModule.MAIN_THREAD;
import static fr.free.nrw.commons.utils.ImageUtils.EMPTY_CAPTION;
import static fr.free.nrw.commons.utils.ImageUtils.FILE_FBMD;
import static fr.free.nrw.commons.utils.ImageUtils.FILE_NAME_EXISTS;
import static fr.free.nrw.commons.utils.ImageUtils.FILE_NO_EXIF;
import static fr.free.nrw.commons.utils.ImageUtils.IMAGE_BLURRY;
import static fr.free.nrw.commons.utils.ImageUtils.IMAGE_DARK;
import static fr.free.nrw.commons.utils.ImageUtils.IMAGE_GEOLOCATION_DIFFERENT;
import static fr.free.nrw.commons.utils.ImageUtils.IMAGE_KEEP;
import static fr.free.nrw.commons.utils.ImageUtils.IMAGE_OK;
@ -331,11 +326,8 @@ public class UploadMediaPresenter implements UserActionListener, SimilarImageInt
view.showDuplicatePicturePopup(uploadItem);
}
// If image has some problems check if the bits are set in errorCode and
// show popup accordingly
if (((errorCode & FILE_NO_EXIF) != 0) || ((errorCode & IMAGE_DARK) != 0) ||
((errorCode & FILE_FBMD) != 0) || ((errorCode & IMAGE_GEOLOCATION_DIFFERENT) != 0) ||
((errorCode & IMAGE_BLURRY) != 0)) {
// If image has some other problems, show popup accordingly
if (errorCode != EMPTY_CAPTION && errorCode != FILE_NAME_EXISTS) {
view.showBadImagePopup(errorCode, uploadItem);
}