Files
cutdex/test/editor_panel_defaults_test.dart
lingjhf 38ca180cf7
Gitea CI / Check code and tests (pull_request) Failing after 8s
Gitea CI / Build Android APK (pull_request) Skipped
Gitea CI / Build Windows x64 app (pull_request) Skipped
Gitea CI / Audit and package Windows x64 (pull_request) Skipped
Gitea CI / Assemble and validate CI artifacts (pull_request) Skipped
Gitea CI / Gitea CI passed (pull_request) Failing after 1s
refactor(core): own editor UI and pin verified native releases
2026-10-12 03:20:29 +08:00

80 lines
2.7 KiB
Dart

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_core/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<ColoredBox>(find.byKey(const Key('preview-default-frame')))
.color,
Colors.black,
);
final ratio = tester.widget<AppSelect<ProjectCanvas>>(
find.byType(AppSelect<ProjectCanvas>),
);
expect(ratio.value, ProjectCanvas.widescreen);
expect(ratio.onChanged, isNull);
final play = tester.widget<IconButton>(
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<IconButton>(
find.byType(IconButton),
)) {
expect(button.onPressed, isNull);
}
expect(find.byType(CircularProgressIndicator), findsNothing);
expect(tester.takeException(), isNull);
});
}