Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ce2fa85 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Mark bots in ActivityTestJunit4 as lateinit var" into main

parents 82a0655a de40eb94
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -45,8 +45,7 @@ import org.junit.Before
 * - Cleans up the test environment
 */
abstract class ActivityTestJunit4<T : Activity?> {
    @JvmField
    var bots: Bots? = null
    lateinit var bots: Bots

    @JvmField
    var device: UiDevice? = null
@@ -133,7 +132,7 @@ abstract class ActivityTestJunit4<T : Activity?> {
        // automatically open for phone devices. Espresso register click() as (x, y) MotionEvents,
        // so if a drawer is on top of a file we want to select, it will actually click the drawer.
        // Thus to start a clean state, we always try to close first.
        bots!!.roots!!.closeDrawer()
        bots.roots!!.closeDrawer()
    }

    @After
+13 −13
Original line number Diff line number Diff line
@@ -67,13 +67,13 @@ class PeekUiTest : ActivityTestJunit4<FilesActivity?>() {
    @Throws(Exception::class)
    fun testSequentialFilePreview() {
        peekBot.assertPeekHidden()
        bots!!.directory.selectDocument("image.png")
        bots!!.main.clickActionItem("Get info")
        bots.directory.selectDocument("image.png")
        bots.main.clickActionItem("Get info")
        validatePeekContents("image.png")
        peekBot.hide()

        bots!!.directory.selectDocument("file0.log")
        bots!!.main.clickActionItem("Get info")
        bots.directory.selectDocument("file0.log")
        bots.main.clickActionItem("Get info")
        validatePeekContents("file0.log")
        peekBot.hide()
    }
@@ -83,11 +83,11 @@ class PeekUiTest : ActivityTestJunit4<FilesActivity?>() {
    fun testFileCantBeSelectedDuringFilePreview() {
        peekBot.assertPeekHidden()
        // Selecting a document should show the "1 selected" label.
        bots!!.directory.selectDocument("image.png", 1)
        bots!!.main.clickActionItem("Get info")
        bots.directory.selectDocument("image.png", 1)
        bots.main.clickActionItem("Get info")
        validatePeekContents("image.png")
        // The selection should not be possible, the "1 selected" label shouldn't show.
        bots!!.directory.selectDocument("image.png")
        bots.directory.selectDocument("image.png")
        val assertSelectionText = "1 selected"
        val timeout: Long = 1000
        val selectionText: UiObject2? =
@@ -98,8 +98,8 @@ class PeekUiTest : ActivityTestJunit4<FilesActivity?>() {
    @Test
    @Throws(Exception::class)
    fun testRestorePeekActiveState() {
        bots!!.directory.selectDocument("image.png")
        bots!!.main.clickActionItem("Get info")
        bots.directory.selectDocument("image.png")
        bots.main.clickActionItem("Get info")
        validatePeekContents("image.png")

        // Recreate the activity (happens on window resize, for example), and ensure that the
@@ -111,8 +111,8 @@ class PeekUiTest : ActivityTestJunit4<FilesActivity?>() {
        mActivityScenario!!.recreate()
        peekBot.assertPeekHidden()

        bots!!.directory.selectDocument("file0.log")
        bots!!.main.clickActionItem("Get info")
        bots.directory.selectDocument("file0.log")
        bots.main.clickActionItem("Get info")
        validatePeekContents("file0.log")
        mActivityScenario!!.recreate()
        validatePeekContents("file0.log")
@@ -121,8 +121,8 @@ class PeekUiTest : ActivityTestJunit4<FilesActivity?>() {
    @Test
    @Throws(Exception::class)
    fun testNoPreview() {
        bots!!.directory.selectDocument("file0.log")
        bots!!.main.clickActionItem("Get info")
        bots.directory.selectDocument("file0.log")
        bots.main.clickActionItem("Get info")
        validatePeekContents("file0.log")

        // Use the "No preview available" content description to ensure that the "No preview" shape