Unverified Commit dc47cf5c authored by Devon Carew's avatar Devon Carew Committed by GitHub

update the test expectations for the flutter widget transformer (#84578)

parent 52f7555f
...@@ -2851,8 +2851,8 @@ class _Location { ...@@ -2851,8 +2851,8 @@ class _Location {
required this.file, required this.file,
required this.line, required this.line,
required this.column, required this.column,
required this.name, this.name,
required this.parameterLocations, this.parameterLocations,
}); });
/// File path of the location. /// File path of the location.
......
...@@ -943,7 +943,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { ...@@ -943,7 +943,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final String fileA = creationLocationA['file']! as String; final String fileA = creationLocationA['file']! as String;
final int lineA = creationLocationA['line']! as int; final int lineA = creationLocationA['line']! as int;
final int columnA = creationLocationA['column']! as int; final int columnA = creationLocationA['column']! as int;
final List<Object?> parameterLocationsA = creationLocationA['parameterLocations']! as List<Object?>;
service.setSelection(elementB, 'my-group'); service.setSelection(elementB, 'my-group');
final Map<String, Object?> jsonB = json.decode(service.getSelectedWidget(null, 'my-group')) as Map<String, Object?>; final Map<String, Object?> jsonB = json.decode(service.getSelectedWidget(null, 'my-group')) as Map<String, Object?>;
...@@ -952,7 +951,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { ...@@ -952,7 +951,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final String fileB = creationLocationB['file']! as String; final String fileB = creationLocationB['file']! as String;
final int lineB = creationLocationB['line']! as int; final int lineB = creationLocationB['line']! as int;
final int columnB = creationLocationB['column']! as int; final int columnB = creationLocationB['column']! as int;
final List<Object?> parameterLocationsB = creationLocationB['parameterLocations']! as List<Object?>;
expect(fileA, endsWith('widget_inspector_test.dart')); expect(fileA, endsWith('widget_inspector_test.dart'));
expect(fileA, equals(fileB)); expect(fileA, equals(fileB));
// We don't hardcode the actual lines the widgets are created on as that // We don't hardcode the actual lines the widgets are created on as that
...@@ -961,21 +959,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { ...@@ -961,21 +959,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
// Column numbers are more stable than line numbers. // Column numbers are more stable than line numbers.
expect(columnA, equals(15)); expect(columnA, equals(15));
expect(columnA, equals(columnB)); expect(columnA, equals(columnB));
expect(parameterLocationsA.length, equals(1));
final Map<String, Object?> paramA = parameterLocationsA[0]! as Map<String, Object?>;
expect(paramA['name'], equals('data'));
expect(paramA['line'], equals(lineA));
expect(paramA['column'], equals(20));
expect(parameterLocationsB.length, equals(2));
final Map<String, Object?> paramB1 = parameterLocationsB[0]! as Map<String, Object?>;
expect(paramB1['name'], equals('data'));
expect(paramB1['line'], equals(lineB));
expect(paramB1['column'], equals(20));
final Map<String, Object?> paramB2 = parameterLocationsB[1]! as Map<String, Object?>;
expect(paramB2['name'], equals('textDirection'));
expect(paramB2['line'], equals(lineB));
expect(paramB2['column'], equals(25));
}, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // Test requires --track-widget-creation flag. }, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // Test requires --track-widget-creation flag.
testWidgets('test transformDebugCreator will re-order if after stack trace', (WidgetTester tester) async { testWidgets('test transformDebugCreator will re-order if after stack trace', (WidgetTester tester) async {
...@@ -1743,7 +1726,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { ...@@ -1743,7 +1726,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final String fileA = creationLocationA['file']! as String; final String fileA = creationLocationA['file']! as String;
final int lineA = creationLocationA['line']! as int; final int lineA = creationLocationA['line']! as int;
final int columnA = creationLocationA['column']! as int; final int columnA = creationLocationA['column']! as int;
final List<Object?> parameterLocationsA = creationLocationA['parameterLocations']! as List<Object?>;
service.setSelection(elementB, 'my-group'); service.setSelection(elementB, 'my-group');
final Map<String, Object?> jsonB = (await service.testExtension('getSelectedWidget', <String, String>{'objectGroup': 'my-group'}))! as Map<String, Object?>; final Map<String, Object?> jsonB = (await service.testExtension('getSelectedWidget', <String, String>{'objectGroup': 'my-group'}))! as Map<String, Object?>;
...@@ -1752,7 +1734,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { ...@@ -1752,7 +1734,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
final String fileB = creationLocationB['file']! as String; final String fileB = creationLocationB['file']! as String;
final int lineB = creationLocationB['line']! as int; final int lineB = creationLocationB['line']! as int;
final int columnB = creationLocationB['column']! as int; final int columnB = creationLocationB['column']! as int;
final List<Object?> parameterLocationsB = creationLocationB['parameterLocations']! as List<Object?>;
expect(fileA, endsWith('widget_inspector_test.dart')); expect(fileA, endsWith('widget_inspector_test.dart'));
expect(fileA, equals(fileB)); expect(fileA, equals(fileB));
// We don't hardcode the actual lines the widgets are created on as that // We don't hardcode the actual lines the widgets are created on as that
...@@ -1761,21 +1742,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService { ...@@ -1761,21 +1742,6 @@ class _TestWidgetInspectorService extends TestWidgetInspectorService {
// Column numbers are more stable than line numbers. // Column numbers are more stable than line numbers.
expect(columnA, equals(15)); expect(columnA, equals(15));
expect(columnA, equals(columnB)); expect(columnA, equals(columnB));
expect(parameterLocationsA.length, equals(1));
final Map<String, Object?> paramA = parameterLocationsA[0]! as Map<String, Object?>;
expect(paramA['name'], equals('data'));
expect(paramA['line'], equals(lineA));
expect(paramA['column'], equals(20));
expect(parameterLocationsB.length, equals(2));
final Map<String, Object?> paramB1 = parameterLocationsB[0]! as Map<String, Object?>;
expect(paramB1['name'], equals('data'));
expect(paramB1['line'], equals(lineB));
expect(paramB1['column'], equals(20));
final Map<String, Object?> paramB2 = parameterLocationsB[1]! as Map<String, Object?>;
expect(paramB2['name'], equals('textDirection'));
expect(paramB2['line'], equals(lineB));
expect(paramB2['column'], equals(25));
}, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // Test requires --track-widget-creation flag. }, skip: !WidgetInspectorService.instance.isWidgetCreationTracked()); // Test requires --track-widget-creation flag.
testWidgets('ext.flutter.inspector.setPubRootDirectories', (WidgetTester tester) async { testWidgets('ext.flutter.inspector.setPubRootDirectories', (WidgetTester tester) async {
......
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