From 24827a1c7b1db33ba8738d716d749dfad4ca4fb1 Mon Sep 17 00:00:00 2001 From: Doris Ling Date: Thu, 10 May 2018 13:32:24 -0700 Subject: [PATCH] Map the new category keys to the corresponding fragment. - map category night_light to NightDisplaySettings - map category gestures to GestureSettings Bug: 79530682 Bug: 79532703 Test: make RunSettingsRoboTests Change-Id: Idc45957d2515e148226897f58fcc358a8c7f37dd --- .../dashboard/DashboardFragmentRegistry.java | 6 ++++ .../display/NightDisplaySettingsTest.java | 7 ++++ .../gestures/GestureSettingsTest.java | 34 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 tests/robotests/src/com/android/settings/gestures/GestureSettingsTest.java diff --git a/src/com/android/settings/dashboard/DashboardFragmentRegistry.java b/src/com/android/settings/dashboard/DashboardFragmentRegistry.java index 7b7fb5bd0c4..5e45c43dfbb 100644 --- a/src/com/android/settings/dashboard/DashboardFragmentRegistry.java +++ b/src/com/android/settings/dashboard/DashboardFragmentRegistry.java @@ -27,7 +27,9 @@ import com.android.settings.connecteddevice.AdvancedConnectedDeviceDashboardFrag import com.android.settings.connecteddevice.ConnectedDeviceDashboardFragment; import com.android.settings.development.DevelopmentSettingsDashboardFragment; import com.android.settings.deviceinfo.StorageDashboardFragment; +import com.android.settings.display.NightDisplaySettings; import com.android.settings.fuelgauge.PowerUsageSummary; +import com.android.settings.gestures.GestureSettings; import com.android.settings.language.LanguageAndInputSettings; import com.android.settings.network.NetworkDashboardFragment; import com.android.settings.notification.ConfigureNotificationSettings; @@ -95,6 +97,10 @@ public class DashboardFragmentRegistry { CategoryKey.CATEGORY_SECURITY_LOCKSCREEN); PARENT_TO_CATEGORY_KEY_MAP.put(ZenModeSettings.class.getName(), CategoryKey.CATEGORY_DO_NOT_DISTURB); + PARENT_TO_CATEGORY_KEY_MAP.put(GestureSettings.class.getName(), + CategoryKey.CATEGORY_GESTURES); + PARENT_TO_CATEGORY_KEY_MAP.put(NightDisplaySettings.class.getName(), + CategoryKey.CATEGORY_NIGHT_LIGHT); CATEGORY_KEY_TO_PARENT_MAP = new ArrayMap<>(PARENT_TO_CATEGORY_KEY_MAP.size()); diff --git a/tests/robotests/src/com/android/settings/display/NightDisplaySettingsTest.java b/tests/robotests/src/com/android/settings/display/NightDisplaySettingsTest.java index 8df4a313a99..e3f90929d2d 100644 --- a/tests/robotests/src/com/android/settings/display/NightDisplaySettingsTest.java +++ b/tests/robotests/src/com/android/settings/display/NightDisplaySettingsTest.java @@ -22,6 +22,7 @@ import android.provider.SearchIndexableResource; import com.android.settings.R; import com.android.settings.testutils.SettingsRobolectricTestRunner; +import com.android.settingslib.drawer.CategoryKey; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RuntimeEnvironment; @@ -45,4 +46,10 @@ public class NightDisplaySettingsTest { assertThat(indexedXml).contains(R.xml.night_display_settings); } + + @Test + public void getCategoryKey_isCategoryNightLight() { + NightDisplaySettings settings = new NightDisplaySettings(); + assertThat(settings.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_NIGHT_LIGHT); + } } diff --git a/tests/robotests/src/com/android/settings/gestures/GestureSettingsTest.java b/tests/robotests/src/com/android/settings/gestures/GestureSettingsTest.java new file mode 100644 index 00000000000..29d2c19e149 --- /dev/null +++ b/tests/robotests/src/com/android/settings/gestures/GestureSettingsTest.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2018 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.gestures; + +import static com.google.common.truth.Truth.assertThat; + +import com.android.settings.testutils.SettingsRobolectricTestRunner; +import com.android.settingslib.drawer.CategoryKey; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(SettingsRobolectricTestRunner.class) +public class GestureSettingsTest { + + @Test + public void getCategoryKey_isCategoryGestures() { + GestureSettings settings = new GestureSettings(); + assertThat(settings.getCategoryKey()).isEqualTo(CategoryKey.CATEGORY_GESTURES); + } +}