[DO NOT MERGE] Fixed LocalDisplayAdapterTest test failure

The test resources is a mock object so it's still possible to return
null in Resources#obtainTypedArray.

Add mocks for new added resource configs.

Bug: 194879684
Test: atest LocalDisplayAdapterTest
Change-Id: Ie5e09e8c43848273d696392da992b366d2514461
This commit is contained in:
shawnlin
2021-07-28 22:22:10 +08:00
parent f04b9b8231
commit dcc1ed475a

View File

@@ -134,6 +134,14 @@ public class LocalDisplayAdapterTest {
when(mMockedResources.getFloat(com.android.internal.R.dimen
.config_screenBrightnessSettingMaximumFloat))
.thenReturn(BACKLIGHT_RANGE_ZERO_TO_ONE[1]);
when(mMockedResources.getStringArray(R.array.config_displayUniqueIdArray))
.thenReturn(new String[]{});
TypedArray mockArray = mock(TypedArray.class);
when(mockArray.length()).thenReturn(0);
when(mMockedResources.obtainTypedArray(R.array.config_maskBuiltInDisplayCutoutArray))
.thenReturn(mockArray);
when(mMockedResources.obtainTypedArray(R.array.config_waterfallCutoutArray))
.thenReturn(mockArray);
}
@After