Files
Qlyra/test/animoji_jumbo_test.dart
sevenhill f74057ce9b
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
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
Rebrand application as Qlyra
2026-08-30 13:16:17 +03:00

51 lines
1.4 KiB
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:qlyra/core/utils/text_format.dart';
FormatRange _animoji(int start, int length, String url) => FormatRange(
format: TextFormat.animoji,
start: start,
length: length,
attributes: {'animojiLottieUrl': url},
);
void main() {
test('single animoji-only message is jumbo', () {
expect(animojiOnlyLottieUrls('❤️', [_animoji(0, 2, 'L1')]), ['L1']);
});
test('several animoji with no other text are jumbo, in order', () {
final urls = animojiOnlyLottieUrls('❤️🔥', [
_animoji(2, 2, 'L2'),
_animoji(0, 2, 'L1'),
]);
expect(urls, ['L1', 'L2']);
});
test('animoji mixed with real text is NOT jumbo', () {
expect(
animojiOnlyLottieUrls('animoji message🤣', [_animoji(15, 2, 'L1')]),
isNull,
);
});
test('plain emoji without an ANIMOJI element is NOT jumbo', () {
expect(animojiOnlyLottieUrls('😀', const []), isNull);
});
test('more than the limit is NOT jumbo', () {
final ranges = [for (var i = 0; i < 5; i++) _animoji(i * 2, 2, 'L$i')];
expect(animojiOnlyLottieUrls('❤️❤️❤️❤️❤️', ranges), isNull);
});
test('whitespace between animoji is allowed', () {
expect(
animojiOnlyLottieUrls('❤️ ❤️', [
_animoji(0, 2, 'L1'),
_animoji(3, 2, 'L2'),
]),
['L1', 'L2'],
);
});
}