Merge "Should popup the confirmation toast after clicking the reset button." into tm-dev am: 8cb0439d9c

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17822267

Change-Id: I14be163454ca16655f88e1d9195e891e065c21bc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
PETER LIANG
2022-04-20 13:01:07 +00:00
committed by Automerger Merge Worker
3 changed files with 21 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.shadows.ShadowToast;
import java.util.ArrayList;
import java.util.Arrays;
@@ -104,4 +105,18 @@ public class TextReadingPreferenceFragmentTest {
verify(listener1).resetState();
verify(listener2).resetState();
}
@Test
public void onDialogPositiveButtonClicked_boldTextEnabled_showToast() {
Settings.Secure.putInt(mContext.getContentResolver(),
Settings.Secure.FONT_WEIGHT_ADJUSTMENT, BOLD_TEXT_ADJUSTMENT);
final AlertDialog dialog = (AlertDialog) mFragment.onCreateDialog(
DialogEnums.DIALOG_RESET_SETTINGS);
dialog.show();
dialog.getButton(DialogInterface.BUTTON_POSITIVE).callOnClick();
assertThat(ShadowToast.getTextOfLatestToast())
.isEqualTo(mContext.getString(R.string.accessibility_text_reading_reset_message));
}
}