Skip to content

Commit 538167a

Browse files
committed
Validate enlarged emoji-only messages on iOS
Signed-off-by: Tom Brow <[email protected]>
1 parent cf5c5d9 commit 538167a

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

‎mobile/test/visual/heart_sim_app.dart‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void main() => runApp(
4343
_message('Ελληνικά · Кириллица · Tiếng Việt'),
4444
const SizedBox(height: 16),
4545
const Text('Emoji-only message'),
46-
_message('❤️ ⚠️'),
46+
_message('❤️ ⚠️', scaleEmojiOnly: true),
4747
],
4848
),
4949
),
@@ -67,7 +67,9 @@ Widget _reactions(bool selected) => ReactionRow(
6767
onToggle: (_) {},
6868
);
6969

70-
Widget _message(String content) => MessageContent(
71-
content: content,
72-
channelNames: const {'general': 'general'},
73-
);
70+
Widget _message(String content, {bool scaleEmojiOnly = false}) =>
71+
MessageContent(
72+
content: content,
73+
scaleEmojiOnly: scaleEmojiOnly,
74+
channelNames: const {'general': 'general'},
75+
);

‎mobile/test/visual/verify_heart_screenshots.py‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def main():
4242
"text-presentation message heart": (550, 980, 620, 1035),
4343
"bold message heart": (170, 1040, 220, 1090),
4444
"italic message heart": (430, 1040, 490, 1090),
45-
"emoji-only message": (65, 1490, 125, 1545),
45+
"emoji-only message": (65, 1490, 200, 1650),
4646
}
4747
warnings = {
4848
"selected warning reaction": (260, 522, 325, 606),
@@ -52,13 +52,22 @@ def main():
5252
"text-presentation message warning": (430, 1090, 490, 1150),
5353
"bold message warning": (230, 1040, 290, 1090),
5454
"italic message warning": (490, 1040, 550, 1090),
55-
"emoji-only warning": (130, 1490, 190, 1550),
55+
"emoji-only warning": (205, 1490, 335, 1650),
5656
}
5757
for cases, predicate in ((regions, is_red), (warnings, is_yellow)):
5858
for name, box in cases.items():
5959
assert not color_pixels(before, box, predicate), f"{name}: original must reproduce monochrome glyph"
6060
pixels = color_pixels(after, box, predicate)
6161
assert len(pixels) > 500, f"{name}: expected native color emoji"
62+
if "emoji-only" in name:
63+
# Production uses a separate 36sp path. Reject a fixture that
64+
# accidentally renders normal-sized inline emoji or clips it.
65+
left, right = min(x for x, _ in pixels), max(x for x, _ in pixels)
66+
top, bottom = min(y for _, y in pixels), max(y for _, y in pixels)
67+
assert len(pixels) > 4500, f"{name}: expected enlarged emoji"
68+
assert 90 <= right - left <= 110 and 90 <= bottom - top <= 110
69+
assert box[0] < left < right < box[2] - 1
70+
assert box[1] < top < bottom < box[3] - 1
6271
if "reaction" in name:
6372
center = (min(y for _, y in pixels) + max(y for _, y in pixels)) / 2
6473
pill_center = (box[1] + box[3] - 1) / 2

0 commit comments

Comments
 (0)