adaptive_test library
Classes
- AdaptiveTestConfiguration
- Singleton class that configures global variables for the test.
- AdaptiveWrapper
- Widget wrapper that paint divers window elements over a child.
- HomeIndicatorData
-
Describe the OS gesture indicator on bottom of apps, expressed in
dp
. - 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.
- Package
- A class representing a package within a multi-packages app
- PunchHoleData
-
Describe the size of Android physical screen camera punch hole in
dp
, - ViewPaddingImpl
- Implementation of the abstract class FakeViewPadding.
- WindowConfig
-
Establish a subtree in which adaptive window resolves to the given data.
Use
WindowConfig.of(context)
to retrieve the data in any child widget. - WindowConfigData
- A Data class that describe a device properties that will impact design.
- WindowVariant
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;
- FakeViewPaddingX on FakeViewPadding
- WidgetTesterWithConfigurableWindow on WidgetTester
- Dart extension to add configuration functions to a WidgetTester object, e.g. configureWindow, configureOpenedKeyboardWindow, configureClosedKeyboardWindow.
Properties
- desktop → WindowConfigData
-
WindowConfigData for a basic 1080p web or desktop window.
final
- iPadPro → WindowConfigData
-
WindowConfigData for a 12.9" iPad Pro.
final
- iPhone13 → WindowConfigData
-
WindowConfigData for an iPhone 13.
final
- iPhone8 → WindowConfigData
-
WindowConfigData for an iPhone 8.
final
- pixel5 → WindowConfigData
-
WindowConfigData for a Google Pixel 5.
final
Functions
-
loadFonts(
[String? package]) → Future< void> - Load fonts to make sure they show up in golden tests.
-
loadFontsFromFontsDir(
[Package? package]) → Map< String, List< Future< >ByteData> > - Assumes a fonts dir in root of project
-
loadFontsFromPackage(
{Package? package}) → Future< void> - Load fonts from a given package to make sure they show up in golden tests.
-
setupFileComparatorWithThreshold(
[double goldenTestsThreshold = _kGoldenTestsThreshold]) → void -
Source : https://blog.rows.com/p/writing-a-localfilecomparator-with?s=r
Since GitHub Actions does not support ARM machines and the difference
in our failing golden tests was never greater than
_kGoldenTestsThreshold
%, we decided to compromise and add a threshold of 0.03% in golden tests. -
testAdaptiveWidgets(
String description, WidgetTesterAdaptiveCallback callback, {bool? skip, Timeout? timeout, bool semanticsEnabled = true, ValueVariant< WindowConfigData> ? variantOverride, dynamic tags}) → void - Function wrapper around testWidgets that will be executed for every WindowConfigData variant.
Typedefs
-
WidgetTesterAdaptiveCallback
= Future<
void> Function(WidgetTester widgetTester, WindowConfigData windowConfig) -
Type of
callback
that will be executed inside the Flutter test environment.