Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9e4b73a2 authored by Ang Li's avatar Ang Li Committed by Automerger Merge Worker
Browse files

Merge "Adapt to the new API of `ShadowCaptioningManager`." into main am: 1d591b26 am: ae15c01d

parents 408bdb1e ae15c01d
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -17,8 +17,10 @@
package com.android.settings.accessibility;

import static com.google.common.truth.Truth.assertThat;
import static org.robolectric.Shadows.shadowOf;

import android.content.Context;
import android.os.Looper;
import android.provider.Settings;
import android.view.accessibility.CaptioningManager;

@@ -68,7 +70,9 @@ public class CaptioningAppearancePreferenceControllerTest {

    @Test
    public void getSummary_smallestScale_shouldReturnExpectedSummary() {
        mShadowCaptioningManager.setFontScale(0.25f);
        Settings.Secure.putFloat(mContext.getContentResolver(),
            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 0.25f);
        shadowOf(Looper.getMainLooper()).idle();

        final String expectedSummary =
                getSummaryCombo(/* fontScaleIndex= */ 0, DEFAULT_PRESET_INDEX);
@@ -77,7 +81,9 @@ public class CaptioningAppearancePreferenceControllerTest {

    @Test
    public void getSummary_smallScale_shouldReturnExpectedSummary() {
        mShadowCaptioningManager.setFontScale(0.5f);
        Settings.Secure.putFloat(mContext.getContentResolver(),
            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 0.5f);
        shadowOf(Looper.getMainLooper()).idle();

        final String expectedSummary =
                getSummaryCombo(/* fontScaleIndex= */ 1, DEFAULT_PRESET_INDEX);
@@ -86,7 +92,9 @@ public class CaptioningAppearancePreferenceControllerTest {

    @Test
    public void getSummary_mediumScale_shouldReturnExpectedSummary() {
        mShadowCaptioningManager.setFontScale(1.0f);
        Settings.Secure.putFloat(mContext.getContentResolver(),
            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 1.0f);
        shadowOf(Looper.getMainLooper()).idle();

        final String expectedSummary =
                getSummaryCombo(/* fontScaleIndex= */ 2, DEFAULT_PRESET_INDEX);
@@ -95,7 +103,9 @@ public class CaptioningAppearancePreferenceControllerTest {

    @Test
    public void getSummary_largeScale_shouldReturnExpectedSummary() {
        mShadowCaptioningManager.setFontScale(1.5f);
        Settings.Secure.putFloat(mContext.getContentResolver(),
            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 1.5f);
        shadowOf(Looper.getMainLooper()).idle();

        final String expectedSummary =
                getSummaryCombo(/* fontScaleIndex= */ 3, DEFAULT_PRESET_INDEX);
@@ -104,7 +114,9 @@ public class CaptioningAppearancePreferenceControllerTest {

    @Test
    public void getSummary_largestScale_shouldReturnExpectedSummary() {
        mShadowCaptioningManager.setFontScale(2.0f);
        Settings.Secure.putFloat(mContext.getContentResolver(),
            Settings.Secure.ACCESSIBILITY_CAPTIONING_FONT_SCALE, 2.0f);
        shadowOf(Looper.getMainLooper()).idle();

        final String expectedSummary =
                getSummaryCombo(/* fontScaleIndex= */ 4, DEFAULT_PRESET_INDEX);
+2 −1
Original line number Diff line number Diff line
@@ -127,7 +127,8 @@ public class CaptioningBackgroundColorControllerTest {

    @Test
    public void onValueChanged_shouldSetCaptionEnabled() {
        mShadowCaptioningManager.setEnabled(false);
        Settings.Secure.putInt(
            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
        mController.displayPreference(mScreen);

        mController.onValueChanged(mPreference, 0xFFFF0000);
+2 −1
Original line number Diff line number Diff line
@@ -103,7 +103,8 @@ public class CaptioningBackgroundOpacityControllerTest {

    @Test
    public void onValueChanged_shouldSetCaptionEnabled() {
        mShadowCaptioningManager.setEnabled(false);
        Settings.Secure.putInt(
            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
        mController.displayPreference(mScreen);

        mController.onValueChanged(mPreference, 0x80FFFFFF);
+2 −1
Original line number Diff line number Diff line
@@ -101,7 +101,8 @@ public class CaptioningEdgeColorControllerTest {

    @Test
    public void onValueChanged_shouldSetCaptionEnabled() {
        mShadowCaptioningManager.setEnabled(false);
        Settings.Secure.putInt(
            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
        mController.displayPreference(mScreen);

        mController.onValueChanged(mPreference, 0xFFFF0000);
+2 −1
Original line number Diff line number Diff line
@@ -103,7 +103,8 @@ public class CaptioningEdgeTypeControllerTest {

    @Test
    public void onValueChanged_shouldSetCaptionEnabled() {
        mShadowCaptioningManager.setEnabled(false);
        Settings.Secure.putInt(
            mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, OFF);
        mController.displayPreference(mScreen);

        mController.onValueChanged(mPreference, CaptionStyle.EDGE_TYPE_OUTLINE);
Loading