Puts a MapLibre map on screen framed on the region, with the credit obligations that come with showing third-party data satisfied structurally rather than by remembering to add a label. The base map style comes from MAP_STYLE_URL, and with no key configured the app generates a fallback style from the region's own bounding box: a flat background and the extent outline, no network sources at all. That keeps a fresh clone runnable offline without pulling in a boundary dataset that would carry its own licence, and it deliberately looks like a placeholder so it is not mistaken for a finished map. Attribution is driven by what is actually rendered. The bar lists the credits for the active sources only, because crediting OpenStreetMap while showing the fallback style would be a false attribution, and it says plainly when no base map is configured. It sits below the map rather than floating over it so no map control or gesture overlay can occlude a credit that the ODbL and CC BY-SA terms require to be visible. The Sources screen leads with the independence disclaimer, before the sources it qualifies, so a reader who stops after the first screenful has still seen it. Sources with no stated licence — ARPA publishes none for the alert bulletin — say so explicitly rather than being shown bare or given an invented one. A separate note explains that the rendered radar frames inherit CC BY-SA from the DPC source data. Also declares the INTERNET permission in the main manifest: Flutter injects it into the debug and profile manifests only, so a release build would otherwise fail every request on device. Verified: analyze clean, 66 tests passing, appbundle builds with the native MapLibre plugin. Not verified visually — this machine has no Android device or emulator image, so nobody has watched the map render. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
72 lines
2.5 KiB
Dart
72 lines
2.5 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:nuvolari/core/region/region_config.dart';
|
|
import 'package:nuvolari/core/region/region_repository.dart';
|
|
import 'package:nuvolari/l10n/app_localizations.dart';
|
|
import 'package:nuvolari/main.dart';
|
|
|
|
void main() {
|
|
// The region stays unresolved so the map screen holds its loading state. A
|
|
// resolved config would instantiate the native map, which has no
|
|
// implementation in the test harness.
|
|
testWidgets('starts up and shows the Italian UI', (tester) async {
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
regionConfigProvider.overrideWith(
|
|
(ref) => Completer<RegionConfig>().future,
|
|
),
|
|
],
|
|
child: const NuvolariApp(),
|
|
),
|
|
);
|
|
await tester.pump();
|
|
|
|
expect(find.text('Nuvolari'), findsWidgets);
|
|
expect(find.text('Caricamento…'), findsOneWidget);
|
|
});
|
|
|
|
group('AppLocalizations', () {
|
|
test('supports Italian', () {
|
|
expect(
|
|
AppLocalizations.supportedLocales.map((locale) => locale.languageCode),
|
|
contains('it'),
|
|
);
|
|
});
|
|
|
|
test('resolves Italian strings', () async {
|
|
final l10n = await AppLocalizations.delegate.load(const Locale('it'));
|
|
|
|
expect(l10n.appTitle, 'Nuvolari');
|
|
expect(l10n.navRadar, 'Radar');
|
|
expect(l10n.navForecast, 'Previsioni');
|
|
expect(l10n.navAlerts, 'Allerte');
|
|
});
|
|
|
|
// The disclaimer is a compliance requirement, not copy: it must state both
|
|
// that the app is independent and that official channels take precedence.
|
|
test(
|
|
'the disclaimer states independence and defers to official channels',
|
|
() async {
|
|
final l10n = await AppLocalizations.delegate.load(const Locale('it'));
|
|
|
|
expect(l10n.sourcesDisclaimerBody, contains('indipendente'));
|
|
expect(l10n.sourcesDisclaimerBody, contains('Arpa Piemonte'));
|
|
expect(l10n.sourcesDisclaimerBody, contains('Protezione Civile'));
|
|
expect(l10n.sourcesDisclaimerBody, contains('ufficiali'));
|
|
},
|
|
);
|
|
|
|
test('pluralises the data age message', () async {
|
|
final l10n = await AppLocalizations.delegate.load(const Locale('it'));
|
|
|
|
expect(l10n.dataAgeMinutes(0), 'Aggiornato ora');
|
|
expect(l10n.dataAgeMinutes(1), 'Aggiornato 1 minuto fa');
|
|
expect(l10n.dataAgeMinutes(12), 'Aggiornato 12 minuti fa');
|
|
});
|
|
});
|
|
}
|