mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-21 20:00:49 +01:00
Update every package that resolves without lifting a documented pin. Riverpod 3.5 deprecates Ref.exists; reading provider.exists keeps the same check without creating the provider. dart_smb2 0.2.5 brings libsmb2 security fixes (no plaintext request on an encrypted session, no out-of-bounds read on armeabi-v7a). flutter_local_notifications 23 only raises build minimums the app already meets (compileSdk 37, AGP 9.1.1). The FFmpegKit fork takes the 2.5.8 Dart fix for Windows apps without a stdout handle; its native libraries are unchanged. Kept: flutter_secure_storage 10, desktop_drop 0.8, connectivity_plus, bonsoir and dbus 0.7, and flutter_rust_bridge 2.11.1, for the reasons noted in pubspec.yaml.
96 lines
3.2 KiB
Dart
96 lines
3.2 KiB
Dart
import 'dart:developer' as developer;
|
|
import 'dart:io';
|
|
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:mornye/providers/download_history_provider.dart';
|
|
import 'package:mornye/providers/library_browse_provider.dart';
|
|
import 'package:mornye/providers/local_library_provider.dart';
|
|
import 'package:mornye/providers/settings_provider.dart';
|
|
|
|
import 'support/fixed_settings.dart';
|
|
import 'support/vm_service_probe.dart';
|
|
|
|
class _History extends DownloadHistoryNotifier {
|
|
@override
|
|
DownloadHistoryState build() => DownloadHistoryState();
|
|
}
|
|
|
|
class _Local extends LocalLibraryNotifier {
|
|
@override
|
|
LocalLibraryState build() => LocalLibraryState();
|
|
}
|
|
|
|
Future<void> _browseAndClose(ProviderContainer container, String search) async {
|
|
final provider = libraryBrowseProvider((
|
|
artists: false,
|
|
artist: null,
|
|
search: search,
|
|
sort: 'a-z',
|
|
limit: 40,
|
|
completeness: null,
|
|
));
|
|
final subscription = container.listen(provider, (_, _) {});
|
|
try {
|
|
await container.read(provider.future);
|
|
for (var page = 0; page < 9; page++) {
|
|
await container.read(provider.notifier).loadMore();
|
|
}
|
|
} finally {
|
|
subscription.close();
|
|
}
|
|
await container.pump();
|
|
expect(container.read(provider.exists), isFalse);
|
|
}
|
|
|
|
Future<void> main() async {
|
|
TestWidgetsFlutterBinding.ensureInitialized();
|
|
final service = (await developer.Service.getInfo()).serverUri;
|
|
test(
|
|
'Library pages and old filter results are collectible after closing',
|
|
() async {
|
|
final overrides = HttpOverrides.current;
|
|
HttpOverrides.global = null;
|
|
addTearDown(() => HttpOverrides.global = overrides);
|
|
final entries = <WeakReference<LibraryBrowseEntry>>[];
|
|
final container = ProviderContainer(
|
|
overrides: [
|
|
settingsProvider.overrideWith(FixedSettingsNotifier.new),
|
|
downloadHistoryProvider.overrideWith(_History.new),
|
|
localLibraryProvider.overrideWith(_Local.new),
|
|
libraryBrowsePageLoaderProvider.overrideWithValue((page) async {
|
|
final rows = [
|
|
for (var i = page.offset; i < page.offset + 40 && i < 400; i++)
|
|
LibraryBrowseEntry(
|
|
source: 'local',
|
|
key: '$i',
|
|
name: 'Album $i',
|
|
artist: 'Artist',
|
|
samplePath: '/music/$i.flac',
|
|
trackCount: 1,
|
|
),
|
|
];
|
|
entries.addAll(rows.map(WeakReference.new));
|
|
return LibraryBrowsePage(rows);
|
|
}),
|
|
],
|
|
);
|
|
// Debug DevTools intentionally retain provider event snapshots. Exclude
|
|
// that history to measure the application-owned lifecycle as in release.
|
|
container.observers.clear();
|
|
addTearDown(container.dispose);
|
|
for (var i = 0; i < 5; i++) {
|
|
await _browseAndClose(container, 'filter $i');
|
|
}
|
|
expect(entries, hasLength(2000));
|
|
await collectTestGarbage(service!);
|
|
expect(
|
|
entries.where((entry) => entry.target != null).length,
|
|
0,
|
|
reason: 'Closed Library queries must not retain their loaded rows',
|
|
);
|
|
},
|
|
skip: service == null ? 'Requires flutter test --enable-vmservice' : false,
|
|
);
|
|
}
|