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

Commit 3b14c2ac authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger: Trivial Transaction_test refactoring."

parents 2abc5ab3 2b91c826
Loading
Loading
Loading
Loading
+87 −87
Original line number Diff line number Diff line
@@ -197,9 +197,9 @@ TEST_F(LayerUpdateTest, LayerMoveWorks) {
    {
        SCOPED_TRACE("before move");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel(  0,  12,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(0, 12);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -209,9 +209,9 @@ TEST_F(LayerUpdateTest, LayerMoveWorks) {
        // This should reflect the new position, but not the new color.
        SCOPED_TRACE("after move, before redraw");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75,  63,  63, 195);
        sc->checkPixel(145, 145, 195,  63,  63);
        sc->expectBGColor(24, 24);
        sc->expectBGColor(75, 75);
        sc->expectFGColor(145, 145);
    }

    fillSurfaceRGBA8(mFGSurfaceControl, 63, 195, 63);
@@ -220,8 +220,8 @@ TEST_F(LayerUpdateTest, LayerMoveWorks) {
        // This should reflect the new position and the new color.
        SCOPED_TRACE("after redraw");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectBGColor(75, 75);
        sc->checkPixel(145, 145, 63, 195, 63);
    }
}
@@ -231,9 +231,9 @@ TEST_F(LayerUpdateTest, LayerResizeWorks) {
    {
        SCOPED_TRACE("before resize");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel(  0,  12,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(0, 12);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    ALOGD("resizing");
@@ -246,9 +246,9 @@ TEST_F(LayerUpdateTest, LayerResizeWorks) {
        // has not yet received a buffer of the correct size.
        SCOPED_TRACE("after resize, before redraw");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel(  0,  12,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(0, 12);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    ALOGD("drawing");
@@ -259,7 +259,7 @@ TEST_F(LayerUpdateTest, LayerResizeWorks) {
        // This should reflect the new size and the new color.
        SCOPED_TRACE("after redraw");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->checkPixel(75, 75, 63, 195, 63);
        sc->checkPixel(145, 145, 63, 195, 63);
    }
@@ -270,9 +270,9 @@ TEST_F(LayerUpdateTest, LayerCropWorks) {
    {
        SCOPED_TRACE("before crop");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -283,11 +283,11 @@ TEST_F(LayerUpdateTest, LayerCropWorks) {
        // This should crop the foreground surface.
        SCOPED_TRACE("after crop");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75,  63,  63, 195);
        sc->checkPixel( 95,  80, 195,  63,  63);
        sc->checkPixel( 80,  95, 195,  63,  63);
        sc->checkPixel( 96,  96,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectBGColor(75, 75);
        sc->expectFGColor(95, 80);
        sc->expectFGColor(80, 95);
        sc->expectBGColor(96, 96);
    }
}

@@ -296,9 +296,9 @@ TEST_F(LayerUpdateTest, LayerFinalCropWorks) {
    {
        SCOPED_TRACE("before crop");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }
    SurfaceComposerClient::openGlobalTransaction();
    Rect cropRect(16, 16, 32, 32);
@@ -308,11 +308,11 @@ TEST_F(LayerUpdateTest, LayerFinalCropWorks) {
        // This should crop the foreground surface.
        SCOPED_TRACE("after crop");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75,  63,  63, 195);
        sc->checkPixel( 95,  80,  63,  63, 195);
        sc->checkPixel( 80,  95,  63,  63, 195);
        sc->checkPixel( 96,  96,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectBGColor(75, 75);
        sc->expectBGColor(95, 80);
        sc->expectBGColor(80, 95);
        sc->expectBGColor(96, 96);
    }
}

@@ -321,9 +321,9 @@ TEST_F(LayerUpdateTest, LayerSetLayerWorks) {
    {
        SCOPED_TRACE("before setLayer");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -333,9 +333,9 @@ TEST_F(LayerUpdateTest, LayerSetLayerWorks) {
        // This should hide the foreground surface beneath the background.
        SCOPED_TRACE("after setLayer");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75,  63,  63, 195);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectBGColor(75, 75);
        sc->expectBGColor(145, 145);
    }
}

@@ -344,9 +344,9 @@ TEST_F(LayerUpdateTest, LayerShowHideWorks) {
    {
        SCOPED_TRACE("before hide");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -356,9 +356,9 @@ TEST_F(LayerUpdateTest, LayerShowHideWorks) {
        // This should hide the foreground surface.
        SCOPED_TRACE("after hide, before show");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75,  63,  63, 195);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectBGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -368,9 +368,9 @@ TEST_F(LayerUpdateTest, LayerShowHideWorks) {
        // This should show the foreground surface.
        SCOPED_TRACE("after show");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }
}

@@ -379,9 +379,9 @@ TEST_F(LayerUpdateTest, LayerSetAlphaWorks) {
    {
        SCOPED_TRACE("before setAlpha");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -391,9 +391,9 @@ TEST_F(LayerUpdateTest, LayerSetAlphaWorks) {
        // This should set foreground to be 75% opaque.
        SCOPED_TRACE("after setAlpha");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->checkPixel(75, 75, 162, 63, 96);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(145, 145);
    }
}

@@ -402,9 +402,9 @@ TEST_F(LayerUpdateTest, LayerSetLayerStackWorks) {
    {
        SCOPED_TRACE("before setLayerStack");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -415,9 +415,9 @@ TEST_F(LayerUpdateTest, LayerSetLayerStackWorks) {
        // layer stack.
        SCOPED_TRACE("after setLayerStack");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75,  63,  63, 195);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectBGColor(75, 75);
        sc->expectBGColor(145, 145);
    }
}

@@ -426,9 +426,9 @@ TEST_F(LayerUpdateTest, LayerSetFlagsWorks) {
    {
        SCOPED_TRACE("before setFlags");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(75, 75);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -439,9 +439,9 @@ TEST_F(LayerUpdateTest, LayerSetFlagsWorks) {
        // This should hide the foreground surface
        SCOPED_TRACE("after setFlags");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 75,  75,  63,  63, 195);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectBGColor(75, 75);
        sc->expectBGColor(145, 145);
    }
}

@@ -450,10 +450,10 @@ TEST_F(LayerUpdateTest, LayerSetMatrixWorks) {
    {
        SCOPED_TRACE("before setMatrix");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 91,  96, 195,  63,  63);
        sc->checkPixel( 96, 101, 195,  63,  63);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(91, 96);
        sc->expectFGColor(96, 101);
        sc->expectBGColor(145, 145);
    }

    SurfaceComposerClient::openGlobalTransaction();
@@ -463,10 +463,10 @@ TEST_F(LayerUpdateTest, LayerSetMatrixWorks) {
    {
        SCOPED_TRACE("after setMatrix");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 24,  24,  63,  63, 195);
        sc->checkPixel( 91,  96, 195,  63,  63);
        sc->checkPixel( 96,  91,  63,  63, 195);
        sc->checkPixel(145, 145,  63,  63, 195);
        sc->expectBGColor(24, 24);
        sc->expectFGColor(91, 96);
        sc->expectBGColor(96, 91);
        sc->expectBGColor(145, 145);
    }
}

@@ -475,9 +475,9 @@ TEST_F(LayerUpdateTest, DeferredTransactionTest) {
    {
        SCOPED_TRACE("before anything");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 32,  32,  63,  63, 195);
        sc->checkPixel( 96,  96, 195,  63,  63);
        sc->checkPixel(160, 160,  63,  63, 195);
        sc->expectBGColor(32, 32);
        sc->expectFGColor(96, 96);
        sc->expectBGColor(160, 160);
    }

    // set up two deferred transactions on different frames
@@ -496,9 +496,9 @@ TEST_F(LayerUpdateTest, DeferredTransactionTest) {
    {
        SCOPED_TRACE("before any trigger");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 32,  32,  63,  63, 195);
        sc->checkPixel( 96,  96, 195,  63,  63);
        sc->checkPixel(160, 160,  63,  63, 195);
        sc->expectBGColor(32, 32);
        sc->expectFGColor(96, 96);
        sc->expectBGColor(160, 160);
    }

    // should trigger the first deferred transaction, but not the second one
@@ -506,9 +506,9 @@ TEST_F(LayerUpdateTest, DeferredTransactionTest) {
    {
        SCOPED_TRACE("after first trigger");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 32,  32,  63,  63, 195);
        sc->expectBGColor(32, 32);
        sc->checkPixel(96, 96, 162, 63, 96);
        sc->checkPixel(160, 160,  63,  63, 195);
        sc->expectBGColor(160, 160);
    }

    // should show up immediately since it's not deferred
@@ -521,9 +521,9 @@ TEST_F(LayerUpdateTest, DeferredTransactionTest) {
    {
        SCOPED_TRACE("after second trigger");
        ScreenCapture::captureScreen(&sc);
        sc->checkPixel( 32,  32,  63,  63, 195);
        sc->checkPixel( 96,  96,  63,  63, 195);
        sc->checkPixel(160, 160, 195,  63,  63);
        sc->expectBGColor(32, 32);
        sc->expectBGColor(96, 96);
        sc->expectFGColor(160, 160);
    }
}