Merge 2024-06 Release (ab/AP2A.240605.024) to aosp-main-future
Bug: 343100748 Merged-In: Id3d79805bb2289b84ad34ac05a97e50f0410502f Change-Id: I70f531e800ed5f3765a100b5b5cecb99664c1dbc
This commit is contained in:
@@ -30,6 +30,7 @@ import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.os.vibrator.Flags;
|
||||
@@ -60,6 +61,9 @@ public class KeyboardVibrationTogglePreferenceControllerTest {
|
||||
@Mock
|
||||
private PreferenceScreen mPreferenceScreen;
|
||||
|
||||
@Mock
|
||||
private ContentResolver mContentResolver;
|
||||
|
||||
private Context mContext;
|
||||
private Resources mResources;
|
||||
private KeyboardVibrationTogglePreferenceController mController;
|
||||
@@ -72,6 +76,7 @@ public class KeyboardVibrationTogglePreferenceControllerTest {
|
||||
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||
mResources = spy(mContext.getResources());
|
||||
when(mContext.getResources()).thenReturn(mResources);
|
||||
when(mContext.getContentResolver()).thenReturn(mContentResolver);
|
||||
mFeatureFactory = FakeFeatureFactory.setupForTest();
|
||||
mController = new KeyboardVibrationTogglePreferenceController(mContext, "preferenceKey");
|
||||
mPreference = new SwitchPreference(mContext);
|
||||
@@ -84,6 +89,9 @@ public class KeyboardVibrationTogglePreferenceControllerTest {
|
||||
public void getAvailabilityStatus_featureSupported_available() {
|
||||
mSetFlagsRule.enableFlags(Flags.FLAG_KEYBOARD_CATEGORY_ENABLED);
|
||||
when(mResources.getBoolean(R.bool.config_keyboard_vibration_supported)).thenReturn(true);
|
||||
when(mResources.getFloat(
|
||||
com.android.internal.R.dimen.config_keyboardHapticFeedbackFixedAmplitude))
|
||||
.thenReturn(0.8f);
|
||||
|
||||
assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user