feat: new ui (#1455)

This commit is contained in:
Levi authored and GitHub committed 2026-09-05 19:53:41 +08:00
1 parent 3be8db664c
commit 177c225f16
742 files changed
+59951 -5934

No files matched your search

@@ -0,0 +1,13 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:gopeed/core/utils/byte_size_formatter.dart';
void main() {
test('formats scaled byte sizes with up to two decimal places', () {
expect(ByteSizeFormatter.format(-1), '0 B');
expect(ByteSizeFormatter.format(512), '512 B');
expect(ByteSizeFormatter.format(1536), '1.5 KB');
expect(ByteSizeFormatter.format(1280), '1.25 KB');
expect(ByteSizeFormatter.format(32 * 1024 * 1024), '32 MB');
expect(ByteSizeFormatter.format(2 * 1024 * 1024 * 1024), '2 GB');
});
}
@@ -0,0 +1,8 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:gopeed/core/utils/content_uri_resolver.dart';
void main() {
test('rejects non-content URIs', () async {
expect(() => ContentUriResolver.copyToCache(Uri.parse('file:///tmp/example.torrent')), throwsArgumentError);
});
}
@@ -0,0 +1,14 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:gopeed/core/utils/transfer_rate_formatter.dart';
void main() {
test('formats transfer rates with adaptive binary units', () {
expect(TransferRateFormatter.format(-1).text, '0 B/s');
expect(TransferRateFormatter.format(512).text, '512 B/s');
expect(TransferRateFormatter.format(96 * 1024).text, '96 KB/s');
expect(TransferRateFormatter.format(1536).text, '1.5 KB/s');
expect(TransferRateFormatter.format(1280).text, '1.25 KB/s');
expect(TransferRateFormatter.format(10 * 1024 * 1024).text, '10 MB/s');
expect(TransferRateFormatter.format(2 * 1024 * 1024 * 1024).text, '2 GB/s');
});
}