@@ -49,11 +49,11 @@ void reviewAvatarTests() {
4949 (tester) async {
5050 final handle = tester.ensureSemantics ();
5151 final alice = 'a' * 64 ;
52- NostrEvent message (String caption) => _textMsg (
52+ NostrEvent message (String caption, [ String second = 'two' ] ) => _textMsg (
5353 id: threadIdRoot,
5454 pubkey: alice,
5555 content:
56- '$caption \n \n ' ,
56+ '$caption \n \n ' ,
5757 );
5858 final notifier = _FakeMessagesNotifier ([message ('Original' )]);
5959 await tester.pumpWidget (
@@ -87,7 +87,10 @@ void reviewAvatarTests() {
8787 final avatar = find
8888 .descendant (of: gate, matching: find.byType (AvatarImage ))
8989 .first;
90- final profile = tester.getSemantics (avatar);
90+ final profile = tester.getSemantics (
91+ find.bySemanticsLabel ('Open Alice profile' ),
92+ );
93+ expect (profile.getSemanticsData ().flagsCollection.isButton, isTrue);
9194 expect (
9295 profile.getSemanticsData ().hasAction (SemanticsAction .tap),
9396 isTrue,
@@ -151,7 +154,43 @@ void reviewAvatarTests() {
151154 .hasAction (SemanticsAction .tap),
152155 isTrue,
153156 );
157+ controller.jumpToPage (1 );
158+ await tester.pumpAndSettle ();
159+ notifier.setMessages ([message ('New media' , 'replacement' )]);
160+ await tester.pumpAndSettle ();
161+ final replacementController =
162+ tester
163+ .widget <CustomScrollView >(
164+ find.descendant (
165+ of: carousel,
166+ matching: find.byType (CustomScrollView ),
167+ ),
168+ )
169+ .controller!
170+ as PageController ;
171+ expect (replacementController.page, 0 );
172+ final restored = tester.getSemantics (
173+ find.bySemanticsLabel ('Open Alice profile' ),
174+ );
175+ expect (restored.getSemanticsData ().flagsCollection.isButton, isTrue);
176+ expect (
177+ restored.getSemanticsData ().hasAction (SemanticsAction .tap),
178+ isTrue,
179+ );
180+ tester.binding.renderViews.single.owner! .semanticsOwner! .performAction (
181+ restored.id,
182+ SemanticsAction .tap,
183+ );
154184 handle.dispose ();
185+ await tester.pumpAndSettle ();
186+ expect (find.byType (UserProfileSheet ), findsOneWidget);
187+ expect (
188+ find.descendant (
189+ of: find.byType (UserProfileSheet ),
190+ matching: find.text ('Alice' ),
191+ ),
192+ findsWidgets,
193+ );
155194 },
156195 );
157196 }
0 commit comments