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

Commit 8603ee0f authored by Jeremie Boulic's avatar Jeremie Boulic
Browse files

[DocsUI Peek] Prevent mouse interactions with background

Bug: 406131116
Flag: com.android.documentsui.flags.use_material3
Flag: com.android.documentsui.flags.use_peek_preview_ro
Test: DocumentsUIGoogleTests:com.android.documentsui.peek.PeekUiTest
Change-Id: Ifda9dddb6830d9ff675d73b9ab3e775dd9c174e4
parent 2e2afbfd
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,7 @@
    android:layout_width="match_parent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_height="match_parent"
    android:background="@color/peek_overlay_scrim"
    android:background="@color/peek_overlay_scrim"
    android:clickable="true"
    android:focusable="false" >
    android:focusable="false" >
    <!-- Text and icons using android:white because the underlying black scrim doesn't dynamically
    <!-- Text and icons using android:white because the underlying black scrim doesn't dynamically
    change colour. -->
    change colour. -->
+24 −3
Original line number Original line Diff line number Diff line
@@ -21,9 +21,13 @@ import android.platform.test.flag.junit.CheckFlagsRule
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import android.platform.test.flag.junit.DeviceFlagsValueProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
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.ActivityTestJunit4
import com.android.documentsui.files.FilesActivity
import com.android.documentsui.files.FilesActivity
import com.android.documentsui.flags.Flags
import com.android.documentsui.flags.Flags
import junit.framework.Assert
import org.junit.After
import org.junit.After
import org.junit.Before
import org.junit.Before
import org.junit.Rule
import org.junit.Rule
@@ -57,9 +61,7 @@ class PeekUiTest : ActivityTestJunit4<FilesActivity?>() {
    }
    }


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