Fix/decoration equality (#61551)
This commit is contained in:
@@ -321,7 +321,7 @@ class BoxDecoration extends Decoration {
|
||||
&& other.image == image
|
||||
&& other.border == border
|
||||
&& other.borderRadius == borderRadius
|
||||
&& other.boxShadow == boxShadow
|
||||
&& listEquals<BoxShadow>(other.boxShadow, boxShadow)
|
||||
&& other.gradient == gradient
|
||||
&& other.shape == shape;
|
||||
}
|
||||
@@ -333,7 +333,7 @@ class BoxDecoration extends Decoration {
|
||||
image,
|
||||
border,
|
||||
borderRadius,
|
||||
boxShadow,
|
||||
hashList(boxShadow),
|
||||
gradient,
|
||||
shape,
|
||||
);
|
||||
|
||||
@@ -257,7 +257,7 @@ class ShapeDecoration extends Decoration {
|
||||
&& other.color == color
|
||||
&& other.gradient == gradient
|
||||
&& other.image == image
|
||||
&& other.shadows == shadows
|
||||
&& listEquals<BoxShadow>(other.shadows, shadows)
|
||||
&& other.shape == shape;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ class ShapeDecoration extends Decoration {
|
||||
gradient,
|
||||
image,
|
||||
shape,
|
||||
shadows,
|
||||
hashList(shadows),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,21 @@ void main() {
|
||||
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', () {
|
||||
final ImageProvider imageProvider = SynchronousTestImageProvider();
|
||||
final DecorationImage backgroundImage = DecorationImage(image: imageProvider);
|
||||
|
||||
@@ -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));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user