import 'package:cutdex/app/editor_theme.dart'; import 'package:cutdex/features/editor/editor_panel_defaults.dart'; import 'package:cutdex/features/preview/preview_panel.dart'; import 'package:cutdex/l10n/app_localizations.dart'; import 'package:cutdex_sdk/editor.dart'; import 'package:cutdex_ui/icons.dart'; import 'package:cutdex_ui/widgets.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { testWidgets('pending preview uses black, zero times and default ratio', ( tester, ) async { await tester.pumpWidget( ProviderScope( child: MaterialApp( theme: EditorTheme.penLight, localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, locale: const Locale('en'), home: const Scaffold( body: EditorPreviewPanel( projectId: 'pending-project', timelineId: '', pending: true, ), ), ), ), ); expect(find.text('00:00:00:00 / 00:00:00:00'), findsOneWidget); expect( tester .widget(find.byKey(const Key('preview-default-frame'))) .color, Colors.black, ); final ratio = tester.widget>( find.byType(AppSelect), ); expect(ratio.value, ProjectCanvas.widescreen); expect(ratio.onChanged, isNull); final play = tester.widget( find.widgetWithIcon(IconButton, AppIcons.play), ); expect(play.onPressed, isNull); expect(find.byType(CircularProgressIndicator), findsNothing); expect(tester.takeException(), isNull); await tester.pumpWidget(const SizedBox()); }); testWidgets('default timeline has empty content and disabled commands', ( tester, ) async { await tester.pumpWidget( MaterialApp( theme: EditorTheme.desktop(EditorTheme.penLight), localizationsDelegates: AppLocalizations.localizationsDelegates, supportedLocales: AppLocalizations.supportedLocales, home: const Scaffold(body: EditorTimelineDefaults()), ), ); expect(find.byKey(const Key('timeline-default-tracks')), findsOneWidget); expect(find.byKey(const Key('timeline-toolbar')), findsOneWidget); expect( tester.getSize(find.byKey(const Key('timeline-add-button'))), const Size.square(24), ); for (final button in tester.widgetList( find.byType(IconButton), )) { expect(button.onPressed, isNull); } expect(find.byType(CircularProgressIndicator), findsNothing); expect(tester.takeException(), isNull); }); }