Loading res/flag(com.android.documentsui.flags.use_material3)/layout/peek_layout.xml +1 −0 Original line number Diff line number Diff line Loading @@ -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. --> Loading tests/functional/com/android/documentsui/peek/PeekUiTest.kt +24 −3 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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") Loading @@ -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) } } Loading
res/flag(com.android.documentsui.flags.use_material3)/layout/peek_layout.xml +1 −0 Original line number Diff line number Diff line Loading @@ -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. --> Loading
tests/functional/com/android/documentsui/peek/PeekUiTest.kt +24 −3 Original line number Diff line number Diff line Loading @@ -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 Loading Loading @@ -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") Loading @@ -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) } }