feat: color a site from its address, and offer a failed web page to the system browser

This commit is contained in:
randogoth 2026-10-11 22:32:44 +03:00
parent 56db479df0
commit 9d9f09ebc7
24 changed files with 597 additions and 25 deletions

View file

@ -133,6 +133,31 @@ void main() {
expect(find.textContaining('Try again'), findsOneWidget);
});
testWidgets('a web page that will not load can open in a web browser',
(tester) async {
final stubDeps = AppDependencies(
database: MewsDatabase.test(NativeDatabase.memory()),
fetch: FakeFetch(const {}),
strings: strings,
);
await tester.pumpWidget(MewsApp(deps: stubDeps, strings: strings));
await tester.pumpAndSettle();
// A web address that answers nothing: the error offers the way out,
// since the web can be shown outside this reader.
await stubDeps.browser.open('https://missing.example.org/');
await tester.pumpAndSettle();
expect(stubDeps.browser.error.value, isA<LoadFailed>());
expect(find.text('Open in a web browser'), findsOneWidget);
// A protocol page has nowhere else to go, so only trying again is
// offered there.
await stubDeps.browser.open('gemini://missing.example.org/');
await tester.pumpAndSettle();
expect(stubDeps.browser.error.value, isA<LoadFailed>());
expect(find.text('Open in a web browser'), findsNothing);
});
testWidgets('the hub opens the settings page, which applies a choice in place',
(tester) async {
await pumpApp(tester);