flutter_test_goldens library

Classes

AngledLinePainter
AnimationTimelineGoldenScene
AnimationTimelineRowBreak
Policy for where to break rows in an AnimationTimeline.
AnimationTimelineSceneLayout
ColumnSceneLayout
FlexGoldenScene
A Golden Scene layout that can orient as either a row or a column.
FlexSceneLayout
FlutterCamera
A camera for taking screenshots of a Flutter UI.
FlutterScreenshot
An in-memory screenshot of a Flutter UI.
FtgLog
Loggers for Flutter Test Goldens (FTG).
A golden builder that builds independent widget tree UIs and then either renders those into a single scene file, or compares them against an existing scene file.
GalleryGoldenRequest
A request for a single UI screenshot within a gallery of independent screenshots.
GoldenCollectionMismatches
All golden mismatches that were found for a collection of golden images.
GoldenImageBounds
A widget that represents the boundary within a widget tree where a golden image is displayed.
GoldenImageMetadata
Metadata that describes an individual image in a golden scene.
GoldenMismatch
A mismatch between a pristine golden image and its latest screenshot.
GoldenReport
A report of success or failure for a single golden within a scene.
GoldenSceneBackground
GoldenSceneBounds
A widget that represents the boundary within a widget tree where a golden scene is displayed.
GoldenSceneMetadata
Metadata that describes the golden images that appear in a given scene, such as each golden's position and size.
GoldenSceneReport
A report of a golden scene test.
GoldenSceneScreenshot
An in-memory golden screenshot or candidate screenshot.
GoldenSceneTheme
A theme, which is applied to various GoldenScenes.
GoldenScreenshotMetadata
GridGoldenScene
GridGoldenSceneLayout
GridSpacing
Level
Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.
MagazineGoldenScene
A "magazine layout" includes a single "featured" golden on the left side, kind of like a full-page feature in a magazine, followed by a grid of other goldens to the right.
MagazineGoldenSceneLayout
MatchesGoldenFileWithPixelAllowance
A special version of MatchesGoldenFile that allows a specified number of pixels to be different between golden files before considering the test to be a failure.
MissingCandidateMismatch
Attempted to compare a candidate to a golden, but the candidate was never generated.
MissingGoldenMismatch
Attempted to compare a candidate to a golden, but the candidate was generated for a golden that doesn't exist.
PixelDiffGoldenComparator
A golden file comparator that allows a specified number of pixels to be different between the golden image file and the test image file, and still pass.
PixelGoldenMismatch
A screenshot was compared with a golden but their pixels didn't match.
PixelSnapAlign
A widget that works like Align, except the child's final offset is forced to an integer value, e.g., (50.4, 30.2) -> (50.0, 30.0).
PixelSnapCenter
A widget that works like Center, except the child's final offset is forced to an integer value, e.g., (50.4, 30.2) -> (50.0, 30.0), also the size of the child can optionally be forced to an integer value, too.
PixelSnapColumn
A Column whose children are positioned at whole-pixel offsets, and whose children are forced to layout at whole-pixel widths and heights.
PixelSnapFlex
A Flex whose children are positioned at whole-pixel offsets, and whose children are forced to layout at whole-pixel widths and heights.
PixelSnapRow
A Row whose children are positioned at whole-pixel offsets, and whose children are forced to layout at whole-pixel widths and heights.
RenderPixelSnapFlex
A RenderFlex subclass that ensures each child sits at a whole-pixel (x, y) offset and (optionally) forces children to be sized at integer values.
RenderPositionedBoxAtPixel
A RenderPositionedBox subclass that ensures each child sits at a whole-pixel (x, y) offset and (optionally) forces children to be sized at integer values.
RowSceneLayout
SceneLayout
Builder that returns a widget for a Golden Scene that lays out all the goldens.
SceneLayoutContent
ScreenshotCollection
A collection of in-memory goldens or candidates.
SingleShot
SingleShotConfiguration
SingleShotConfigurator
TestFonts
Tools for working with fonts in tests.
Timeline
A golden builder that takes screenshots over a period of time and stitches them together into a single golden file with a given _layout.
TimelineTestContext
WrongSizeGoldenMismatch
A screenshot was compared with a golden but they were different sizes.

Constants

defaultDarkGoldenSceneBackground → const GoldenSceneBackground
The GoldenSceneBackground for GoldenSceneTheme.standardDark.
defaultFeaturePadding → const EdgeInsets
defaultGoldenSceneBackground → const GoldenSceneBackground
The default background for all GoldenScenes.
defaultGridSpacing → const GridSpacing
isGoldenScene → const _IsGoldenScene
Annotation for tests that generate a golden scene, which allows them to be easily indexed by tooling built on flutter_test_goldens.

