| 123456789101112131415161718192021222324252627282930313233343536373839 |
- import 'package:cardash_launcher/features/home/widgets/marquee_text.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_test/flutter_test.dart';
- void main() {
- testWidgets('long text duplicates for a seamless loop', (tester) async {
- const title = 'A very long song title that cannot possibly fit';
- await tester.pumpWidget(
- const MaterialApp(
- home: Scaffold(
- body: SizedBox(
- width: 140,
- child: MarqueeText(text: title, animate: true),
- ),
- ),
- ),
- );
- await tester.pump(const Duration(milliseconds: 100));
- expect(tester.takeException(), isNull);
- expect(find.text(title), findsNWidgets(2));
- });
- testWidgets('paused marquee does not animate', (tester) async {
- const title = 'A very long song title that cannot possibly fit';
- await tester.pumpWidget(
- const MaterialApp(
- home: Scaffold(
- body: SizedBox(
- width: 140,
- child: MarqueeText(text: title, animate: false),
- ),
- ),
- ),
- );
- await tester.pump();
- expect(tester.binding.transientCallbackCount, 0);
- });
- }
|