Resolves test resource issues and re-enables test
Fixes: b/291104503
Test: ThemePickerRoboTests pass in atest and Studio
Change-Id: I03da527b4ccb2d5abfc4320879aeaaa43809a64c
diff --git a/tests/robotests/Android.bp b/tests/robotests/Android.bp
index c34ed2c..d4dde59 100644
--- a/tests/robotests/Android.bp
+++ b/tests/robotests/Android.bp
@@ -2,22 +2,30 @@
default_applicable_licenses: ["Android-Apache-2.0"],
}
+android_app {
+ name: "ThemePickerShell",
+ defaults: ["ThemePicker_defaults"],
+ platform_apis: true,
+ static_libs: ["ThemePickerTestLib"],
+}
+
android_robolectric_test {
name: "ThemePickerRoboTests",
srcs: [
"src/**/*.java",
"src/**/*.kt",
],
- // TODO(b/291104503) Enable this test
- exclude_srcs: ["src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt"],
java_resource_dirs: ["config"],
+
+ // Do not add picker-related dependencies here. Add them to ThemePickerShell
+ // instead.
static_libs: [
- "WallpaperPicker2TestLib",
"androidx.test.rules",
"junit",
"kotlinx_coroutines_test",
"truth",
],
+
libs: [
"androidx.test.core",
"androidx.test.runner",
@@ -25,5 +33,5 @@
upstream: true,
- instrumentation_for: "ThemePicker",
+ instrumentation_for: "ThemePickerShell",
}
diff --git a/tests/robotests/res/values/overlayable_icons_test.xml b/tests/robotests/res/values/overlayable_icons_test.xml
deleted file mode 100644
index 73cffe1..0000000
--- a/tests/robotests/res/values/overlayable_icons_test.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<!--
- Copyright (C) 2019 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.
--->
-<resources>
- <!-- overlayable_icons references all of the drawables in this package
- that are being overlayed by resource overlays. If you remove/rename
- any of these resources, you must also change the resource overlay icons.-->
- <array name="overlayable_icons">
- <item>@drawable/ic_add_24px</item>
- <item>@drawable/ic_close_24px</item>
- <item>@drawable/ic_colorize_24px</item>
- <item>@drawable/ic_delete_24px</item>
- <item>@drawable/ic_font</item>
- <item>@drawable/ic_nav_clock</item>
- <item>@drawable/ic_nav_grid</item>
- <item>@drawable/ic_nav_theme</item>
- <item>@drawable/ic_nav_wallpaper</item>
- <item>@drawable/ic_shapes_24px</item>
- <item>@drawable/ic_tune</item>
- <item>@drawable/ic_wifi_24px</item>
- </array>
-</resources>
diff --git a/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt b/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
index a82cc00..b572401 100644
--- a/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
+++ b/tests/robotests/src/com/android/customization/model/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModelTest.kt
@@ -353,8 +353,16 @@
"${FakeCustomizationProviderClient.AFFORDANCE_1}," +
" ${FakeCustomizationProviderClient.AFFORDANCE_3}"
),
- icon1 = Icon.Loaded(FakeCustomizationProviderClient.ICON_1, null),
- icon2 = Icon.Loaded(FakeCustomizationProviderClient.ICON_3, null),
+ icon1 =
+ Icon.Loaded(
+ FakeCustomizationProviderClient.ICON_1,
+ Text.Loaded("Left shortcut")
+ ),
+ icon2 =
+ Icon.Loaded(
+ FakeCustomizationProviderClient.ICON_3,
+ Text.Loaded("Right shortcut")
+ ),
)
)
}
@@ -373,7 +381,11 @@
.isEqualTo(
KeyguardQuickAffordanceSummaryViewModel(
description = Text.Loaded(FakeCustomizationProviderClient.AFFORDANCE_1),
- icon1 = Icon.Loaded(FakeCustomizationProviderClient.ICON_1, null),
+ icon1 =
+ Icon.Loaded(
+ FakeCustomizationProviderClient.ICON_1,
+ Text.Loaded("Left shortcut")
+ ),
icon2 = null,
)
)
@@ -397,7 +409,11 @@
KeyguardQuickAffordanceSummaryViewModel(
description = Text.Loaded(FakeCustomizationProviderClient.AFFORDANCE_3),
icon1 = null,
- icon2 = Icon.Loaded(FakeCustomizationProviderClient.ICON_3, null),
+ icon2 =
+ Icon.Loaded(
+ FakeCustomizationProviderClient.ICON_3,
+ Text.Loaded("Right shortcut")
+ ),
)
)
}