GoldenTestGroup class

A widget responsible for grouping test scenarios for use in golden tests.

Commonly used in the goldenTest function. See its documentation for more details.

This widgets groups together all provided children into a single widget with a table layout, and its resulting snapshot will be used when generating golden test images. The list of children must be provided and must not be empty.

The columns parameter determines the number of columns in the table. If provided, the resulting table will have the specified number of columns. If left unset, the number of columns will be determined by the number of provided children.

The columnWidthBuilder, if provided, will be used to determine the width of each column in the table. If not provided, the width for every column is determined by the widest widget in that column (IntrinsicColumnWidth). Returning null will tell the table to use the default column width for the column at the given index.

The scenarioConstraints parameter, if provided, will be applied to the children of each GoldenTestScenario in children. Otherwise, the children will only be constrained based on each column's width according to the columnWidthBuilder, and unconstrained vertically. Note: the constraints will not apply to children that aren't GoldenTestScenarios.

See also:

  • GoldenTestScenario, which describes a single test scenario or state of widget that should be included in a golden test group.
Inheritance

Constructors

GoldenTestGroup({Key? key, int? columns, ColumnWidthBuilder? columnWidthBuilder, BoxConstraints? scenarioConstraints, required List<Widget> children})
A widget responsible for grouping test scenarios for use in golden tests.
const

Properties

children List<Widget>
The scenarios to display in this test group.
final
columns int?
The number of columns in the grid.
final
columnWidthBuilder ColumnWidthBuilder?
A builder that returns the desired column widths for every column in the table that shows the children in this builder.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scenarioConstraints BoxConstraints?
An optional set of constraints that will be applied to the child of each GoldenTestScenario in the children.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited