testGoldensOnAndroid function
- @isTest
- String description,
- WidgetTesterCallback test, {
- bool skip = false,
- Size? windowSize,
A golden test that configures itself as a Android platform before executing the
given test, and nullifies the Android configuration when the test is done.
Implementation
@isTest
void testGoldensOnAndroid(
String description,
WidgetTesterCallback test, {
bool skip = false,
Size? windowSize,
}) {
testGoldens('$description (on Android)', (tester) async {
debugDefaultTargetPlatformOverride = TargetPlatform.android;
// Adjust the size of the golden window/image as desired.
tester.viewSize = windowSize;
try {
await test(tester);
} finally {
debugDefaultTargetPlatformOverride = null;
}
}, skip: skip);
}