Unverified Commit 9ef81927 authored by Bogdan Lukin's avatar Bogdan Lukin Committed by GitHub

Fix/decoration equality (#61551)

parent 63ceeb8f
...@@ -321,7 +321,7 @@ class BoxDecoration extends Decoration { ...@@ -321,7 +321,7 @@ class BoxDecoration extends Decoration {
&& other.image == image && other.image == image
&& other.border == border && other.border == border
&& other.borderRadius == borderRadius && other.borderRadius == borderRadius
&& other.boxShadow == boxShadow && listEquals<BoxShadow>(other.boxShadow, boxShadow)
&& other.gradient == gradient && other.gradient == gradient
&& other.shape == shape; && other.shape == shape;
} }
...@@ -333,7 +333,7 @@ class BoxDecoration extends Decoration { ...@@ -333,7 +333,7 @@ class BoxDecoration extends Decoration {
image, image,
border, border,
borderRadius, borderRadius,
boxShadow, hashList(boxShadow),
gradient, gradient,
shape, shape,
); );
......
...@@ -257,7 +257,7 @@ class ShapeDecoration extends Decoration { ...@@ -257,7 +257,7 @@ class ShapeDecoration extends Decoration {
&& other.color == color && other.color == color
&& other.gradient == gradient && other.gradient == gradient
&& other.image == image && other.image == image
&& other.shadows == shadows && listEquals<BoxShadow>(other.shadows, shadows)
&& other.shape == shape; && other.shape == shape;
} }
...@@ -268,7 +268,7 @@ class ShapeDecoration extends Decoration { ...@@ -268,7 +268,7 @@ class ShapeDecoration extends Decoration {
gradient, gradient,
image, image,
shape, shape,
shadows, hashList(shadows),
); );
} }
......
...@@ -126,6 +126,21 @@ void main() { ...@@ -126,6 +126,21 @@ void main() {
expect(c.color, equals(b.color)); expect(c.color, equals(b.color));
}); });
test('Decoration equality', () {
const BoxDecoration a = BoxDecoration(
color: Color(0xFFFFFFFF),
boxShadow: <BoxShadow>[BoxShadow()],
);
const BoxDecoration b = BoxDecoration(
color: Color(0xFFFFFFFF),
boxShadow: <BoxShadow>[BoxShadow()],
);
expect(a.hashCode, equals(b.hashCode));
expect(a, equals(b));
});
test('BoxDecorationImageListenerSync', () { test('BoxDecorationImageListenerSync', () {
final ImageProvider imageProvider = SynchronousTestImageProvider(); final ImageProvider imageProvider = SynchronousTestImageProvider();
final DecorationImage backgroundImage = DecorationImage(image: imageProvider); final DecorationImage backgroundImage = DecorationImage(image: imageProvider);
......
...@@ -115,4 +115,21 @@ Future<void> main() async { ...@@ -115,4 +115,21 @@ Future<void> main() async {
], ],
); );
}); });
test('ShapeDecoration equality', () {
const ShapeDecoration a = ShapeDecoration(
color: Color(0xFFFFFFFF),
shadows: <BoxShadow>[BoxShadow()],
shape: Border(),
);
const ShapeDecoration b = ShapeDecoration(
color: Color(0xFFFFFFFF),
shadows: <BoxShadow>[BoxShadow()],
shape: Border(),
);
expect(a.hashCode, equals(b.hashCode));
expect(a, equals(b));
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment