@@ -114,6 +114,39 @@ void main() {
114114      check (renderObject).size.equals (Size .square (40 ));
115115    });
116116
117+     group ('AnimatedScaleOnTap' , () {
118+       void  checkScale (WidgetTester  tester, Finder  finder, double  expectedScale) {
119+         final  scale =  tester.widget <AnimatedScale >(finder).scale;
120+         check (scale).equals (expectedScale);
121+       }
122+ 
123+       testWidgets ('Animation happen instantly when tap down' , (tester) async  {
124+         addTearDown (testBinding.reset);
125+ 
126+         await  tester.pumpWidget (TestZulipApp (
127+           child:  AnimatedScaleOnTap (
128+             scaleEnd:  0.95 ,
129+             duration:  Duration (milliseconds:  100 ),
130+             child:  UnconstrainedBox (
131+               child:  ZulipIconButton (
132+                 icon:  ZulipIcons .follow,
133+                 onPressed:  () {})))));
134+         await  tester.pump ();
135+ 
136+         final  animatedScaleFinder =  find.byType (AnimatedScale );
137+ 
138+         // Now that the widget is being held down, its scale should be at the target scaleEnd i.e 0.95. 
139+         final  gesture =  await  tester.startGesture (tester.getCenter (find.byType (ZulipIconButton )));
140+         await  tester.pumpAndSettle ();
141+         checkScale (tester, animatedScaleFinder, 0.95 );
142+ 
143+         // After releasing, the scale must return to 1.0. 
144+         await  gesture.up ();
145+         await  tester.pumpAndSettle ();
146+         checkScale (tester, animatedScaleFinder, 1.0 );
147+       });
148+     });
149+ 
117150    // TODO test that the touch feedback fills the whole square 
118151  });
119152}
0 commit comments