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

Commit 3d22f3ae authored by Chia-I Wu's avatar Chia-I Wu
Browse files

surfaceflinger: add more setLayerStack tests

Add LayerTransactionTest.
  SetLayerStackBasic

Test: SurfaceFlinger_test
Change-Id: Ica18beed20cecb958f79ec49a66ec5ee65278318
parent e4ef6102
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -988,6 +988,24 @@ TEST_F(LayerTransactionTest, SetColorWithBuffer) {
    screenshot()->expectColor(Rect(0, 0, 32, 32), Color::RED);
}

TEST_F(LayerTransactionTest, SetLayerStackBasic) {
    sp<SurfaceControl> layer;
    ASSERT_NO_FATAL_FAILURE(layer = createLayer("test", 32, 32));
    ASSERT_NO_FATAL_FAILURE(fillLayerColor(layer, Color::RED));

    Transaction().setLayerStack(layer, mDisplayLayerStack + 1).apply();
    {
        SCOPED_TRACE("non-existing layer stack");
        screenshot()->expectColor(Rect(0, 0, mDisplayWidth, mDisplayHeight), Color::BLACK);
    }

    Transaction().setLayerStack(layer, mDisplayLayerStack).apply();
    {
        SCOPED_TRACE("original layer stack");
        screenshot()->expectColor(Rect(0, 0, 32, 32), Color::RED);
    }
}

class LayerUpdateTest : public ::testing::Test {
protected:
    virtual void SetUp() {