Skip to content

Commit

Permalink
add relevant comment and fix failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
RitikaPahwa4444 committed Jun 25, 2023
1 parent 7208018 commit 3c0339b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
12 changes: 7 additions & 5 deletions app/src/main/java/fr/free/nrw/commons/upload/FileProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ class FileProcessor @Inject constructor(
Timber.d("Calling GPSExtractor")
val originalImageCoordinates = ImageCoordinates(exifInterface, location)
if (originalImageCoordinates.decimalCoords == null) {
//Find other photos taken around the same time which has gps coordinates
findOtherImages(
File(filePath),
similarImageInterface
)
//Find other photos taken around the same time which has gps coordinates
findOtherImages(
File(filePath),
similarImageInterface
)
} else {
prePopulateCategoriesAndDepictionsBy(originalImageCoordinates)
}
Expand Down Expand Up @@ -164,6 +164,8 @@ class FileProcessor @Inject constructor(

private fun readImageCoordinates(file: File) =
try {
/* Used null location as location for similar images captured before is not available
in case it is not present in the EXIF. */
ImageCoordinates(contentResolver.openInputStream(Uri.fromFile(file))!!, null)
} catch (e: IOException) {
Timber.e(e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class u {
`when`(fileUtilsWrapper!!.getSHA1(any(FileInputStream::class.java)))
.thenReturn("fileSha")

`when`(fileUtilsWrapper!!.getGeolocationOfFile(ArgumentMatchers.anyString(), location))
`when`(fileUtilsWrapper!!.getGeolocationOfFile(ArgumentMatchers.anyString(), any(LatLng::class.java)))
.thenReturn("latLng")

`when`(imageUtilsWrapper?.checkIfImageIsTooDark(ArgumentMatchers.anyString()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ class UploadMediaDetailFragmentUnitTest {
@Mock
private lateinit var imageCoordinates: ImageCoordinates


private lateinit var activity: UploadActivity

@Before
Expand Down

0 comments on commit 3c0339b

Please sign in to comment.