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
This commit is contained in:
Peter_Liang
2022-04-22 01:53:04 +08:00
parent fd7153ed39
commit fcce62aa77
14 changed files with 411 additions and 9 deletions

View File

@@ -0,0 +1,55 @@
/*
* 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);
}
}