|
| 1 | +// Copyright 2013 The Flutter Authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +#include "flutter/flow/testing/diff_context_test.h" |
| 6 | + |
| 7 | +namespace flutter { |
| 8 | +namespace testing { |
| 9 | + |
| 10 | +TEST_F(DiffContextTest, ClipAlignment) { |
| 11 | + MockLayerTree t1; |
| 12 | + t1.root()->Add( |
| 13 | + CreatePictureLayer(CreatePicture(SkRect::MakeLTRB(30, 30, 50, 50), 1))); |
| 14 | + auto damage = DiffLayerTree(t1, MockLayerTree(), SkIRect::MakeEmpty(), 0, 0); |
| 15 | + EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(30, 30, 50, 50)); |
| 16 | + EXPECT_EQ(damage.buffer_damage, SkIRect::MakeLTRB(30, 30, 50, 50)); |
| 17 | + |
| 18 | + damage = DiffLayerTree(t1, MockLayerTree(), SkIRect::MakeEmpty(), 1, 1); |
| 19 | + EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(30, 30, 50, 50)); |
| 20 | + EXPECT_EQ(damage.buffer_damage, SkIRect::MakeLTRB(30, 30, 50, 50)); |
| 21 | + |
| 22 | + damage = DiffLayerTree(t1, MockLayerTree(), SkIRect::MakeEmpty(), 8, 1); |
| 23 | + EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(24, 30, 56, 50)); |
| 24 | + EXPECT_EQ(damage.buffer_damage, SkIRect::MakeLTRB(24, 30, 56, 50)); |
| 25 | + |
| 26 | + damage = DiffLayerTree(t1, MockLayerTree(), SkIRect::MakeEmpty(), 1, 8); |
| 27 | + EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(30, 24, 50, 56)); |
| 28 | + EXPECT_EQ(damage.buffer_damage, SkIRect::MakeLTRB(30, 24, 50, 56)); |
| 29 | + |
| 30 | + damage = DiffLayerTree(t1, MockLayerTree(), SkIRect::MakeEmpty(), 16, 16); |
| 31 | + EXPECT_EQ(damage.frame_damage, SkIRect::MakeLTRB(16, 16, 64, 64)); |
| 32 | + EXPECT_EQ(damage.buffer_damage, SkIRect::MakeLTRB(16, 16, 64, 64)); |
| 33 | +} |
| 34 | + |
| 35 | +} // namespace testing |
| 36 | +} // namespace flutter |
0 commit comments