summaryrefslogtreecommitdiff
path: root/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java
diff options
context:
space:
mode:
authorCyril Lee <cyrillee@google.com>2018-06-20 18:52:05 +0800
committerCyril Lee <cyrillee@google.com>2018-06-25 11:08:53 +0800
commite4d2a1d06a1aac5c71729f51834f5a9952120b3f (patch)
tree514d1c54661f11d42bf6c78894cc9d1c421eb8c6 /library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java
parent7c8910c4e435fe36f70a3a610491cd7d49c9d45d (diff)
downloadsetupwizard-e4d2a1d06a1aac5c71729f51834f5a9952120b3f.tar.gz
Fix video view without updates aspect ratio
The IllustrationVideoView should update size of view when new aspectRatio is different from current. Bug: 110098506 Test: "./gradlew test" on folder of ub-setupwizard-master branch Change-Id: I5a4663fa0949a285966be923f183c9f24c4a709c
Diffstat (limited to 'library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java')
-rw-r--r--library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java31
1 files changed, 31 insertions, 0 deletions
diff --git a/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java b/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java
index 2ef2b7d..7bcefd0 100644
--- a/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java
+++ b/library/test/robotest/src/com/android/setupwizardlib/shadow/ShadowMediaPlayer.java
@@ -34,6 +34,15 @@ import java.util.Map;
@Implements(MediaPlayer.class)
public class ShadowMediaPlayer extends org.robolectric.shadows.ShadowMediaPlayer {
+ private int mVideoWidth;
+ private int mVideoHeight;
+
+ public ShadowMediaPlayer() {
+ super();
+ mVideoWidth = -1;
+ mVideoHeight = -1;
+ }
+
@Implementation
public void setDataSource(
@NonNull Context context,
@@ -48,4 +57,26 @@ public class ShadowMediaPlayer extends org.robolectric.shadows.ShadowMediaPlayer
public void seekTo(long msec, int mode) {
seekTo((int) msec);
}
+
+ public void setVideoSize(int width, int height) {
+ if (width < 0) {
+ throw new IllegalArgumentException("Unexpected negative width=" + width);
+ }
+ if (height < 0) {
+ throw new IllegalArgumentException("Unexpected negative height=" + height);
+ }
+
+ mVideoWidth = width;
+ mVideoHeight = height;
+ }
+
+ @Override
+ public int getVideoWidth() {
+ return mVideoWidth;
+ }
+
+ @Override
+ public int getVideoHeight() {
+ return mVideoHeight;
+ }
}