Release IKAR 1.0.7: port navigation and sharing improvements, harden calls
Tests / test (push) Canceled after 0s
Build Android (FCM) / build-android-fcm (push) Canceled after 0s
Build Android / build-android (push) Canceled after 0s
Build iOS / build-ios (push) Canceled after 0s
Build Linux / build-linux (push) Canceled after 0s
Build macOS / build-macos (push) Canceled after 0s
Build Windows / build-windows (push) Canceled after 0s
Native crypto / native-crypto (push) Canceled after 0s
Release (main) / android (oneme) (push) Canceled after 0s
Release (main) / android (qlyra) (push) Canceled after 0s
Release (main) / windows (push) Canceled after 0s
Release (main) / linux (push) Canceled after 0s
Release (main) / macos (push) Canceled after 0s
Release (main) / ios (push) Canceled after 0s
Release (main) / release (push) Canceled after 0s
Tests / test (push) Canceled after 0s
Build Android (FCM) / build-android-fcm (push) Canceled after 0s
Build Android / build-android (push) Canceled after 0s
Build iOS / build-ios (push) Canceled after 0s
Build Linux / build-linux (push) Canceled after 0s
Build macOS / build-macos (push) Canceled after 0s
Build Windows / build-windows (push) Canceled after 0s
Native crypto / native-crypto (push) Canceled after 0s
Release (main) / android (oneme) (push) Canceled after 0s
Release (main) / android (qlyra) (push) Canceled after 0s
Release (main) / windows (push) Canceled after 0s
Release (main) / linux (push) Canceled after 0s
Release (main) / macos (push) Canceled after 0s
Release (main) / ios (push) Canceled after 0s
Release (main) / release (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:ikar/backend/modules/messages.dart';
|
||||
import 'package:ikar/core/utils/download_progress.dart';
|
||||
import 'package:ikar/core/utils/file_download.dart';
|
||||
import 'package:ikar/frontend/widgets/attachment/bubbles/bubble_context.dart';
|
||||
import 'package:ikar/frontend/widgets/attachment/bubbles/file_bubble.dart';
|
||||
import 'package:ikar/l10n/app_localizations.dart';
|
||||
import 'package:ikar/models/attachment.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets(
|
||||
'whole file card cannot open twice while external opening is pending',
|
||||
(tester) async {
|
||||
var opens = 0;
|
||||
var ready = Completer<FileDownloadResult>();
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
locale: const Locale('ru'),
|
||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
supportedLocales: AppLocalizations.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: Builder(
|
||||
builder: (context) {
|
||||
const file = FileAttachment(
|
||||
fileId: 765,
|
||||
name: 'report.pdf',
|
||||
size: 1024,
|
||||
);
|
||||
return FileBubble(
|
||||
file: file,
|
||||
ctx: BubbleContext(
|
||||
context: context,
|
||||
cs: Theme.of(context).colorScheme,
|
||||
text: Colors.black,
|
||||
shape: BubbleShape.singleMiddle,
|
||||
contentType: MessageType.attachment,
|
||||
hasPhotoWithCaption: false,
|
||||
hasMultiplePhotosNoCaption: false,
|
||||
message: CachedMessage(
|
||||
id: '1',
|
||||
accountId: 1,
|
||||
chatId: 2,
|
||||
senderId: 3,
|
||||
time: 1000,
|
||||
status: 'sent',
|
||||
),
|
||||
isMe: false,
|
||||
myId: 1,
|
||||
chatType: 'DIALOG',
|
||||
),
|
||||
openFile:
|
||||
(
|
||||
name,
|
||||
url, {
|
||||
onProgress,
|
||||
onReady,
|
||||
download,
|
||||
downloadOnlyIfMissing = false,
|
||||
}) {
|
||||
opens++;
|
||||
onReady?.call();
|
||||
return ready.future;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
await tester.tap(find.text('report.pdf'));
|
||||
await tester.pump();
|
||||
await tester.tap(find.text('report.pdf'));
|
||||
await tester.pump();
|
||||
expect(opens, 1);
|
||||
expect(find.textContaining('Открытие'), findsOneWidget);
|
||||
ready.complete(const FileDownloadResult(ok: true));
|
||||
await tester.pumpAndSettle();
|
||||
ready = Completer<FileDownloadResult>();
|
||||
await tester.tap(find.text('report.pdf'));
|
||||
expect(opens, 2);
|
||||
ready.complete(const FileDownloadResult(ok: true));
|
||||
await tester.pumpAndSettle();
|
||||
MediaDownloadProgress.set('765_report.pdf', null);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user