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.
72 lines
2.0 KiB
Dart
72 lines
2.0 KiB
Dart
import 'package:cutdex_ui/theme.dart';
|
|
import 'package:cutdex_ui/widgets.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
testWidgets('active resource progress omits a redundant status suffix', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
const MaterialApp(
|
|
home: Scaffold(
|
|
body: ResourceDownloadProgress(
|
|
downloadedBytes: 7100000,
|
|
totalBytes: 618000000,
|
|
status: '',
|
|
),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text('0 B/s - 7.1 MB/618 MB'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('progress displays the download speed supplied by the task', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
const MaterialApp(
|
|
home: Scaffold(
|
|
body: ResourceDownloadProgress(
|
|
downloadedBytes: 7100000,
|
|
totalBytes: 618000000,
|
|
bytesPerSecond: 1200000,
|
|
status: '',
|
|
),
|
|
),
|
|
),
|
|
);
|
|
expect(find.text('1.2 MB/s - 7.1 MB/618 MB'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('resource download shows byte progress above a thin track', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(
|
|
MaterialApp(
|
|
theme: AppTheme.penDark,
|
|
home: const Scaffold(
|
|
body: SizedBox(
|
|
width: 300,
|
|
child: ResourceDownloadProgress(
|
|
downloadedBytes: 7100000,
|
|
totalBytes: 618000000,
|
|
status: '已暂停',
|
|
paused: true,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
|
|
final label = find.text('7.1 MB/618 MB, 已暂停');
|
|
final bar = find.byType(LinearProgressIndicator);
|
|
expect(label, findsOneWidget);
|
|
expect(tester.getRect(label).bottom, lessThan(tester.getRect(bar).top));
|
|
final indicator = tester.widget<LinearProgressIndicator>(bar);
|
|
expect(indicator.value, closeTo(7.1 / 618, 0.00001));
|
|
expect(indicator.minHeight, 3);
|
|
expect(indicator.backgroundColor, AppTheme.penDark.dividerColor);
|
|
});
|
|
}
|