Skip to content

Commit ab13bde

Browse files
committed
task_list_item_test.dart
1 parent ade1ecc commit ab13bde

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

test/modules/home/task_list_item_test.dart

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ void main() {
6262
final Container container = tester.widget(containerFinder);
6363
final BoxDecoration decoration = container.decoration as BoxDecoration;
6464
expect(decoration.border!.top.color, isNot(Colors.red));
65-
expect((decoration.color as Color).alpha, isNot(50));
65+
expect(((decoration.color as Color).a * 255.0).round().clamp(0, 255),
66+
isNot(50));
6667
});
6768

6869
testWidgets('renders due soon task with red border',
@@ -104,8 +105,9 @@ void main() {
104105
final containerFinder = find.byType(Container).first;
105106
final Container container = tester.widget(containerFinder);
106107
final BoxDecoration decoration = container.decoration as BoxDecoration;
107-
expect((decoration.color as Color).red, Colors.red.red);
108-
expect((decoration.color as Color).alpha, 50);
108+
expect(((decoration.color as Color).r * 255.0).round().clamp(0, 255),
109+
(Colors.red.r * 255.0).round().clamp(0, 255));
110+
expect(((decoration.color as Color).a * 255.0).round().clamp(0, 255), 50);
109111
});
110112

111113
testWidgets('does not highlight tasks when useDelayTask is false',
@@ -127,7 +129,8 @@ void main() {
127129
final Container container = tester.widget(containerFinder);
128130
final BoxDecoration decoration = container.decoration as BoxDecoration;
129131
expect(decoration.border!.top.color, isNot(Colors.red));
130-
expect((decoration.color as Color).alpha, isNot(50));
132+
expect(((decoration.color as Color).a * 255.0).round().clamp(0, 255),
133+
isNot(50));
131134
});
132135
});
133136
}

0 commit comments

Comments
 (0)