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

Commit 5e3befda authored by Vishnu Nair's avatar Vishnu Nair
Browse files

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

Test: atest
LayerTransactionTest#BufferTakesPriorityOverBlur
Bug: 245052266

Change-Id: Ide73878fc55e0b75cc63076cba82f16e6e91446c
parent 89eca324
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