adaptive_golden_test library

Classes

AdaptiveTestConfiguration
Singleton class that configures global variables for the test.
AdaptiveWrapper
DeviceFrame
Simulate a physical device and embedding a virtual screen into it.
DeviceFrameStyle
The device frame style only allows to update the keyboardStyle for now.
DeviceFrameTheme
The theme gives a style to all its descentant device frames.
DeviceIdentifier
A unique identifier that represents a device.
DeviceInfo
Info about a device and its frame.
DeviceKeyboardStyle
The keyboard style allows to customize the virtual onscreen keyboard visuals.
Devices
A list of common device specifications sorted by target platform.
GenericDesktopMonitorFramePainter
GenericLaptopFramePainter
GenericPhoneFramePainter
GenericTabletFramePainter
LocalFileComparatorWithThreshold
Source : https://blog.rows.com/p/writing-a-localfilecomparator-with?s=r Works just like LocalFileComparator but includes a threshold that, when exceeded, marks the test as a failure.
VirtualKeyboard
Display a simulated on screen keyboard at the bottom of a child widget.
WindowVariant

Enums

DeviceType
A device form factor.

Extensions

Adaptive on WidgetTester
Extend WidgetTester with the expectGolden method, providing the ability to assert golden matching for a given WindowConfigData.
AwaitImages on WidgetTester
Dart extension to add an await images function to a WidgetTester object, e.g. awaitImages;
DeviceInfoExtension on DeviceInfo
ShouldSkipAdaptiveTest on AdaptiveTestConfiguration
Extension on AdaptiveTestConfiguration to determine if a test should be skipped based on the AdaptiveTestConfiguration.enforcedTestPlatform and AdaptiveTestConfiguration.failTestOnWrongPlatform values.
WidgetTesterWithConfigurableWindow on WidgetTester
Dart extension to add configuration functions to a WidgetTester object, e.g. configureWindow, configureOpenedKeyboardWindow, configureClosedKeyboardWindow.

Functions

buildGenericDesktopMonitorDevice({required TargetPlatform platform, required String id, required String name, required Size screenSize, required Rect windowPosition, EdgeInsets safeAreas = EdgeInsets.zero, double pixelRatio = 2.0, EdgeInsets? rotatedSafeAreas, GenericDesktopMonitorFramePainter? framePainter}) DeviceInfo
Creates a generic desktop monitor device definition for the given name, target platform and screenSize. The windowPosition defines the position of a virtual window with a window frame adapted for the given platform.
buildGenericLaptopDevice({required TargetPlatform platform, required String id, required String name, required Size screenSize, required Rect windowPosition, EdgeInsets safeAreas = EdgeInsets.zero, double pixelRatio = 2.0, EdgeInsets? rotatedSafeAreas, GenericLaptopFramePainter? framePainter}) DeviceInfo
Creates a generic laptop device definition.
buildGenericPhoneDevice({required TargetPlatform platform, required String id, required String name, required Size screenSize, EdgeInsets safeAreas = EdgeInsets.zero, EdgeInsets rotatedSafeAreas = EdgeInsets.zero, double pixelRatio = 2.0, GenericPhoneFramePainter framePainter = const GenericPhoneFramePainter()}) DeviceInfo
Creates a generic phone device definition.
buildGenericTabletDevice({required TargetPlatform platform, required String id, required String name, required Size screenSize, EdgeInsets safeAreas = EdgeInsets.zero, EdgeInsets rotatedSafeAreas = EdgeInsets.zero, double pixelRatio = 2.0, GenericTabletFramePainter framePainter = const GenericTabletFramePainter()}) DeviceInfo
Creates a generic tablet device definition.
loadFonts() Future<void>
Loads fonts and icons to ensure they appear in golden tests.
setupFileComparatorWithThreshold([double goldenTestsThreshold = _kGoldenTestsThreshold]) → void
testAdaptiveWidgets(String description, WidgetTesterAdaptiveCallback callback, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, ValueVariant<DeviceInfo>? variantOverride, dynamic tags}) → void
Function wrapper around testWidgets that will be executed for every WindowConfigData variant.

Typedefs

WidgetTesterAdaptiveCallback = Future<void> Function(WidgetTester widgetTester, DeviceInfo windowConfig)
Type of callback that will be executed inside the Flutter test environment.