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

Commit af353b0f authored by Jeremie Boulic's avatar Jeremie Boulic Committed by Android (Google) Code Review
Browse files

Merge "[DocsUI Peek] Prevent mouse interactions with background" into main

parents 034e0a40 8603ee0f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/peek_overlay_scrim"
    android:clickable="true"
    android:focusable="false" >
    <!-- Text and icons using android:white because the underlying black scrim doesn't dynamically
    change colour. -->
+24 −3
Original line number Diff line number Diff line
@@ -21,9 +21,13 @@ import android.platform.test.flag.junit.CheckFlagsRule
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiObject2
import androidx.test.uiautomator.Until
import com.android.documentsui.ActivityTestJunit4
import com.android.documentsui.files.FilesActivity
import com.android.documentsui.flags.Flags
import junit.framework.Assert
import org.junit.After
import org.junit.Before
import org.junit.Rule
@@ -57,9 +61,7 @@ class PeekUiTest : ActivityTestJunit4<FilesActivity?>() {
    }

    @Test
    @Throws(
        Exception::class
    )
    @Throws(Exception::class)
    fun testSequentialFilePreview() {
        bots!!.peek.assertPeekHidden()
        bots!!.directory.selectDocument("image.png")
@@ -74,4 +76,23 @@ class PeekUiTest : ActivityTestJunit4<FilesActivity?>() {
        bots!!.peek.assertHasTitle("file0.log")
        bots!!.peek.hide()
    }

    @Test
    @Throws(Exception::class)
    fun testFileCantBeSelectedDuringFilePreview() {
        bots!!.peek.assertPeekHidden()
        // Selecting a document should show the "1 selected" label.
        bots!!.directory.selectDocument("image.png", 1)
        bots!!.main.clickActionItem("Get info")
        bots!!.peek.waitForPeekActive()
        bots!!.peek.assertHasTitle("image.png")
        // The selection should not be possible, the "1 selected" label shouldn't show.
        bots!!.directory.selectDocument("image.png")
        val assertSelectionText = "1 selected"
        val timeout: Long = 1000
        val selectionText: UiObject2? = device!!.wait(
            Until.findObject(By.text(assertSelectionText)), timeout
        )
        Assert.assertNull(selectionText)
    }
}