Add setBackgroundColor() in VideoPreference
- Add setBackgroundColor() to allow changed background color of VideoPreference. - Add test case. Bug: 149974597 Test: make -j42 RunSettingsRoboTests Change-Id: I14f849d54657dc0ccbd599c393de6f430e9352d4
This commit is contained in:
@@ -32,6 +32,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.TextureView;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.preference.PreferenceFragmentCompat;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
@@ -60,6 +61,9 @@ public class VideoPreferenceTest {
|
||||
private ImageView fakePreview;
|
||||
@Mock
|
||||
private ImageView fakePlayButton;
|
||||
@Mock
|
||||
private LinearLayout mAnimationView;
|
||||
|
||||
private Context mContext;
|
||||
private VideoPreference mVideoPreference;
|
||||
private PreferenceViewHolder mPreferenceViewHolder;
|
||||
@@ -73,6 +77,7 @@ public class VideoPreferenceTest {
|
||||
new MediaAnimationController(mContext, R.raw.accessibility_screen_magnification));
|
||||
mVideoPreference = new VideoPreference(mContext, null /* attrs */);
|
||||
mVideoPreference.mAnimationController = mAnimationController;
|
||||
mVideoPreference.mAnimationView = mAnimationView;
|
||||
when(mAnimationController.getVideoWidth()).thenReturn(VIDEO_WIDTH);
|
||||
when(mAnimationController.getVideoHeight()).thenReturn(VIDEO_HEIGHT);
|
||||
|
||||
@@ -157,6 +162,13 @@ public class VideoPreferenceTest {
|
||||
assertThat(vp2.mAnimationController instanceof VectorAnimationController).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setBackgroundColor_shouldBeCalled() {
|
||||
mVideoPreference.setBackgroundColor(1111);
|
||||
|
||||
assertThat(mVideoPreference.mBackgroundResId).isEqualTo(1111);
|
||||
}
|
||||
|
||||
public static class TestFragment extends PreferenceFragmentCompat {
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
|
Reference in New Issue
Block a user