-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[pigeon] Initial integration test setup #2851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
auto-submit
merged 8 commits into
flutter:main
from
stuartmorgan-g:pigeon-integration-initial
Nov 28, 2022
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
008576c
[pigeon] Initial integration test setup
stuartmorgan-g f89c57b
Version bump for bugfix
stuartmorgan-g 982ae19
Check in generated files needed for analysis
stuartmorgan-g 0fc99bd
Add the actual integration test file, which was left out
stuartmorgan-g baf5c60
Address review comments
stuartmorgan-g 40c5d88
Fix incorrect Swift unit test for void call fix
stuartmorgan-g 0c1a099
Analysis ignore
stuartmorgan-g 9d4db5c
Autoformat
stuartmorgan-g File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
packages/pigeon/platform_tests/test_plugin/example/integration_test/test.dart
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| // TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#104231) | ||
| // ignore: unnecessary_import | ||
| import 'dart:typed_data'; | ||
|
|
||
| import 'package:flutter/foundation.dart'; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:integration_test/integration_test.dart'; | ||
| import 'package:test_plugin/all_datatypes.gen.dart'; | ||
| import 'package:test_plugin/all_void.gen.dart'; | ||
|
|
||
| void main() { | ||
| IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| group('Host API tests', () { | ||
| testWidgets('voidCallVoidReturn', (WidgetTester _) async { | ||
| final AllVoidHostApi api = AllVoidHostApi(); | ||
|
|
||
| expect(api.doit(), completes); | ||
| }); | ||
|
|
||
| testWidgets('allDataTypesEcho', (WidgetTester _) async { | ||
| final HostEverything api = HostEverything(); | ||
|
|
||
| final Everything sentObject = Everything( | ||
| aBool: true, | ||
| anInt: 42, | ||
| aDouble: 3.14159, | ||
| aString: 'Hello host!', | ||
| aByteArray: Uint8List.fromList(<int>[1, 2, 3]), | ||
| a4ByteArray: Int32List.fromList(<int>[4, 5, 6]), | ||
| a8ByteArray: Int64List.fromList(<int>[7, 8, 9]), | ||
| aFloatArray: Float64List.fromList(<double>[2.71828, 3.14159]), | ||
| aList: <Object?>['Thing 1', 2], | ||
| aMap: <Object?, Object?>{'a': 1, 'b': 2.0}, | ||
| nestedList: <List<bool>>[ | ||
| <bool>[true, false], | ||
| <bool>[false, true] | ||
| ], | ||
| ); | ||
|
|
||
| final Everything echoObject = await api.echo(sentObject); | ||
| expect(echoObject.aBool, sentObject.aBool); | ||
| expect(echoObject.anInt, sentObject.anInt); | ||
| expect(echoObject.aDouble, sentObject.aDouble); | ||
| expect(echoObject.aString, sentObject.aString); | ||
| // TODO(stuartmorgan): Enable these once they work for all generators; | ||
| // currently at least Swift is broken. | ||
| // See https://github.com/flutter/flutter/issues/115906 | ||
| //expect(echoObject.aByteArray, sentObject.aByteArray); | ||
| //expect(echoObject.a4ByteArray, sentObject.a4ByteArray); | ||
| //expect(echoObject.a8ByteArray, sentObject.a8ByteArray); | ||
| //expect(echoObject.aFloatArray, sentObject.aFloatArray); | ||
| expect(listEquals(echoObject.aList, sentObject.aList), true); | ||
| expect(mapEquals(echoObject.aMap, sentObject.aMap), true); | ||
| expect(echoObject.nestedList?.length, sentObject.nestedList?.length); | ||
| // TODO(stuartmorgan): Enable this once the Dart types are fixed; see | ||
| // https://github.com/flutter/flutter/issues/116117 | ||
| //for (int i = 0; i < echoObject.nestedList!.length; i++) { | ||
| // expect(listEquals(echoObject.nestedList![i], sentObject.nestedList![i]), | ||
| // true); | ||
| //} | ||
| expect( | ||
| mapEquals( | ||
| echoObject.mapWithAnnotations, sentObject.mapWithAnnotations), | ||
| true); | ||
| expect( | ||
| mapEquals(echoObject.mapWithObject, sentObject.mapWithObject), true); | ||
| }); | ||
| }); | ||
|
|
||
| group('Flutter API tests', () { | ||
| // TODO(stuartmorgan): Add Flutter API tests, driven by wrapper host APIs | ||
| // that forward the arguments and return values in the opposite direction. | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.