Functions

compareGoldenCollections(ScreenshotCollection goldens, ScreenshotCollection screenshots, {Map<String, int> tolerances = const {}}) GoldenCollectionMismatches
Compares new screenshots to existing goldens and reports any mismatches between them.
defaultDarkGoldenSceneItemDecorator(BuildContext context, GoldenScreenshotMetadata metadata, Widget content) Widget
The GoldenSceneItemDecorator for GoldenSceneTheme.standardDark.
defaultDarkGoldenSceneItemScaffold(WidgetTester tester, Widget content) Widget
The GoldenSceneItemScaffold for GoldenSceneTheme.standardDark.
defaultGoldenSceneItemDecorator(BuildContext context, GoldenScreenshotMetadata metadata, Widget content) Widget
The widget tree that wraps around each golden image in a Golden Scene, unless using a custom GoldenSceneTheme, or is configured directly on a gallery, timeline, etc.
defaultGoldenSceneItemScaffold(WidgetTester tester, Widget content) Widget
The ancestor widget tree for every item in a golden scene, unless using a custom GoldenSceneTheme, or is configured directly on a gallery, timeline, etc.
extractGoldenCollectionFromSceneFile(File file) ScreenshotCollection
Extracts a ScreenshotCollection from a golden scene within the given image file.
extractGoldenCollectionFromSceneWidgetTree(WidgetTester tester, GoldenSceneMetadata sceneMetadata, [Finder? sceneBounds]) Future<ScreenshotCollection>
Extracts a ScreenshotCollection from a golden scene within the current widget tree.
loadMaterialIconsFont() Future<void>
Loads the Material icons font into the FontLoader, which doesn't happen by default in widget tests.
matchesGoldenFileWithPixelAllowance(Object key, int maxPixelMismatchCount, {int? version}) MatchesGoldenFile
A matcher that expects given content to match the golden file referenced by key, allowing up to maxPixelMismatchCount different pixels before considering the test to be a failure.
minimalTimelineItemScaffold(WidgetTester tester, Widget content) Widget
An absolute minimal GoldenSceneItemScaffold that wraps the content within a Timeline.
standardTimelineItemScaffold(WidgetTester tester, Widget content) Widget
The standard GoldenSceneItemScaffold that wraps the content of a Timeline, which includes a dark theme, a dark background color, and some padding around the content.
testGoldenScene(String description, WidgetTesterCallback test, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), dynamic tags, int? retry}) → void
Run a golden scene test.
testGoldenSceneOnAndroid(String description, WidgetTesterCallback test, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), dynamic tags, int? retry}) → void
Run a golden scene test, which pretends to run on an Android platform.
testGoldenSceneOnIOS(String description, WidgetTesterCallback test, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), dynamic tags, int? retry}) → void
Run a golden scene test, which pretends to run on an iOS platform.
testGoldenSceneOnLinux(String description, WidgetTesterCallback test, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), dynamic tags, int? retry}) → void
Run a golden scene test, which pretends to run on a Linux platform.
testGoldenSceneOnMac(String description, WidgetTesterCallback test, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), dynamic tags, int? retry}) → void
Run a golden scene test, which pretends to run on a Mac platform.
testGoldenSceneOnWindows(String description, WidgetTesterCallback test, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, TestVariant<Object?> variant = const DefaultTestVariant(), dynamic tags, int? retry}) → void
Run a golden scene test, which pretends to run on a Windows platform.

Typedefs

GoldenSceneItemDecorator = Widget Function(BuildContext context, GoldenScreenshotMetadata metadata, Widget content)
Decorates a golden screenshot by wrapping the given content in a new widget tree.
GoldenSceneItemPumper = Future Function(WidgetTester tester, GoldenSceneItemScaffold scaffold, String description)
Pumps a widget tree into the given tester, wrapping its content within the given decorator.
GoldenSceneItemScaffold = Widget Function(WidgetTester tester, Widget content)
Scaffolds a gallery item, such as building a MaterialApp with a Scaffold.
GoldenSetup = FutureOr<void> Function(WidgetTester tester)
MagazineFeatureBuilder = Widget Function(BuildContext context, Widget featuredGolden)
TimelineModifySceneDelegate = Future<void> Function(WidgetTester tester, TimelineTestContext testContext)
TimelineSetupBuilder = Widget Function()
TimelineSetupDelegate = Future<void> Function(WidgetTester tester)