Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flutter-candidate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
52af7a5040254357f2ab98723b51bbd92d4e6337
78df185e5a8da5290246fb25d3c81851834c729a
Original file line number Diff line number Diff line change
Expand Up @@ -261,132 +261,141 @@ void main() {
});
});

group('widget trees', () {
test('isSummaryTree = true', () async {
await env.setupEnvironment();
final group = inspectorService!.createObjectGroup('test-group');
final root = (await group.getRoot(
FlutterTreeType.widget,
isSummaryTree: true,
))!;
// Tree only contains widgets from local app.
expect(
treeToDebugString(root),
equals(
equalsGoldenIgnoringHashCodes(
'inspector_service_tree_summary.txt',
group(
'widget trees',
() {
test('isSummaryTree = true', () async {
await env.setupEnvironment();
final group = inspectorService!.createObjectGroup('test-group');
final root = (await group.getRoot(
FlutterTreeType.widget,
isSummaryTree: true,
))!;
// Tree only contains widgets from local app.
expect(
treeToDebugString(root),
equals(
equalsGoldenIgnoringHashCodes(
'inspector_service_tree_summary.txt',
),
),
),
);
final nodeInSummaryTree = findNodeMatching(root, 'MaterialApp')!;
expect(nodeInSummaryTree, isNotNull);
);
final nodeInSummaryTree = findNodeMatching(root, 'MaterialApp')!;
expect(nodeInSummaryTree, isNotNull);

expect(
treeToDebugString(nodeInSummaryTree),
equals(
equalsGoldenIgnoringHashCodes(
'inspector_service_node_summary.txt',
expect(
treeToDebugString(nodeInSummaryTree),
equals(
equalsGoldenIgnoringHashCodes(
'inspector_service_node_summary.txt',
),
),
),
);
);

await group.dispose();
});
await group.dispose();
});

test('isSummaryTree = false', () async {
await env.setupEnvironment();
final group = inspectorService!.createObjectGroup('test-group');
final root = (await group.getRoot(FlutterTreeType.widget))!;
// Tree contains all widgets.
expect(
treeToDebugString(root),
equals(
equalsGoldenIgnoringHashCodes(
'inspector_service_tree_no_summary.txt',
test('isSummaryTree = false', () async {
await env.setupEnvironment();
final group = inspectorService!.createObjectGroup('test-group');
final root = (await group.getRoot(FlutterTreeType.widget))!;
// Tree contains all widgets.
expect(
treeToDebugString(root),
equals(
equalsGoldenIgnoringHashCodes(
'inspector_service_tree_no_summary.txt',
),
),
),
);
final nodeInTree = findNodeMatching(root, 'MaterialApp')!;
expect(nodeInTree, isNotNull);
expect(
treeToDebugString(nodeInTree),
equals(
equalsGoldenIgnoringHashCodes(
'inspector_service_node_no_summary.txt',
);
final nodeInTree = findNodeMatching(root, 'MaterialApp')!;
expect(nodeInTree, isNotNull);
expect(
treeToDebugString(nodeInTree),
equals(
equalsGoldenIgnoringHashCodes(
'inspector_service_node_no_summary.txt',
),
),
),
);
);

await group.dispose();
});
await group.dispose();
});

test('details tree', () async {
await env.setupEnvironment();
test('details tree', () async {
await env.setupEnvironment();

// First get a node in the summary tree:
final group = inspectorService!.createObjectGroup('test-group');
final root = (await group.getRoot(
FlutterTreeType.widget,
isSummaryTree: true,
))!;
RemoteDiagnosticsNode nodeInSummaryTree = findNodeMatching(
root,
'MaterialApp',
)!;
expect(nodeInSummaryTree, isNotNull);

// Then get the details tree for the node in the summary tree:
RemoteDiagnosticsNode nodeInDetailsTree = (await group
.getDetailsSubtree(nodeInSummaryTree))!;

// When flutter rolls, this string may sometimes change due to
// implementation details.
expect(
treeToDebugStringTruncated(nodeInDetailsTree, 30),
equalsGoldenIgnoringHashCodes('inspector_service_details_tree.txt'),
);
// First get a node in the summary tree:
final group = inspectorService!.createObjectGroup('test-group');
final root = (await group.getRoot(
FlutterTreeType.widget,
isSummaryTree: true,
))!;
RemoteDiagnosticsNode nodeInSummaryTree = findNodeMatching(
root,
'MaterialApp',
)!;
expect(nodeInSummaryTree, isNotNull);

// Then get the details tree for the node in the summary tree:
RemoteDiagnosticsNode nodeInDetailsTree = (await group
.getDetailsSubtree(nodeInSummaryTree))!;

// When flutter rolls, this string may sometimes change due to
// implementation details.
expect(
treeToDebugStringTruncated(nodeInDetailsTree, 30),
equalsGoldenIgnoringHashCodes(
'inspector_service_details_tree.txt',
),
);

nodeInSummaryTree = findNodeMatching(root, 'Text')!;
expect(nodeInSummaryTree, isNotNull);
expect(
treeToDebugString(nodeInSummaryTree),
equalsIgnoringHashCodes('Text\n'),
);
nodeInSummaryTree = findNodeMatching(root, 'Text')!;
expect(nodeInSummaryTree, isNotNull);
expect(
treeToDebugString(nodeInSummaryTree),
equalsIgnoringHashCodes('Text\n'),
);

nodeInDetailsTree = (await group.getDetailsSubtree(
nodeInSummaryTree,
))!;
nodeInDetailsTree = (await group.getDetailsSubtree(
nodeInSummaryTree,
))!;

expect(
treeToDebugString(nodeInDetailsTree),
equalsGoldenIgnoringHashCodes(
'inspector_service_text_details_tree.txt',
),
);
expect(
treeToDebugString(nodeInDetailsTree),
equalsGoldenIgnoringHashCodes(
'inspector_service_text_details_tree.txt',
),
);

expect(
nodeInDetailsTree.valueRef,
equals(nodeInSummaryTree.valueRef),
);
expect(
nodeInDetailsTree.valueRef,
equals(nodeInSummaryTree.valueRef),
);

await group.setSelectionInspector(nodeInDetailsTree.valueRef, true);
final selection = (await group.getSelection(
null,
FlutterTreeType.widget,
))!;
expect(selection, isNotNull);
expect(selection.valueRef, equals(nodeInDetailsTree.valueRef));
expect(
treeToDebugString(selection),
equalsIgnoringHashCodes(
'Text\n'
' └─RichText\n',
),
);
await group.setSelectionInspector(nodeInDetailsTree.valueRef, true);
final selection = (await group.getSelection(
null,
FlutterTreeType.widget,
))!;
expect(selection, isNotNull);
expect(selection.valueRef, equals(nodeInDetailsTree.valueRef));
expect(
treeToDebugString(selection),
equalsIgnoringHashCodes(
'Text\n'
' └─RichText\n',
),
);

await group.dispose();
});
});
await group.dispose();
});
},
// TODO(https://github.com/flutter/devtools/issues/9395): Tests should be
// re-enabled once they are no longer dependant on widget ordering in the
// framework.
skip: true,
);

test('enables hover eval mode by default', () async {
await env.setupEnvironment();
Expand Down
Loading