nandi/vflutter_ffipublic Fork 0
7fdf71219e3dd44c76c7be4120ff73a31d6237ce
Commits
Clone
git clone https://git.rickub.com/nandi/vflutter_ffi.git
git clone ssh://git@rickub.com/nandi/vflutter_ffi.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

widget_test.dart · 36 lines · 1.2 KBDart Blame HistoryRaw
Add Flutter example app with Linux runner 7fdf712 nandi 8h ago1// Smoke test for the V bridge behind the UI. Runs on the host, so it loads
2// the same libvflutter.so the desktop app does.
3
4import 'package:flutter_test/flutter_test.dart';
5
6import 'package:vflutter_ffi_example/main.dart';
7
8void main() {
9 testWidgets('renders results computed in V', (WidgetTester tester) async {
10 await tester.pumpWidget(const ExampleApp());
11
12 // vf_add across the C ABI.
13 expect(find.text('42'), findsOneWidget);
14
15 // vf_greet round-trips a string and frees the V allocation.
16 expect(find.text('Hello, Flutter, from V!'), findsOneWidget);
17 });
18
19 testWidgets('background isolate returns the same answer',
20 (WidgetTester tester) async {
21 await tester.pumpWidget(const ExampleApp());
22
23 expect(find.text('(not run)'), findsNWidgets(2));
24
25 // greetAsync spawns a real isolate, which the default fake-async clock
26 // never lets complete — runAsync is required for the await to resolve.
27 await tester.runAsync(() async {
28 await tester.tap(find.text('run on background isolate'));
29 await Future<void>.delayed(const Duration(seconds: 2));
30 });
31 await tester.pump();
32
33 // Once on the sync row, once on the async row.
34 expect(find.text('Hello, Flutter, from V!'), findsNWidgets(2));
35 });
36}