| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| import 'package:flutter/foundation.dart'; |
| |
| /// Whether to replace all shadows with solid color blocks. |
| /// |
| /// This is useful when writing golden file tests (see [matchesGoldenFile]) since |
| /// the rendering of shadows is not guaranteed to be pixel-for-pixel identical from |
| /// version to version (or even from run to run). |
| bool debugDisableShadows = false; |
| |
| /// Returns true if none of the painting library debug variables have been changed. |
| /// |
| /// This function is used by the test framework to ensure that debug variables |
| /// haven't been inadvertently changed. |
| /// |
| /// See <https://docs.flutter.io/flutter/rendering/painting-library.html> for |
| /// a complete list. |
| /// |
| /// The `debugDisableShadowsOverride` argument can be provided to override |
| /// the expected value for [debugDisableShadows]. (This exists because the |
| /// test framework itself overrides this value in some cases.) |
| bool debugAssertAllPaintingVarsUnset(String reason, { bool debugDisableShadowsOverride = false }) { |
| assert(() { |
| if (debugDisableShadows != debugDisableShadowsOverride) { |
| throw FlutterError(reason); |
| } |
| return true; |
| }()); |
| return true; |
| } |