[RRS] show resolution option on Settings page.
Due to the special width/ height of the device, we have to modify the
available condition otherwise the resolution option cannot be shown on Settings.
Bug: 258346214
Test: Lunch Settings and check the Display page
atest SettingsUnitTests:ScreenResolutionControllerTest
atest SettingsUnitTests:ScreenResolutionFragmentTest
Change-Id: Ie22df7dff6e31a7697c128eabe69dfe4bba29746
This commit is contained in:
@@ -37,59 +37,62 @@ public class ScreenResolutionFragmentTest {
|
||||
|
||||
private Context mContext;
|
||||
private ScreenResolutionFragment mFragment;
|
||||
|
||||
private static final int FHD_WIDTH = 1080;
|
||||
private static final int QHD_WIDTH = 1440;
|
||||
private ScreenResolutionController mController;
|
||||
private int mHighWidth;
|
||||
private int mFullWidth;
|
||||
|
||||
@Before
|
||||
@UiThreadTest
|
||||
public void setup() {
|
||||
mContext = spy(ApplicationProvider.getApplicationContext());
|
||||
mFragment = spy(new ScreenResolutionFragment());
|
||||
mController = spy(new ScreenResolutionController(mContext, "test"));
|
||||
mHighWidth = mController.getHighWidth();
|
||||
mFullWidth = mController.getFullWidth();
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void getDefaultKey_FHD() {
|
||||
Display.Mode mode = new Display.Mode(0, FHD_WIDTH, 0, 0);
|
||||
public void getDefaultKey_highResolution() {
|
||||
Display.Mode mode = new Display.Mode(0, mHighWidth, 0, 0);
|
||||
doReturn(mode).when(mFragment).getDisplayMode();
|
||||
doReturn(mContext).when(mFragment).getContext();
|
||||
|
||||
mFragment.onAttach(mContext);
|
||||
assertThat(mFragment.getDefaultKey()).isEqualTo(mFragment.getKeyForResolution(FHD_WIDTH));
|
||||
assertThat(mFragment.getDefaultKey()).isEqualTo(mFragment.getKeyForResolution(mHighWidth));
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void getDefaultKey_QHD() {
|
||||
Display.Mode mode = new Display.Mode(0, QHD_WIDTH, 0, 0);
|
||||
public void getDefaultKey_fullResolution() {
|
||||
Display.Mode mode = new Display.Mode(0, mFullWidth, 0, 0);
|
||||
doReturn(mode).when(mFragment).getDisplayMode();
|
||||
doReturn(mContext).when(mFragment).getContext();
|
||||
|
||||
mFragment.onAttach(mContext);
|
||||
assertThat(mFragment.getDefaultKey()).isEqualTo(mFragment.getKeyForResolution(QHD_WIDTH));
|
||||
assertThat(mFragment.getDefaultKey()).isEqualTo(mFragment.getKeyForResolution(mFullWidth));
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void setDefaultKey_FHD() {
|
||||
public void setDefaultKey_highResolution() {
|
||||
doReturn(mContext).when(mFragment).getContext();
|
||||
mFragment.onAttach(mContext);
|
||||
|
||||
mFragment.setDefaultKey(mFragment.getKeyForResolution(FHD_WIDTH));
|
||||
mFragment.setDefaultKey(mFragment.getKeyForResolution(mHighWidth));
|
||||
|
||||
verify(mFragment).setDisplayMode(FHD_WIDTH);
|
||||
verify(mFragment).setDisplayMode(mHighWidth);
|
||||
}
|
||||
|
||||
@Test
|
||||
@UiThreadTest
|
||||
public void setDefaultKey_QHD() {
|
||||
public void setDefaultKey_fullResolution() {
|
||||
doReturn(mContext).when(mFragment).getContext();
|
||||
mFragment.onAttach(mContext);
|
||||
|
||||
mFragment.setDefaultKey(mFragment.getKeyForResolution(QHD_WIDTH));
|
||||
mFragment.setDefaultKey(mFragment.getKeyForResolution(mFullWidth));
|
||||
|
||||
verify(mFragment).setDisplayMode(QHD_WIDTH);
|
||||
verify(mFragment).setDisplayMode(mFullWidth);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user