Index: talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java |
diff --git a/talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java b/talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java |
index cd8bfcb48c7b4ae623e94a24ecafe38bf096bbb7..766c56fc3c2ea6f4140e9f003767fcfdd7a7fe9a 100644 |
--- a/talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java |
+++ b/talk/app/webrtc/androidtests/src/org/webrtc/RendererCommonTest.java |
@@ -36,7 +36,7 @@ import android.graphics.Point; |
import static org.webrtc.RendererCommon.ScalingType.*; |
import static org.webrtc.RendererCommon.getDisplaySize; |
import static org.webrtc.RendererCommon.getLayoutMatrix; |
-import static org.webrtc.RendererCommon.getSamplingMatrix; |
+import static org.webrtc.RendererCommon.rotateTextureMatrix; |
public class RendererCommonTest extends ActivityTestCase { |
@SmallTest |
@@ -149,27 +149,40 @@ public class RendererCommonTest extends ActivityTestCase { |
} |
@SmallTest |
- static public void testSamplingMatrixDefault() { |
- final float samplingMatrix[] = getSamplingMatrix(null, 0); |
+ static public void testRotateTextureMatrixDefault() { |
+ // Test that rotation with 0 degrees returns an identical matrix. |
+ final float[] matrix = new float[] { |
+ 1, 2, 3, 4, |
+ 5, 6, 7, 8, |
+ 9, 0, 1, 2, |
+ 3, 4, 5, 6 |
+ }; |
+ final float rotatedMatrix[] = rotateTextureMatrix(matrix, 0); |
+ MoreAsserts.assertEquals(round(rotatedMatrix), round(matrix)); |
+ } |
+ |
+ @SmallTest |
+ static public void testRotateTextureMatrix90Deg() { |
+ final float samplingMatrix[] = rotateTextureMatrix(RendererCommon.IDENTITY_MATRIX, 90); |
// Assert: |
- // u' = u. |
- // v' = 1 - v. |
+ // u' = 1 - v. |
+ // v' = u. |
MoreAsserts.assertEquals(round(samplingMatrix), new double[] |
- {1, 0, 0, 0, |
- 0, -1, 0, 0, |
- 0, 0, 1, 0, |
- 0, 1, 0, 1}); |
+ { 0, 1, 0, 0, |
+ -1, 0, 0, 0, |
+ 0, 0, 1, 0, |
+ 1, 0, 0, 1}); |
} |
@SmallTest |
- static public void testSamplingMatrixRotation90Deg() { |
- final float samplingMatrix[] = getSamplingMatrix(null, 90); |
+ static public void testRotateTextureMatrix180Deg() { |
+ final float samplingMatrix[] = rotateTextureMatrix(RendererCommon.IDENTITY_MATRIX, 180); |
// Assert: |
// u' = 1 - u. |
// v' = 1 - v. |
MoreAsserts.assertEquals(round(samplingMatrix), new double[] |
- { 0, -1, 0, 0, |
- -1, 0, 0, 0, |
+ {-1, 0, 0, 0, |
+ 0, -1, 0, 0, |
0, 0, 1, 0, |
1, 1, 0, 1}); |
} |