Commit 15ca8296 by Corentin Wallez

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/287640Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent f3357ee2
......@@ -17,25 +17,28 @@ ANGLETest::~ANGLETest()
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.";
}
// 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);
// 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 @@ bool ANGLETest::DestroyTestWindow()
return true;
}
bool ANGLETest::ResizeWindow(int width, int height)
{
return mOSWindow->resize(width, height);
}
void ANGLETest::SetWindowVisible(bool isVisible)
{
mOSWindow->setVisible(isVisible);
......
......@@ -67,7 +67,6 @@ class ANGLETest : public ::testing::TestWithParam<angle::PlatformParameters>
public:
static bool InitTestWindow();
static bool DestroyTestWindow();
static bool ResizeWindow(int width, int height);
static void SetWindowVisible(bool isVisible);
protected:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment