Files
chanora/apps/chanora_flutter/test/widget_test.dart
T
EdisonJwa 4c19410556 test+diag: SWE.4 unit tests for Rust paths, Dart service tests, diagnostics audio.android section
Verification + diagnostics:

- apps/chanora_flutter/test/services/back_intent_policy_test.dart:
  8-case truth table for the BackIntentPolicy pure function
  (SWE4-UV-042).
- apps/chanora_flutter/test/services/back_intent_service_test.dart:
  5 channel-routing tests (SWE4-UV-042, SWE5-IV-019 unit slice).
- apps/chanora_flutter/test/services/android_permissions_service_test.dart:
  12 tests covering inbound channel events, outbound requests,
  state-machine transitions, and non-Android short-circuit
  (SWE4-UV-041).
- SDD/SRS trace headers added to alpha_e2e_test.dart,
  beta_e2e_test.dart, widget_test.dart so the existing test ↔ ID
  mapping is discoverable by grep.
- chanora_diagnostics: extends DiagnosticExport with android_audio:
  Option<String> for the SDD-116 evidence schema (requested /
  achieved performance mode + sharing mode + input preset + sample
  rate + frames per burst, per-effect engagement, latency tier).
  The bridge's export_diagnostics() now embeds the Android section
  when current_android_audio_diagnostics() returns Some.

All 93 workspace Rust tests and 26 Dart test/services tests pass.

Trace: SDD-090, SDD-112, SDD-113, SDD-116, SWE4-UV-041, SWE4-UV-042,
SWE4-UV-045, SWE4-UV-047, SWE4-UV-048, SWE4-UV-049, SWE4-UV-051,
SWE4-UV-052, SWE5-IV-019.
2026-05-18 12:48:28 +08:00

46 lines
1.8 KiB
Dart

// Smoke test for the Beta UI banners. Verifies the
// non-production-ready banner appears in both supported locales.
//
// Does NOT call into the FRB Rust side; that requires the cdylib at
// runtime and is verified by alpha_e2e_test.dart + beta_e2e_test.dart.
//
// Requirement trace (SWE.4 unit verification — banner widget):
// SRS-165..SRS-169 (localization), SRS-170..SRS-176 (Unicode / server content),
// SAD-014 (design-system + localization integration),
// SDD-031, SDD-032, SDD-033, SDD-034 (localization fallback + product-vs-server text).
// Verification-plan rows: SWE4-UV-014, SWE4-UV-019, SWE4-UV-020 (swe4-unit-verification-plan.md).
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:chanora_flutter/l10n/generated/app_localizations.dart';
void main() {
testWidgets('renders English banner', (tester) async {
await tester.pumpWidget(MaterialApp(
localizationsDelegates: AppL10n.localizationsDelegates,
supportedLocales: AppL10n.supportedLocales,
home: Builder(builder: (ctx) {
final l10n = AppL10n.of(ctx);
return Scaffold(body: Text(l10n.homeNotProductionReadyBanner));
}),
));
await tester.pumpAndSettle();
expect(find.textContaining('Beta build'), findsOneWidget);
});
testWidgets('renders Simplified Chinese banner', (tester) async {
await tester.pumpWidget(MaterialApp(
locale: const Locale('zh'),
localizationsDelegates: AppL10n.localizationsDelegates,
supportedLocales: AppL10n.supportedLocales,
home: Builder(builder: (ctx) {
final l10n = AppL10n.of(ctx);
return Scaffold(body: Text(l10n.homeNotProductionReadyBanner));
}),
));
await tester.pumpAndSettle();
expect(find.textContaining('Beta 版本'), findsOneWidget);
});
}