Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4697528e authored by Jamie Gennis's avatar Jamie Gennis
Browse files

SurfaceTexture: fix a few tests

Change-Id: Ic74fe8791361f8fe91ad7149720fafd4cc154ac1
parent d69097f9
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -241,7 +241,7 @@ TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) {
    EXPECT_EQ(1, buf->height);
    EXPECT_EQ(1, buf->height);
    EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format);
    EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format);
    ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1));
    ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1));
    EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0));
    EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 16, 8));
    ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
    ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf));
    EXPECT_EQ(16, buf->width);
    EXPECT_EQ(16, buf->width);
    EXPECT_EQ(8, buf->height);
    EXPECT_EQ(8, buf->height);
@@ -597,15 +597,15 @@ TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWi
    ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 6)); // frees buffers
    ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 6)); // frees buffers
    mST->getTransformMatrix(mtx);
    mST->getTransformMatrix(mtx);


    // This accounts for the 1 texel shrink for each edge that's included in the
    // This accounts for the .5 texel shrink for each edge that's included in the
    // transform matrix to avoid texturing outside the crop region.
    // transform matrix to avoid texturing outside the crop region.
    EXPECT_EQ(.375f, mtx[0]);
    EXPECT_EQ(0.5, mtx[0]);
    EXPECT_EQ(0.f, mtx[1]);
    EXPECT_EQ(0.f, mtx[1]);
    EXPECT_EQ(0.f, mtx[2]);
    EXPECT_EQ(0.f, mtx[2]);
    EXPECT_EQ(0.f, mtx[3]);
    EXPECT_EQ(0.f, mtx[3]);


    EXPECT_EQ(0.f, mtx[4]);
    EXPECT_EQ(0.f, mtx[4]);
    EXPECT_EQ(-.375f, mtx[5]);
    EXPECT_EQ(-0.5, mtx[5]);
    EXPECT_EQ(0.f, mtx[6]);
    EXPECT_EQ(0.f, mtx[6]);
    EXPECT_EQ(0.f, mtx[7]);
    EXPECT_EQ(0.f, mtx[7]);


@@ -614,8 +614,8 @@ TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWi
    EXPECT_EQ(1.f, mtx[10]);
    EXPECT_EQ(1.f, mtx[10]);
    EXPECT_EQ(0.f, mtx[11]);
    EXPECT_EQ(0.f, mtx[11]);


    EXPECT_EQ(.125f, mtx[12]);
    EXPECT_EQ(0.0625f, mtx[12]);
    EXPECT_EQ(.5f, mtx[13]);
    EXPECT_EQ(0.5625f, mtx[13]);
    EXPECT_EQ(0.f, mtx[14]);
    EXPECT_EQ(0.f, mtx[14]);
    EXPECT_EQ(1.f, mtx[15]);
    EXPECT_EQ(1.f, mtx[15]);
}
}
+12 −0
Original line number Original line Diff line number Diff line
@@ -1420,6 +1420,9 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromGLFilledRGBABufferPow2) {


    mST->setDefaultBufferSize(texWidth, texHeight);
    mST->setDefaultBufferSize(texWidth, texHeight);


    // This test requires 3 buffers to complete run on a single thread.
    mST->setDefaultMaxBufferCount(3);

    // Do the producer side of things
    // Do the producer side of things
    EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
    EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface,
            mProducerEglSurface, mProducerEglContext));
            mProducerEglSurface, mProducerEglContext));
@@ -1612,6 +1615,9 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromUserSizedGLFilledBuffer) {
    enum { texWidth = 64 };
    enum { texWidth = 64 };
    enum { texHeight = 64 };
    enum { texHeight = 64 };


    // This test requires 3 buffers to complete run on a single thread.
    mST->setDefaultMaxBufferCount(3);

    // Set the user buffer size.
    // Set the user buffer size.
    native_window_set_buffers_user_dimensions(mANW.get(), texWidth, texHeight);
    native_window_set_buffers_user_dimensions(mANW.get(), texWidth, texHeight);


@@ -1666,6 +1672,9 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedUserSizedGLFilledBuffer)
    enum { texWidth = 64 };
    enum { texWidth = 64 };
    enum { texHeight = 16 };
    enum { texHeight = 16 };


    // This test requires 3 buffers to complete run on a single thread.
    mST->setDefaultMaxBufferCount(3);

    // Set the transform hint.
    // Set the transform hint.
    mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90);
    mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90);


@@ -1724,6 +1733,9 @@ TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedGLFilledBuffer) {
    enum { texWidth = 64 };
    enum { texWidth = 64 };
    enum { texHeight = 16 };
    enum { texHeight = 16 };


    // This test requires 3 buffers to complete run on a single thread.
    mST->setDefaultMaxBufferCount(3);

    // Set the transform hint.
    // Set the transform hint.
    mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90);
    mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90);