@@ -639,45 +639,43 @@ void main() {
639639 });
640640
641641 group ('NumberBox interval (hold-to-repeat) tests' , () {
642- testWidgets (
643- 'NumberBox auto-increments when spin button is held' ,
644- (tester) async {
645- int ? newValue;
646- await tester.pumpWidget (
647- wrapApp (
648- child: NumberBox <int >(
649- value: 0 ,
650- onChanged: (value) {
651- newValue = value;
652- },
653- mode: SpinButtonPlacementMode .inline,
654- interval: const Duration (milliseconds: 100 ),
655- ),
642+ testWidgets ('NumberBox auto-increments when spin button is held' , (
643+ tester,
644+ ) async {
645+ int ? newValue;
646+ await tester.pumpWidget (
647+ wrapApp (
648+ child: NumberBox <int >(
649+ value: 0 ,
650+ onChanged: (value) {
651+ newValue = value;
652+ },
653+ mode: SpinButtonPlacementMode .inline,
656654 ),
657- );
655+ ),
656+ );
658657
659- // Press and hold the increment button
660- final gesture = await tester.startGesture (
661- tester.getCenter (find.byIcon (FluentIcons .chevron_up)),
662- );
658+ // Press and hold the increment button
659+ final gesture = await tester.startGesture (
660+ tester.getCenter (find.byIcon (FluentIcons .chevron_up)),
661+ );
663662
664- // First increment fires immediately on pointer down
665- await tester.pump ();
666- expect (newValue, equals (1 ));
663+ // First increment fires immediately on pointer down
664+ await tester.pump ();
665+ expect (newValue, equals (1 ));
667666
668- // After one interval, should auto-increment again
669- await tester.pump (const Duration (milliseconds: 100 ));
670- expect (newValue, equals (2 ));
667+ // After one interval, should auto-increment again
668+ await tester.pump (const Duration (milliseconds: 100 ));
669+ expect (newValue, equals (2 ));
671670
672- // After another interval
673- await tester.pump (const Duration (milliseconds: 100 ));
674- expect (newValue, equals (3 ));
671+ // After another interval
672+ await tester.pump (const Duration (milliseconds: 100 ));
673+ expect (newValue, equals (3 ));
675674
676- // Release the button
677- await gesture.up ();
678- await tester.pumpAndSettle ();
679- },
680- );
675+ // Release the button
676+ await gesture.up ();
677+ await tester.pumpAndSettle ();
678+ });
681679
682680 testWidgets (
683681 'NumberBox auto-decrements when decrement spin button is held' ,
@@ -691,7 +689,6 @@ void main() {
691689 newValue = value;
692690 },
693691 mode: SpinButtonPlacementMode .inline,
694- interval: const Duration (milliseconds: 100 ),
695692 ),
696693 ),
697694 );
@@ -727,7 +724,6 @@ void main() {
727724 newValue = value;
728725 },
729726 mode: SpinButtonPlacementMode .inline,
730- interval: const Duration (milliseconds: 100 ),
731727 ),
732728 ),
733729 );
@@ -753,73 +749,70 @@ void main() {
753749 },
754750 );
755751
756- testWidgets (
757- 'NumberBox uses smallChange step during auto-repeat' ,
758- (tester) async {
759- int ? newValue;
760- await tester.pumpWidget (
761- wrapApp (
762- child: NumberBox <int >(
763- value: 0 ,
764- smallChange: 5 ,
765- onChanged: (value) {
766- newValue = value;
767- },
768- mode: SpinButtonPlacementMode .inline,
769- interval: const Duration (milliseconds: 100 ),
770- ),
752+ testWidgets ('NumberBox uses smallChange step during auto-repeat' , (
753+ tester,
754+ ) async {
755+ int ? newValue;
756+ await tester.pumpWidget (
757+ wrapApp (
758+ child: NumberBox <int >(
759+ value: 0 ,
760+ smallChange: 5 ,
761+ onChanged: (value) {
762+ newValue = value;
763+ },
764+ mode: SpinButtonPlacementMode .inline,
771765 ),
772- );
766+ ),
767+ );
773768
774- final gesture = await tester.startGesture (
775- tester.getCenter (find.byIcon (FluentIcons .chevron_up)),
776- );
769+ final gesture = await tester.startGesture (
770+ tester.getCenter (find.byIcon (FluentIcons .chevron_up)),
771+ );
777772
778- // Each step should be 5 (smallChange)
779- await tester.pump ();
780- expect (newValue, equals (5 ));
773+ // Each step should be 5 (smallChange)
774+ await tester.pump ();
775+ expect (newValue, equals (5 ));
781776
782- await tester.pump (const Duration (milliseconds: 100 ));
783- expect (newValue, equals (10 ));
777+ await tester.pump (const Duration (milliseconds: 100 ));
778+ expect (newValue, equals (10 ));
784779
785- await gesture.up ();
786- await tester.pumpAndSettle ();
787- },
788- );
780+ await gesture.up ();
781+ await tester.pumpAndSettle ();
782+ });
789783
790- testWidgets (
791- 'NumberBox does not auto-repeat when interval is null' ,
792- (tester) async {
793- int callCount = 0 ;
794- await tester.pumpWidget (
795- wrapApp (
796- child: NumberBox <int >(
797- value: 0 ,
798- onChanged: (value) {
799- callCount++ ;
800- },
801- mode: SpinButtonPlacementMode .inline,
802- interval: null ,
803- ),
784+ testWidgets ('NumberBox does not auto-repeat when interval is null' , (
785+ tester,
786+ ) async {
787+ var callCount = 0 ;
788+ await tester.pumpWidget (
789+ wrapApp (
790+ child: NumberBox <int >(
791+ value: 0 ,
792+ onChanged: (value) {
793+ callCount++ ;
794+ },
795+ mode: SpinButtonPlacementMode .inline,
796+ interval: null ,
804797 ),
805- );
798+ ),
799+ );
806800
807- // Press and hold the increment button
808- final gesture = await tester.startGesture (
809- tester.getCenter (find.byIcon (FluentIcons .chevron_up)),
810- );
801+ // Press and hold the increment button
802+ final gesture = await tester.startGesture (
803+ tester.getCenter (find.byIcon (FluentIcons .chevron_up)),
804+ );
811805
812- // First press fires immediately
813- await tester.pump ();
814- expect (callCount, equals (1 ));
806+ // First press fires immediately
807+ await tester.pump ();
808+ expect (callCount, equals (1 ));
815809
816- // Waiting well past a typical interval should not trigger more calls
817- await tester.pump (const Duration (milliseconds: 300 ));
818- expect (callCount, equals (1 ));
810+ // Waiting well past a typical interval should not trigger more calls
811+ await tester.pump (const Duration (milliseconds: 300 ));
812+ expect (callCount, equals (1 ));
819813
820- await gesture.up ();
821- await tester.pumpAndSettle ();
822- },
823- );
814+ await gesture.up ();
815+ await tester.pumpAndSettle ();
816+ });
824817 });
825818}
0 commit comments