1 /* 2 * Copyright (C) 2023 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 17 package com.android.settingslib.spa.screenshot.widget.button 18 19 import androidx.compose.material.icons.Icons 20 import androidx.compose.material.icons.automirrored.outlined.Launch 21 import androidx.compose.material.icons.outlined.Delete 22 import androidx.compose.material.icons.outlined.WarningAmber 23 import com.android.settingslib.spa.screenshot.util.settingsScreenshotTestRule 24 import com.android.settingslib.spa.widget.button.ActionButton 25 import com.android.settingslib.spa.widget.button.ActionButtons 26 import org.junit.Rule 27 import org.junit.Test 28 import org.junit.runner.RunWith 29 import platform.test.runner.parameterized.ParameterizedAndroidJunit4 30 import platform.test.runner.parameterized.Parameters 31 import platform.test.screenshot.DeviceEmulationSpec 32 import platform.test.screenshot.PhoneAndTabletMinimal 33 34 /** A screenshot test for ExampleFeature. */ 35 @RunWith(ParameterizedAndroidJunit4::class) 36 class ActionButtonsScreenshotTest(emulationSpec: DeviceEmulationSpec) { 37 companion object { 38 @Parameters(name = "{0}") 39 @JvmStatic getTestSpecsnull40 fun getTestSpecs() = DeviceEmulationSpec.PhoneAndTabletMinimal 41 } 42 43 @get:Rule 44 val screenshotRule = 45 settingsScreenshotTestRule( 46 emulationSpec, 47 ) 48 49 @Test 50 fun test() { 51 screenshotRule.screenshotTest("actionButtons") { 52 val actionButtons = listOf( 53 ActionButton(text = "Open", imageVector = Icons.AutoMirrored.Outlined.Launch) {}, 54 ActionButton(text = "Uninstall", imageVector = Icons.Outlined.Delete) {}, 55 ActionButton(text = "Force stop", imageVector = Icons.Outlined.WarningAmber) {}, 56 ) 57 ActionButtons(actionButtons) 58 } 59 } 60 } 61