Repository: incubator-weex Updated Branches: refs/heads/master d731f4d79 -> b296bea73
* [ios] fix #WEEX-88, support BOOL type argument bridging when in 32-bit iOS and add related unit test. Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/d12a4425 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/d12a4425 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/d12a4425 Branch: refs/heads/master Commit: d12a442511e3e746a37311cff27dc40937f8a01d Parents: aaa1bdb Author: xusw <[email protected]> Authored: Fri Nov 10 17:08:04 2017 +0800 Committer: xusw <[email protected]> Committed: Fri Nov 10 17:08:04 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK.xcodeproj/project.pbxproj | 6 +++++ ios/sdk/WeexSDK/Sources/Utility/WXUtility.h | 1 + ios/sdk/WeexSDKTests/WXBridgeMethodTests.m | 15 +++++++++++ ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.h | 24 ++++++++++++++++++ ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.m | 28 +++++++++++++++++++++ 5 files changed, 74 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d12a4425/ios/sdk/WeexSDK.xcodeproj/project.pbxproj ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj index 749cb8c..f728c40 100644 --- a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj +++ b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj @@ -268,6 +268,7 @@ 841CD1051F974DFA0081196D /* WXExceptionUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 841CD1041F97399C0081196D /* WXExceptionUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; 841CD1061F974DFA0081196D /* WXExceptionUtils.h in Headers */ = {isa = PBXBuildFile; fileRef = 841CD1041F97399C0081196D /* WXExceptionUtils.h */; settings = {ATTRIBUTES = (Public, ); }; }; 841CD1071F974E000081196D /* WXExceptionUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 841CD1021F9739890081196D /* WXExceptionUtils.m */; }; + 9B9E74791FA2DB5800DAAEA9 /* WXTestBridgeMethodDummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B9E74781FA2DB5800DAAEA9 /* WXTestBridgeMethodDummy.m */; }; C401945E1E344E8300D19C31 /* WXFloatCompareTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C401945D1E344E8300D19C31 /* WXFloatCompareTests.m */; }; C41E1A971DC1FD15009C7F90 /* WXDatePickerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = C41E1A951DC1FD15009C7F90 /* WXDatePickerManager.h */; }; C41E1A981DC1FD15009C7F90 /* WXDatePickerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C41E1A961DC1FD15009C7F90 /* WXDatePickerManager.m */; }; @@ -857,6 +858,8 @@ 77E65A181C155F25008B8775 /* WXScrollerComponent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXScrollerComponent.m; sourceTree = "<group>"; }; 841CD1021F9739890081196D /* WXExceptionUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXExceptionUtils.m; sourceTree = "<group>"; }; 841CD1041F97399C0081196D /* WXExceptionUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WXExceptionUtils.h; sourceTree = "<group>"; }; + 9B9E74771FA2DB5800DAAEA9 /* WXTestBridgeMethodDummy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXTestBridgeMethodDummy.h; sourceTree = "<group>"; }; + 9B9E74781FA2DB5800DAAEA9 /* WXTestBridgeMethodDummy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXTestBridgeMethodDummy.m; sourceTree = "<group>"; }; C401945D1E344E8300D19C31 /* WXFloatCompareTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXFloatCompareTests.m; sourceTree = "<group>"; }; C41E1A951DC1FD15009C7F90 /* WXDatePickerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXDatePickerManager.h; sourceTree = "<group>"; }; C41E1A961DC1FD15009C7F90 /* WXDatePickerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXDatePickerManager.m; sourceTree = "<group>"; }; @@ -1190,6 +1193,8 @@ isa = PBXGroup; children = ( 74F7BFF41DC782EC004D0871 /* testRootView.js */, + 9B9E74771FA2DB5800DAAEA9 /* WXTestBridgeMethodDummy.h */, + 9B9E74781FA2DB5800DAAEA9 /* WXTestBridgeMethodDummy.m */, ); name = Resources; sourceTree = "<group>"; @@ -2090,6 +2095,7 @@ 74B8BF011DC49AFE004A6027 /* WXRootViewTests.m in Sources */, 597334B11D4D9E7F00988789 /* WXSDKManagerTests.m in Sources */, 74C896401D2AC2210043B82A /* WeexSDKTests.m in Sources */, + 9B9E74791FA2DB5800DAAEA9 /* WXTestBridgeMethodDummy.m in Sources */, 598805AD1D52D8C800EDED2C /* WXStorageTests.m in Sources */, C401945E1E344E8300D19C31 /* WXFloatCompareTests.m in Sources */, ); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d12a4425/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h index 538dc77..dfbc303 100644 --- a/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h +++ b/ios/sdk/WeexSDK/Sources/Utility/WXUtility.h @@ -70,6 +70,7 @@ do {\ WX_ENUMBER_CASE(_invocation, idx, _C_LNG, _obj, long, longValue, _ppFree)\ WX_ENUMBER_CASE(_invocation, idx, _C_LNG_LNG, _obj, long long, longLongValue, _ppFree)\ WX_ENUMBER_CASE(_invocation, idx, _C_UCHR, _obj, unsigned char, unsignedCharValue, _ppFree)\ + WX_ENUMBER_CASE(_invocation, idx, _C_CHR, _obj, char, charValue, _ppFree)\ WX_ENUMBER_CASE(_invocation, idx, _C_UINT, _obj, unsigned int, unsignedIntValue, _ppFree)\ WX_ENUMBER_CASE(_invocation, idx, _C_USHT, _obj, unsigned short, unsignedShortValue, _ppFree)\ WX_ENUMBER_CASE(_invocation, idx, _C_ULNG, _obj, unsigned long, unsignedLongValue, _ppFree)\ http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d12a4425/ios/sdk/WeexSDKTests/WXBridgeMethodTests.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDKTests/WXBridgeMethodTests.m b/ios/sdk/WeexSDKTests/WXBridgeMethodTests.m index dc8580a..bf95d4d 100644 --- a/ios/sdk/WeexSDKTests/WXBridgeMethodTests.m +++ b/ios/sdk/WeexSDKTests/WXBridgeMethodTests.m @@ -20,6 +20,7 @@ #import <XCTest/XCTest.h> #import "WXCallJSMethod.h" #import "WXSDKInstance.h" +#import "WXTestBridgeMethodDummy.h" @interface WXBridgeMethodTests : XCTestCase @@ -65,4 +66,18 @@ XCTAssertTrue(args.count == 0); } +- (void)testBOOLArgumentInvocation { + WXSDKInstance *instance = [[WXSDKInstance alloc] init]; + WXTestBridgeMethodDummy *dummy = [[WXTestBridgeMethodDummy alloc] init]; + WXBridgeMethod *method = [[WXBridgeMethod alloc] initWithMethodName:@"methodWithBOOLArg:" + arguments:@[@(NO)] + instance:instance]; + NSInvocation *invocation = [method invocationWithTarget:dummy + selector:NSSelectorFromString(@"methodWithBOOLArg:")]; + + BOOL receivedArg = NO; + [invocation getArgument:&receivedArg atIndex:2]; + XCTAssert(NO == receivedArg, @"receivedArg value should be NO, but now is YES"); +} + @end http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d12a4425/ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.h ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.h b/ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.h new file mode 100644 index 0000000..abe0a6b --- /dev/null +++ b/ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.h @@ -0,0 +1,24 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#import <Foundation/Foundation.h> + +@interface WXTestBridgeMethodDummy : NSObject + +@end http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/d12a4425/ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.m b/ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.m new file mode 100644 index 0000000..f156d08 --- /dev/null +++ b/ios/sdk/WeexSDKTests/WXTestBridgeMethodDummy.m @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#import "WXTestBridgeMethodDummy.h" + +@implementation WXTestBridgeMethodDummy + +- (void)methodWithBOOLArg:(BOOL)arg { + // No implementaion here, just for testing. +} + +@end
