You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/08/22 08:26:53 UTC

[1/9] incubator-weex git commit: * [ios] add transition vue example

Repository: incubator-weex
Updated Branches:
  refs/heads/0.16-dev 952697a19 -> dffa92f8a


* [ios] add transition vue example


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/5863b935
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5863b935
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5863b935

Branch: refs/heads/0.16-dev
Commit: 5863b935fa2fb054b4e7f9791cd37c252287f57e
Parents: 4fd66f1
Author: doumafang <do...@gmail.com>
Authored: Thu Aug 17 16:14:12 2017 +0800
Committer: doumafang <do...@gmail.com>
Committed: Thu Aug 17 16:14:12 2017 +0800

----------------------------------------------------------------------
 examples/vue/index.vue      |  1 -
 examples/vue/transition.vue | 75 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5863b935/examples/vue/index.vue
----------------------------------------------------------------------
diff --git a/examples/vue/index.vue b/examples/vue/index.vue
index d9b949a..c0aae8c 100644
--- a/examples/vue/index.vue
+++ b/examples/vue/index.vue
@@ -15,7 +15,6 @@
           {name: root + '/animation', title: 'Animation'},
           {name: root + '/transition', title: 'Transition'},
 
-
           // component
           {name: root + '/components/text', title: 'Text'},
           {name: root + '/iconfont', title: 'iconfont'},

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5863b935/examples/vue/transition.vue
----------------------------------------------------------------------
diff --git a/examples/vue/transition.vue b/examples/vue/transition.vue
new file mode 100644
index 0000000..dbdf38a
--- /dev/null
+++ b/examples/vue/transition.vue
@@ -0,0 +1,75 @@
+<template>
+    <list class="list">
+        <cell class="cell" v-for="(item, i) in panels" @click="change(i)">
+            <div class="panel" :style="{height: item.height,width:item.width,backgroundColor:item.bgc,opacity:item.opacity,transform:item.transform}">
+                 <text class="text">{{item.label}}</text> 
+            </div>
+            <div class="panel" :style="{height: item.height,width:item.width,backgroundColor:item.bgc,opacity:item.opacity,transform:item.transform}">
+                 <text class="text">{{item.label}}</text> 
+            </div>
+        </cell>
+    </list>
+</template>
+<script>
+    export default {
+        created () {
+            this.panels = this.randomfn()
+        },
+        data () {
+            return {
+                panels: []
+            }
+        },
+        methods: {
+            change (i) {
+                const item = this.panels[i]
+                if (item) {
+                    item.height = item.height === 200 ? 400 : 200
+                    item.width = item.width === 330 ? 660 : 330
+                    item.bgc = item.bgc ===  '#69BE96' ? '#72B8DF':'#69BE96'
+                    item.opacity = item.opacity === 1.0 ? 0.6 : 1.0
+                    item.transform = item.transform === 'translateX(20px)'?'translateX(40px)':'translateX(20px)'
+                }
+            },
+            randomfn () {
+                let ary = [];
+                for(let i = 1; i<= 10; i++) {
+                    ary.push({label: i ,height: 200 , width:730, bgc:'#69BE96',opacity:1})
+                }
+                return ary;
+            }
+        }
+    }
+</script>
+
+<style scoped>
+    .panel {
+        margin: 10px;
+        top:10px;
+        align-items: center;
+        justify-content: center;
+        border: solid;
+        border-radius: 10px; 
+          
+        transition-property: width,height,backgroundColor,opacity,transform;  
+        transition-duration: 0.5s; 
+        transition-delay: 0s;
+        transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1.0); 
+    }
+    .cell{
+        background-color:white;
+        flex-direction: row;
+    }
+
+
+    .text {
+        font-size: 60px; 
+        text-align: center;
+        color: white;
+
+    }
+    .list{
+        background-color:white;
+        flex-direction: row;
+    }
+</style>


[3/9] incubator-weex git commit: * [ios] WXTransition frame animation including backgroundColor, opactity and transfrom

Posted by ac...@apache.org.
* [ios] WXTransition frame animation including backgroundColor, opactity and transfrom


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ec1dd7bf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ec1dd7bf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ec1dd7bf

Branch: refs/heads/0.16-dev
Commit: ec1dd7bffa090ce86aa66cf7996b84e6d2e4ccbb
Parents: 27c4547
Author: doumafang <do...@gmail.com>
Authored: Mon Aug 21 17:26:58 2017 +0800
Committer: doumafang <do...@gmail.com>
Committed: Mon Aug 21 17:26:58 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXTransition.m | 187 ++++++++++++++++++++-
 1 file changed, 179 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ec1dd7bf/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
index a6efe29..2c27cb4 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
@@ -30,6 +30,7 @@
 #import "WXUtility.h"
 #import "WXAssert.h"
 #import "WXSDKInstance_private.h"
+#import "WXLength.h"
 
 @implementation WXLayoutAnimationInfo
 
@@ -83,10 +84,10 @@
     {
         [_addStyles addEntriesFromDictionary:styles];
     }
