summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/gallery3d/ui/GLCanvasStub.java14
-rw-r--r--tests/src/com/android/gallery3d/ui/GLCanvasTest.java24
-rw-r--r--tests/src/com/android/gallery3d/ui/TextureTest.java11
3 files changed, 35 insertions, 14 deletions
diff --git a/tests/src/com/android/gallery3d/ui/GLCanvasStub.java b/tests/src/com/android/gallery3d/ui/GLCanvasStub.java
index afa34ac..e993223 100644
--- a/tests/src/com/android/gallery3d/ui/GLCanvasStub.java
+++ b/tests/src/com/android/gallery3d/ui/GLCanvasStub.java
@@ -19,7 +19,8 @@ package com.android.gallery3d.ui;
import android.graphics.Bitmap;
import android.graphics.RectF;
-import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
import javax.microedition.khronos.opengles.GL11;
@@ -132,8 +133,12 @@ public class GLCanvasStub extends GLCanvas {
int format, int type) {
}
@Override
- public int[] uploadBuffers(Buffer[] buffers) {
- return null;
+ public int uploadBuffer(ByteBuffer buffer) {
+ return 0;
+ }
+ @Override
+ public int uploadBuffer(FloatBuffer buffer) {
+ return 0;
}
@Override
public void setBlending(Blending blending) {
@@ -153,4 +158,7 @@ public class GLCanvasStub extends GLCanvas {
@Override
public void drawOnlyOutsideStencil(boolean onlyOutside) {
}
+ @Override
+ public void initialize(GL11 gl) {
+ }
}
diff --git a/tests/src/com/android/gallery3d/ui/GLCanvasTest.java b/tests/src/com/android/gallery3d/ui/GLCanvasTest.java
index 8df7a3d..ddbddad 100644
--- a/tests/src/com/android/gallery3d/ui/GLCanvasTest.java
+++ b/tests/src/com/android/gallery3d/ui/GLCanvasTest.java
@@ -39,7 +39,8 @@ public class GLCanvasTest extends TestCase {
@SmallTest
public void testSetSize() {
GL11 glStub = new GLStub();
- GLCanvas canvas = new GLCanvasImpl(glStub);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(glStub);
canvas.setSize(100, 200);
canvas.setSize(1000, 100);
try {
@@ -57,7 +58,8 @@ public class GLCanvasTest extends TestCase {
private static class ClearBufferTest extends GLMock {
void run() {
- GLCanvas canvas = new GLCanvasImpl(this);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(this);
assertEquals(0, mGLClearCalled);
canvas.clearBuffer();
assertEquals(GL10.GL_COLOR_BUFFER_BIT, mGLClearMask);
@@ -79,7 +81,8 @@ public class GLCanvasTest extends TestCase {
0x7F010101, 0xFEFEFDFC, 0x017F8081, 0x027F8081, 0x2ADE4C4D
};
- GLCanvas canvas = new GLCanvasImpl(this);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(this);
canvas.setSize(400, 300);
// Test one color to make sure blend function is set.
assertEquals(0, mGLColorCalled);
@@ -107,7 +110,8 @@ public class GLCanvasTest extends TestCase {
@SmallTest
public void testSetGetMultiplyAlpha() {
GL11 glStub = new GLStub();
- GLCanvas canvas = new GLCanvasImpl(glStub);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(glStub);
canvas.setAlpha(1f);
assertEquals(1f, canvas.getAlpha());
@@ -146,7 +150,8 @@ public class GLCanvasTest extends TestCase {
private static class AlphaTest extends GLMock {
void run() {
- GLCanvas canvas = new GLCanvasImpl(this);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(this);
canvas.setSize(400, 300);
assertEquals(0, mGLColorCalled);
@@ -188,7 +193,8 @@ public class GLCanvasTest extends TestCase {
}
void run() {
- GLCanvas canvas = new GLCanvasImpl(this);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(this);
canvas.setSize(400, 300);
canvas.drawLine(2, 7, 1, 8, newColorPaint(0) /* color */);
assertTrue(mGLVertexArrayEnabled);
@@ -232,7 +238,8 @@ public class GLCanvasTest extends TestCase {
}
void run() {
- GLCanvas canvas = new GLCanvasImpl(this);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(this);
canvas.setSize(400, 300);
canvas.fillRect(2, 7, 1, 8, 0 /* color */);
assertTrue(mGLVertexArrayEnabled);
@@ -294,7 +301,8 @@ public class GLCanvasTest extends TestCase {
}
void run() {
- GLCanvas canvas = new GLCanvasImpl(this);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(this);
canvas.setSize(40, 50);
int color = 0;
diff --git a/tests/src/com/android/gallery3d/ui/TextureTest.java b/tests/src/com/android/gallery3d/ui/TextureTest.java
index 36446b3..361bf7b 100644
--- a/tests/src/com/android/gallery3d/ui/TextureTest.java
+++ b/tests/src/com/android/gallery3d/ui/TextureTest.java
@@ -48,6 +48,7 @@ public class TextureTest extends TestCase {
return GL11.GL_TEXTURE_2D;
}
+ @Override
public boolean isOpaque() {
mOpaqueCalled++;
return true;
@@ -61,7 +62,8 @@ public class TextureTest extends TestCase {
@SmallTest
public void testBasicTexture() {
GL11 glStub = new GLStub();
- GLCanvas canvas = new GLCanvasImpl(glStub);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(glStub);
MyBasicTexture texture = new MyBasicTexture(canvas, 47);
assertEquals(47, texture.getId());
@@ -81,7 +83,8 @@ public class TextureTest extends TestCase {
assertTrue(texture.isLoaded());
// For a different GL, it's not loaded.
- GLCanvas canvas2 = new GLCanvasImpl(new GLStub());
+ GLCanvas canvas2 = new GLCanvasImpl();
+ canvas2.initialize(glStub);
assertFalse(texture.isLoaded());
assertEquals(0, texture.mOnBindCalled);
@@ -135,7 +138,8 @@ public class TextureTest extends TestCase {
@SmallTest
public void testUploadedTexture() {
GL11 glStub = new GLStub();
- GLCanvas canvas = new GLCanvasImpl(glStub);
+ GLCanvas canvas = new GLCanvasImpl();
+ canvas.initialize(glStub);
MyUploadedTexture texture = new MyUploadedTexture();
// draw it and the bitmap should be fetched.
@@ -181,6 +185,7 @@ public class TextureTest extends TestCase {
return GL11.GL_TEXTURE_2D;
}
+ @Override
public boolean isOpaque() {
return true;
}