Unverified Commit 7820641a authored by Jacob Richman's avatar Jacob Richman Committed by GitHub

Fix Diagnostics subclasses that had the wrong default value for the named parameter. (#50645)

parent 24f8f799
...@@ -1033,7 +1033,7 @@ class CupertinoDynamicColor extends Color with DiagnosticableMixin implements Di ...@@ -1033,7 +1033,7 @@ class CupertinoDynamicColor extends Color with DiagnosticableMixin implements Di
} }
@override @override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) { String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
String toString(String name, Color color) { String toString(String name, Color color) {
final String marker = color == _effectiveColor ? '*' : ''; final String marker = color == _effectiveColor ? '*' : '';
return '$marker$name = $color$marker'; return '$marker$name = $color$marker';
......
...@@ -586,7 +586,7 @@ class FlutterErrorDetails extends Diagnosticable { ...@@ -586,7 +586,7 @@ class FlutterErrorDetails extends Diagnosticable {
} }
@override @override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.debug}) { String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return toDiagnosticsNode(style: DiagnosticsTreeStyle.error).toStringDeep(minLevel: minLevel); return toDiagnosticsNode(style: DiagnosticsTreeStyle.error).toStringDeep(minLevel: minLevel);
} }
...@@ -889,7 +889,7 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti ...@@ -889,7 +889,7 @@ class FlutterError extends Error with DiagnosticableTreeMixin implements Asserti
String toStringShort() => 'FlutterError'; String toStringShort() => 'FlutterError';
@override @override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.debug}) { String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
// Avoid wrapping lines. // Avoid wrapping lines.
final TextTreeRenderer renderer = TextTreeRenderer(wrapWidth: 4000000000); final TextTreeRenderer renderer = TextTreeRenderer(wrapWidth: 4000000000);
return diagnostics.map((DiagnosticsNode node) => renderer.render(node).trimRight()).join('\n'); return diagnostics.map((DiagnosticsNode node) => renderer.render(node).trimRight()).join('\n');
......
...@@ -3087,7 +3087,7 @@ mixin DiagnosticableMixin { ...@@ -3087,7 +3087,7 @@ mixin DiagnosticableMixin {
String toStringShort() => describeIdentity(this); String toStringShort() => describeIdentity(this);
@override @override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) { String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
String fullString; String fullString;
assert(() { assert(() {
fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel); fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel);
...@@ -3442,7 +3442,7 @@ abstract class DiagnosticableTree extends Diagnosticable { ...@@ -3442,7 +3442,7 @@ abstract class DiagnosticableTree extends Diagnosticable {
/// This mixin is identical to class [DiagnosticableTree]. /// This mixin is identical to class [DiagnosticableTree].
mixin DiagnosticableTreeMixin implements DiagnosticableTree { mixin DiagnosticableTreeMixin implements DiagnosticableTree {
@override @override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) { String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
return toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel); return toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine).toString(minLevel: minLevel);
} }
......
...@@ -2774,7 +2774,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im ...@@ -2774,7 +2774,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
} }
@override @override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) => toStringShort(); String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) => toStringShort();
/// Returns a description of the tree rooted at this node. /// Returns a description of the tree rooted at this node.
/// If the prefix argument is provided, then every line in the output /// If the prefix argument is provided, then every line in the output
......
...@@ -802,6 +802,30 @@ void main() { ...@@ -802,6 +802,30 @@ void main() {
); );
}); });
test('toString test', () {
final TestTree tree = TestTree(
properties: <DiagnosticsNode>[
StringProperty('stringProperty1', 'value1', quoted: false),
DoubleProperty('doubleProperty1', 42.5),
DoubleProperty('roundedProperty', 1.0 / 3.0),
StringProperty('DO_NOT_SHOW', 'DO_NOT_SHOW', level: DiagnosticLevel.hidden, quoted: false),
StringProperty('DEBUG_ONLY', 'DEBUG_ONLY', level: DiagnosticLevel.debug, quoted: false),
],
// child to verify that children are not included in the toString.
children: <TestTree>[TestTree(name: 'node A')],
);
expect(
tree.toString(),
equalsIgnoringHashCodes('TestTree#00000(stringProperty1: value1, doubleProperty1: 42.5, roundedProperty: 0.3)'),
);
expect(
tree.toString(minLevel: DiagnosticLevel.debug),
equalsIgnoringHashCodes('TestTree#00000(stringProperty1: value1, doubleProperty1: 42.5, roundedProperty: 0.3, DEBUG_ONLY: DEBUG_ONLY)'),
);
});
test('transition test', () { test('transition test', () {
// Test multiple styles integrating together in the same tree due to using // Test multiple styles integrating together in the same tree due to using
// transition to go between styles that would otherwise be incompatible. // transition to go between styles that would otherwise be incompatible.
......
...@@ -747,7 +747,7 @@ class _TextStyleProxy implements TextStyle { ...@@ -747,7 +747,7 @@ class _TextStyleProxy implements TextStyle {
List<ui.FontFeature> get fontFeatures => _delegate.fontFeatures; List<ui.FontFeature> get fontFeatures => _delegate.fontFeatures;
@override @override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) => String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) =>
super.toString(); super.toString();
@override @override
......
...@@ -27,7 +27,7 @@ class Alive extends StatefulWidget { ...@@ -27,7 +27,7 @@ class Alive extends StatefulWidget {
AliveState createState() => AliveState(); AliveState createState() => AliveState();
@override @override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) => '$index $alive'; String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) => '$index $alive';
} }
class AliveState extends State<Alive> with AutomaticKeepAliveClientMixin { class AliveState extends State<Alive> with AutomaticKeepAliveClientMixin {
......
...@@ -117,7 +117,7 @@ class CyclicDiagnostic extends DiagnosticableTree { ...@@ -117,7 +117,7 @@ class CyclicDiagnostic extends DiagnosticableTree {
// We have to override toString to avoid the toString call itself triggering a // We have to override toString to avoid the toString call itself triggering a
// stack overflow. // stack overflow.
@override @override
String toString({ DiagnosticLevel minLevel = DiagnosticLevel.debug }) { String toString({ DiagnosticLevel minLevel = DiagnosticLevel.info }) {
return toStringShort(); return toStringShort();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment