Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
440ddef6
Commit
440ddef6
authored
Nov 29, 2016
by
Hans Muller
Committed by
GitHub
Nov 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Regression tests should verify that debug are not set (#7090)
parent
94de7e30
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
118 additions
and
11 deletions
+118
-11
debug.dart
packages/flutter/lib/src/rendering/debug.dart
+62
-11
debug.dart
packages/flutter/lib/src/scheduler/debug.dart
+23
-0
debug.dart
packages/flutter/lib/src/widgets/debug.dart
+24
-0
binding.dart
packages/flutter_test/lib/src/binding.dart
+9
-0
No files found.
packages/flutter/lib/src/rendering/debug.dart
View file @
440ddef6
...
...
@@ -7,40 +7,55 @@ import 'package:flutter/rendering.dart';
export
'package:flutter/foundation.dart'
show
debugPrint
;
// Any changes to this file should be reflected in the debugAssertAllRenderVarsUnset()
// function below.
const
Color
_kDebugPaintSizeColor
=
const
Color
(
0xFF00FFFF
);
const
Color
_kDebugPaintSpacingColor
=
const
Color
(
0x90909090
);
const
Color
_kDebugPaintPaddingColor
=
const
Color
(
0x900090FF
);
const
Color
_kDebugPaintPaddingInnerEdgeColor
=
const
Color
(
0xFF0090FF
);
const
Color
_kDebugPaintArrowColor
=
const
Color
(
0xFFFFFF00
);
const
Color
_kDebugPaintAlphabeticBaselineColor
=
const
Color
(
0xFF00FF00
);
const
Color
_kDebugPaintIdeographicBaselineColor
=
const
Color
(
0xFFFFD000
);
const
Color
_kDebugPaintLayerBordersColor
=
const
Color
(
0xFFFF9800
);
const
int
_kDebugPaintPointersColorValue
=
0x00BBBB
;
const
HSVColor
_kDebugCurrentRepaintColor
=
const
HSVColor
.
fromAHSV
(
0.4
,
60.0
,
1.0
,
1.0
);
const
double
_kDebugRepaintRainbowHueIncrement
=
2.0
;
/// Causes each RenderBox to paint a box around its bounds, and some extra
/// boxes, such as RenderPadding, to draw construction lines.
bool
debugPaintSizeEnabled
=
false
;
/// The color to use when painting RenderObject bounds.
Color
debugPaintSizeColor
=
const
Color
(
0xFF00FFFF
)
;
Color
debugPaintSizeColor
=
_kDebugPaintSizeColor
;
/// The color to use when painting some boxes that just add space (e.g. an empty
/// RenderConstrainedBox or RenderPadding).
Color
debugPaintSpacingColor
=
const
Color
(
0x90909090
)
;
Color
debugPaintSpacingColor
=
_kDebugPaintSpacingColor
;
/// The color to use when painting RenderPadding edges.
Color
debugPaintPaddingColor
=
const
Color
(
0x900090FF
)
;
Color
debugPaintPaddingColor
=
_kDebugPaintPaddingColor
;
/// The color to use when painting RenderPadding edges.
Color
debugPaintPaddingInnerEdgeColor
=
const
Color
(
0xFF0090FF
)
;
Color
debugPaintPaddingInnerEdgeColor
=
_kDebugPaintPaddingInnerEdgeColor
;
/// The color to use when painting the arrows used to show RenderPositionedBox alignment.
Color
debugPaintArrowColor
=
const
Color
(
0xFFFFFF00
)
;
Color
debugPaintArrowColor
=
_kDebugPaintArrowColor
;
/// Causes each RenderBox to paint a line at each of its baselines.
bool
debugPaintBaselinesEnabled
=
false
;
/// The color to use when painting alphabetic baselines.
Color
debugPaintAlphabeticBaselineColor
=
const
Color
(
0xFF00FF00
)
;
Color
debugPaintAlphabeticBaselineColor
=
_kDebugPaintAlphabeticBaselineColor
;
/// The color ot use when painting ideographic baselines.
Color
debugPaintIdeographicBaselineColor
=
const
Color
(
0xFFFFD000
)
;
Color
debugPaintIdeographicBaselineColor
=
_kDebugPaintIdeographicBaselineColor
;
/// Causes each Layer to paint a box around its bounds.
bool
debugPaintLayerBordersEnabled
=
false
;
/// The color to use when painting Layer borders.
Color
debugPaintLayerBordersColor
=
const
Color
(
0xFFFF9800
)
;
Color
debugPaintLayerBordersColor
=
_kDebugPaintLayerBordersColor
;
/// Causes objects like [RenderPointerListener] to flash while they are being
/// tapped. This can be useful to see how large the hit box is, e.g. when
...
...
@@ -51,16 +66,16 @@ Color debugPaintLayerBordersColor = const Color(0xFFFF9800);
bool
debugPaintPointersEnabled
=
false
;
/// The color to use when reporting pointers for [debugPaintPointersEnabled].
int
debugPaintPointersColorValue
=
0x00BBBB
;
int
debugPaintPointersColorValue
=
_kDebugPaintPointersColorValue
;
/// Overlay a rotating set of colors when repainting layers in checked mode.
bool
debugRepaintRainbowEnabled
=
false
;
/// The current color to overlay when repainting a layer.
HSVColor
debugCurrentRepaintColor
=
const
HSVColor
.
fromAHSV
(
0.4
,
60.0
,
1.0
,
1.0
)
;
HSVColor
debugCurrentRepaintColor
=
_kDebugCurrentRepaintColor
;
/// The amount to increment the hue of the current repaint color.
double
debugRepaintRainbowHueIncrement
=
2.0
;
double
debugRepaintRainbowHueIncrement
=
_kDebugRepaintRainbowHueIncrement
;
/// Log the call stacks that mark render objects as needing paint.
bool
debugPrintMarkNeedsPaintStacks
=
false
;
...
...
@@ -89,3 +104,39 @@ List<String> debugDescribeTransform(Matrix4 transform) {
matrix
.
removeLast
();
return
matrix
;
}
/// Returns true if none of the rendering 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/rendering-library.html] for
/// a complete list.
bool
debugAssertAllRenderVarsUnset
(
String
reason
)
{
assert
(()
{
if
(
debugPaintSizeEnabled
||
debugPaintBaselinesEnabled
||
debugPaintLayerBordersEnabled
||
debugPaintPointersEnabled
||
debugRepaintRainbowEnabled
||
debugPrintMarkNeedsPaintStacks
||
debugPrintMarkNeedsLayoutStacks
||
debugCheckIntrinsicSizes
||
debugProfilePaintsEnabled
||
debugPaintSizeColor
!=
_kDebugPaintSizeColor
||
debugPaintSpacingColor
!=
_kDebugPaintSpacingColor
||
debugPaintPaddingColor
!=
_kDebugPaintPaddingColor
||
debugPaintPaddingInnerEdgeColor
!=
_kDebugPaintPaddingInnerEdgeColor
||
debugPaintArrowColor
!=
_kDebugPaintArrowColor
||
debugPaintAlphabeticBaselineColor
!=
_kDebugPaintAlphabeticBaselineColor
||
debugPaintIdeographicBaselineColor
!=
_kDebugPaintIdeographicBaselineColor
||
debugPaintLayerBordersColor
!=
_kDebugPaintLayerBordersColor
||
debugPaintPointersColorValue
!=
_kDebugPaintPointersColorValue
||
debugCurrentRepaintColor
!=
_kDebugCurrentRepaintColor
||
debugRepaintRainbowHueIncrement
!=
_kDebugRepaintRainbowHueIncrement
)
{
throw
new
FlutterError
(
reason
);
}
return
true
;
});
return
true
;
}
packages/flutter/lib/src/scheduler/debug.dart
View file @
440ddef6
...
...
@@ -2,6 +2,11 @@
// 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'
;
// Any changes to this file should be reflected in the debugAssertAllSchedulerVarsUnset()
// function below.
/// Print a banner at the beginning of each frame.
///
/// Frames triggered by the engine and handler by the scheduler binding will
...
...
@@ -24,3 +29,21 @@ bool debugPrintBeginFrameBanner = false;
/// Combined with [debugPrintBeginFrameBanner], this can be helpful for
/// determining if code is running during a frame or between frames.
bool
debugPrintEndFrameBanner
=
false
;
/// Returns true if none of the scheduler 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/scheduler/scheduler-library.html] for
/// a complete list.
bool
debugAssertAllSchedulerVarsUnset
(
String
reason
)
{
assert
(()
{
if
(
debugPrintBeginFrameBanner
||
debugPrintEndFrameBanner
)
{
throw
new
FlutterError
(
reason
);
}
return
true
;
});
return
true
;
}
packages/flutter/lib/src/widgets/debug.dart
View file @
440ddef6
...
...
@@ -8,6 +8,9 @@ import 'package:flutter/foundation.dart';
import
'framework.dart'
;
import
'table.dart'
;
// Any changes to this file should be reflected in the debugAssertAllWidgetVarsUnset()
// function below.
/// Log the dirty widgets that are built each frame.
///
/// Combined with [debugPrintBuildScope] or [debugPrintBeginFrameBanner], this
...
...
@@ -167,3 +170,24 @@ void debugWidgetBuilderValue(Widget widget, Widget built) {
return
true
;
});
}
/// Returns true if none of the widget 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/widgets/widgets-library.html] for
/// a complete list.
bool
debugAssertAllWidgetVarsUnset
(
String
reason
)
{
assert
(()
{
if
(
debugPrintRebuildDirtyWidgets
||
debugPrintBuildScope
||
debugPrintScheduleBuildForStacks
||
debugPrintGlobalKeyedWidgetLifecycle
||
debugProfileBuildsEnabled
)
{
throw
new
FlutterError
(
reason
);
}
return
true
;
});
return
true
;
}
packages/flutter_test/lib/src/binding.dart
View file @
440ddef6
...
...
@@ -395,6 +395,15 @@ abstract class TestWidgetsFlutterBinding extends BindingBase
assert
(
debugAssertNoTransientCallbacks
(
'An animation is still running even after the widget tree was disposed.'
));
assert
(
debugAssertAllRenderVarsUnset
(
'The value of a rendering debug variable was changed by the test.'
));
assert
(
debugAssertAllWidgetVarsUnset
(
'The value of a widget debug variable was changed by the test.'
));
assert
(
debugAssertAllSchedulerVarsUnset
(
'The value of a scheduler debug variable was changed by the test.'
));
}
/// Called by the [testWidgets] function after a test is executed.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment