rautomation 0.14.1 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4eaaa6e89ff50f57258c5df9b84d373adca0fc1
4
- data.tar.gz: 4f41ba6864d5dce23f42a7fc7a5beb3d0efff7d3
3
+ metadata.gz: 3c6d6a52e58f96779bd37c86b30ba8f392dd0191
4
+ data.tar.gz: fbc26ee037eef080677cf8997aeb924f02bd1360
5
5
  SHA512:
6
- metadata.gz: 3f7ab9a4f98f7d4859093745514d3f328ddb11cdf13fe49076027e1b10a88ac7cf3702ec7de82ae9234fc739f9b151ed809d34bd3c70382af98ac6b19a49ea8a
7
- data.tar.gz: 324e3c6f2f65e571e1469e0b4074997f59240691e60f59faee40b486f60b22319ee56cf73a8a376a5ee13105e3116bae91d28a597be44db33c24553730fab634
6
+ metadata.gz: 652ed3ab3c3624056af6166a4a2c4569f0a0e3c02201d69a3bfba9d3f82be7b73f255f6c7fa7188b6c98c43e6f496b2fab78d562637cac2ccfc086a9b8ecc2d2
7
+ data.tar.gz: 1d10710a01cdebfed601261cdb34bd5a3e3e79cfb979f2ad4be6e797c1aad1804a9f8dfab43359e8267f86378021f71ccd96b453bdacc4974792e58e9543daa5
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rautomation (0.14.1)
4
+ rautomation (0.15.0)
5
5
  ffi (= 1.9.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,7 @@
1
+ == 0.15.0 / 2014-06-01
2
+
3
+ * Fixes #send_keys with special characters. Issue #92.
4
+
1
5
  == 0.14.1 / 2014-02-05
2
6
 
3
7
  * Set ffi 1.9.0 as a dependency for now because newer versions are broken. See more at issue #81.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.14.1
1
+ 0.15.0
@@ -3,7 +3,7 @@ module RAutomation
3
3
  module Win32
4
4
  class Keys
5
5
  KEYS = {
6
- # keycodes from http://msdn.microsoft.com/en-us/library/ms927178.aspx
6
+ # keycodes from http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx
7
7
  :null => 0x00,
8
8
  :cancel => 0x03,
9
9
  :help => 0x2F,
@@ -38,8 +38,8 @@ module RAutomation
38
38
  :arrow_down => 0x28,
39
39
  :insert => 0x2D,
40
40
  :delete => 0x2E,
41
- :semicolon => 0x3B,
42
- :equals => 0x3D,
41
+ :semicolon => 0xBA,
42
+ :equals => 0xBB,
43
43
  :numpad0 => 0x60,
44
44
  :numpad1 => 0x61,
45
45
  :numpad2 => 0x62,
@@ -68,11 +68,29 @@ module RAutomation
68
68
  :f10 => 0x79,
69
69
  :f11 => 0x7A,
70
70
  :f12 => 0x7B,
71
+ :comma => 0xBC,
71
72
  :dash => 0xBD,
72
- :slash => 0x6F,
73
+ :period => 0xBE,
74
+ :slash => 0xBF,
75
+ :grave => 0xC0,
73
76
  :backslash => 0xDC
74
- }
77
+ }
78
+
79
+ MAPPED_KEYS = {
80
+ "\\" => KEYS[:backslash],
81
+ "-" => KEYS[:dash],
82
+ "/" => KEYS[:slash],
83
+ "=" => KEYS[:equals],
84
+ ";" => KEYS[:semicolon],
85
+ "'" => KEYS[:single_quote],
86
+ "." => KEYS[:period],
87
+ "," => KEYS[:comma],
88
+ "[" => KEYS[:left_bracket],
89
+ "]" => KEYS[:right_bracket],
90
+ '`' => KEYS[:grave]
91
+ }
75
92
 
93
+ # Assumes US standard keyboard layout
76
94
  SPECIAL_KEYS = {
77
95
  "!" => 0x31,
78
96
  "@" => 0x32,
@@ -84,16 +102,17 @@ module RAutomation
84
102
  "*" => 0x38,
85
103
  "(" => 0x39,
86
104
  ")" => 0x30,
87
- "_" => 0x2D,
88
- "+" => 0x3D,
89
- "{" => 0x5B,
90
- "}" => 0x5D,
91
- ":" => 0x3B,
92
- "\"" => 0x27,
93
- "|" => 0x5C,
94
- "?" => 0x2F,
95
- ">" => 0x2E,
96
- "<" => 0x2C
105
+ "_" => KEYS[:dash],
106
+ "+" => KEYS[:equals],
107
+ "{" => KEYS[:left_bracket],
108
+ "}" => KEYS[:right_bracket],
109
+ ":" => KEYS[:semicolon],
110
+ "\"" => KEYS[:single_quote],
111
+ "|" => KEYS[:backslash],
112
+ "?" => KEYS[:slash],
113
+ ">" => KEYS[:period],
114
+ "<" => KEYS[:comma],
115
+ "~" => KEYS[:grave]
97
116
  }
98
117
 
99
118
  def self.[](key)
@@ -115,7 +134,7 @@ module RAutomation
115
134
 
116
135
  def self.encode_str(keys)
117
136
  keys.to_s.split("").map do |key|
118
- key =~ /[a-z]/ ? key.upcase.unpack("c")[0] :
137
+ key =~ /[a-z]/ || MAPPED_KEYS[key] ? MAPPED_KEYS[key] || key.upcase.unpack("c")[0] :
119
138
  key =~ /[A-Z]/ || SPECIAL_KEYS[key] ? [Keys[:shift], SPECIAL_KEYS[key] || key.unpack("c")[0], Keys[:null]] :
120
139
  key.unpack("c")[0]
121
140
  end
@@ -17,11 +17,12 @@ describe "Win32::Window", :if => SpecHelper.adapter == :win_32 do
17
17
  it "send arbitrary characters and control keys" do
18
18
  text_field = window.text_field(:index => 2)
19
19
  text_field.focus
20
- window.send_keys "abc123ABChiHI!"
21
- text_field.value.should == "abc123ABChiHI!"
20
+ arbitrary_str = "abc123ABChiHI!@#$%^&*()-_+=[{]}\\|;:'\",<.>/?`~"
21
+ window.send_keys arbitrary_str
22
+ text_field.value.should == arbitrary_str
22
23
 
23
24
  window.send_keys :space, "X"
24
- text_field.value.should == "abc123ABChiHI! X"
25
+ text_field.value.should == "#{arbitrary_str} X"
25
26
 
26
27
  window.send_keys [:control, "a"], :backspace
27
28
  text_field.value.should be_empty
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rautomation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jarmo Pertman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-05 00:00:00.000000000 Z
11
+ date: 2014-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi