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

Commit da5d6329 authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "SurfaceFlinger: Add a test to ensure buffer takes priority over blur"

parents e94a4998 5e3befda
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
@@ -154,6 +154,36 @@ TEST_F(LayerTransactionTest, DISABLED_BufferQueueLayerMergeDamageRegionWhenDropp

    ASSERT_EQ(OK, producer->disconnect(NATIVE_WINDOW_API_CPU));
}

// b/245052266 - we possible could support blur and a buffer at the same layer but
// might break existing assumptions at higher level. This test captures the current
// expectations. A layer drawing a buffer will not support blur.
TEST_F(LayerTransactionTest, BufferTakesPriorityOverBlur) {
    sp<SurfaceControl> layer;
    ASSERT_NO_FATAL_FAILURE(layer = createLayer("test", 32, 32));
    ASSERT_NO_FATAL_FAILURE(fillBufferStateLayerColor(layer, Color::RED, 32, 32));
    Transaction().setBackgroundBlurRadius(layer, 5).apply();
    {
        SCOPED_TRACE("BufferTakesPriorityOverBlur");
        const Rect rect(0, 0, 32, 32);
        auto shot = screenshot();
        shot->expectColor(rect, Color::RED);
    }
}

TEST_F(LayerTransactionTest, BufferTakesPriorityOverColor) {
    sp<SurfaceControl> layer;
    ASSERT_NO_FATAL_FAILURE(layer = createLayer("test", 32, 32));
    ASSERT_NO_FATAL_FAILURE(fillBufferStateLayerColor(layer, Color::RED, 32, 32));
    Transaction().setColor(layer, {Color::GREEN.r, Color::GREEN.g, Color::GREEN.b}).apply();
    {
        SCOPED_TRACE("BufferTakesPriorityOverColor");
        const Rect rect(0, 0, 32, 32);
        auto shot = screenshot();
        shot->expectColor(rect, Color::RED);
    }
}

} // namespace android

// TODO(b/129481165): remove the #pragma below and fix conversion issues