implemented enlarged emoji rendering for chat messages containing up to three emojis

This commit is contained in:
2026-07-12 16:26:22 +02:00
parent 91a6216f66
commit 59501d3b45
4 changed files with 170 additions and 2 deletions
+62
View File
@@ -0,0 +1,62 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:marianum_mobile/utils/emoji_detection.dart';
void main() {
group('standaloneEmojiFontSize', () {
test('returns null for empty or whitespace-only text', () {
expect(standaloneEmojiFontSize(''), isNull);
expect(standaloneEmojiFontSize(' '), isNull);
});
test('returns null for plain text', () {
expect(standaloneEmojiFontSize('Hallo'), isNull);
expect(standaloneEmojiFontSize('ok'), isNull);
});
test('returns null when emoji is mixed with text', () {
expect(standaloneEmojiFontSize('Hallo 😀'), isNull);
expect(standaloneEmojiFontSize('😀 super'), isNull);
});
test('enlarges a single emoji the most', () {
expect(standaloneEmojiFontSize('😀'), 34);
expect(standaloneEmojiFontSize('👍'), 34);
});
test('enlarges up to three emojis at the largest size', () {
expect(standaloneEmojiFontSize('😀😀😀'), 34);
expect(standaloneEmojiFontSize('😀 😀 😀'), 34);
});
test('does not enlarge more than three emojis', () {
expect(standaloneEmojiFontSize('😀😀😀😀'), isNull);
expect(standaloneEmojiFontSize('😀😀😀😀😀😀'), isNull);
});
test('handles ZWJ sequences as a single emoji', () {
// Family emoji: multiple codepoints joined via ZWJ → one cluster.
expect(standaloneEmojiFontSize('👨‍👩‍👧‍👦'), 34);
});
test('handles skin-tone modified emoji as a single emoji', () {
expect(standaloneEmojiFontSize('👍🏽'), 34);
});
test('handles emoji with variation selectors', () {
expect(standaloneEmojiFontSize('❤️'), 34);
expect(standaloneEmojiFontSize(''), 34);
});
test('handles keycap emoji', () {
expect(standaloneEmojiFontSize('1️⃣'), 34);
});
test('handles flag emoji (regional indicators)', () {
expect(standaloneEmojiFontSize('🇩🇪'), 34);
});
test('bare digits without keycap are not emoji', () {
expect(standaloneEmojiFontSize('123'), isNull);
});
});
}