Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 7b5e35a

Browse files
[url_launcher_web] Added stress test of creation and disposing of Link widgets.
1 parent 00f0f2a commit 7b5e35a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

packages/url_launcher/url_launcher_web/example/integration_test/link_widget_test.dart

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,36 @@ void main() {
123123
final html.Element anchor = _findSingleAnchor();
124124
expect(anchor.hasAttribute('href'), false);
125125
});
126+
127+
testWidgets('can be created and disposed', (WidgetTester tester) async {
128+
final Uri uri = Uri.parse('http://foobar');
129+
const int itemCount = 500;
130+
await tester.pumpWidget(
131+
Directionality(
132+
textDirection: TextDirection.ltr,
133+
child: MediaQuery(
134+
data: const MediaQueryData(),
135+
child: ListView.builder(
136+
itemCount: itemCount,
137+
itemBuilder: (_, int index) => WebLinkDelegate(TestLinkInfo(
138+
uri: uri,
139+
target: LinkTarget.defaultTarget,
140+
builder: (BuildContext context, FollowLink? followLink) =>
141+
Text('#$index', textAlign: TextAlign.center),
142+
)),
143+
),
144+
),
145+
),
146+
);
147+
148+
await tester.pumpAndSettle();
149+
150+
await tester.scrollUntilVisible(
151+
find.text('#${itemCount - 1}'),
152+
2500,
153+
maxScrolls: 1000,
154+
);
155+
});
126156
});
127157
}
128158

0 commit comments

Comments
 (0)