Fix _RenderDecoration.debugDescribeChildren() (#14217)
This commit is contained in:
parent
894d9d2caf
commit
773902c59d
@ -674,7 +674,7 @@ class _RenderDecoration extends RenderBox {
|
||||
final List<DiagnosticsNode> value = <DiagnosticsNode>[];
|
||||
void add(RenderBox child, String name) {
|
||||
if (child != null)
|
||||
value.add(input.toDiagnosticsNode(name: name));
|
||||
value.add(child.toDiagnosticsNode(name: name));
|
||||
}
|
||||
add(icon, 'icon');
|
||||
add(input, 'input');
|
||||
|
@ -1049,6 +1049,47 @@ void main() {
|
||||
);
|
||||
});
|
||||
|
||||
testWidgets('InputDecorator.debugDescribeChildren', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
buildInputDecorator(
|
||||
decoration: const InputDecoration(
|
||||
icon: const Text('icon'),
|
||||
labelText: 'label',
|
||||
hintText: 'hint',
|
||||
prefixText: 'prefix',
|
||||
suffixText: 'suffix',
|
||||
prefixIcon: const Text('prefixIcon'),
|
||||
suffixIcon: const Text('suffixIcon'),
|
||||
helperText: 'helper',
|
||||
counterText: 'counter',
|
||||
),
|
||||
child: const Text('text'),
|
||||
),
|
||||
);
|
||||
|
||||
final RenderObject renderer = tester.renderObject(find.byType(InputDecorator));
|
||||
final Iterable<String> nodeNames = renderer.debugDescribeChildren()
|
||||
.map((DiagnosticsNode node) => node.name);
|
||||
expect(nodeNames, unorderedEquals(<String>[
|
||||
'container',
|
||||
'counter',
|
||||
'helperError',
|
||||
'hint',
|
||||
'icon',
|
||||
'input',
|
||||
'label',
|
||||
'prefix',
|
||||
'prefixIcon',
|
||||
'suffix',
|
||||
'suffixIcon',
|
||||
]));
|
||||
|
||||
final Set<Object> nodeValues = new Set<Object>.from(
|
||||
renderer.debugDescribeChildren().map<Object>((DiagnosticsNode node) => node.value)
|
||||
);
|
||||
expect(nodeValues.length, 11);
|
||||
});
|
||||
|
||||
testWidgets('InputDecorator with empty border and label', (WidgetTester tester) async {
|
||||
// Regression test for https://github.com/flutter/flutter/issues/14165
|
||||
await tester.pumpWidget(
|
||||
|
Loading…
x
Reference in New Issue
Block a user