summaryrefslogtreecommitdiffstats
path: root/tests/src
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
commit37c605949219b8bf54c165c34d6405f5f2989f50 (patch)
tree1ce579fb9e7374bc1026199adefe5806a1ae60a9 /tests/src
parente919bcff63e898d53869725a979cdfd01ef92b08 (diff)
downloadandroid_packages_apps_Gallery2-37c605949219b8bf54c165c34d6405f5f2989f50.tar.gz
android_packages_apps_Gallery2-37c605949219b8bf54c165c34d6405f5f2989f50.tar.bz2
android_packages_apps_Gallery2-37c605949219b8bf54c165c34d6405f5f2989f50.zip
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/src')
-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 be2356c8e..9e34083b8 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