You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/04/28 03:04:46 UTC

[38/50] [abbrv] incubator-weex git commit: + [test] Add compositing test

+ [test] Add compositing 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/cf8c0542
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/cf8c0542
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/cf8c0542

Branch: refs/heads/master
Commit: cf8c05423cd51fe310c66aa8535c9f4870f3b453
Parents: cf7ee9d
Author: yinfeng <cx...@apache.org>
Authored: Thu Apr 27 11:31:47 2017 +0800
Committer: yinfeng <cx...@apache.org>
Committed: Thu Apr 27 11:31:47 2017 +0800

----------------------------------------------------------------------
 test/pages/attributes/compositing.vue       |  89 +++++++++++++++++++++++
 test/screenshot/compositing-ios.png         | Bin 0 -> 228661 bytes
 test/scripts/attributes/compositing.test.js |  63 ++++++++++++++++
 3 files changed, 152 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cf8c0542/test/pages/attributes/compositing.vue
----------------------------------------------------------------------
diff --git a/test/pages/attributes/compositing.vue b/test/pages/attributes/compositing.vue
new file mode 100644
index 0000000..a404f32
--- /dev/null
+++ b/test/pages/attributes/compositing.vue
@@ -0,0 +1,89 @@
+
+<template>
+  <div class="wrapper" @click="update" >
+    <div class="item" compositing=true>
+      <div class="itemWrapper">
+        <div class="nameWrapper">
+          <text class="itemName">Thomas Carlyle</text>
+        </div>
+        <image class="itemPhoto" src="https://gw.alicdn.com/tps/TB1Jl1CPFXXXXcJXXXXXXXXXXXX-370-370.jpg"></image>
+        <div class="descWrapper">
+          <text class="itemDesc">Genius only means hard-working all one\'s life</text>
+        </div>
+      </div>
+    </div>
+
+    <div class="item" compositing=false>
+      <div class="itemWrapper">
+        <div class="nameWrapper">
+          <text class="itemName">Thomas Carlyle</text>
+        </div>
+        <image class="itemPhoto" src="https://gw.alicdn.com/tps/TB1Jl1CPFXXXXcJXXXXXXXXXXXX-370-370.jpg"></image>
+        <div class="descWrapper">
+          <text test-id="test-text" class="itemDesc">Genius only means hard-working all one\'s life</text>
+        </div>
+      </div>
+    </div>
+  </div>
+</template>
+
+<style>
+  .wrapper {
+    align-items: center; 
+    opacity: 0.8;
+  }
+  .itemWrapper {
+    flex:1;
+    border-top-right-radius: 80;
+    border-bottom-right-radius: 80;
+    border-top-width: 10;
+    border-top-color: red;
+    border-style: dashed;
+    align-items: center;
+    background-color: white;
+  }
+  .nameWrapper {
+    background-color:rgba(255,0,0,0.5);
+    border-radius: 30;
+    overflow: visible;
+    border-color: black;
+    border-width: 10;
+  }
+  .item {
+    margin-top: 120px; 
+    background-color: #CCCCCC;
+    align-items: center;
+  }
+  .itemName {
+    font-size:28;
+    color:#333333;
+    line-height:42;
+    text-align:left;
+    margin-top: 24;
+  }
+  .itemPhoto {
+    margin-top: 18;
+    width: 220;
+    height: 220;
+    margin-bottom: 18;
+    border-radius: 30;
+    overflow: hidden;
+    background-color: blue;
+  }
+  .itemDesc {
+    font-size:24;
+    margin:12;
+    color:#999999;
+    line-height:36;
+    text-align:left;
+  }
+</style>
+
+<script>
+  module.exports = {
+    data: {
+    },
+    methods: {
+    }
+  }
+</script>

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cf8c0542/test/screenshot/compositing-ios.png
----------------------------------------------------------------------
diff --git a/test/screenshot/compositing-ios.png b/test/screenshot/compositing-ios.png
new file mode 100644
index 0000000..85669fa
Binary files /dev/null and b/test/screenshot/compositing-ios.png differ

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cf8c0542/test/scripts/attributes/compositing.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/attributes/compositing.test.js b/test/scripts/attributes/compositing.test.js
new file mode 100644
index 0000000..ce4c5e9
--- /dev/null
+++ b/test/scripts/attributes/compositing.test.js
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+'use strict';
+
+var assert = require('chai').assert
+var wd = require('weex-wd')
+var path = require('path');
+var util = require("../util.js");
+var assert = require('chai').assert
+
+describe('compositing test', function () {
+  this.timeout(util.getTimeoutMills());
+  var driver = util.createDriver(wd);
+
+  if (process.env.platform !== 'ios') {
+    return;
+  }
+
+  before(function () {
+    return util.init(driver)
+      .get(util.getPage('/attributes/compositing.js'))
+      .waitForElementById('test-text',util.getGETActionWaitTimeMills() + 2000,1000)
+  });
+
+  after(function () {
+    return util.quit(driver);
+  })
+
+
+  it('#1 compositing screenshot diff', () => {
+    return driver
+    .takeScreenshot()
+    .then(imgData => {
+      var newImg = new Buffer(imgData, 'base64');
+      var screenshotFolder = path.resolve(__dirname, '../../screenshot');
+      var oldImgPath = path.join(screenshotFolder, process.env.platform === 'android' ? 'compositing-android.png' : 'compositing-ios.png');
+      var diffImgPath = path.join(screenshotFolder, process.env.platform === 'android' ? 'compositing-android-diff.png' : 'compositing-ios-diff.png');
+      return util.diffImage(oldImgPath, newImg, 1, diffImgPath);
+    })
+    .then(result => {
+      console.log(result)
+      assert.isOk(result)
+    })
+  })
+});
+
+