From 63dc2f2f68eaf84592f2812ea1a42d5e3d631760 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 4 Jul 2019 11:49:53 -0700 Subject: [PATCH 1/2] fix return type check and interface --- lib/stub_ui/lib/src/ui/canvas.dart | 2 +- web_sdk/test/api_conform_test.dart | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/stub_ui/lib/src/ui/canvas.dart b/lib/stub_ui/lib/src/ui/canvas.dart index 9d01ae0546bc7..2c4a8875d53f9 100644 --- a/lib/stub_ui/lib/src/ui/canvas.dart +++ b/lib/stub_ui/lib/src/ui/canvas.dart @@ -978,7 +978,7 @@ class Picture { /// /// Although the image is returned synchronously, the picture is actually /// rasterized the first time the image is drawn and then cached. - Image toImage(int width, int height) => null; + Future toImage(int width, int height) => null; /// Release the resources used by this object. The object is no longer usable /// after this method is called. diff --git a/web_sdk/test/api_conform_test.dart b/web_sdk/test/api_conform_test.dart index 137237bc79bd9..c2cad160720cd 100644 --- a/web_sdk/test/api_conform_test.dart +++ b/web_sdk/test/api_conform_test.dart @@ -148,6 +148,15 @@ void main() { '${uiParam.identifier.name} is named, but not in lib/stub_ui/ui.dart.'); } } + // check return type. + if (uiMethod.returnType?.toString() != webMethod.returnType?.toString()) { + // allow dynmaic. + if (webMethod.returnType?.toString() != 'dynamic') { + failed = true; + print('Warning: lib/ui/ui.dart $className.$methodName return type' + '${uiMethod.returnType?.toString()} is not the same as in lib/stub_ui/ui.dart.'); + } + } } } if (failed) { @@ -158,8 +167,6 @@ void main() { exit(0); } -void _checkParameters() {} - // Collects all public classes defined by the part files of [unit]. void _collectPublicClasses(CompilationUnit unit, Map destination, String root) { From 0fed71dcf3f8bde3f2ff40305f44f04d708c62e6 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 4 Jul 2019 12:35:51 -0700 Subject: [PATCH 2/2] Update api_conform_test.dart --- web_sdk/test/api_conform_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_sdk/test/api_conform_test.dart b/web_sdk/test/api_conform_test.dart index c2cad160720cd..d121fb48b8b3d 100644 --- a/web_sdk/test/api_conform_test.dart +++ b/web_sdk/test/api_conform_test.dart @@ -150,7 +150,7 @@ void main() { } // check return type. if (uiMethod.returnType?.toString() != webMethod.returnType?.toString()) { - // allow dynmaic. + // allow dynamic in web implementation. if (webMethod.returnType?.toString() != 'dynamic') { failed = true; print('Warning: lib/ui/ui.dart $className.$methodName return type'