feat: initial Cutdex application
Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
This commit is contained in:
commit
27e77fff39
718 files changed
+183958
No files matched your search
@@ -0,0 +1,69 @@
|
||||
import 'package:cutdex/l10n/app_localizations.dart';
|
||||
import 'package:cutdex/shared/widgets/processing_resource_download_dialog.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('resource download keeps the same actions across phases', (
|
||||
tester,
|
||||
) async {
|
||||
var cancelled = 0;
|
||||
var downloaded = 0;
|
||||
var paused = 0;
|
||||
var backgrounded = 0;
|
||||
|
||||
Future<void> show({bool downloading = false, bool isPaused = false}) =>
|
||||
tester.pumpWidget(
|
||||
MaterialApp(
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
locale: const Locale('zh'),
|
||||
home: Scaffold(
|
||||
body: ProcessingResourceDownloadDialog(
|
||||
title: '下载抠像资源',
|
||||
description: '下载完成后自动开始抠像。',
|
||||
resourceName: '抠像模型',
|
||||
downloadSize: '需下载 973 MB',
|
||||
downloading: downloading,
|
||||
paused: isPaused,
|
||||
downloadedBytes: 250,
|
||||
totalBytes: 1000,
|
||||
bytesPerSecond: 100,
|
||||
onCancel: () => cancelled++,
|
||||
onDownload: () => downloaded++,
|
||||
onTogglePause: () => paused++,
|
||||
onBackground: () => backgrounded++,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await show();
|
||||
expect(find.text('下载抠像资源'), findsOneWidget);
|
||||
expect(find.text('下载完成后自动开始抠像。'), findsOneWidget);
|
||||
expect(find.text('需下载 973 MB'), findsOneWidget);
|
||||
expect(find.text('取消'), findsOneWidget);
|
||||
expect(find.text('下载'), findsOneWidget);
|
||||
expect(find.text('后台下载'), findsNothing);
|
||||
await tester.tap(find.text('下载'));
|
||||
expect(downloaded, 1);
|
||||
|
||||
await show(downloading: true);
|
||||
expect(find.text('需下载 973 MB'), findsNothing);
|
||||
expect(find.text('抠像模型'), findsOneWidget);
|
||||
expect(find.text('25%'), findsOneWidget);
|
||||
expect(find.text('取消下载'), findsOneWidget);
|
||||
expect(find.text('暂停'), findsOneWidget);
|
||||
expect(find.text('后台下载'), findsOneWidget);
|
||||
await tester.tap(find.text('暂停'));
|
||||
await tester.tap(find.text('后台下载'));
|
||||
expect(paused, 1);
|
||||
expect(backgrounded, 1);
|
||||
|
||||
await show(downloading: true, isPaused: true);
|
||||
expect(find.text('已暂停'), findsOneWidget);
|
||||
expect(find.text('继续'), findsOneWidget);
|
||||
await tester.tap(find.text('取消下载'));
|
||||
expect(cancelled, 1);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user