Skip to content

Commit a8fc00d

Browse files
PIG208gnprice
authored andcommitted
msglist test: Move marker message back and forth.
Previously, messageWithMarker already has its new topic in the message list when initialized. A subsequent event that moves the message from elsewhere to said topic does not logically make sense. This fixed that by moving the message back and forth. We can't simply move the message from elsewhere because we need to record the initial rects of the messages. Signed-off-by: Zixuan James Li <[email protected]>
1 parent ce999c4 commit a8fc00d

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

test/widgets/message_list_test.dart

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,20 +1019,25 @@ void main() {
10191019

10201020
testWidgets('edit state updates do not affect layout', (WidgetTester tester) async {
10211021
final messages = [
1022-
eg.streamMessage(),
1022+
eg.streamMessage(topic: 'orig'),
10231023
eg.streamMessage(
1024+
topic: 'orig',
10241025
reactions: [eg.unicodeEmojiReaction, eg.realmEmojiReaction],
10251026
flags: [MessageFlag.starred]),
1026-
eg.streamMessage(),
1027+
eg.streamMessage(topic: 'orig'),
10271028
];
10281029
final StreamMessage messageWithMarker = messages[1];
10291030
await setupMessageListPage(tester, messages: messages);
10301031
final rectsBefore = captureMessageRects(tester, messages, messageWithMarker);
10311032
checkMarkersCount(edited: 0, moved: 0);
10321033

1033-
// TODO(#150): [messageWithMarker]'s topic in store is inconsistent with the event. This will be fixed soon.
1034-
await store.handleEvent(eg.updateMessageEventMoveTo(
1035-
origTopic: 'old', newMessages: [messageWithMarker]));
1034+
await store.handleEvent(eg.updateMessageEventMoveFrom(
1035+
origMessages: [store.messages[messageWithMarker.id] as StreamMessage],
1036+
newTopic: 'new'));
1037+
await tester.pump();
1038+
await store.handleEvent(eg.updateMessageEventMoveFrom(
1039+
origMessages: [store.messages[messageWithMarker.id] as StreamMessage],
1040+
newTopic: 'orig'));
10361041
await tester.pump();
10371042
check(captureMessageRects(tester, messages, messageWithMarker))
10381043
.deepEquals(rectsBefore);

0 commit comments

Comments
 (0)