π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[auth] Exercise Linux QR share guard in regression test
Neeraj Gupta3715c2a614e4
diff --git a/mobile/apps/auth/lib/ui/components/auth_qr_dialog.dart b/mobile/apps/auth/lib/ui/components/auth_qr_dialog.dartindex 0257c3b20b..084087fe83 100644--- a/mobile/apps/auth/lib/ui/components/auth_qr_dialog.dart+++ b/mobile/apps/auth/lib/ui/components/auth_qr_dialog.dart@@ -7,7 +7,7 @@ import 'package:ente_auth/theme/colors.dart';import 'package:ente_auth/theme/ente_theme.dart';import 'package:ente_components/ente_components.dart' hide textBaseLight;import 'package:ente_strings/ente_strings.dart';-import 'package:flutter/foundation.dart' show kIsWeb;+import 'package:flutter/foundation.dart' show kIsWeb, visibleForTesting;import 'package:flutter/material.dart';import 'package:flutter/rendering.dart';import 'package:flutter_svg/flutter_svg.dart';@@ -36,14 +36,15 @@ class AuthQrDialog extends StatefulWidget {});@override- State<AuthQrDialog> createState() => _AuthQrDialogState();+ State<AuthQrDialog> createState() => AuthQrDialogState();}-class _AuthQrDialogState extends State<AuthQrDialog> {+class AuthQrDialogState extends State<AuthQrDialog> {final GlobalKey _qrKey = GlobalKey();bool _useBlackFinderPatterns = false;- Future<void> _shareQrCode() async {+ @visibleForTesting+ Future<void> shareQrCode() async {try {if (!kIsWeb && Platform.isLinux) return;if (!mounted) return;@@ -204,7 +205,7 @@ class _AuthQrDialogState extends State<AuthQrDialog> {),actions: [if (kIsWeb || !Platform.isLinux)- ButtonComponent(label: widget.shareButtonText, onTap: _shareQrCode),+ ButtonComponent(label: widget.shareButtonText, onTap: shareQrCode),],),);diff --git a/mobile/apps/auth/test/ui/auth_qr_dialog_test.dart b/mobile/apps/auth/test/ui/auth_qr_dialog_test.dartindex 392baa2e98..ecb052f9c0 100644--- a/mobile/apps/auth/test/ui/auth_qr_dialog_test.dart+++ b/mobile/apps/auth/test/ui/auth_qr_dialog_test.dart@@ -85,9 +85,12 @@ void main() {await _pumpDialog(tester);if (Platform.isLinux) {expect(find.text('Share'), findsNothing);+ // Exercise the defensive guard even though its button is hidden.+ final state = tester.state<AuthQrDialogState>(find.byType(AuthQrDialog));+ await tester.runAsync(state.shareQrCode);+ expect(directory.listSync(), isEmpty);expect(temporaryDirectoryRequests, 0);expect(shares, isEmpty);- expect(directory.listSync(), isEmpty);} else {final button = tester.widget<ButtonComponent>(find.widgetWithText(ButtonComponent, 'Share'),