-    
     _toStyles = [NSMutableDictionary dictionaryWithDictionary:_fromStyles];
     [_toStyles addEntriesFromDictionary:_addStyles];
     
+    
     _layoutAnimationDuration = _fromStyles[kWXTransitionDuration] ? [WXConvert CGFloat:_fromStyles[kWXTransitionDuration]] : 0;
     _layoutAnimationDelay = _fromStyles[kWXTransitionDelay] ? [WXConvert CGFloat:_fromStyles[kWXTransitionDelay]] : 0;
     _layoutAnimationTimingFunction = [WXConvert CAMediaTimingFunction:_fromStyles[kWXTransitionTimingFunction]];
@@ -120,13 +121,13 @@
 
 - (void)_resloveTransitionProperty:(NSString *)propertyNames withStyles:(NSDictionary *)styles
 {
-    NSArray *array = @[@"width",@"height",@"top",@"bottom",@"right",@"left"];
+    NSArray *array = @[@"width",@"height",@"top",@"bottom",@"right",@"left",@"opacity"];
     for (NSString *propertyName in array) {
         if ([propertyNames containsString:propertyName]) {
             [self _judgeProperty:propertyName ];
         }
     }
-    NSArray *animationModuleArray = @[@"transform",@"backgroundColor",@"opacity"];
+    NSArray *animationModuleArray = @[@"transform",@"backgroundColor"];
     for (NSString *propertyName in animationModuleArray) {
         if ([propertyNames containsString:propertyName]) {
             [self _dealWithAnimationModuleProperty:propertyName styles:styles];
@@ -151,9 +152,129 @@
 {
     if (styles[singleProperty])
     {
-        NSDictionary *args = @{@"delay":@(_layoutAnimationDelay),@"duration":@(_layoutAnimationDuration),@"styles":styles,@"timingFunction":_fromStyles[kWXTransitionTimingFunction]};
-        [self _animationModuleHandleTransition:args];
+        if (!_propertyArray) {
+            _propertyArray = [NSMutableArray new];
+        }
+        
+        if ([singleProperty isEqualToString:@"backgroundColor"]) {
+            WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+            info.fromValue = [self _dealWithColor:[WXConvert UIColor:_fromStyles[singleProperty]]];
+            info.toValue = [self _dealWithColor:[WXConvert UIColor:_toStyles[singleProperty]]];
+            info.perValue = [self _calculatePerColorRGB1:info.toValue RGB2:info.fromValue];
+            info.propertyName = singleProperty;
+            [_propertyArray addObject:info];
+        }
+        if ([singleProperty isEqualToString:@"transform"]) {
+            NSString *transformOrigin = styles[@"transformOrigin"];
+            WXTransform *wxTransform = [[WXTransform alloc] initWithCSSValue:styles[singleProperty] origin:transformOrigin instance:_targetComponent.weexInstance];
+            WXTransform *oldTransform = _targetComponent->_transform;
+            if (wxTransform.rotateAngle != oldTransform.rotateAngle) {
+                WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+                info.propertyName = @"transform.rotation";
+                info.fromValue = @(oldTransform.rotateAngle);
+                info.toValue = [NSNumber numberWithDouble:wxTransform.rotateAngle];
+                info.perValue = @([info.toValue doubleValue] - [info.fromValue doubleValue]);
+                [_propertyArray addObject:info];
+            }
+            if (wxTransform.rotateX != oldTransform.rotateX)
+            {
+                WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+                info.propertyName = @"transform.rotation.x";
+                info.fromValue = @(oldTransform.rotateX);
+                info.toValue = [NSNumber numberWithDouble:wxTransform.rotateX];
+                info.perValue = @([info.toValue doubleValue] - [info.fromValue doubleValue]);
+                [_propertyArray addObject:info];
+            }
+            if (wxTransform.rotateY != oldTransform.rotateY)
+            {
+                WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+                info.propertyName = @"transform.rotation.y";
+                info.fromValue = @(oldTransform.rotateY);
+                info.toValue = [NSNumber numberWithDouble:wxTransform.rotateY];
+                info.perValue = @([info.toValue doubleValue] - [info.fromValue doubleValue]);
+                [_propertyArray addObject:info];
+            }
+            if (wxTransform.rotateZ != oldTransform.rotateZ)
+            {
+                WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+                info.propertyName = @"transform.rotation.z";
+                info.fromValue = @(oldTransform.rotateZ);
+                info.toValue = [NSNumber numberWithDouble:wxTransform.rotateZ];
+                info.perValue = @([info.toValue doubleValue] - [info.fromValue doubleValue]);
+                [_propertyArray addObject:info];
+            }
+            
+            if (wxTransform.scaleX != oldTransform.scaleX) {
+                WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+                info.propertyName = @"transform.scale.x";
+                info.fromValue = @(oldTransform.scaleX);
+                info.toValue = @(wxTransform.scaleX);
+                info.perValue = @([info.toValue doubleValue] - [info.fromValue doubleValue]);
+                [_propertyArray addObject:info];
+            }
+            
+            if (wxTransform.scaleY != oldTransform.scaleY) {
+                WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+                info.propertyName = @"transform.scale.y";
+                info.fromValue = @(oldTransform.scaleY);
+                info.toValue = @(wxTransform.scaleX);
+                info.perValue = @([info.toValue doubleValue] - [info.fromValue doubleValue]);
+                [_propertyArray addObject:info];
+            }
+            
+            if ((wxTransform.translateX && ![wxTransform.translateX isEqualToLength:oldTransform.translateX]) || (!wxTransform.translateX && oldTransform.translateX)) {
+                WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+                info.propertyName = @"transform.translation.x";
+                info.fromValue = @([oldTransform.translateX valueForMaximum:_targetComponent.view.bounds.size.width]);
+                info.toValue = @([wxTransform.translateX valueForMaximum:_targetComponent.view.bounds.size.width]);
+                info.perValue = @([info.toValue doubleValue] - [info.fromValue doubleValue]);
+                [_propertyArray addObject:info];
+            }
+            
+            if ((wxTransform.translateY && ![wxTransform.translateY isEqualToLength:oldTransform.translateY]) || (!wxTransform.translateY && oldTransform.translateY)) {
+                WXLayoutAnimationInfo *info = [WXLayoutAnimationInfo new];
+                info.propertyName = @"transform.translation.y";
+                info.fromValue = @([oldTransform.translateY valueForMaximum:_targetComponent.view.bounds.size.height]);
+                info.toValue = @([wxTransform.translateY valueForMaximum:_targetComponent.view.bounds.size.height]);
+                info.perValue = @([info.toValue doubleValue] - [info.fromValue doubleValue]);
+                [_propertyArray addObject:info];
+            }
+            _targetComponent->_transform = wxTransform;
+        }
+    }
+}
+
+- (NSArray *)_dealWithColor:(UIColor *)color
+{
+    CGFloat R, G, B, A;
+    [color getRed:&R green:&G blue:&B alpha:&A];
+    return @[@(R),@(G),@(B),@(A)];
+}
+
+- (NSArray *)_calculatePerColorRGB1:(NSArray *)RGB1 RGB2:(NSArray *)RGB2
+{
+    CGFloat R = [RGB1[0] doubleValue] - [RGB2[0] doubleValue];
+    CGFloat G = [RGB1[1] doubleValue] - [RGB2[1] doubleValue];
+    CGFloat B = [RGB1[2] doubleValue] - [RGB2[2] doubleValue];
+    CGFloat A = [RGB1[3] doubleValue] - [RGB2[3] doubleValue];
+    return @[@(R),@(G),@(B),@(A)];
+}
+
+- (NSString *)_hexWithColor:(UIColor *)color
+{
+    uint hex;
+    CGFloat red, green, blue, alpha;
+    if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
+        [color getWhite:&red alpha:&alpha];
+        green = red;
+        blue = red;
     }
+    red = roundf(red * 255.f);
+    green = roundf(green * 255.f);
+    blue = roundf(blue * 255.f);
+    alpha = roundf(alpha * 255.f);
+    hex =  ((uint)red << 16) | ((uint)green << 8) | ((uint)blue);
+    return [NSString stringWithFormat:@"#%02x", hex];
 }
 
 - (void)_calculateLayoutAnimationProcessingStyle
@@ -166,10 +287,60 @@
         per = [self solveWithx:((_layoutAnimationCount+2)*16)/_layoutAnimationDuration epsilon:SOLVE_EPS(_layoutAnimationDuration)];
     }
     for (WXLayoutAnimationInfo *info in _propertyArray) {
-        double currentValue = [info.fromValue doubleValue] + [info.perValue doubleValue] * per;
-        [_fromStyles setObject:@(currentValue) forKey:info.propertyName];
+        if ([info.propertyName isEqualToString:@"backgroundColor"]) {
+            NSArray *array = @[
+                               @([info.fromValue[0] floatValue] + [info.perValue[0] floatValue] * per),
+                               @([info.fromValue[1] floatValue] + [info.perValue[1] floatValue] * per),
+                               @([info.fromValue[2] floatValue] + [info.perValue[2] floatValue] * per),
+                               @([info.fromValue[3] floatValue] + [info.perValue[3] floatValue] * per)];
+            UIColor *color = [UIColor colorWithRed:[array[0] floatValue] green:[array[1] floatValue] blue:[array[2] floatValue] alpha:[array[3] floatValue]];
+            WXPerformBlockOnMainThread(^{
+                _targetComponent.view.backgroundColor = color;
+                [_targetComponent.view setNeedsDisplay];
+            });
+            NSString *colorString = [self _hexWithColor:color];
+            [_fromStyles setObject:colorString forKey:info.propertyName];
+        }
+        else if ([info.propertyName hasPrefix:@"transform"])
+        {
+            double currentValue = [info.fromValue doubleValue] + [info.perValue doubleValue] * per;
+            NSString *transformString;
+            if ([info.propertyName isEqualToString:@"transfrom.rotation"]) {
+                transformString = [NSString stringWithFormat:@"rotate(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            }
+            if ([info.propertyName isEqualToString:@"transfrom.rotation.x"]) {
+                transformString = [NSString stringWithFormat:@"rotateX(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            }
+            if ([info.propertyName isEqualToString:@"transform.rotation.y"]) {
+                transformString = [NSString stringWithFormat:@"rotateY(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            }
+            if ([info.propertyName isEqualToString:@"transform.rotation.z"]) {
+                transformString = [NSString stringWithFormat:@"rotateZ(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            }
+            if ([info.propertyName isEqualToString:@"transform.scale.x"]) {
+                transformString = [NSString stringWithFormat:@"scaleX(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            }
+            if ([info.propertyName isEqualToString:@"transform.scale.y"]) {
+                transformString = [NSString stringWithFormat:@"scaleY(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            }
+            if ([info.propertyName isEqualToString:@"transform.translation.x"]) {
+                transformString = [NSString stringWithFormat:@"translateX(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            }
+            if ([info.propertyName isEqualToString:@"transform.translation.y"]) {
+                transformString = [NSString stringWithFormat:@"translateY(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            }
+            [_fromStyles setObject:transformString forKey:@"transform"];
+        }
+        else
+        {
+            double currentValue = [info.fromValue doubleValue] + [info.perValue doubleValue] * per;
+            [_fromStyles setObject:@(currentValue) forKey:info.propertyName];
+        }
     }
-    [_targetComponent _modifyStyles:_fromStyles];
+    WXPerformBlockOnMainThread(^{
+        [_targetComponent _updateViewStyles:_fromStyles];
+    });
+
     [_targetComponent _updateCSSNodeStyles:_fromStyles];
     [_targetComponent.weexInstance.componentManager startComponentTasks];
 }

[6/9] incubator-weex git commit: * [ios] delete animationmodule with transition

Posted by ac...@apache.org.
* [ios] delete animationmodule with transition


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/2474c2de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/2474c2de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/2474c2de

Branch: refs/heads/0.16-dev
Commit: 2474c2def55d5174bdd80c12e2a9e160d262ab3e
Parents: af8f9cd
Author: doumafang <do...@gmail.com>
Authored: Mon Aug 21 18:12:55 2017 +0800
Committer: doumafang <do...@gmail.com>
Committed: Mon Aug 21 18:12:55 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.h | 4 ----
 ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m | 7 -------
 ios/sdk/WeexSDK/Sources/Module/WXTransition.h      | 2 --
 ios/sdk/WeexSDK/Sources/Module/WXTransition.m      | 9 ---------
 4 files changed, 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2474c2de/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.h b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.h
index d5a8c43..e5082da 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.h
+++ b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.h
@@ -21,9 +21,5 @@
 #import "WXModuleProtocol.h"
 
 @interface WXAnimationModule : NSObject <WXModuleProtocol>
-
-
 - (void)animation:(WXComponent *)targetComponent args:(NSDictionary *)args callback:(WXModuleCallback)callback;
-- (void)animationModuleProcessAnimationWithArgs:(NSDictionary *)args withWeexInstance:(WXSDKInstance *)instance targetComponent:(WXComponent *)target;
-
 @end

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2474c2de/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
index efec793..824431d 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXAnimationModule.m
@@ -257,7 +257,6 @@ WX_EXPORT_METHOD(@selector(transition:args:callback:))
                 newInfo.toValue = @([wxTransform.translateY valueForMaximum:view.bounds.size.height]);
                 [infos addObject:newInfo];
             }
-            
             target->_transform = wxTransform;
         } else if ([property isEqualToString:@"backgroundColor"]) {
             info.propertyName = @"backgroundColor";
@@ -301,12 +300,6 @@ WX_EXPORT_METHOD(@selector(transition:args:callback:))
     return infos;
 }
 
-- (void)animationModuleProcessAnimationWithArgs:(NSDictionary *)args withWeexInstance:(WXSDKInstance *)instance targetComponent:(WXComponent *)target
-{
-    self.weexInstance = instance;
-    [self animation:target args:args callback:nil];
-}
-
 - (void)animationWithLayoutAnimationTarget:(WXComponent *)target handleProperty:(NSString *)property withDic:(NSDictionary *)args
 {
     NSDictionary *styles = args[@"styles"];

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2474c2de/ios/sdk/WeexSDK/Sources/Module/WXTransition.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.h b/ios/sdk/WeexSDK/Sources/Module/WXTransition.h
index 19870d2..777b5bd 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.h
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.h
@@ -29,7 +29,6 @@
 @property (nonatomic, strong) id toValue;
 @property (nonatomic, strong) id perValue;
 @property (nonatomic, strong) NSString *propertyName;
-
 @end
 
 @interface WXTransition : NSObject
@@ -37,7 +36,6 @@
 @property(nonatomic,strong) NSMutableDictionary *addStyles;
 @property(nonatomic,strong) NSMutableArray *propertyArray;
 - (void)_handleTransitionWithStyles:(NSDictionary *)styles withTarget:(WXComponent *)targetComponent;
-
 @end
 
 

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/2474c2de/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
index 1b513a5..9bb903b 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
@@ -21,7 +21,6 @@
 
 #import <QuartzCore/CATransaction.h>
 #import <QuartzCore/CADisplayLink.h>
-#import "WXAnimationModule.h"
 #import "WXComponentManager.h"
 #import "WXSDKInstance.h"
 #import "WXComponent+Layout.h"
@@ -421,14 +420,6 @@
     _toStyles = nil;
 }
 
-- (void)_animationModuleHandleTransition:(NSDictionary *)args
-{
-    WXAnimationModule *animation = [WXAnimationModule new];
-    WXPerformBlockOnMainThread(^{
-        [animation animationModuleProcessAnimationWithArgs:args withWeexInstance:_targetComponent.weexInstance targetComponent:_targetComponent];
-    });
-}
-
 - (NSMutableDictionary *)_addStyles
 {
     return self.addStyles;

[5/9] incubator-weex git commit: * [ios] add bug fix

Posted by ac...@apache.org.
* [ios] add bug fix


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/af8f9cd4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/af8f9cd4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/af8f9cd4

Branch: refs/heads/0.16-dev
Commit: af8f9cd48f10bba8a34207115c59dfefe36f7cb6
Parents: 5189d9c
Author: doumafang <do...@gmail.com>
Authored: Mon Aug 21 18:09:58 2017 +0800
Committer: doumafang <do...@gmail.com>
Committed: Mon Aug 21 18:09:58 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXTransition.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/af8f9cd4/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
index 9230a27..1b513a5 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
@@ -315,7 +315,7 @@
                 transformString = [NSString stringWithFormat:@"rotateY(%lfdeg)",currentValue * 180.0 / M_PI];
             }
             if ([info.propertyName isEqualToString:@"transform.rotation.z"]) {
-                transformString = [NSString stringWithFormat:@"rotateZ(%lfdeg)",currentValue];
+                transformString = [NSString stringWithFormat:@"rotateZ(%lfdeg)",currentValue * 180.0 / M_PI];
             }
             if ([info.propertyName isEqualToString:@"transform.scale.x"]) {
                 transformString = [NSString stringWithFormat:@"scaleX(%lf)",currentValue];

[7/9] incubator-weex git commit: * [ios] add UIColor test function

Posted by ac...@apache.org.
* [ios] add UIColor test function


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/1d87ab3e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/1d87ab3e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/1d87ab3e

Branch: refs/heads/0.16-dev
Commit: 1d87ab3e9078cbaa4ee25d35ec23177d96df4d80
Parents: 2474c2d
Author: doumafang <do...@gmail.com>
Authored: Tue Aug 22 15:05:44 2017 +0800
Committer: doumafang <do...@gmail.com>
Committed: Tue Aug 22 15:05:44 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXTransition.m   | 24 +++-----------------
 ios/sdk/WeexSDK/Sources/Utility/WXConvert.h     |  1 +
 ios/sdk/WeexSDK/Sources/Utility/WXConvert.m     | 17 ++++++++++++++
 .../Sources/View/WXComponent+ViewManagement.m   |  1 -
 ios/sdk/WeexSDKTests/WXConvertTests.m           | 17 +++++++++++---
 5 files changed, 35 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1d87ab3e/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
index 9bb903b..be963ae 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
@@ -259,23 +259,6 @@
     return @[@(R),@(G),@(B),@(A)];
 }
 
-- (NSString *)_hexWithColor:(UIColor *)color
-{
-    uint hex;
-    CGFloat red, green, blue, alpha;
-    if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
-        [color getWhite:&red alpha:&alpha];
-        green = red;
-        blue = red;
-    }
-    red = roundf(red * 255.f);
-    green = roundf(green * 255.f);
-    blue = roundf(blue * 255.f);
-    alpha = roundf(alpha * 255.f);
-    hex =  ((uint)red << 16) | ((uint)green << 8) | ((uint)blue);
-    return [NSString stringWithFormat:@"#%02x", hex];
-}
-
 - (void)_calculateLayoutAnimationProcessingStyle
 {
     if (_propertyArray.count == 0) {
@@ -297,7 +280,7 @@
                 _targetComponent.view.backgroundColor = color;
                 [_targetComponent.view setNeedsDisplay];
             });
-            NSString *colorString = [self _hexWithColor:color];
+            NSString *colorString = [WXConvert HexWithColor:color];
             [_fromStyles setObject:colorString forKey:info.propertyName];
         }
         else if ([info.propertyName hasPrefix:@"transform"])
@@ -313,7 +296,7 @@
             if ([info.propertyName isEqualToString:@"transform.rotation.y"]) {
                 transformString = [NSString stringWithFormat:@"rotateY(%lfdeg)",currentValue * 180.0 / M_PI];
             }
-            if ([info.propertyName isEqualToString:@"transform.rotation.z"]) {
+            if ([info.propertyName isEqualToString:@"transform.rotation.z"]) {
                 transformString = [NSString stringWithFormat:@"rotateZ(%lfdeg)",currentValue * 180.0 / M_PI];
             }
             if ([info.propertyName isEqualToString:@"transform.scale.x"]) {
@@ -379,8 +362,7 @@
 - (void)_suspendLayoutAnimationDisplayLink
 {
     WXAssertComponentThread();
-    if(_layoutAnimationDisplayLink && !_layoutAnimationDisplayLink.paused)
-    {
+    if(_layoutAnimationDisplayLink && !_layoutAnimationDisplayLink.paused){
         _layoutAnimationDisplayLink.paused = YES;
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1d87ab3e/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
index eedcbbf..25c6430 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.h
@@ -53,6 +53,7 @@ typedef CGFloat WXPixelType;
 
 + (UIColor *)UIColor:(id)value;
 + (CGColorRef)CGColor:(id)value;
++ (NSString *)HexWithColor:(UIColor *)color;
 + (WXBorderStyle)WXBorderStyle:(id)value;
 typedef BOOL WXClipType;
 + (WXClipType)WXClipType:(id)value;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1d87ab3e/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
index 18892e6..24458e4 100644
--- a/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
+++ b/ios/sdk/WeexSDK/Sources/Utility/WXConvert.m
@@ -421,6 +421,23 @@ WX_NUMBER_CONVERT(NSUInteger, unsignedIntegerValue)
     return [color CGColor];
 }
 
++ (NSString *)HexWithColor:(UIColor *)color
+{
+    uint hex;
+    CGFloat red, green, blue, alpha;
+    if (![color getRed:&red green:&green blue:&blue alpha:&alpha]) {
+        [color getWhite:&red alpha:&alpha];
+        green = red;
+        blue = red;
+    }
+    red = roundf(red * 255.f);
+    green = roundf(green * 255.f);
+    blue = roundf(blue * 255.f);
+    alpha = roundf(alpha * 255.f);
+    hex =  ((uint)red << 16) | ((uint)green << 8) | ((uint)blue);
+    return [NSString stringWithFormat:@"#%02x", hex];
+}
+
 + (WXBorderStyle)WXBorderStyle:(id)value
 {
     if([value isKindOfClass:[NSString class]]){

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1d87ab3e/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.m b/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.m
index 9a3cf6d..ef00f9a 100644
--- a/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.m
+++ b/ios/sdk/WeexSDK/Sources/View/WXComponent+ViewManagement.m
@@ -197,7 +197,6 @@ do {\
     
     if (styles[@"backgroundImage"]) {
         _backgroundImage = styles[@"backgroundImage"] ? [WXConvert NSString:styles[@"backgroundImage"]]: nil;
-        
         if (_backgroundImage) {
             [self setGradientLayer];
         }

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/1d87ab3e/ios/sdk/WeexSDKTests/WXConvertTests.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDKTests/WXConvertTests.m b/ios/sdk/WeexSDKTests/WXConvertTests.m
index f3ed6a2..d5874bd 100644
--- a/ios/sdk/WeexSDKTests/WXConvertTests.m
+++ b/ios/sdk/WeexSDKTests/WXConvertTests.m
@@ -53,7 +53,6 @@
     NSUInteger val= [WXConvert NSUInteger:@"x"];
     XCTAssertTrue(0==val);
     
-    
     val= [WXConvert NSUInteger:@"9"];
     XCTAssertTrue(9);
     
@@ -62,8 +61,6 @@
     val= [WXConvert NSUInteger:unsignedIntMax];
     XCTAssertTrue(val==NSUIntegerMax);
     
-    
-    
     //test overflow
     unsigned long long uio = NSUIntegerMax;
     uio++;
@@ -71,7 +68,21 @@
     NSString * ulval  = [NSString stringWithFormat:@"%llu", uio ];
     val = [WXConvert NSUInteger:ulval];
     XCTAssertTrue(0==val);//overflowed
+
+}
+
+- (void) testColor{
+    
+    UIColor *redColor = [UIColor redColor];
+    NSString *redString = @"#ff0000";
+    
+    //color2hex
+    NSString *hexString = [WXConvert HexWithColor:redColor];
+    XCTAssertTrue([redString isEqualToString:hexString]);
     
+    //hex2color
+    UIColor *redTestColor = [WXConvert UIColor:redString];
+    XCTAssertTrue(CGColorEqualToColor(redTestColor.CGColor, redColor.CGColor));
 }
 
 @end

[4/9] incubator-weex git commit: * [ios] transition fix number calculate bug

Posted by ac...@apache.org.
* [ios] transition fix number calculate bug


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/5189d9cf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/5189d9cf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/5189d9cf

Branch: refs/heads/0.16-dev
Commit: 5189d9cfa68cb3bc385e038d645019c00132cc53
Parents: ec1dd7b
Author: doumafang <do...@gmail.com>
Authored: Mon Aug 21 18:08:00 2017 +0800
Committer: doumafang <do...@gmail.com>
Committed: Mon Aug 21 18:08:00 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXTransition.m | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5189d9cf/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
index 2c27cb4..9230a27 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
@@ -304,24 +304,24 @@
         else if ([info.propertyName hasPrefix:@"transform"])
         {
             double currentValue = [info.fromValue doubleValue] + [info.perValue doubleValue] * per;
-            NSString *transformString;
-            if ([info.propertyName isEqualToString:@"transfrom.rotation"]) {
-                transformString = [NSString stringWithFormat:@"rotate(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            NSString *transformString = [NSString string];
+            if ([info.propertyName isEqualToString:@"transform.rotation"]) {
+                transformString = [NSString stringWithFormat:@"rotate(%lfdeg)",currentValue * 180.0 / M_PI];
             }
-            if ([info.propertyName isEqualToString:@"transfrom.rotation.x"]) {
-                transformString = [NSString stringWithFormat:@"rotateX(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+            if ([info.propertyName isEqualToString:@"transform.rotation.x"]) {
+                transformString = [NSString stringWithFormat:@"rotateX(%lfdeg)",currentValue * 180.0 / M_PI];
             }
             if ([info.propertyName isEqualToString:@"transform.rotation.y"]) {
-                transformString = [NSString stringWithFormat:@"rotateY(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+                transformString = [NSString stringWithFormat:@"rotateY(%lfdeg)",currentValue * 180.0 / M_PI];
             }
             if ([info.propertyName isEqualToString:@"transform.rotation.z"]) {
-                transformString = [NSString stringWithFormat:@"rotateZ(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+                transformString = [NSString stringWithFormat:@"rotateZ(%lfdeg)",currentValue];
             }
             if ([info.propertyName isEqualToString:@"transform.scale.x"]) {
-                transformString = [NSString stringWithFormat:@"scaleX(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+                transformString = [NSString stringWithFormat:@"scaleX(%lf)",currentValue];
             }
             if ([info.propertyName isEqualToString:@"transform.scale.y"]) {
-                transformString = [NSString stringWithFormat:@"scaleY(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];
+                transformString = [NSString stringWithFormat:@"scaleY(%lf)",currentValue];
             }
             if ([info.propertyName isEqualToString:@"transform.translation.x"]) {
                 transformString = [NSString stringWithFormat:@"translateX(%lfpx)",currentValue / _targetComponent.weexInstance.pixelScaleFactor];

[2/9] incubator-weex git commit: * [ios] fix double change style transition

Posted by ac...@apache.org.
* [ios] fix double change style transition


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/27c4547d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/27c4547d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/27c4547d

Branch: refs/heads/0.16-dev
Commit: 27c4547d03de7d095db5bcd983064704ff3c3a44
Parents: 5863b93
Author: doumafang <do...@gmail.com>
Authored: Thu Aug 17 17:59:47 2017 +0800
Committer: doumafang <do...@gmail.com>
Committed: Thu Aug 17 17:59:47 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDK/Sources/Module/WXTransition.m | 36 ++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/27c4547d/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
index 51dc131..a6efe29 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXTransition.m
@@ -63,11 +63,19 @@
 
 @implementation WXTransition
 
+#pragma mark - HandleStyle
 - (void)_handleTransitionWithStyles:(NSDictionary *)styles withTarget:(WXComponent *)targetComponent
 {
-    [self _suspendLayoutAnimationDisplayLink];
+    if ([self _isLayoutAnimationRunning]) {
+        [self _rollBackTransitionWithStyles:styles];
+    }
+    else
+    {
+        [self _suspendLayoutAnimationDisplayLink];
+    }
+    
     _targetComponent = targetComponent;
-    if (!_addStyles) {
+    if (!_fromStyles) {
         _fromStyles = [NSMutableDictionary dictionaryWithDictionary:targetComponent.styles];
         _addStyles = [NSMutableDictionary dictionaryWithDictionary:styles];
     }
@@ -75,6 +83,7 @@
     {
         [_addStyles addEntriesFromDictionary:styles];
     }
+    
     _toStyles = [NSMutableDictionary dictionaryWithDictionary:_fromStyles];
     [_toStyles addEntriesFromDictionary:_addStyles];
     
@@ -102,6 +111,13 @@
     [self performSelector:@selector(_startLayoutAnimationDisplayLink) withObject:self afterDelay:_layoutAnimationDelay/1000];
 }
 
+- (void)_rollBackTransitionWithStyles:(NSDictionary *)styles
+{
+    _layoutAnimationDuration = _layoutAnimationCount * 1000 / 60;
+    _layoutAnimationCount = 0;
+    _propertyArray = nil;
+}
+
 - (void)_resloveTransitionProperty:(NSString *)propertyNames withStyles:(NSDictionary *)styles
 {
     NSArray *array = @[@"width",@"height",@"top",@"bottom",@"right",@"left"];
@@ -153,10 +169,12 @@
         double currentValue = [info.fromValue doubleValue] + [info.perValue doubleValue] * per;
         [_fromStyles setObject:@(currentValue) forKey:info.propertyName];
     }
+    [_targetComponent _modifyStyles:_fromStyles];
     [_targetComponent _updateCSSNodeStyles:_fromStyles];
     [_targetComponent.weexInstance.componentManager startComponentTasks];
 }
 
+#pragma mark CADisplayLink
 - (void)_startLayoutAnimationDisplayLink
 {
     WXAssertComponentThread();
@@ -178,6 +196,16 @@
     }
 }
 
+- (BOOL)_isLayoutAnimationRunning
+{
+    WXAssertComponentThread();
+    BOOL yesOrNo = NO;
+    if (!_layoutAnimationDisplayLink.paused && _layoutAnimationCount >= 5) {
+        yesOrNo = YES;
+    }
+    return yesOrNo;
+}
+
 - (void)_suspendLayoutAnimationDisplayLink
 {
     WXAssertComponentThread();
@@ -217,6 +245,9 @@
     _layoutAnimationDuration = 0;
     _propertyArray = nil;
 
+    _addStyles = nil;
+    _fromStyles = nil;
+    _toStyles = nil;
 }
 
 - (void)_animationModuleHandleTransition:(NSDictionary *)args
@@ -237,6 +268,7 @@
     return self.fromStyles;
 }
 
+#pragma mark UnitBezierp
 - (void)unitBezierp1x:(double)p1x p1y:(double)p1y p2x:(double)p2x p2y:(double)p2y
 {
     cx = 3.0 * p1x;


[9/9] incubator-weex git commit: Merge branch 'ios-feature-layoutanimation-0.16dev' of https://github.com/doumafang/incubator-weex into wip-us-0.16-dev

Posted by ac...@apache.org.
Merge branch 'ios-feature-layoutanimation-0.16dev' of https://github.com/doumafang/incubator-weex into wip-us-0.16-dev


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/dffa92f8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/dffa92f8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/dffa92f8

Branch: refs/heads/0.16-dev
Commit: dffa92f8afaac2c4fbd04c12785647e69f3fc24b
Parents: 952697a 60cad94
Author: acton393 <zh...@gmail.com>
Authored: Tue Aug 22 16:27:26 2017 +0800
Committer: acton393 <zh...@gmail.com>
Committed: Tue Aug 22 16:27:26 2017 +0800

----------------------------------------------------------------------
 examples/vue/index.vue                          |   1 -
 examples/vue/transition.vue                     |  75 +++++++
 .../WeexSDK/Sources/Module/WXAnimationModule.h  |   4 -
 .../WeexSDK/Sources/Module/WXAnimationModule.m  |   7 -
 ios/sdk/WeexSDK/Sources/Module/WXTransition.h   |   2 -
 ios/sdk/WeexSDK/Sources/Module/WXTransition.m   | 214 +++++++++++++++++--
 ios/sdk/WeexSDK/Sources/Utility/WXConvert.h     |   1 +
 ios/sdk/WeexSDK/Sources/Utility/WXConvert.m     |  17 ++
 .../Sources/View/WXComponent+ViewManagement.m   |   1 -
 ios/sdk/WeexSDKTests/WXConvertTests.m           |  21 +-
 10 files changed, 306 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/dffa92f8/examples/vue/index.vue
----------------------------------------------------------------------


[8/9] incubator-weex git commit: * [ios] add color2hex test

Posted by ac...@apache.org.
* [ios] add color2hex 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/60cad949
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/60cad949
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/60cad949

Branch: refs/heads/0.16-dev
Commit: 60cad9498e0aa10d6ae6d18815c26441d53c599f
Parents: 1d87ab3
Author: doumafang <do...@gmail.com>
Authored: Tue Aug 22 16:06:06 2017 +0800
Committer: doumafang <do...@gmail.com>
Committed: Tue Aug 22 16:06:06 2017 +0800

----------------------------------------------------------------------
 ios/sdk/WeexSDKTests/WXConvertTests.m | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/60cad949/ios/sdk/WeexSDKTests/WXConvertTests.m
----------------------------------------------------------------------
diff --git a/ios/sdk/WeexSDKTests/WXConvertTests.m b/ios/sdk/WeexSDKTests/WXConvertTests.m
index d5874bd..8b33922 100644
--- a/ios/sdk/WeexSDKTests/WXConvertTests.m
+++ b/ios/sdk/WeexSDKTests/WXConvertTests.m
@@ -71,18 +71,22 @@
 
 }
 
-- (void) testColor{
+- (void) testHex2Color{
     
     UIColor *redColor = [UIColor redColor];
     NSString *redString = @"#ff0000";
+    //hex2color
+    UIColor *redTestColor = [WXConvert UIColor:redString];
+    XCTAssertTrue(CGColorEqualToColor(redTestColor.CGColor, redColor.CGColor));
+}
+
+- (void) testColor2Hex{
     
+    UIColor *redColor = [UIColor redColor];
+    NSString *redString = @"#ff0000";
     //color2hex
     NSString *hexString = [WXConvert HexWithColor:redColor];
     XCTAssertTrue([redString isEqualToString:hexString]);
-    
-    //hex2color
-    UIColor *redTestColor = [WXConvert UIColor:redString];
-    XCTAssertTrue(CGColorEqualToColor(redTestColor.CGColor, redColor.CGColor));
 }
 
 @end