mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
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:
parent
587ff3b54f
commit
e135fea20d
9 changed files with 161 additions and 44 deletions
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue