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 +4 -4
- data/Gemfile.lock +1 -1
- data/History.rdoc +4 -0
- data/VERSION +1 -1
- data/lib/rautomation/adapter/win_32/keys.rb +35 -16
- data/spec/adapter/win_32/window_spec.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c6d6a52e58f96779bd37c86b30ba8f392dd0191
|
4
|
+
data.tar.gz: fbc26ee037eef080677cf8997aeb924f02bd1360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 652ed3ab3c3624056af6166a4a2c4569f0a0e3c02201d69a3bfba9d3f82be7b73f255f6c7fa7188b6c98c43e6f496b2fab78d562637cac2ccfc086a9b8ecc2d2
|
7
|
+
data.tar.gz: 1d10710a01cdebfed601261cdb34bd5a3e3e79cfb979f2ad4be6e797c1aad1804a9f8dfab43359e8267f86378021f71ccd96b453bdacc4974792e58e9543daa5
|
data/Gemfile.lock
CHANGED
data/History.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
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/
|
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 =>
|
42
|
-
:equals =>
|
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
|
-
:
|
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
|
-
"_" =>
|
88
|
-
"+" =>
|
89
|
-
"{" =>
|
90
|
-
"}" =>
|
91
|
-
":" =>
|
92
|
-
"\"" =>
|
93
|
-
"|" =>
|
94
|
-
"?" =>
|
95
|
-
">" =>
|
96
|
-
"<" =>
|
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
|
-
|
21
|
-
|
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 == "
|
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.
|
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-
|
11
|
+
date: 2014-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|