Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 57ad22d

Browse files
committed
Add a regression test.
1 parent 0784e31 commit 57ad22d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

display_list/skia/dl_sk_paint_dispatcher_unittests.cc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5+
#include "display_list/effects/dl_color_source.h"
56
#include "flutter/display_list/skia/dl_sk_paint_dispatcher.h"
67

78
#include "flutter/display_list/utils/dl_receiver_utils.h"
@@ -46,5 +47,23 @@ TEST(DisplayListUtils, SetColorSourceClearsDitherIfNotGradient) {
4647
EXPECT_FALSE(helper.paint().isDither());
4748
}
4849

50+
// https://github.com/flutter/flutter/issues/132860.
51+
TEST(DisplayListUtils, SetDitherTrueThenSetColorSourceDithersIfGradient) {
52+
// Create a simple linear gradient.
53+
const DlColor colors[2] = {0xFF000000, 0xFFFFFFFF};
54+
const float stops[2] = {0.0f, 1.0f};
55+
const auto linear_gradient = DlColorSource::MakeLinear(
56+
SkPoint::Make(0.0f, 0.0f), SkPoint::Make(100.0f, 100.0f), 2, colors,
57+
stops, DlTileMode::kClamp, nullptr);
58+
59+
MockDispatchHelper helper;
60+
61+
// A naive implementation would ignore the dither flag here since the current
62+
// color source is not a gradient.
63+
helper.setDither(true);
64+
helper.setColorSource(linear_gradient.get());
65+
EXPECT_TRUE(helper.paint().isDither());
66+
}
67+
4968
} // namespace testing
5069
} // namespace flutter

0 commit comments

Comments
 (0)