createSequenceGolden method
Implementation
Future<void> createSequenceGolden(
NvGoldenSingular nvGolden,
String name, {
required List<NvGesture> gestures,
Future<void> Function()? afterPump,
Color touchColor = Colors.orange,
}) async {
final isPumped = this.any(find.byType(DefaultAssetBundle));
if (!isPumped) {
final widget = MaterialApp(
key: ValueKey('nv_golden_sequence_testing_root'),
home: nvGolden.wrap?.call(nvGolden.widget) ?? nvGolden.widget,
debugShowCheckedModeBanner: false,
);
final screenSize = nvGolden.size;
await binding.setSurfaceSize(screenSize);
binding.window.physicalSizeTestValue = screenSize;
binding.window.devicePixelRatioTestValue = 1.0;
binding.window.textScaleFactorTestValue = 1.0;
await _pumpWidgetWithGestures(widget, gestures: [], color: touchColor);
}
final widgetState = this.widget(
find.byKey(ValueKey('nv_golden_sequence_testing_root')),
);
await _pumpWidgetWithGestures(
widgetState,
gestures: gestures,
color: touchColor,
);
await _defaultPrimeAssets();
await pumpAndSettle();
await expectLater(
find.byType(DefaultAssetBundle),
matchesGoldenFile('goldens/$name.png'),
);
await _pumpWidgetWithGestures(widgetState, gestures: [], color: touchColor);
await afterPump?.call();
for (NvGesture gesture in gestures) {
final finder = find.descendant(
of: find.byType(MaterialApp),
matching: gesture.finder(),
);
await tap(finder);
}
}