testGoldensWithTextScale function
void
testGoldensWithTextScale(})
Golden test of a single widget rendered at several text scale factors.
Generates a light (<title>_light) and a dark (<title>_dark) golden,
each containing the widget at default size, x2 and max text scale.
Implementation
void testGoldensWithTextScale(
String title, {
required Widget widget,
required double height,
ThemeData? lightTheme,
ThemeData? darkTheme,
double? width,
Iterable<LocalizationsDelegate<dynamic>>? localizations,
}) {
GoldenBuilder builder(Color color) => GoldenBuilder.column(bgColor: color)
..addScenario('Default font size', widget)
..addTextScaleScenario('Large font size', widget, textScaleFactor: 2)
..addTextScaleScenario('Largest font', widget);
_testGoldens(
title,
widget: builder(Colors.white).build(),
height: height,
width: width,
themeMode: ThemeMode.light,
lightTheme: lightTheme,
darkTheme: darkTheme,
localizations: localizations,
);
_testGoldens(
title,
widget: builder(Colors.black).build(),
height: height,
width: width,
themeMode: ThemeMode.dark,
lightTheme: lightTheme,
darkTheme: darkTheme,
localizations: localizations,
);
}