1 /* 2 * Copyright (C) 2025 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.documentsui.peek 17 18 import android.os.RemoteException 19 import android.platform.test.annotations.RequiresFlagsEnabled 20 import android.platform.test.flag.junit.CheckFlagsRule 21 import android.platform.test.flag.junit.DeviceFlagsValueProvider 22 import androidx.test.ext.junit.runners.AndroidJUnit4 23 import androidx.test.filters.LargeTest 24 import com.android.documentsui.ActivityTestJunit4 25 import com.android.documentsui.files.FilesActivity 26 import com.android.documentsui.flags.Flags 27 import org.junit.After 28 import org.junit.Before 29 import org.junit.Rule 30 import org.junit.Test 31 import org.junit.runner.RunWith 32 33 @LargeTest 34 @RunWith(AndroidJUnit4::class) 35 @RequiresFlagsEnabled(Flags.FLAG_USE_MATERIAL3, Flags.FLAG_USE_PEEK_PREVIEW_RO) 36 class PeekUiTest : ActivityTestJunit4<FilesActivity?>() { 37 @get:Rule 38 val mCheckFlagsRule: CheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule() 39 40 @Before 41 @Throws(Exception::class) setUpnull42 override fun setUp() { 43 super.setUp() 44 initTestFiles() 45 } 46 47 @After 48 @Throws(Exception::class) tearDownnull49 override fun tearDown() { 50 super.tearDown() 51 } 52 53 @Throws(RemoteException::class) initTestFilesnull54 override fun initTestFiles() { 55 mDocsHelper!!.createDocument(rootDir0, "image/png", "image.png") 56 } 57 58 @Test 59 @Throws( 60 Exception::class 61 ) testShowPeeknull62 fun testShowPeek() { 63 bots!!.peek.assertPeekHidden() 64 bots!!.directory.selectDocument("image.png") 65 bots!!.main.clickActionItem("Get info") 66 bots!!.peek.assertPeekActive() 67 } 68 } 69