setUp static method
void
setUp({
- TargetPlatform? platform,
- int? iosMajorVersion,
- bool shaderSupported = true,
- bool reduceTransparency = false,
Fixes the environment for the test that follows, and stops the
shader assets loading (they do not load under flutter test).
platform defaults to defaultTargetPlatform (so a
TargetPlatformVariant applies), and iosMajorVersion to none.
On iOS, 26 or later picks the native path (platform views, which
widget tests do not draw) and earlier versions the shader path; leave
it unset or pass 18 to test the Flutter-drawn glass. Without
shaderSupported glass is drawn degraded, and with
reduceTransparency opaque. On Android the default is the Material
path.
Call it in setUp (or at the start of a test, after which
defaultTargetPlatform is the variant's); undo it with reset.
Implementation
static void setUp({
TargetPlatform? platform,
int? iosMajorVersion,
bool shaderSupported = true,
bool reduceTransparency = false,
}) {
for (final reset in _programResets) {
reset(skipLoad: true);
}
GlassPlatform.instance.debugEnvironment = GlassEnvironment(
platform: platform ?? defaultTargetPlatform,
iosMajorVersion: iosMajorVersion,
reduceTransparency: reduceTransparency,
shaderSupported: shaderSupported,
);
}