added support for simultan downloads in files and talk, support for background downloads, enhanced loading in files with retry
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:marianum_mobile/state/app/infrastructure/loadable_state/view/loadable_state_primary_loading.dart';
|
||||
|
||||
void main() {
|
||||
Widget wrap(Widget child) => MaterialApp(home: Scaffold(body: child));
|
||||
|
||||
const slowHint = LoadableStatePrimaryLoading.slowHintText;
|
||||
|
||||
testWidgets('shows the slow hint only after the threshold elapses', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
wrap(const LoadableStatePrimaryLoading(visible: true)),
|
||||
);
|
||||
|
||||
expect(find.text(slowHint), findsNothing);
|
||||
|
||||
await tester.pump(const Duration(seconds: 7));
|
||||
expect(find.text(slowHint), findsNothing);
|
||||
|
||||
await tester.pump(const Duration(seconds: 2));
|
||||
expect(find.text(slowHint), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('an explicit statusText takes precedence over the slow hint', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
wrap(
|
||||
const LoadableStatePrimaryLoading(
|
||||
visible: true,
|
||||
statusText: 'Erneuter Versuch (2 von 3) …',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.text('Erneuter Versuch (2 von 3) …'), findsOneWidget);
|
||||
|
||||
// Even after the slow-hint threshold the explicit status wins.
|
||||
await tester.pump(const Duration(seconds: 9));
|
||||
expect(find.text('Erneuter Versuch (2 von 3) …'), findsOneWidget);
|
||||
expect(find.text(slowHint), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('does not arm the slow hint while invisible', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
wrap(const LoadableStatePrimaryLoading(visible: false)),
|
||||
);
|
||||
|
||||
await tester.pump(const Duration(seconds: 20));
|
||||
expect(find.text(slowHint), findsNothing);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user