+ [ios] extmodule for coverage
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2ac30d5a Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2ac30d5a Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2ac30d5a Branch: refs/heads/0.16-dev Commit: 2ac30d5a49f9be46bb76e410ca36dd55d3b767cf Parents: 027f8a1 Author: gurisxie <279483...@qq.com> Authored: Tue Aug 8 20:56:16 2017 +0800 Committer: gurisxie <279483...@qq.com> Committed: Tue Aug 8 20:56:16 2017 +0800 ---------------------------------------------------------------------- .../WeexDemo.xcodeproj/project.pbxproj | 6 + ios/playground/WeexDemo/AppDelegate.m | 8 +- ios/playground/WeexDemo/WXExtModule.h | 15 ++ ios/playground/WeexDemo/WXExtModule.m | 32 ++++ package.json | 7 +- test/pages/include/button.vue | 162 +++++++++++++++++++ test/pages/include/h1.vue | 13 ++ test/pages/include/h2.vue | 13 ++ test/pages/include/h3.vue | 13 ++ test/pages/include/hn.vue | 47 ++++++ test/pages/include/panel.vue | 141 ++++++++++++++++ test/pages/include/wxc-desc.vue | 66 ++++++++ test/pages/modules/cover-generate.vue | 53 ++++++ 13 files changed, 568 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/ios/playground/WeexDemo.xcodeproj/project.pbxproj ---------------------------------------------------------------------- diff --git a/ios/playground/WeexDemo.xcodeproj/project.pbxproj b/ios/playground/WeexDemo.xcodeproj/project.pbxproj index 6791723..1943c69 100644 --- a/ios/playground/WeexDemo.xcodeproj/project.pbxproj +++ b/ios/playground/WeexDemo.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ 847CAF2C1F39BB8A00551725 /* WXATLoggerPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = DCABAFF01D029685001C8592 /* WXATLoggerPlugin.m */; }; 847CAF2D1F39BBB900551725 /* WXScannerHistoryVC.m in Sources */ = {isa = PBXBuildFile; fileRef = DC5B53681E8CED9400E02125 /* WXScannerHistoryVC.m */; }; 847CAF2E1F39BBFB00551725 /* WXConfigCenterDefaultImpl.m in Sources */ = {isa = PBXBuildFile; fileRef = DC20B8E51ECADA2500845F39 /* WXConfigCenterDefaultImpl.m */; }; + 847CAF311F39E3F100551725 /* WXExtModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 847CAF301F39E3F100551725 /* WXExtModule.m */; }; 84D7CAC71CE3266C00D48D46 /* libsqlite3.0.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 7475ACA01CD8444A0044E96C /* libsqlite3.0.tbd */; }; 8A0B5EFFF75BF82EA481983D /* libPods-WeexUITestDemo.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E48C20F443AA337D1FE97622 /* libPods-WeexUITestDemo.a */; }; C43CDA031F1C6E01005A6B03 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = C43CDA021F1C6E01005A6B03 /* libz.tbd */; }; @@ -92,6 +93,8 @@ 775BEE981C1E8ECC008D1629 /* WeexDemoTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = WeexDemoTests.m; sourceTree = "<group>"; }; 775BEE9A1C1E8ECC008D1629 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 84361D751CA10F8E00F43825 /* WeexUITestDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WeexUITestDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 847CAF2F1F39E3F100551725 /* WXExtModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXExtModule.h; sourceTree = "<group>"; }; + 847CAF301F39E3F100551725 /* WXExtModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXExtModule.m; sourceTree = "<group>"; }; 9420131417A731ED089B0814 /* Pods-WeexDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-WeexDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-WeexDemo/Pods-WeexDemo.release.xcconfig"; sourceTree = "<group>"; }; C43CDA021F1C6E01005A6B03 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; DC20B8E41ECADA2500845F39 /* WXConfigCenterDefaultImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXConfigCenterDefaultImpl.h; sourceTree = "<group>"; }; @@ -300,6 +303,8 @@ DCABB0001D02975E001C8592 /* WXEventModule.m */, 7478481C1E0CD4910044500D /* WXSyncTestModule.h */, 7478481D1E0CD4910044500D /* WXSyncTestModule.m */, + 847CAF2F1F39E3F100551725 /* WXExtModule.h */, + 847CAF301F39E3F100551725 /* WXExtModule.m */, ); name = module; sourceTree = "<group>"; @@ -576,6 +581,7 @@ DCABB0011D02975E001C8592 /* WXEventModule.m in Sources */, 7478481E1E0CD4910044500D /* WXSyncTestModule.m in Sources */, 775BEE831C1E8ECC008D1629 /* AppDelegate.m in Sources */, + 847CAF311F39E3F100551725 /* WXExtModule.m in Sources */, DC20B8E61ECADA2500845F39 /* WXConfigCenterDefaultImpl.m in Sources */, DCABAFF41D029685001C8592 /* WXATViewHierarchyPlugin.m in Sources */, 775BEE801C1E8ECC008D1629 /* main.m in Sources */, http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/ios/playground/WeexDemo/AppDelegate.m ---------------------------------------------------------------------- diff --git a/ios/playground/WeexDemo/AppDelegate.m b/ios/playground/WeexDemo/AppDelegate.m index 4d9b9cd..19c702e 100644 --- a/ios/playground/WeexDemo/AppDelegate.m +++ b/ios/playground/WeexDemo/AppDelegate.m @@ -28,6 +28,7 @@ #import "WXScannerVC.h" #import "WXScannerHistoryVC.h" #import "WXSyncTestModule.h" +#import "WXExtModule.h" #import "UIView+UIThreadCheck.h" #import <WeexSDK/WeexSDK.h> #import <AVFoundation/AVFoundation.h> @@ -119,6 +120,8 @@ [WXSDKEngine registerComponent:@"select" withClass:NSClassFromString(@"WXSelectComponent")]; [WXSDKEngine registerModule:@"event" withClass:[WXEventModule class]]; [WXSDKEngine registerModule:@"syncTest" withClass:[WXSyncTestModule class]]; + [WXSDKEngine registerModule:@"ext" withClass:[WXExtModule class]]; + #if !(TARGET_IPHONE_SIMULATOR) [self checkUpdate]; @@ -148,11 +151,6 @@ #else ((WXDemoViewController *)demo).url = [NSURL URLWithString:BUNDLE_URL]; #endif - -#ifdef UITEST - ((WXDemoViewController *)demo).url = [NSURL URLWithString:UITEST_HOME_URL]; -#endif - return demo; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/ios/playground/WeexDemo/WXExtModule.h ---------------------------------------------------------------------- diff --git a/ios/playground/WeexDemo/WXExtModule.h b/ios/playground/WeexDemo/WXExtModule.h new file mode 100644 index 0000000..3c92ead --- /dev/null +++ b/ios/playground/WeexDemo/WXExtModule.h @@ -0,0 +1,15 @@ +// +// WXExtModule.h +// WeexDemo +// +// Created by admin on 2017/8/8. +// Copyright © 2017å¹´ taobao. All rights reserved. +// + +#import <Foundation/Foundation.h> + +#import <WeexSDK/WXModuleProtocol.h> + +@interface WXExtModule : NSObject <WXModuleProtocol> + +@end http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/ios/playground/WeexDemo/WXExtModule.m ---------------------------------------------------------------------- diff --git a/ios/playground/WeexDemo/WXExtModule.m b/ios/playground/WeexDemo/WXExtModule.m new file mode 100644 index 0000000..2bde6cd --- /dev/null +++ b/ios/playground/WeexDemo/WXExtModule.m @@ -0,0 +1,32 @@ +// +// WXExtModule.m +// WeexDemo +// +// Created by admin on 2017/8/8. +// Copyright © 2017å¹´ taobao. All rights reserved. +// + +#import "WXExtModule.h" + +@implementation WXExtModule + +WX_EXPORT_METHOD(@selector(generateCover:)) + +- (void)generateCover:(WXModuleCallback)callback +{ +#if !TARGET_IPHONE_SIMULATOR + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *documentsDirectory = [paths objectAtIndex:0]; + setenv("GCOV_PREFIX", [documentsDirectory cStringUsingEncoding:NSUTF8StringEncoding], 1); + setenv("GCOV_PREFIX_STRIP", "6", 1); +#endif + extern void __gcov_flush(void); + __gcov_flush(); + + if (callback) { + NSDictionary * result = @{@"ok": @true}; + callback(result); + } +} + +@end http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/package.json ---------------------------------------------------------------------- diff --git a/package.json b/package.json index 270267e..46ab3a6 100644 --- a/package.json +++ b/package.json @@ -89,8 +89,9 @@ "danger": "danger" }, "dependencies": { - "autoprefixer": "^6.7.7", + "@weex-project/downgrade": "^1.0.3", "animationjs": "^0.1.5", + "autoprefixer": "^6.7.7", "blink-diff": "~1.0.12", "core-js": "^2.4.0", "cubicbezier": "^0.1.1", @@ -104,8 +105,8 @@ "semver": "^5.1.0", "weex-picker": "^0.1.0", "weex-rax-framework": "0.4.7", - "weex-vue-framework": "2.4.2-weex.3", - "weex-styler": "0.1.9" + "weex-styler": "0.1.9", + "weex-vue-framework": "2.4.2-weex.3" }, "devDependencies": { "@weex-project/weex-picker": "^0.2.4", http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/test/pages/include/button.vue ---------------------------------------------------------------------- diff --git a/test/pages/include/button.vue b/test/pages/include/button.vue new file mode 100644 index 0000000..7c9565a --- /dev/null +++ b/test/pages/include/button.vue @@ -0,0 +1,162 @@ +<!-- Inspired by bootstrap http://getbootstrap.com/ --> +<template> + <div :class="['btn', 'btn-' + type, 'btn-sz-' + size]"> + <text :class="['btn-txt', 'btn-txt-' + type, 'btn-txt-sz-' + size]">{{value}}</text> + </div> +</template> + +<script> + module.exports = { + props: { + type: { default: 'default' }, + size: { default: 'large' }, + value: { default: '' } + } + } +</script> + +<style scoped> + .btn { + margin-bottom: 0; + align-items: center; + justify-content: center; + border-width: 1px; + border-style: solid; + border-color: #333; + + /*white-space: nowrap;*/ + /*vertical-align: middle;*/ + /*touch-action: manipulation;*/ + /*cursor: pointer;*/ + /*-webkit-user-select: none;*/ + /*background-image: none;*/ + /*border-image-source: initial;*/ + /*border-image-slice: initial;*/ + /*border-image-width: initial;*/ + /*border-image-outset: initial;*/ + /*border-image-repeat: initial;*/ + } + + .btn-txt { + + } + + /**TYPE**/ + + .btn-default { + color: rgb(51, 51, 51); + } + + .btn-primary { + background-color: rgb(40, 96, 144); + border-color: rgb(40, 96, 144); + } + + .btn-success { + background-color: rgb(92, 184, 92); + border-color: rgb(76, 174, 76); + } + + .btn-info { + background-color: rgb(91, 192, 222); + border-color: rgb(70, 184, 218); + } + + .btn-warning { + background-color: rgb(240, 173, 78); + border-color: rgb(238, 162, 54); + } + + .btn-danger { + background-color: rgb(217, 83, 79); + border-color: rgb(212, 63, 58); + } + + .btn-link { + border-color: transparent; + border-radius: 0; + } + + .btn-txt-default { + color: rgb(51, 51, 51); + } + + .btn-txt-primary { + color: rgb(255, 255, 255); + } + + .btn-txt-success { + color: rgb(255, 255, 255); + } + + .btn-txt-info { + color: rgb(255, 255, 255); + } + + .btn-txt-warning { + color: rgb(255, 255, 255); + } + + .btn-txt-danger { + color: rgb(255, 255, 255); + } + + .btn-txt-link { + color: rgb(51, 122, 183); + /*font-weight: 400;*/ + } + + /**SIZE**/ + + .btn-sz-large { + width: 300px; + height: 100px; + padding-top: 25px; + padding-bottom: 25px; + padding-left: 40px; + padding-right: 40px; + /*line-height: 1.33333;*/ + border-radius: 15px; + } + + .btn-sz-middle { + width: 240px; + height: 80px; + padding-top: 15px; + padding-bottom: 15px; + padding-left: 30px; + padding-right: 30px; + /*line-height: 1.42857;*/ + border-radius: 10px; + } + + .btn-sz-small { + width: 170px; + height: 60px; + padding-top: 12px; + padding-bottom: 12px; + padding-left: 25px; + padding-right: 25px; + /*line-height: 1.5;*/ + border-radius: 7px; + } + + .btn-txt-sz-large { + font-size: 45px; + } + + .btn-txt-sz-middle { + font-size: 35px; + } + + .btn-txt-sz-small { + font-size: 30px; + } + + /*DISABLED*/ + + .disabled { + + } + +</style> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/test/pages/include/h1.vue ---------------------------------------------------------------------- diff --git a/test/pages/include/h1.vue b/test/pages/include/h1.vue new file mode 100644 index 0000000..78c0191 --- /dev/null +++ b/test/pages/include/h1.vue @@ -0,0 +1,13 @@ +<template> + <text class="h1">{{value}}</text> +</template> + +<style scoped> + .h1 {font-size: 64px; font-weight: bold; + padding: 20px; margin-top: 20px; margin-bottom: 20px; + background-color: #eee;} +</style> + +<script> + exports.props = ['value'] +</script> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/test/pages/include/h2.vue ---------------------------------------------------------------------- diff --git a/test/pages/include/h2.vue b/test/pages/include/h2.vue new file mode 100644 index 0000000..6362093 --- /dev/null +++ b/test/pages/include/h2.vue @@ -0,0 +1,13 @@ +<template> + <text class="h2">{{value}}</text> +</template> + +<style scoped> + .h2 {font-size: 48px; font-weight: bold; + padding: 20px; margin-top: 20px; margin-bottom: 20px; + background-color: #eee;} +</style> + +<script> + exports.props = ['value'] +</script> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/test/pages/include/h3.vue ---------------------------------------------------------------------- diff --git a/test/pages/include/h3.vue b/test/pages/include/h3.vue new file mode 100644 index 0000000..338b340 --- /dev/null +++ b/test/pages/include/h3.vue @@ -0,0 +1,13 @@ +<template> + <text class="h3">{{value}}</text> +</template> + +<style scoped> + .h3 {font-size: 36px; font-weight: bold; + padding: 20px; margin-top: 20px; margin-bottom: 20px; + background-color: #eee;} +</style> + +<script> + exports.props = ['value'] +</script> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/test/pages/include/hn.vue ---------------------------------------------------------------------- diff --git a/test/pages/include/hn.vue b/test/pages/include/hn.vue new file mode 100644 index 0000000..39e18b6 --- /dev/null +++ b/test/pages/include/hn.vue @@ -0,0 +1,47 @@ +<template> + <div :class="['h' + level]" style="justify-content: center;"> + <text :class="['txt-h' + level]">{{value}}</text> + </div> +</template> + +<script> + module.exports = { + props: { + level: { default: 1 }, + value: { default: '' } + } + } +</script> + +<style scoped> + .h1 { + height: 110px; + padding-top: 20px; + padding-bottom: 20px; + } + + .h2 { + height: 110px; + padding-top: 20px; + padding-bottom: 20px; + } + + .h3 { + height: 110px; + padding-top: 20px; + padding-bottom: 20px; + } + + + .txt-h1 { + font-size: 70px; + } + + .txt-h2 { + font-size: 52px; + } + + .txt-h3 { + font-size: 42px; + } +</style> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/test/pages/include/panel.vue ---------------------------------------------------------------------- diff --git a/test/pages/include/panel.vue b/test/pages/include/panel.vue new file mode 100644 index 0000000..b0c151f --- /dev/null +++ b/test/pages/include/panel.vue @@ -0,0 +1,141 @@ +<!-- Inspired by bootstrap http://getbootstrap.com/ --> +<template> + <div + :class="['panel', 'panel-' + type]" + :style="{ borderWidth: border }"> + <text + :class="['panel-header', 'panel-header-' + type]" + :style="{ + paddingTop: paddingHead, + paddingBottom: paddingHead, + paddingLeft: paddingHead*1.5, + paddingRight: paddingHead*1.5 + }">{{title}}</text> + <div + :class="['panel-body', 'panel-body-' + type]" + :style="{ + paddingTop: paddingBody, + paddingBottom: paddingBody, + paddingLeft: paddingBody*1.5, + paddingRight: paddingBody*1.5 + }"> + <slot></slot> + </div> + </div> +</template> + +<script> + module.exports = { + props: { + type: { default: 'default' }, + title: { default: '' }, + paddingBody: { default: 20 }, + paddingHead: { default: 20 }, + dataClass: { default: '' }, // FIXME transfer class + border:{ default: 0 } + } + } +</script> + +<style scoped> + .panel { + margin-bottom: 20px; + background-color: #fff; + /*border: 1px solid transparent;*/ + /*border-radius: 10px;*/ + /*-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);*/ + /*box-shadow: 0 1px 1px rgba(0,0,0,.05);*/ + border-color: #dddddd; + border-width: 1px; + } + + .panel-default { + } + + .panel-primary { + border-color: rgb(40, 96, 144); + } + + .panel-success { + border-color: rgb(76, 174, 76); + + } + + .panel-info { + border-color: rgb(70, 184, 218); + + } + + .panel-warning { + border-color: rgb(238, 162, 54); + + } + + .panel-danger { + border-color: rgb(212, 63, 58); + + } + + .panel-header { + background-color: #f5f5f5; + font-size: 40px; + /*padding-left: 12px;*/ + /*padding-right: 12px;*/ + /*padding-top: 20px;*/ + /*padding-bottom: 20px;*/ + color: #333; + } + + .panel-header-default { + } + + .panel-header-primary { + background-color: rgb(40, 96, 144); + color: #ffffff; + } + + .panel-header-success { + background-color: rgb(92, 184, 92); + color: #ffffff; + } + + .panel-header-info { + background-color: rgb(91, 192, 222); + color: #ffffff; + } + + .panel-header-warning { + background-color: rgb(240, 173, 78); + color: #ffffff; + } + + .panel-header-danger { + background-color: rgb(217, 83, 79); + color: #ffffff; + } + + .panel-body { + padding-left: 12px; + padding-right: 12px; + padding-top: 20px; + padding-bottom: 20px; + } + + .panel-body-default { + } + + .panel-body-primary { + } + + .panel-body-success { + } + + .panel-body-info { + } + + .panel-body-warning { + } + + .panel-body-danger { + } +</style> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/test/pages/include/wxc-desc.vue ---------------------------------------------------------------------- diff --git a/test/pages/include/wxc-desc.vue b/test/pages/include/wxc-desc.vue new file mode 100644 index 0000000..ccb4593 --- /dev/null +++ b/test/pages/include/wxc-desc.vue @@ -0,0 +1,66 @@ +<template> + <div class='absolute'> + <div class='desc'> + <button type="info" size="middle" value="æµè¯æè¿°" @click.native="show"></button> + </div> + <mask class="mask" v-if="shown" @click="hide"> + <div class="content" @click="divclick"> + <text class='h3'>æµè¯æè¿°ï¼</text> + <text class='tips'>ç¹å»é®ç½©å±å¯å ³é!</text> + <slot></slot> + </div> + </mask> + </div> +</template> + +<script> + module.exports = { + components: { + button: require('./button.vue') + }, + data : { + shown:false + }, + methods : { + show : function(e) { + this.shown = true + this.$forceUpdate() + }, + hide: function(e) { + this.shown = false + this.$forceUpdate() + }, + } + } +</script> + +<style scoped> + .mask{ + background-color: #cccccc; + position:absolute; + left:20; + top:20; + width:710; + } + .content{ + margin:20; + } + .h3 {font-size: 36px; font-weight: bold; + margin-top: 20px; margin-bottom: 20px; + } + .desc{ + margin:20; + } + .tips{ + font-size: 13px; + position: absolute; + right:10px; + top:10px; + } + .absolute{ + position:absolute; + right:20; + bottom:20; + } +</style> + http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2ac30d5a/test/pages/modules/cover-generate.vue ---------------------------------------------------------------------- diff --git a/test/pages/modules/cover-generate.vue b/test/pages/modules/cover-generate.vue new file mode 100644 index 0000000..30c6a4a --- /dev/null +++ b/test/pages/modules/cover-generate.vue @@ -0,0 +1,53 @@ +<template> + <div> + <panel title = 'cover-generate' :padding-body='0'> + <div style='flex-direction:row'> + <button class='mr-base' type="info" size="middle" value="generate" @click.native="generate"></button> + </div> + <panel title='æ ¡éªç»æï¼'> + <text style="font-size:30px">{{resultTxt}}</text> + </panel> + </panel> + <wxc-desc> + <text class='desc'> +æµè¯ç¹ï¼ + * + +æµè¯æ¹å¼ï¼ + * + * + </text> + </wxc-desc> + </div> +</template> +<script> + var ext = weex.requireModule("ext"); + module.exports = { + data : { + resultTxt:'', + }, + components: { + "wxc-desc":require('../include/wxc-desc.vue'), + panel: require('../include/panel.vue'), + button: require('../include/button.vue'), + }, + methods : { + generate:function() { + ext.generateCover((ret)=>{ + this.resultTxt = 'coverage success' + }); + } + } + } +</script> + +<style scoped> + .origin{background-color: #FFFFDF;width: 200;height: 50;} + .mr-base{ + margin: 10px; + } + .desc{ + color:#aa0000; + font-size: 30px; + } +</style> \ No newline at end of file