calabash-android 0.3.3.pre2 → 0.3.3.pre3

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,11 +13,11 @@ def calabash_build(app)
13
13
  FileUtils.cp(unsigned_test_apk, "TestServer.apk")
14
14
  FileUtils.cp(File.join(File.dirname(__FILE__), '..', 'test-server/AndroidManifest.xml'), "AndroidManifest.xml")
15
15
 
16
- unless system %Q{ruby -pi.bak -e "gsub(/#targetPackage#/, '#{package_name(app)}')" AndroidManifest.xml}
16
+ unless system %Q{ruby -pi.bak -e "gsub(/#targetPackage#/, '#{package_name(app)}')" AndroidManifest.xml}
17
17
  raise "Could not replace package name in manifest"
18
18
  end
19
19
 
20
- unless system("\"#{ENV["ANDROID_HOME"]}/platform-tools/aapt\" package -M AndroidManifest.xml -I #{android_platform}/android.jar -F dummy.apk")
20
+ unless system %Q{"#{ENV["ANDROID_HOME"]}/platform-tools/aapt" package -M AndroidManifest.xml -I "#{android_platform}/android.jar" -F dummy.apk}
21
21
  raise "Could not create dummy.apk"
22
22
  end
23
23
 
@@ -266,7 +266,7 @@ module Operations
266
266
  if is_windows?
267
267
  %Q("#{ENV["ANDROID_HOME"]}\\platform-tools\\adb.exe" #{device_args})
268
268
  else
269
- %Q(#{ENV["ANDROID_HOME"]}/platform-tools/adb #{device_args})
269
+ %Q("#{ENV["ANDROID_HOME"]}/platform-tools/adb" #{device_args})
270
270
  end
271
271
  end
272
272
 
@@ -395,7 +395,7 @@ module Operations
395
395
  ni
396
396
  end
397
397
 
398
- def background(secs)
398
+ def app_to_background(secs)
399
399
  ni
400
400
  end
401
401
 
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.3.3.pre2"
3
+ VERSION = "0.3.3.pre3"
4
4
  end
5
5
  end
@@ -52,36 +52,12 @@ public class CalabashChromeClient extends WebChromeClient {
52
52
  }
53
53
  }
54
54
 
55
- public float getScale() {
56
- if (Build.VERSION.SDK_INT >= 16) { // jelly bean
57
- return webView.getScale();
58
- }
59
- try {
60
- Field mActualScaleField = null;
61
- Object targetObject = webView;
62
-
63
- if (Build.VERSION.SDK_INT < 14) { //before Ice cream sandwich
64
- mActualScaleField = WebView.class.getDeclaredField("mActualScale");
65
- } else {
66
- Field zoomManagerField = WebView.class.getDeclaredField("mZoomManager");
67
- zoomManagerField.setAccessible(true);
68
- targetObject = zoomManagerField.get(webView);
69
-
70
- mActualScaleField = Class.forName("android.webkit.ZoomManager").getDeclaredField("mActualScale");
71
- }
72
- mActualScaleField.setAccessible(true);
73
- return mActualScaleField.getFloat(targetObject);
74
- } catch (Exception e) {
75
- throw new RuntimeException(e);
76
- }
77
- }
78
-
79
55
  public WebView getWebView() {
80
56
  return webView;
81
57
  }
82
58
 
83
59
  public String getResult() {
84
- eventHandled.block(30000);
60
+ eventHandled.block(3000);
85
61
  if (result.message == null) {
86
62
  throw new RuntimeException("Timed out waiting for result for JavaScript");
87
63
  }
@@ -56,7 +56,7 @@ public class QueryHelper {
56
56
  CalabashChromeClient calabashChromeClient = CalabashChromeClient.findAndPrepareWebViews().get(0);
57
57
 
58
58
  WebView webView = calabashChromeClient.getWebView();
59
- float scale = calabashChromeClient.getScale();
59
+ float scale = calabashChromeClient.getWebView().getScale();
60
60
 
61
61
  System.out.println("scale: " + scale);
62
62
  int[] webviewLocation = new int[2];
@@ -55,14 +55,12 @@ public class ScrollTo implements Action {
55
55
  }
56
56
 
57
57
  }
58
-
59
-
60
-
58
+
61
59
  private boolean isVisible(Map<String, Object> rectangle, CalabashChromeClient calabashChromeClient) {
62
60
  WebView webView = calabashChromeClient.getWebView();
63
61
  int windowTop = webView.getScrollY();
64
62
  int windowBottom = webView.getScrollY() + webView.getHeight();
65
- int centerY = (int) ((Integer)rectangle.get("center_y") * calabashChromeClient.getScale());
63
+ int centerY = (int) ((Integer)rectangle.get("center_y") * calabashChromeClient.getWebView().getScale());
66
64
 
67
65
  return windowTop < centerY && centerY < windowBottom;
68
66
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3.pre2
4
+ version: 0.3.3.pre3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-22 00:00:00.000000000 Z
12
+ date: 2012-10-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber