import 'package:flutter/material.dart'; import 'package:flutter_animate/flutter_animate.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pluriwave/tema/pluri_animate.dart'; /// S5-R3: the central reduced-motion gate. When the OS reports /// disableAnimations, the helpers must return the child UNANIMATED /// (no [Animate] wrapper at all). void main() { Widget host({required bool reducedMotion, required WidgetBuilder builder}) { return MediaQuery( data: MediaQueryData(disableAnimations: reducedMotion), child: Directionality( textDirection: TextDirection.ltr, child: Builder(builder: builder), ), ); } testWidgets('pluriFadeIn anima en modo normal', (tester) async { await tester.pumpWidget( host( reducedMotion: false, builder: (context) => const Text('hola').pluriFadeIn(context), ), ); expect(find.byType(Animate), findsOneWidget); await tester.pumpAndSettle(); }); testWidgets('pluriFadeIn devuelve el hijo intacto con reduced motion', ( tester, ) async { await tester.pumpWidget( host( reducedMotion: true, builder: (context) => const Text('hola').pluriFadeIn(context), ), ); expect(find.byType(Animate), findsNothing); expect(find.text('hola'), findsOneWidget); }); testWidgets('pluriFadeSlideIn respeta el gate de reduced motion', ( tester, ) async { await tester.pumpWidget( host( reducedMotion: true, builder: (context) => const Text('hola').pluriFadeSlideIn(context, beginY: 0.2), ), ); expect(find.byType(Animate), findsNothing); await tester.pumpWidget( host( reducedMotion: false, builder: (context) => const Text('hola').pluriFadeSlideIn(context, beginY: 0.2), ), ); expect(find.byType(Animate), findsOneWidget); await tester.pumpAndSettle(); }); testWidgets('pluriScaleIn respeta el gate de reduced motion', (tester) async { await tester.pumpWidget( host( reducedMotion: true, builder: (context) => const Text('hola').pluriScaleIn(context), ), ); expect(find.byType(Animate), findsNothing); }); }