testing library
Golden test helpers shared by every member that renders design-system widgets.
Import it only from tests: import 'package:design_system/testing.dart';. The golden
setup itself (fonts, AlchemistConfig) lives in each member's test/flutter_test_config.dart
(docs/DECISIONS.md D-M4-04-5).
Classes
- DsGoldenFileComparator
-
Golden comparator of the members with design-system goldens. In a CI golden (a file under
ci/, the path of D-M4-04-5) a pixel differs only when one channel differs by more than dsCiGoldenChannelTolerance, and the image passes while at most dsCiGoldenDiffThreshold of its pixels differ; a platform golden must match exactly, as it is recorded and compared on macOS only. A different size always fails.
Constants
- dsCiGoldenChannelTolerance → const int
- Largest difference of one color channel (0 to 255) at which two pixels still count as equal in DsGoldenFileComparator.
- dsCiGoldenDiffThreshold → const double
- Largest fraction of differing pixels a CI golden still passes with (0.02 %).
Functions
-
dsGoldenMatrix(
{required String name, required Widget builder(), Iterable< DsThemeMode> themes = DsThemeMode.values, Iterable<DsDensityMode> densities = const [DsDensityMode.comfortable], Iterable<double> textScales = const [1.0], Iterable<Locale> locales = const [Locale('en')]}) → GoldenTestGroup -
Builds one alchemist GoldenTestGroup with a scenario per combination of
themes,densities,textScalesandlocales. -
dsPumpIcons(
WidgetTester tester, {Duration timeout = const Duration(seconds: 10)}) → Future< void> - Pumps until every DsIcon below the root has loaded its asset, then settles.