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.

Add Flutter example app with Linux runner 7fdf712 · on 7fdf71219e3dd44c76c7be4120ff73a31d6237ce · nandi · 7h ago
widget_test.dart · 36 lines · 1.2 KBDart Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Smoke test for the V bridge behind the UI. Runs on the host, so it loads
// the same libvflutter.so the desktop app does.

import 'package:flutter_test/flutter_test.dart';

import 'package:vflutter_ffi_example/main.dart';

void main() {
  testWidgets('renders results computed in V', (WidgetTester tester) async {
    await tester.pumpWidget(const ExampleApp());

    // vf_add across the C ABI.
    expect(find.text('42'), findsOneWidget);

    // vf_greet round-trips a string and frees the V allocation.
    expect(find.text('Hello, Flutter, from V!'), findsOneWidget);
  });

  testWidgets('background isolate returns the same answer',
      (WidgetTester tester) async {
    await tester.pumpWidget(const ExampleApp());

    expect(find.text('(not run)'), findsNWidgets(2));

    // greetAsync spawns a real isolate, which the default fake-async clock
    // never lets complete — runAsync is required for the await to resolve.
    await tester.runAsync(() async {
      await tester.tap(find.text('run on background isolate'));
      await Future<void>.delayed(const Duration(seconds: 2));
    });
    await tester.pump();

    // Once on the sync row, once on the async row.
    expect(find.text('Hello, Flutter, from V!'), findsNWidgets(2));
  });
}