Add turn screen darker fragment in a11y settings text and display

Accessibility settings category restructure, add turn screen darker
fragment for related accessibility services.

Bug: 174829936
Test: atest TurnScreenDarkerFragmentTest, atest AccessibilitySettingsTest
Change-Id: I8aef7a0b5a6d407813aadb22d7ade5103533efa4
This commit is contained in:
Ben Chung
2021-01-28 16:19:55 +08:00
parent 74eb482fba
commit 359665c3b0
6 changed files with 258 additions and 73 deletions

View File

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2021 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.google.common.truth.Truth.assertThat;
import android.content.Context;
import androidx.test.core.app.ApplicationProvider;
import com.android.settings.R;
import com.android.settings.testutils.XmlTestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import java.util.List;
/** Tests for {@link TurnScreenDarkerFragment}. */
@RunWith(RobolectricTestRunner.class)
public class TurnScreenDarkerFragmentTest {
private Context mContext = ApplicationProvider.getApplicationContext();
@Test
public void getNonIndexableKeys_existInXmlLayout() {
final List<String> niks = TurnScreenDarkerFragment.SEARCH_INDEX_DATA_PROVIDER
.getNonIndexableKeys(mContext);
final List<String> keys =
XmlTestUtils.getKeysFromPreferenceXml(mContext,
R.xml.accessibility_turn_screen_darker);
assertThat(keys).containsAtLeastElementsIn(niks);
}
}