@@ -901,6 +901,11 @@ void main() {
901
901
check (opacity.opacity).equals (expected ? 0.5 : 1.0 );
902
902
}
903
903
904
+ void checkHasOpacityValue (WidgetTester tester, Widget child, double expectedOpacity) {
905
+ check (find.byWidget (child).evaluate ()).length.equals (1 );
906
+ check (tester.widget <AnimatedOpacity >(find.byType (AnimatedOpacity )).opacity).equals (expectedOpacity);
907
+ }
908
+
904
909
testWidgets ('loading is changed correctly' , (WidgetTester tester) async {
905
910
final narrow = TopicNarrow .ofMessage (message);
906
911
await setupMessageListPage (tester,
@@ -945,6 +950,42 @@ void main() {
945
950
await tester.pump (const Duration (milliseconds: 2000 ));
946
951
checkAppearsLoading (tester, false );
947
952
});
953
+
954
+ testWidgets ('in idle state' , (WidgetTester tester) async {
955
+ final child = Container ();
956
+
957
+ await tester.pumpWidget (MaterialApp (
958
+ home: MarkAsReadAnimation (hidden: false , loading: false , child: child)));
959
+
960
+ checkHasOpacityValue (tester, child, 1 );
961
+ });
962
+
963
+ testWidgets ('in loading state' , (WidgetTester tester) async {
964
+ final child = Container ();
965
+
966
+ await tester.pumpWidget (MaterialApp (
967
+ home: MarkAsReadAnimation (hidden: false , loading: true , child: child)));
968
+
969
+ checkHasOpacityValue (tester, child, 0.5 );
970
+ });
971
+
972
+ testWidgets ('in hidden state' , (WidgetTester tester) async {
973
+ final child = Container ();
974
+
975
+ await tester.pumpWidget (MaterialApp (
976
+ home: MarkAsReadAnimation (hidden: true , loading: false , child: child)));
977
+
978
+ checkHasOpacityValue (tester, child, 0 );
979
+ });
980
+
981
+ testWidgets ('in hidden state but loading is true' , (WidgetTester tester) async {
982
+ final child = Container ();
983
+
984
+ await tester.pumpWidget (MaterialApp (
985
+ home: MarkAsReadAnimation (hidden: true , loading: true , child: child)));
986
+
987
+ checkHasOpacityValue (tester, child, 0 );
988
+ });
948
989
});
949
990
950
991
testWidgets ('smoke test on modern server' , (WidgetTester tester) async {
0 commit comments