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); }); }); }