Skip to content

Commit 176ba45

Browse files
committed
emoji_reaction test [nfc]: Move some helper logic out of its group
1 parent 83f759c commit 176ba45

File tree

1 file changed

+37
-37
lines changed

1 file changed

+37
-37
lines changed

Diff for: test/widgets/emoji_reaction_test.dart

+37-37
Original file line numberDiff line numberDiff line change
@@ -23,44 +23,44 @@ import 'text_test.dart';
2323
void main() {
2424
TestZulipBinding.ensureInitialized();
2525

26-
group('ReactionChipsList', () {
27-
late PerAccountStore store;
28-
29-
Future<void> prepare() async {
30-
addTearDown(testBinding.reset);
31-
await testBinding.globalStore.add(eg.selfAccount, eg.initialSnapshot());
32-
store = await testBinding.globalStore.perAccount(eg.selfAccount.id);
33-
34-
await store.addUser(eg.selfUser);
35-
36-
// TODO do this more centrally, or put in reusable helper
37-
final Future<ByteData> font = rootBundle.load('assets/Source_Sans_3/SourceSans3VF-Upright.otf');
38-
final fontLoader = FontLoader('Source Sans 3')..addFont(font);
39-
await fontLoader.load();
40-
}
41-
42-
Future<void> setupChipsInBox(WidgetTester tester, {
43-
required List<Reaction> reactions,
44-
double width = 245.0, // (seen in context on an iPhone 13 Pro)
45-
}) async {
46-
final message = eg.streamMessage(reactions: reactions);
47-
48-
await tester.pumpWidget(TestZulipApp(accountId: eg.selfAccount.id,
49-
child: Center(
50-
child: ColoredBox(
51-
color: Colors.white,
52-
child: SizedBox(
53-
width: width,
54-
child: ReactionChipsList(
55-
messageId: message.id,
56-
reactions: message.reactions!,
57-
))))));
58-
await tester.pumpAndSettle(); // global store, per-account store
59-
60-
final reactionChipsList = tester.element(find.byType(ReactionChipsList));
61-
check(reactionChipsList).size.isNotNull().width.equals(width);
62-
}
26+
late PerAccountStore store;
27+
28+
Future<void> prepare() async {
29+
addTearDown(testBinding.reset);
30+
await testBinding.globalStore.add(eg.selfAccount, eg.initialSnapshot());
31+
store = await testBinding.globalStore.perAccount(eg.selfAccount.id);
32+
33+
await store.addUser(eg.selfUser);
34+
35+
// TODO do this more centrally, or put in reusable helper
36+
final Future<ByteData> font = rootBundle.load('assets/Source_Sans_3/SourceSans3VF-Upright.otf');
37+
final fontLoader = FontLoader('Source Sans 3')..addFont(font);
38+
await fontLoader.load();
39+
}
40+
41+
Future<void> setupChipsInBox(WidgetTester tester, {
42+
required List<Reaction> reactions,
43+
double width = 245.0, // (seen in context on an iPhone 13 Pro)
44+
}) async {
45+
final message = eg.streamMessage(reactions: reactions);
46+
47+
await tester.pumpWidget(TestZulipApp(accountId: eg.selfAccount.id,
48+
child: Center(
49+
child: ColoredBox(
50+
color: Colors.white,
51+
child: SizedBox(
52+
width: width,
53+
child: ReactionChipsList(
54+
messageId: message.id,
55+
reactions: message.reactions!,
56+
))))));
57+
await tester.pumpAndSettle(); // global store, per-account store
58+
59+
final reactionChipsList = tester.element(find.byType(ReactionChipsList));
60+
check(reactionChipsList).size.isNotNull().width.equals(width);
61+
}
6362

63+
group('ReactionChipsList', () {
6464
// Smoke tests under various conditions.
6565
for (final displayEmojiReactionUsers in [true, false]) {
6666
for (final emojiset in [Emojiset.text, Emojiset.google]) {

0 commit comments

Comments
 (0)