Fixes 1848 : Option for adding location for those pictures which have no location (#4755)

* Location wizard

* Location wizard

* Minor fix

* message changed

* Test fail fixed

* Test fail fixed

* Test fail fixed

* last location triggered

* last location added

* Some test added

* Java docs added

* More java docs added
This commit is contained in:
Ayan Sarkar 2022-02-05 06:26:59 +05:30 committed by GitHub
parent 587ff3b54f
commit e135fea20d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 161 additions and 44 deletions

View file

@ -44,6 +44,9 @@ class UploadMediaPresenterTest {
@Mock
private lateinit var uploadItem: UploadItem
@Mock
private lateinit var imageCoordinates: ImageCoordinates
@Mock
private lateinit var uploadMediaDetails: List<UploadMediaDetail>
@ -93,20 +96,41 @@ class UploadMediaPresenterTest {
}
/**
* unit test for method UploadMediaPresenter.verifyImageQuality
* unit test for method UploadMediaPresenter.verifyImageQuality (For else case)
*/
@Test
fun verifyImageQualityTest() {
whenever(repository.uploads).thenReturn(listOf(uploadItem))
whenever(repository.getImageQuality(uploadItem))
.thenReturn(testSingleImageResult)
whenever(uploadItem.imageQuality).thenReturn(ArgumentMatchers.anyInt())
whenever(uploadItem.imageQuality).thenReturn(0)
whenever(uploadItem.gpsCoords)
.thenReturn(imageCoordinates)
whenever(uploadItem.gpsCoords.decimalCoords)
.thenReturn("imageCoordinates")
uploadMediaPresenter.verifyImageQuality(0)
verify(view).showProgress(true)
testScheduler.triggerActions()
verify(view).showProgress(false)
}
/**
* unit test for method UploadMediaPresenter.verifyImageQuality (For if case)
*/
@Test
fun `verify ImageQuality Test while coordinates equals to null`() {
whenever(repository.uploads).thenReturn(listOf(uploadItem))
whenever(repository.getImageQuality(uploadItem))
.thenReturn(testSingleImageResult)
whenever(uploadItem.imageQuality).thenReturn(0)
whenever(uploadItem.gpsCoords)
.thenReturn(imageCoordinates)
whenever(uploadItem.gpsCoords.decimalCoords)
.thenReturn(null)
uploadMediaPresenter.verifyImageQuality(0)
testScheduler.triggerActions()
}
/**
* unit test for method UploadMediaPresenter.handleImageResult
*/

View file

@ -58,6 +58,7 @@ class UploadMediaDetailFragmentUnitTest {
private lateinit var context: Context
private lateinit var layoutInflater: LayoutInflater
private lateinit var view: View
private lateinit var runnable: Runnable
private lateinit var tvTitle: TextView
private lateinit var tooltip: ImageView
@ -338,13 +339,6 @@ class UploadMediaDetailFragmentUnitTest {
fragment.showConnectionErrorPopup()
}
@Test
@Throws(Exception::class)
fun testShowMapWithImageCoordinates() {
Shadows.shadowOf(Looper.getMainLooper()).idle()
fragment.showMapWithImageCoordinates(true)
}
@Test
@Throws(Exception::class)
fun testShowExternalMap() {
@ -429,4 +423,12 @@ class UploadMediaDetailFragmentUnitTest {
fragment.onButtonCopyTitleDescToSubsequentMedia()
}
@Test
@Throws(Exception::class)
fun testDisplayAddLocationDialog() {
Shadows.shadowOf(Looper.getMainLooper()).idle()
runnable = Runnable { }
fragment.displayAddLocationDialog(runnable)
}
}