fix: 引入Settings的Module
This commit is contained in:
78
Settings/tests/screenshot/Android.bp
Normal file
78
Settings/tests/screenshot/Android.bp
Normal file
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// Copyright (C) 2023 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package {
|
||||
default_team: "trendy_team_android_settings_app",
|
||||
}
|
||||
|
||||
android_app {
|
||||
name: "ScreenshotTestStub",
|
||||
defaults: [
|
||||
"SettingsLibDefaults",
|
||||
],
|
||||
platform_apis: true,
|
||||
certificate: "platform",
|
||||
privileged: true,
|
||||
use_resource_processor: true,
|
||||
|
||||
static_libs: [
|
||||
"Settings-core",
|
||||
"androidx.fragment_fragment-testing",
|
||||
"androidx.fragment_fragment",
|
||||
"androidx.test.runner",
|
||||
"androidx.test.core",
|
||||
"androidx.test.rules",
|
||||
"androidx.test.ext.junit",
|
||||
"platform-screenshot-diff-core",
|
||||
"Settings-testutils2",
|
||||
"androidx.test.espresso.core",
|
||||
"kotlinx-coroutines-android",
|
||||
"androidx.lifecycle_lifecycle-runtime-testing",
|
||||
"kotlinx_coroutines_test",
|
||||
],
|
||||
uses_libs: ["org.apache.http.legacy"],
|
||||
aaptflags: ["--extra-packages com.android.settings"],
|
||||
manifest: "AndroidManifest.xml",
|
||||
}
|
||||
|
||||
// This is a RNG (Robolectric native graphics) test target.
|
||||
android_robolectric_test {
|
||||
name: "SettingsScreenshotRNGTests",
|
||||
srcs: [
|
||||
"src/**/*.kt",
|
||||
],
|
||||
test_suites: ["general-tests"],
|
||||
|
||||
// Do not add any libraries here, instead add them to the ScreenshotTestStub
|
||||
static_libs: [
|
||||
"androidx.compose.runtime_runtime",
|
||||
"androidx.test.uiautomator_uiautomator",
|
||||
"androidx.test.ext.junit",
|
||||
"inline-mockito-robolectric-prebuilt",
|
||||
"platform-parametric-runner-lib",
|
||||
"uiautomator-helpers",
|
||||
|
||||
],
|
||||
libs: [
|
||||
"android.test.runner",
|
||||
"android.test.base",
|
||||
"android.test.mock",
|
||||
"truth",
|
||||
],
|
||||
|
||||
upstream: true,
|
||||
instrumentation_for: "ScreenshotTestStub",
|
||||
java_resource_dirs: ["config"],
|
||||
}
|
||||
30
Settings/tests/screenshot/AndroidManifest.xml
Normal file
30
Settings/tests/screenshot/AndroidManifest.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
|
||||
coreApp="true"
|
||||
package="com.android.settings">
|
||||
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
|
||||
|
||||
<application>
|
||||
<activity android:name="com.android.settings.test.screenshot.ContainerActivity" android:exported="true" />
|
||||
<activity android:name="platform.test.screenshot.FragmentScreenshotActivity" android:exported="true"
|
||||
android:theme="@style/GlifTheme.Light" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
2
Settings/tests/screenshot/OWNERS
Normal file
2
Settings/tests/screenshot/OWNERS
Normal file
@@ -0,0 +1,2 @@
|
||||
joshmccloskey@google.com
|
||||
jbolinger@google.com
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 83 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 46 KiB |
BIN
Settings/tests/screenshot/assets/robolectric/fp_enroll_intro.png
Normal file
BIN
Settings/tests/screenshot/assets/robolectric/fp_enroll_intro.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 146 KiB |
16
Settings/tests/screenshot/config/robolectric.properties
Normal file
16
Settings/tests/screenshot/config/robolectric.properties
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright (C) 2023 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
sdk=NEWEST_SDK
|
||||
graphicsMode=NATIVE
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.tests.screenshot
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.fragment.app.FragmentContainerView
|
||||
|
||||
/**
|
||||
* This activity is a container for all RNG (Robolectric Native Graphic) Settings screenshot tests.
|
||||
*/
|
||||
class ContainerActivity : FragmentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val contentView = FragmentContainerView(this)
|
||||
contentView.setId(CONTAINER_VIEW_ID)
|
||||
setContentView(contentView)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val CONTAINER_VIEW_ID = 1234
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
# Background info about tests
|
||||
1. This test is ran in postsubmits at andoid-settings/robo_tests.gcl
|
||||
2. It is important that this module stays somewhat small, if the test size grows
|
||||
too large, it will be likely that this suite breaks due to flakiness(which
|
||||
tends to happen with screenshot tests). In this case investigate splitting
|
||||
the module.
|
||||
|
||||
# Running and updating screenshots.
|
||||
1. For FingerprintEnrollIntroScreenshotTest.kt#testEnrollIntro
|
||||
2. atest SettingsScreenshotRNGTests
|
||||
3. There should be a file like com.android.settings.tests.screenshot.biometrics.fingerprint.fragment.FingerprintEnrollIntroScreenshotTest_testEnrollIntro_actual_robolectric_fp_enroll_intro.png_6245562387930305138.png
|
||||
4. Place this screenshot in packages/apps/Settings/tests/screenshot/assets/robolectric/fp_enroll_intro.png
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.settings.tests.screenshot.biometrics.fingerprint
|
||||
|
||||
import android.content.res.Configuration
|
||||
import android.view.Surface
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.settings.biometrics.fingerprint2.domain.interactor.AccessibilityInteractor
|
||||
import com.android.settings.biometrics.fingerprint2.domain.interactor.FoldStateInteractor
|
||||
import com.android.settings.biometrics.fingerprint2.domain.interactor.OrientationInteractor
|
||||
import com.android.settings.biometrics.fingerprint2.lib.model.Default
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.modules.enrolling.rfps.ui.viewmodel.RFPSIconTouchViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.modules.enrolling.rfps.ui.viewmodel.RFPSViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.BackgroundViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintEnrollConfirmationViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintEnrollEnrollingViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintEnrollFindSensorViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintEnrollIntroViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintEnrollViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintFlowViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintGatekeeperViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintNavigationStep
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintNavigationViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintScrollViewModel
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.GatekeeperInfo
|
||||
import com.android.settings.testutils2.FakeFingerprintManagerInteractor
|
||||
import com.android.systemui.biometrics.shared.model.FingerprintSensor
|
||||
import com.android.systemui.biometrics.shared.model.FingerprintSensorType
|
||||
import com.android.systemui.biometrics.shared.model.SensorStrength
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.flowOf
|
||||
import kotlinx.coroutines.flow.update
|
||||
import platform.test.screenshot.DeviceEmulationSpec
|
||||
import platform.test.screenshot.DisplaySpec
|
||||
import platform.test.screenshot.FragmentScreenshotTestRule
|
||||
import platform.test.screenshot.GoldenImagePathManager
|
||||
import platform.test.screenshot.matchers.PixelPerfectMatcher
|
||||
|
||||
class Injector(step: FingerprintNavigationStep.UiStep) {
|
||||
|
||||
var enrollFlow = Default
|
||||
var fingerprintSensor = FingerprintSensor(1, SensorStrength.STRONG, 5, FingerprintSensorType.REAR)
|
||||
var accessibilityInteractor =
|
||||
object : AccessibilityInteractor {
|
||||
override val isAccessibilityEnabled: Flow<Boolean> = flowOf(true)
|
||||
}
|
||||
|
||||
var foldStateInteractor =
|
||||
object : FoldStateInteractor {
|
||||
private val _foldState = MutableStateFlow(false)
|
||||
override val isFolded: Flow<Boolean> = _foldState.asStateFlow()
|
||||
|
||||
override fun onConfigurationChange(newConfig: Configuration) {
|
||||
_foldState.update { false }
|
||||
}
|
||||
}
|
||||
|
||||
var orientationInteractor =
|
||||
object : OrientationInteractor {
|
||||
override val orientation: Flow<Int> = flowOf(Configuration.ORIENTATION_LANDSCAPE)
|
||||
override val rotation: Flow<Int> = flowOf(Surface.ROTATION_0)
|
||||
|
||||
override fun getRotationFromDefault(rotation: Int): Int = rotation
|
||||
}
|
||||
var gatekeeperViewModel =
|
||||
FingerprintGatekeeperViewModel(
|
||||
GatekeeperInfo.GatekeeperPasswordInfo(byteArrayOf(1, 2, 3), 100L),
|
||||
interactor,
|
||||
)
|
||||
|
||||
val flowViewModel = FingerprintFlowViewModel(enrollFlow)
|
||||
|
||||
var navigationViewModel = FingerprintNavigationViewModel(step, true, flowViewModel, interactor)
|
||||
var fingerprintViewModel =
|
||||
FingerprintEnrollIntroViewModel(navigationViewModel, flowViewModel, interactor)
|
||||
|
||||
var fingerprintScrollViewModel = FingerprintScrollViewModel()
|
||||
var backgroundViewModel = BackgroundViewModel()
|
||||
|
||||
var fingerprintEnrollViewModel =
|
||||
FingerprintEnrollViewModel(interactor, gatekeeperViewModel, navigationViewModel)
|
||||
|
||||
var fingerprintEnrollEnrollingViewModel =
|
||||
FingerprintEnrollEnrollingViewModel(fingerprintEnrollViewModel, backgroundViewModel)
|
||||
|
||||
var rfpsIconTouchViewModel = RFPSIconTouchViewModel()
|
||||
var rfpsViewModel =
|
||||
RFPSViewModel(fingerprintEnrollEnrollingViewModel, navigationViewModel, orientationInteractor)
|
||||
|
||||
val fingerprintEnrollConfirmationViewModel =
|
||||
FingerprintEnrollConfirmationViewModel(navigationViewModel, interactor)
|
||||
|
||||
var fingerprintFindSensorViewModel =
|
||||
FingerprintEnrollFindSensorViewModel(
|
||||
navigationViewModel,
|
||||
fingerprintEnrollViewModel,
|
||||
gatekeeperViewModel,
|
||||
backgroundViewModel,
|
||||
accessibilityInteractor,
|
||||
foldStateInteractor,
|
||||
orientationInteractor,
|
||||
flowViewModel,
|
||||
interactor,
|
||||
)
|
||||
|
||||
val factory =
|
||||
object : ViewModelProvider.Factory {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
return when (modelClass) {
|
||||
FingerprintEnrollIntroViewModel::class.java -> fingerprintViewModel
|
||||
FingerprintScrollViewModel::class.java -> fingerprintScrollViewModel
|
||||
FingerprintNavigationViewModel::class.java -> navigationViewModel
|
||||
FingerprintGatekeeperViewModel::class.java -> gatekeeperViewModel
|
||||
FingerprintEnrollFindSensorViewModel::class.java -> fingerprintFindSensorViewModel
|
||||
FingerprintEnrollViewModel::class.java -> fingerprintEnrollViewModel
|
||||
RFPSViewModel::class.java -> rfpsViewModel
|
||||
BackgroundViewModel::class.java -> backgroundViewModel
|
||||
RFPSIconTouchViewModel::class.java -> rfpsIconTouchViewModel
|
||||
FingerprintEnrollEnrollingViewModel::class.java -> fingerprintEnrollEnrollingViewModel
|
||||
FingerprintEnrollConfirmationViewModel::class.java -> fingerprintEnrollConfirmationViewModel
|
||||
else -> null
|
||||
}
|
||||
as T
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
fingerprintEnrollViewModel.sensorTypeCached = fingerprintSensor.sensorType
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val Phone = DisplaySpec("phone", width = 1080, height = 2340, densityDpi = 420)
|
||||
private const val screenshotPath = "/settings_screenshots"
|
||||
val interactor = FakeFingerprintManagerInteractor()
|
||||
|
||||
fun BiometricFragmentScreenShotRule() =
|
||||
FragmentScreenshotTestRule(
|
||||
DeviceEmulationSpec.forDisplays(Phone).first(),
|
||||
GoldenImagePathManager(
|
||||
InstrumentationRegistry.getInstrumentation().context,
|
||||
InstrumentationRegistry.getInstrumentation().targetContext.filesDir.absolutePath +
|
||||
screenshotPath,
|
||||
),
|
||||
PixelPerfectMatcher(),
|
||||
true,
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.tests.screenshot.biometrics.fingerprint.fragment
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.fragment.FingerprintEnrollConfirmationV2Fragment
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintNavigationStep
|
||||
import com.android.settings.tests.screenshot.biometrics.fingerprint.Injector
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import platform.test.screenshot.FragmentScreenshotTestRule
|
||||
import platform.test.screenshot.ViewScreenshotTestRule.Mode
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class FingerprintEnrollConfirmationScreenshotTest {
|
||||
private val injector: Injector = Injector(FingerprintNavigationStep.Confirmation)
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
var rule: FragmentScreenshotTestRule = Injector.BiometricFragmentScreenShotRule()
|
||||
|
||||
@Test
|
||||
fun testConfirmation() {
|
||||
rule.screenshotTest(
|
||||
"fp_enroll_confirmation",
|
||||
Mode.MatchSize,
|
||||
FingerprintEnrollConfirmationV2Fragment(injector.factory),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.android.settings.tests.screenshot.biometrics.fingerprint.fragment
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.modules.enrolling.rfps.ui.fragment.RFPSEnrollFragment
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintNavigationStep
|
||||
import com.android.settings.tests.screenshot.biometrics.fingerprint.Injector
|
||||
import com.android.settings.tests.screenshot.biometrics.fingerprint.Injector.Companion.BiometricFragmentScreenShotRule
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import platform.test.screenshot.FragmentScreenshotTestRule
|
||||
import platform.test.screenshot.ViewScreenshotTestRule.Mode
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class FingerprintEnrollEnrollingScreenshotTest {
|
||||
private val injector: Injector =
|
||||
Injector(FingerprintNavigationStep.Enrollment(Injector.interactor.sensorProp))
|
||||
|
||||
@Rule @JvmField var rule: FragmentScreenshotTestRule = BiometricFragmentScreenShotRule()
|
||||
|
||||
@Test
|
||||
fun testEnrollEnrolling() {
|
||||
rule.screenshotTest("fp_enroll_enrolling", Mode.MatchSize, RFPSEnrollFragment(injector.factory))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.android.settings.tests.screenshot.biometrics.fingerprint.fragment
|
||||
|
||||
/*
|
||||
* Copyright (C) 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.fragment.FingerprintEnrollFindSensorV2Fragment
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintNavigationStep
|
||||
import com.android.settings.tests.screenshot.biometrics.fingerprint.Injector
|
||||
import com.android.settings.tests.screenshot.biometrics.fingerprint.Injector.Companion.BiometricFragmentScreenShotRule
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import platform.test.screenshot.FragmentScreenshotTestRule
|
||||
import platform.test.screenshot.ViewScreenshotTestRule.Mode
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class FingerprintEnrollFindSensorScreenshotTest {
|
||||
private val injector: Injector =
|
||||
Injector(FingerprintNavigationStep.Education(Injector.interactor.sensorProp))
|
||||
|
||||
@Rule @JvmField var rule: FragmentScreenshotTestRule = BiometricFragmentScreenShotRule()
|
||||
|
||||
@Test
|
||||
fun testEnrollFindSensor() {
|
||||
rule.screenshotTest(
|
||||
"fp_enroll_find_sensor",
|
||||
Mode.MatchSize,
|
||||
FingerprintEnrollFindSensorV2Fragment(injector.fingerprintSensor.sensorType, injector.factory),
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (C) 2023 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.tests.screenshot.biometrics.fingerprint.fragment
|
||||
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.fragment.FingerprintEnrollIntroV2Fragment
|
||||
import com.android.settings.biometrics.fingerprint2.ui.enrollment.viewmodel.FingerprintNavigationStep
|
||||
import com.android.settings.tests.screenshot.biometrics.fingerprint.Injector
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import platform.test.screenshot.FragmentScreenshotTestRule
|
||||
import platform.test.screenshot.ViewScreenshotTestRule.Mode
|
||||
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class FingerprintEnrollIntroScreenshotTest {
|
||||
private val injector: Injector = Injector(FingerprintNavigationStep.Introduction)
|
||||
|
||||
@Rule
|
||||
@JvmField
|
||||
var rule: FragmentScreenshotTestRule = Injector.BiometricFragmentScreenShotRule()
|
||||
|
||||
@Test
|
||||
fun testEnrollIntro() {
|
||||
rule.screenshotTest(
|
||||
"fp_enroll_intro",
|
||||
Mode.MatchSize,
|
||||
FingerprintEnrollIntroV2Fragment(injector.factory),
|
||||
)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user