ANGLETest::SetUp: resize the window only if needed.
This avoids a flickering of the window at the start of every test.
BUG=angleproject:1105
Change-Id: Ib277ad5cfef97e00d27408f8feaa8ccba9a5e032
Reviewed-on: https://chromium-review.googlesource.com/287640
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/tests/test_utils/ANGLETest.cpp b/src/tests/test_utils/ANGLETest.cpp
index 2e6fdbd..3a1c77f 100644
--- a/src/tests/test_utils/ANGLETest.cpp
+++ b/src/tests/test_utils/ANGLETest.cpp
@@ -17,25 +17,28 @@
void ANGLETest::SetUp()
{
- if (!ResizeWindow(mWidth, mHeight))
- {
- FAIL() << "Failed to resize ANGLE test window.";
- }
-
if (!createEGLContext())
{
FAIL() << "egl context creation failed.";
}
- // Swap the buffers so that the default framebuffer picks up the resize
- // which will allow follow-up test code to assume the framebuffer covers
- // the whole window.
- swapBuffers();
+ if (mOSWindow->getWidth() != mWidth || mOSWindow->getHeight() != mHeight)
+ {
+ if (!mOSWindow->resize(mWidth, mHeight))
+ {
+ FAIL() << "Failed to resize ANGLE test window.";
+ }
- // This Viewport command is not strictly necessary but we add it so that programs
- // taking OpenGL traces can guess the size of the default framebuffer and show it
- // in their UIs
- glViewport(0, 0, mWidth, mHeight);
+ // Swap the buffers so that the default framebuffer picks up the resize
+ // which will allow follow-up test code to assume the framebuffer covers
+ // the whole window.
+ swapBuffers();
+
+ // This Viewport command is not strictly necessary but we add it so that programs
+ // taking OpenGL traces can guess the size of the default framebuffer and show it
+ // in their UIs
+ glViewport(0, 0, mWidth, mHeight);
+ }
}
void ANGLETest::TearDown()
@@ -250,11 +253,6 @@
return true;
}
-bool ANGLETest::ResizeWindow(int width, int height)
-{
- return mOSWindow->resize(width, height);
-}
-
void ANGLETest::SetWindowVisible(bool isVisible)
{
mOSWindow->setVisible(isVisible);