Add summary and footer message for the ScreenResolutionFragment.
Bug: b/199559703 Test: Check resolution switch UI in Settings app atest SettingsUnitTests:ScreenResolutionControllerTest atest SettingsUnitTests:ScreenResolutionFragmentTest Change-Id: Iee1e74d3d4de81500b2abe62bc7e9bd69f55452c
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings.display;
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
@@ -28,6 +29,8 @@ import androidx.test.annotation.UiThreadTest;
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4;
|
||||
|
||||
import com.android.settingslib.widget.SelectorWithWidgetPreference;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -87,4 +90,19 @@ public class ScreenResolutionFragmentTest {
|
||||
|
||||
verify(mFragment).setDisplayMode(QHD_WIDTH);
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void bindPreferenceExtra_setSummary() {
|
||||
mFragment.onAttach(mContext);
|
||||
SelectorWithWidgetPreference preference = new SelectorWithWidgetPreference(mContext);
|
||||
ScreenResolutionFragment.ScreenResolutionCandidateInfo candidates =
|
||||
mock(ScreenResolutionFragment.ScreenResolutionCandidateInfo.class);
|
||||
CharSequence summary = "test summary";
|
||||
doReturn(summary).when(candidates).loadSummary();
|
||||
|
||||
mFragment.bindPreferenceExtra(preference, "com.example.test", candidates, null, null);
|
||||
|
||||
assertThat(preference.getSummary().toString().contentEquals(summary)).isTrue();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user