// 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.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)); }); }