Files
app_Settings/tests/robotests/src/com/android/settings/accessibility/TextReadingFragmentBaseControllerTest.java
Peter_Liang fcce62aa77 Logging for the feature "Text and reading options" in Android T.
Logging for the status of five features “Font size”, “Display size”, “Bold Text”, “High contrast text”, and “Reset” in the “Display size and text” page.

Bug: 222661478
Test: manual test
Change-Id: I33060fca860e02ddac7716275e8682e70fbaff1f
2022-04-27 15:25:30 +08:00

56 lines
2.2 KiB
Java

/*
* 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.accessibility;
import static com.android.settings.accessibility.TextReadingPreferenceFragment.EXTRA_LAUNCHED_FROM;
import static com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint.ACCESSIBILITY_SETTINGS;
import static com.android.settings.accessibility.TextReadingPreferenceFragment.EntryPoint.UNKNOWN_ENTRY;
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import androidx.preference.Preference;
import androidx.test.core.app.ApplicationProvider;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
/**
* Tests for {@link TextReadingFragmentBaseController}.
*/
@RunWith(RobolectricTestRunner.class)
public class TextReadingFragmentBaseControllerTest {
private static final String FRAGMENT_PREF_KEY = "FRAGMENT_PREF_KEY";
private final Context mContext = ApplicationProvider.getApplicationContext();
@Test
public void handlePreferenceClick_getExtraWithA11ySettingsEntryPoint() {
final Preference a11ySettingsPreference = new Preference(mContext);
a11ySettingsPreference.setKey(FRAGMENT_PREF_KEY);
final TextReadingFragmentBaseController mA11ySettingsFragmentController =
new TextReadingFragmentBaseController(mContext, FRAGMENT_PREF_KEY,
ACCESSIBILITY_SETTINGS);
mA11ySettingsFragmentController.handlePreferenceTreeClick(a11ySettingsPreference);
assertThat(a11ySettingsPreference.getExtras().getInt(EXTRA_LAUNCHED_FROM,
UNKNOWN_ENTRY)).isEqualTo(ACCESSIBILITY_SETTINGS);
}
}