Add test cases for highlight Preference click behavior

On large screen Activity embedding devices, Settings homepage
shows a highlighted Preference which is mapped to current
right pane.

For better UX, when users click again on a highlighted Preference,
it should not launch SubSettings.

Fix: 236275503
Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=com.android.settings.dashboard.DashboardFeatureProviderImplTest
Change-Id: I222c9b015fb090f359c3c9f4187823477920715b
This commit is contained in:
Arc Wang
2022-06-22 16:36:16 +08:00
parent 21d6249393
commit 69974d0c4f
4 changed files with 131 additions and 1 deletions

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2022 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.testutils.shadow;
import android.app.Activity;
import androidx.window.embedding.SplitController;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;
/**
* Shadow class for {@link SplitController} to test embedding activity features.
*/
@Implements(SplitController.class)
public class ShadowSplitController {
private static boolean sIsActivityEmbedded;
@Implementation
protected static boolean isActivityEmbedded(Activity activity) {
return sIsActivityEmbedded;
}
public static void setIsActivityEmbedded(boolean isActivityEmbedded) {
sIsActivityEmbedded = isActivityEmbedded;
}
}