Index: webrtc/api/androidtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java |
diff --git a/webrtc/api/androidtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java b/webrtc/api/androidtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java |
index 60720ff955dc155f75ad276afea96fb1141f40eb..300cdf81319bdd7284b869fa4d684b929845b59c 100644 |
--- a/webrtc/api/androidtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java |
+++ b/webrtc/api/androidtests/src/org/webrtc/SurfaceViewRendererOnMeasureTest.java |
@@ -24,8 +24,7 @@ public final class SurfaceViewRendererOnMeasureTest extends ActivityTestCase { |
* List with all possible scaling types. |
*/ |
private static final List<RendererCommon.ScalingType> scalingTypes = Arrays.asList( |
- RendererCommon.ScalingType.SCALE_ASPECT_FIT, |
- RendererCommon.ScalingType.SCALE_ASPECT_FILL, |
+ RendererCommon.ScalingType.SCALE_ASPECT_FIT, RendererCommon.ScalingType.SCALE_ASPECT_FILL, |
RendererCommon.ScalingType.SCALE_ASPECT_BALANCED); |
/** |
@@ -50,22 +49,19 @@ public final class SurfaceViewRendererOnMeasureTest extends ActivityTestCase { |
/** |
* Assert onMeasure() with given parameters will result in expected measured size. |
*/ |
- private static void assertMeasuredSize( |
- SurfaceViewRenderer surfaceViewRenderer, RendererCommon.ScalingType scalingType, |
- String frameDimensions, |
- int expectedWidth, int expectedHeight, |
- int widthSpec, int heightSpec) { |
+ private static void assertMeasuredSize(SurfaceViewRenderer surfaceViewRenderer, |
+ RendererCommon.ScalingType scalingType, String frameDimensions, int expectedWidth, |
+ int expectedHeight, int widthSpec, int heightSpec) { |
surfaceViewRenderer.setScalingType(scalingType); |
surfaceViewRenderer.onMeasure(widthSpec, heightSpec); |
final int measuredWidth = surfaceViewRenderer.getMeasuredWidth(); |
final int measuredHeight = surfaceViewRenderer.getMeasuredHeight(); |
if (measuredWidth != expectedWidth || measuredHeight != expectedHeight) { |
- fail("onMeasure(" |
- + MeasureSpec.toString(widthSpec) + ", " + MeasureSpec.toString(heightSpec) + ")" |
- + " with scaling type " + scalingType |
- + " and frame: " + frameDimensions |
- + " expected measured size " + expectedWidth + "x" + expectedHeight |
- + ", but was " + measuredWidth + "x" + measuredHeight); |
+ fail("onMeasure(" + MeasureSpec.toString(widthSpec) + ", " + MeasureSpec.toString(heightSpec) |
+ + ")" |
+ + " with scaling type " + scalingType + " and frame: " + frameDimensions |
+ + " expected measured size " + expectedWidth + "x" + expectedHeight + ", but was " |
+ + measuredWidth + "x" + measuredHeight); |
} |
} |
@@ -82,24 +78,22 @@ public final class SurfaceViewRendererOnMeasureTest extends ActivityTestCase { |
for (RendererCommon.ScalingType scalingType : scalingTypes) { |
for (int measureSpecMode : measureSpecModes) { |
final int zeroMeasureSize = MeasureSpec.makeMeasureSpec(0, measureSpecMode); |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- 0, 0, zeroMeasureSize, zeroMeasureSize); |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- 1280, 720, |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, 0, 0, zeroMeasureSize, |
+ zeroMeasureSize); |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, 1280, 720, |
MeasureSpec.makeMeasureSpec(1280, measureSpecMode), |
MeasureSpec.makeMeasureSpec(720, measureSpecMode)); |
} |
} |
- // Test behaviour after SurfaceViewRenderer.init() is called, but still no frame. |
+ // Test behaviour after SurfaceViewRenderer.init() is called, but still no frame. |
surfaceViewRenderer.init((EglBase.Context) null, null); |
for (RendererCommon.ScalingType scalingType : scalingTypes) { |
for (int measureSpecMode : measureSpecModes) { |
final int zeroMeasureSize = MeasureSpec.makeMeasureSpec(0, measureSpecMode); |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- 0, 0, zeroMeasureSize, zeroMeasureSize); |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- 1280, 720, |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, 0, 0, zeroMeasureSize, |
+ zeroMeasureSize); |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, 1280, 720, |
MeasureSpec.makeMeasureSpec(1280, measureSpecMode), |
MeasureSpec.makeMeasureSpec(720, measureSpecMode)); |
} |
@@ -163,25 +157,23 @@ public final class SurfaceViewRendererOnMeasureTest extends ActivityTestCase { |
for (RendererCommon.ScalingType scalingType : scalingTypes) { |
for (int measureSpecMode : measureSpecModes) { |
final int zeroMeasureSize = MeasureSpec.makeMeasureSpec(0, measureSpecMode); |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- 0, 0, zeroMeasureSize, zeroMeasureSize); |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, 0, 0, |
+ zeroMeasureSize, zeroMeasureSize); |
} |
} |
// Test perfect fit. |
for (RendererCommon.ScalingType scalingType : scalingTypes) { |
for (int measureSpecMode : measureSpecModes) { |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- rotatedWidth, rotatedHeight, |
- MeasureSpec.makeMeasureSpec(rotatedWidth, measureSpecMode), |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, rotatedWidth, |
+ rotatedHeight, MeasureSpec.makeMeasureSpec(rotatedWidth, measureSpecMode), |
MeasureSpec.makeMeasureSpec(rotatedHeight, measureSpecMode)); |
} |
} |
// Force spec size with different aspect ratio than frame aspect ratio. |
for (RendererCommon.ScalingType scalingType : scalingTypes) { |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- 720, 1280, |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, 720, 1280, |
MeasureSpec.makeMeasureSpec(720, MeasureSpec.EXACTLY), |
MeasureSpec.makeMeasureSpec(1280, MeasureSpec.EXACTLY)); |
} |
@@ -194,8 +186,8 @@ public final class SurfaceViewRendererOnMeasureTest extends ActivityTestCase { |
for (RendererCommon.ScalingType scalingType : scalingTypes) { |
final Point expectedSize = |
RendererCommon.getDisplaySize(scalingType, videoAspectRatio, 720, 1280); |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- expectedSize.x, expectedSize.y, widthSpec, heightSpec); |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, expectedSize.x, |
+ expectedSize.y, widthSpec, heightSpec); |
} |
} |
{ |
@@ -206,8 +198,8 @@ public final class SurfaceViewRendererOnMeasureTest extends ActivityTestCase { |
for (RendererCommon.ScalingType scalingType : scalingTypes) { |
final Point expectedSize = |
RendererCommon.getDisplaySize(scalingType, videoAspectRatio, 720, 1280); |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- expectedSize.x, expectedSize.y, widthSpec, heightSpec); |
+ assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, expectedSize.x, |
+ expectedSize.y, widthSpec, heightSpec); |
} |
} |
{ |
@@ -215,8 +207,8 @@ public final class SurfaceViewRendererOnMeasureTest extends ActivityTestCase { |
final int widthSpec = MeasureSpec.makeMeasureSpec(720, MeasureSpec.AT_MOST); |
final int heightSpec = MeasureSpec.makeMeasureSpec(1280, MeasureSpec.EXACTLY); |
for (RendererCommon.ScalingType scalingType : scalingTypes) { |
- assertMeasuredSize(surfaceViewRenderer, scalingType, frameDimensions, |
- 720, 1280, widthSpec, heightSpec); |
+ assertMeasuredSize( |
+ surfaceViewRenderer, scalingType, frameDimensions, 720, 1280, widthSpec, heightSpec); |
} |
} |
} |