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/03/03 02:01:25 UTC

[2/5] incubator-weex git commit: * [android] update testcase

* [android] update testcase


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

Branch: refs/heads/0.11-dev
Commit: 26ad7abe7a25e4f53bc863ea15515f2d754a0a30
Parents: 5a285f0
Author: moxun.ljf <mo...@alibaba-inc.com>
Authored: Thu Mar 2 16:52:33 2017 +0800
Committer: moxun.ljf <mo...@alibaba-inc.com>
Committed: Thu Mar 2 16:52:33 2017 +0800

----------------------------------------------------------------------
 test/pages/image.we                   | 19 +++++++++++++++
 test/scripts/components/image.test.js | 39 ++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/26ad7abe/test/pages/image.we
----------------------------------------------------------------------
diff --git a/test/pages/image.we b/test/pages/image.we
new file mode 100644
index 0000000..8d21c7a
--- /dev/null
+++ b/test/pages/image.we
@@ -0,0 +1,19 @@
+<template>
+  <div>
+    <img style="width: 500;height: 500;" src="https://gw.alicdn.com/tps/TB1bEMYKXXXXXaLaXXXXXXXXXXX-360-388.png" onload="onload"></img>
+    <text style="font-size:30">{{size}}</text>
+  </div>
+</template>
+<script>
+  module.exports = {
+    data : {
+      size:"-1,-1"
+    },
+    methods : {
+      onload : function(e) {
+        nativeLog(JSON.stringify(e))
+        this.size = e.size.naturalWidth + ',' + e.size.naturalHeight;
+      }
+    }
+  }
+</script>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/26ad7abe/test/scripts/components/image.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/image.test.js b/test/scripts/components/image.test.js
new file mode 100644
index 0000000..8030511
--- /dev/null
+++ b/test/scripts/components/image.test.js
@@ -0,0 +1,39 @@
+'use strict';
+
+var _ = require('macaca-utils');
+var assert = require('chai').assert
+var wd = require('weex-wd')
+var path = require('path');
+var os = require('os');
+var util = require("../util.js");
+
+describe('image onload', function () {
+  this.timeout(util.getTimeoutMills());
+  var driver = util.createDriver(wd);
+
+  before(function () {
+    return util.init(driver)
+      .get('wxpage://' + util.getDeviceHost() +'/image.js')
+      .waitForElementByXPath('//div/text[1]',util.getGETActionWaitTimeMills(),1000)
+  });
+
+  after(function () {
+      return util.quit(driver);
+  })
+
+
+  it('#1 download image', () => {
+    return driver
+    .sleep(5000)
+    .elementByXPath('//div/text')
+    .text()
+    .then((text)=>{
+        if(text == '-1,-1') {
+            return;
+        }
+        assert.equal(text, '360,388')
+    })
+  })
+});
+
+