Merge origin/dev into feat/bookmarks-ux-improvements
This commit is contained in:
commit
faa9bf3752
16 files changed
+408
-316
No files matched your search
@@ -281,6 +281,55 @@ void main() {
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
|
||||
testWidgets('Reboot and Delete All Paths use theme colours and confirm', (
|
||||
tester,
|
||||
) async {
|
||||
final connector = await _connectedConnector(tester);
|
||||
Future<void> settle() async {
|
||||
for (var i = 0; i < 8; i++) {
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
}
|
||||
}
|
||||
|
||||
await tester.pumpWidget(_app(connector, const SettingsScreen()));
|
||||
await settle();
|
||||
final scheme = Theme.of(
|
||||
tester.element(find.byType(SettingsScreen)),
|
||||
).colorScheme;
|
||||
|
||||
final rows = {
|
||||
_l10n.settings_rebootDevice: (_l10n.common_reboot, scheme.tertiary),
|
||||
_l10n.settings_deleteAllPaths: (_l10n.common_deleteAll, scheme.error),
|
||||
};
|
||||
for (final MapEntry(key: title, value: (label, color)) in rows.entries) {
|
||||
await tester.scrollUntilVisible(
|
||||
find.text(title),
|
||||
200,
|
||||
scrollable: find
|
||||
.descendant(
|
||||
of: find.byType(ListView),
|
||||
matching: find.byType(Scrollable),
|
||||
)
|
||||
.first,
|
||||
);
|
||||
await settle();
|
||||
expect(tester.widget<Text>(find.text(title)).style?.color, color);
|
||||
|
||||
await tester.tap(find.text(title));
|
||||
await settle();
|
||||
final confirm = tester.widget<FilledButton>(
|
||||
find.widgetWithText(FilledButton, label),
|
||||
);
|
||||
expect(confirm.style?.backgroundColor?.resolve({}), color, reason: title);
|
||||
|
||||
// Cancel, so the review radio isn't rebooted.
|
||||
await tester.tap(find.text(_l10n.common_cancel));
|
||||
await settle();
|
||||
expect(find.byType(AlertDialog), findsNothing, reason: title);
|
||||
}
|
||||
await tester.pumpWidget(const SizedBox());
|
||||
});
|
||||
|
||||
testWidgets('Radio Settings shows Save only while something differs', (
|
||||
tester,
|
||||
) async {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:meshcore_open/widgets/sync_progress_overlay.dart';
|
||||
|
||||
// The shared top progress bar: 4px, theme colours, keeps its height idle.
|
||||
void main() {
|
||||
Widget host(Widget child) => MaterialApp(
|
||||
home: Scaffold(body: Column(children: [child])),
|
||||
);
|
||||
|
||||
testWidgets('idle bar keeps its 4px height and draws nothing', (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(host(const MeshProgressBar(active: false)));
|
||||
expect(tester.getSize(find.byType(MeshProgressBar)).height, 4);
|
||||
expect(find.byType(LinearProgressIndicator), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('active bar fills with the theme colour', (tester) async {
|
||||
await tester.pumpWidget(host(const MeshProgressBar(value: 0.5)));
|
||||
final bar = tester.widget<LinearProgressIndicator>(
|
||||
find.byType(LinearProgressIndicator),
|
||||
);
|
||||
expect(bar.value, 0.5);
|
||||
expect(bar.minHeight, 4);
|
||||
expect(bar.color, isNull);
|
||||
expect(bar.backgroundColor, isNull);
|
||||
});
|
||||
|
||||
test('app bar versions are 4px tall', () {
|
||||
expect(const MeshProgressAppBarBottom().preferredSize.height, 4);
|
||||
expect(const SyncProgressAppBarBottom().preferredSize.height, 4);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user