Enable support toolbar for ProfileActivity and added a couple of unit… (#5188)

* Enable support toolbar for ProfileActivity and added a couple of unit tests

* Nit fixes

* Nit Fixes

* Minor styling changes in ContributionsFragment
This commit is contained in:
Priyank Shankar 2023-04-03 12:32:16 +05:30 committed by GitHub
parent fc672dbd9b
commit 07616485ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 97 additions and 50 deletions

View file

@ -67,7 +67,7 @@ class MediaDetailPagerFragmentUnitTests {
val activity = Robolectric.buildActivity(SearchActivity::class.java).create().get()
fragment = MediaDetailPagerFragment()
fragment = MediaDetailPagerFragment(false, true)
fragment = MediaDetailPagerFragment(false, false)
fragment = MediaDetailPagerFragment(false, false, 0)
fragmentManager = activity.supportFragmentManager

View file

@ -5,6 +5,7 @@ import android.graphics.Bitmap
import android.os.Looper
import android.view.Menu
import android.view.MenuItem
import androidx.appcompat.widget.Toolbar
import androidx.test.core.app.ApplicationProvider
import fr.free.nrw.commons.R
import fr.free.nrw.commons.TestCommonsApplication
@ -106,4 +107,17 @@ class ProfileActivityTest {
fun testOnSupportNavigateUp() {
activity.onSupportNavigateUp()
}
@Test
fun testToolbarNotNull() {
val toolbar = activity.findViewById<Toolbar>(R.id.toolbar)
Assert.assertNotNull(toolbar)
}
@Test
fun testOptionsMenu() {
val menu: Menu = RoboMenu(mockContext)
activity.onCreateOptionsMenu(menu)
Assert.assertEquals(1, menu.size())
}
}