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

Commit a6f35dd3 authored by Jamie Gennis's avatar Jamie Gennis
Browse files

SurfaceTexture: add a format querying test.

This change adds a test to verify that querying the format of a
SurfaceTextureClient immediately after setting it returns the correct
result.  The test is currently disabled because it does not pass.

Change-Id: I5bddb39c5bf96d6104624094383d410ed913e9f3
parent 72f6af86
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -622,4 +622,29 @@ TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWi
    EXPECT_EQ(1.f, mtx[15]);
}

// This test verifies that the buffer format can be queried immediately after
// it is set.
TEST_F(SurfaceTextureClientTest, DISABLED_QueryFormatAfterSettingWorks) {
    sp<ANativeWindow> anw(mSTC);
    int fmts[] = {
        // RGBA_8888 should not come first, as it's the default
        HAL_PIXEL_FORMAT_RGBX_8888,
        HAL_PIXEL_FORMAT_RGBA_8888,
        HAL_PIXEL_FORMAT_RGB_888,
        HAL_PIXEL_FORMAT_RGB_565,
        HAL_PIXEL_FORMAT_BGRA_8888,
        HAL_PIXEL_FORMAT_RGBA_5551,
        HAL_PIXEL_FORMAT_RGBA_4444,
        HAL_PIXEL_FORMAT_YV12,
    };

    const int numFmts = (sizeof(fmts) / sizeof(fmts[0]));
    for (int i = 0; i < numFmts; i++) {
      int fmt = -1;
      ASSERT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 0, 0, fmts[i]));
      ASSERT_EQ(OK, anw->query(anw.get(), NATIVE_WINDOW_FORMAT, &fmt));
      EXPECT_EQ(fmts[i], fmt);
    }
}

} // namespace android