summaryrefslogtreecommitdiffstats
path: root/libs/gui
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-11-14 11:54:38 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-11-14 11:54:38 -0800
commitd8fa1ad4523b6c04cab663ff4b65181fc00594d9 (patch)
tree7ed37b59efdc59ea95e8966d0a528fdec69689ce /libs/gui
parent527c44e8a455dd0fdef1aeb6d7d8f99bb0839295 (diff)
parent738d8cae2239d194429676f2889cfae3c8f7ba08 (diff)
downloadframeworks_base-d8fa1ad4523b6c04cab663ff4b65181fc00594d9.zip
frameworks_base-d8fa1ad4523b6c04cab663ff4b65181fc00594d9.tar.gz
frameworks_base-d8fa1ad4523b6c04cab663ff4b65181fc00594d9.tar.bz2
am 738d8cae: am c93a151f: Merge "Define, document, and test the behavior of very large SurfaceTextures" into ics-mr1
* commit '738d8cae2239d194429676f2889cfae3c8f7ba08': Define, document, and test the behavior of very large SurfaceTextures
Diffstat (limited to 'libs/gui')
-rw-r--r--libs/gui/tests/SurfaceTexture_test.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp
index 0d0654f..4268782 100644
--- a/libs/gui/tests/SurfaceTexture_test.cpp
+++ b/libs/gui/tests/SurfaceTexture_test.cpp
@@ -1520,4 +1520,36 @@ TEST_F(SurfaceTextureGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) {
EXPECT_EQ(1, buffers[2]->getStrongCount());
}
+TEST_F(SurfaceTextureGLTest, InvalidWidthOrHeightFails) {
+ int texHeight = 16;
+ ANativeWindowBuffer* anb;
+
+ GLint maxTextureSize;
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize);
+
+ // make sure it works with small textures
+ mST->setDefaultBufferSize(16, texHeight);
+ EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
+ EXPECT_EQ(16, anb->width);
+ EXPECT_EQ(texHeight, anb->height);
+ EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb));
+ EXPECT_EQ(NO_ERROR, mST->updateTexImage());
+
+ // make sure it works with GL_MAX_TEXTURE_SIZE
+ mST->setDefaultBufferSize(maxTextureSize, texHeight);
+ EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
+ EXPECT_EQ(maxTextureSize, anb->width);
+ EXPECT_EQ(texHeight, anb->height);
+ EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb));
+ EXPECT_EQ(NO_ERROR, mST->updateTexImage());
+
+ // make sure it fails with GL_MAX_TEXTURE_SIZE+1
+ mST->setDefaultBufferSize(maxTextureSize+1, texHeight);
+ EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb));
+ EXPECT_EQ(maxTextureSize+1, anb->width);
+ EXPECT_EQ(texHeight, anb->height);
+ EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb));
+ ASSERT_NE(NO_ERROR, mST->updateTexImage());
+}
+
} // namespace android