summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2012-05-18 11:30:26 -0700
committerOwen Lin <owenlin@google.com>2012-05-22 14:28:35 -0700
commit68386e085d3e2338be74996ff99672ff849467cb (patch)
tree74e1bcd78e4c172ecbd04946f1a5c4c624d265fd /tests
parentc5c5f2558e9ed3bc46a94c5515481b1dac9ffd77 (diff)
downloadandroid_packages_apps_Snap-68386e085d3e2338be74996ff99672ff849467cb.zip
android_packages_apps_Snap-68386e085d3e2338be74996ff99672ff849467cb.tar.gz
android_packages_apps_Snap-68386e085d3e2338be74996ff99672ff849467cb.tar.bz2
Add a new state uploading to UploadedTexture.
This state means the texture is being uploaded in background and should not be drawn now to prevent janking. Sometimes, we may lose GLContext and we will need to reupload textures again. In this case, we would like to upload these texture in foreground instead of using TextureUploader. (for simplicity since this won't happen too often). bug: 6519344 Change-Id: Ic5d7547c6a0eb4b044b79aa0eb4eb52397faac03
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/gallery3d/ui/TextureTest.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/src/com/android/gallery3d/ui/TextureTest.java b/tests/src/com/android/gallery3d/ui/TextureTest.java
index be2356c..9e34083 100644
--- a/tests/src/com/android/gallery3d/ui/TextureTest.java
+++ b/tests/src/com/android/gallery3d/ui/TextureTest.java
@@ -20,10 +20,10 @@ import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.test.suitebuilder.annotation.SmallTest;
-import javax.microedition.khronos.opengles.GL11;
-
import junit.framework.TestCase;
+import javax.microedition.khronos.opengles.GL11;
+
@SmallTest
public class TextureTest extends TestCase {
@SuppressWarnings("unused")
@@ -34,7 +34,7 @@ public class TextureTest extends TestCase {
int mOpaqueCalled;
MyBasicTexture(GLCanvas canvas, int id) {
- super(canvas, id, BasicTexture.STATE_UNLOADED);
+ super(canvas, id, 0);
}
@Override
@@ -54,7 +54,7 @@ public class TextureTest extends TestCase {
}
void upload() {
- mState = STATE_LOADED;
+ mState |= STATE_BIT_LOADED;
}
}
@@ -76,13 +76,13 @@ public class TextureTest extends TestCase {
assertEquals(4, texture.getTextureWidth());
assertEquals(8, texture.getTextureHeight());
- assertFalse(texture.isLoaded(canvas));
+ assertFalse(texture.isLoaded());
texture.upload();
- assertTrue(texture.isLoaded(canvas));
+ assertTrue(texture.isLoaded());
// For a different GL, it's not loaded.
GLCanvas canvas2 = new GLCanvasImpl(new GLStub());
- assertFalse(texture.isLoaded(canvas2));
+ assertFalse(texture.isLoaded());
assertEquals(0, texture.mOnBindCalled);
assertEquals(0, texture.mOpaqueCalled);
@@ -143,20 +143,20 @@ public class TextureTest extends TestCase {
assertEquals(0, texture.mGetCalled);
texture.draw(canvas, 0, 0);
assertEquals(1, texture.mGetCalled);
- assertTrue(texture.isLoaded(canvas));
- assertTrue(texture.isContentValid(canvas));
+ assertTrue(texture.isLoaded());
+ assertTrue(texture.isContentValid());
// invalidate content and it should be freed.
texture.invalidateContent();
- assertFalse(texture.isContentValid(canvas));
+ assertFalse(texture.isContentValid());
assertEquals(1, texture.mFreeCalled);
- assertTrue(texture.isLoaded(canvas)); // But it's still loaded
+ assertTrue(texture.isLoaded()); // But it's still loaded
// draw it again and the bitmap should be fetched again.
texture.draw(canvas, 0, 0);
assertEquals(2, texture.mGetCalled);
- assertTrue(texture.isLoaded(canvas));
- assertTrue(texture.isContentValid(canvas));
+ assertTrue(texture.isLoaded());
+ assertTrue(texture.isContentValid());
// recycle the texture and it should be freed again.
texture.recycle();
@@ -168,7 +168,7 @@ public class TextureTest extends TestCase {
class MyTextureForMixed extends BasicTexture {
MyTextureForMixed(GLCanvas canvas, int id) {
- super(canvas, id, BasicTexture.STATE_UNLOADED);
+ super(canvas, id, 0);
}
@Override