vigilem-win32_api 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +22 -0
- data/lib/vigilem/win32_api/console_input_events.rb +78 -0
- data/lib/vigilem/win32_api/constants.rb +97 -0
- data/lib/vigilem/win32_api/dom/adapter.rb +59 -0
- data/lib/vigilem/win32_api/dom/code_values_tables.rb +136 -0
- data/lib/vigilem/win32_api/dom/input_record_utils.rb +259 -0
- data/lib/vigilem/win32_api/dom/key_values_tables.rb +123 -0
- data/lib/vigilem/win32_api/dom.rb +5 -0
- data/lib/vigilem/win32_api/eventable.rb +41 -0
- data/lib/vigilem/win32_api/input__record.rb +53 -0
- data/lib/vigilem/win32_api/input_system_handler.rb +124 -0
- data/lib/vigilem/win32_api/p_input__record.rb +55 -0
- data/lib/vigilem/win32_api/rubyized.rb +114 -0
- data/lib/vigilem/win32_api/types.rb +153 -0
- data/lib/vigilem/win32_api/utils/keyboard.rb +120 -0
- data/lib/vigilem/win32_api/version.rb +5 -0
- data/lib/vigilem/win32_api/virtual_keys/map.rb +211 -0
- data/lib/vigilem/win32_api/virtual_keys.rb +9 -0
- data/lib/vigilem/win32_api.rb +61 -0
- data/spec/acceptance/custom_input_system.feature +3 -0
- data/spec/acceptance/dom_adapter.feature +7 -0
- data/spec/acceptance/rubyized.feature +6 -0
- data/spec/acceptance/steps/custom_input_system_steps.rb +37 -0
- data/spec/acceptance/steps/dom_adapter_steps.rb +7 -0
- data/spec/acceptance/steps/rubyized_steps.rb +20 -0
- data/spec/attributes_and_size_test.rb +10 -0
- data/spec/input_helper.rb +41 -0
- data/spec/spec_helper.rb +28 -0
- data/spec/turnip_helper.rb +1 -0
- data/spec/vigilem/api_spec.rb +139 -0
- data/spec/vigilem/win32_api/console_input_events_spec.rb +67 -0
- data/spec/vigilem/win32_api/dom/adapter_spec.rb +164 -0
- data/spec/vigilem/win32_api/dom/code_values_tables_spec.rb +5 -0
- data/spec/vigilem/win32_api/dom/input_record_utils_spec.rb +255 -0
- data/spec/vigilem/win32_api/dom/key_values_tables_spec.rb +5 -0
- data/spec/vigilem/win32_api/eventable_spec.rb +96 -0
- data/spec/vigilem/win32_api/input__record_spec.rb +113 -0
- data/spec/vigilem/win32_api/input_system_handler_spec.rb +164 -0
- data/spec/vigilem/win32_api/p_input__record_spec.rb +43 -0
- data/spec/vigilem/win32_api/rubyized_spec.rb +134 -0
- data/spec/vigilem/win32_api/types_spec.rb +139 -0
- data/spec/vigilem/win32_api/utils/keyboard_spec.rb +126 -0
- data/spec/vigilem/win32_api/virtual_keys/map_spec.rb +10 -0
- data/spec/vigilem/win32_api/virtual_keys_spec.rb +28 -0
- metadata +225 -0
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'vigilem/win32_api/utils/keyboard'
|
2
|
+
|
3
|
+
describe (KB = Vigilem::Win32API::Utils::Keyboard) do
|
4
|
+
|
5
|
+
let!(:arrows) { [KB::VK[:LEFT], KB::VK[:RIGHT], KB::VK[:UP], KB::VK[:DOWN]] }
|
6
|
+
|
7
|
+
describe described_class::ControlPadKeys do
|
8
|
+
describe '::control_pad_key?' do
|
9
|
+
it 'returns true if a control key' do
|
10
|
+
expect([KB::VK[:INSERT], KB::VK[:DELETE],
|
11
|
+
KB::VK[:PRIOR], KB::VK[:NEXT], KB::VK[:END],
|
12
|
+
KB::VK[:HOME]].all? {|vk| KB.control_pad_key?(vk) }).to be_truthy
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns false if not a control key' do
|
16
|
+
expect(KB.control_pad_key?(1)).to be_falsey
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe described_class::NavigationKeys do
|
22
|
+
|
23
|
+
describe '::arrow_key?' do
|
24
|
+
it 'returns true if code is any arrow key' do
|
25
|
+
expect(arrows.all? do |vk|
|
26
|
+
KB.arrow_key?(vk)
|
27
|
+
end).to be_truthy
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'returns false if code is not an arrow key' do
|
31
|
+
expect(KB.arrow_key?(1)).to be_falsey
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe '::nav_arrow_key?' do
|
36
|
+
it 'returns true if the key is nav pad arrow key' do
|
37
|
+
expect(arrows.all? do |vk|
|
38
|
+
KB.nav_arrow_key?(vk, :ENHANCED_KEY)
|
39
|
+
end).to be_truthy
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'returns false if the key is not a nav pad arrow key' do
|
43
|
+
expect(KB.nav_arrow_key?(KB::VK[:UP])).to be_falsey
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe '::nav_control_pad_key?' do
|
48
|
+
it 'returns true if the key is one that is above the nav arrow pad' do
|
49
|
+
expect(KB.nav_control_pad_key?(KB::VK[:NEXT], :ENHANCED_KEY, :SOME_OTHER_KEY)).to be_truthy
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'returns false if the key is one that is not above the nav arrow pad' do
|
53
|
+
expect(KB.nav_control_pad_key?(1, :ENHANCED_KEY)).to be_falsey
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
describe described_class::NumpadKeys do
|
60
|
+
|
61
|
+
describe '::numlock?' do
|
62
|
+
it 'will be true when given numlock id' do
|
63
|
+
expect(KB.numlock?(KB::VK[:NUMLOCK])).to be_truthy
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'will be false when not given numlock num id' do
|
67
|
+
expect(KB.numlock?(12)).to be_falsey
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '::numpad_return?' do
|
72
|
+
it 'will be true when given numpad return id and :ENHANCED_KEY symbol' do
|
73
|
+
expect(KB.numpad_return?(0x0D, :ENHANCED_KEY, :SOME_OTHER_KEY)).to be_truthy
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'will be false when not given numlock num id' do
|
77
|
+
expect(KB.numpad_return?(0x0D)).to be_falsey
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '::numpad_number_functions?' do
|
82
|
+
|
83
|
+
let(:numbers) { 10.times.map {|n| KB::VK[:"NUMPAD#{n}"] } }
|
84
|
+
|
85
|
+
it 'will be true when given keycode is a NUMPAD number' do
|
86
|
+
expect(numbers.all? {|n| KB::numpad_number_function?(n) }).to be_truthy
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'will be false when given keycode not is a NUMPAD number' do
|
90
|
+
expect(KB.numpad_number_function?(5)).to be_falsey
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
describe '::numpad_arrow?' do
|
95
|
+
it 'returns true if the keycode is a numpad arrow' do
|
96
|
+
expect(arrows.all? {|vk| KB.numpad_arrow?(vk) }).to be_truthy
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'returns false if the keycode is not a numpad arrow' do
|
100
|
+
expect(arrows.all? {|vk| KB.numpad_arrow?(vk, :ENHANCED_KEY) }).to be_falsey
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe '::numpad_control_pad_key?' do
|
105
|
+
it 'returns whether or not the keycode is a control key on the numpad , HOME, Page UP etc' do
|
106
|
+
expect(KB.numpad?(KB::VK[:HOME])).to be_truthy
|
107
|
+
end
|
108
|
+
|
109
|
+
it 'will return false when the keycode is not a control key on the numpad, :ENHANCED_KEY refers to the nav control pad ' do
|
110
|
+
expect(KB.numpad?(KB::VK[:HOME], :ENHANCED_KEY)).to be_falsey
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
describe '::numpad?' do
|
115
|
+
it 'returns true if the keycode is a numpad' do
|
116
|
+
expect(KB.numpad?(KB::VK[:HOME])).to be_truthy
|
117
|
+
end
|
118
|
+
|
119
|
+
it 'returns false if the keycode is not a numpad' do
|
120
|
+
expect(KB.numpad?(KB::VK[:A])).to be_falsey
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
require 'vigilem/win32_api/virtual_keys'
|
4
|
+
|
5
|
+
describe Vigilem::Win32API::VirtualKeys do
|
6
|
+
|
7
|
+
describe '::[]' do
|
8
|
+
it 'converts the current side to the opposite' do
|
9
|
+
expect(described_class::Map[0x10]).to eql(:VK_SHIFT)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'shorthand for Map so that VK_ prefix isn;t needed' do
|
13
|
+
expect(described_class::VK[:SHIFT]).to eql(0x10)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '::virtual_key' do
|
18
|
+
|
19
|
+
it 'convert Integer vk-code to vk Symbol' do
|
20
|
+
expect(described_class::Map.virtual_keyname(0x10)).to eql(:VK_SHIFT)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'short hand for Map returns without the VK prefix ' do
|
24
|
+
expect(described_class::VK.virtual_keyname(0x10)).to eql(:SHIFT)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,225 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vigilem-win32_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.10
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- jtzero
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-03-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: vigilem-dom
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: yard
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.1'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-given
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: turnip
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Windows API Bindings and DOM converter for Vigilem
|
126
|
+
email: jtzero511@gmail
|
127
|
+
executables: []
|
128
|
+
extensions: []
|
129
|
+
extra_rdoc_files: []
|
130
|
+
files:
|
131
|
+
- LICENSE.txt
|
132
|
+
- lib/vigilem/win32_api.rb
|
133
|
+
- lib/vigilem/win32_api/console_input_events.rb
|
134
|
+
- lib/vigilem/win32_api/constants.rb
|
135
|
+
- lib/vigilem/win32_api/dom.rb
|
136
|
+
- lib/vigilem/win32_api/dom/adapter.rb
|
137
|
+
- lib/vigilem/win32_api/dom/code_values_tables.rb
|
138
|
+
- lib/vigilem/win32_api/dom/input_record_utils.rb
|
139
|
+
- lib/vigilem/win32_api/dom/key_values_tables.rb
|
140
|
+
- lib/vigilem/win32_api/eventable.rb
|
141
|
+
- lib/vigilem/win32_api/input__record.rb
|
142
|
+
- lib/vigilem/win32_api/input_system_handler.rb
|
143
|
+
- lib/vigilem/win32_api/p_input__record.rb
|
144
|
+
- lib/vigilem/win32_api/rubyized.rb
|
145
|
+
- lib/vigilem/win32_api/types.rb
|
146
|
+
- lib/vigilem/win32_api/utils/keyboard.rb
|
147
|
+
- lib/vigilem/win32_api/version.rb
|
148
|
+
- lib/vigilem/win32_api/virtual_keys.rb
|
149
|
+
- lib/vigilem/win32_api/virtual_keys/map.rb
|
150
|
+
- spec/acceptance/custom_input_system.feature
|
151
|
+
- spec/acceptance/dom_adapter.feature
|
152
|
+
- spec/acceptance/rubyized.feature
|
153
|
+
- spec/acceptance/steps/custom_input_system_steps.rb
|
154
|
+
- spec/acceptance/steps/dom_adapter_steps.rb
|
155
|
+
- spec/acceptance/steps/rubyized_steps.rb
|
156
|
+
- spec/attributes_and_size_test.rb
|
157
|
+
- spec/input_helper.rb
|
158
|
+
- spec/spec_helper.rb
|
159
|
+
- spec/turnip_helper.rb
|
160
|
+
- spec/vigilem/api_spec.rb
|
161
|
+
- spec/vigilem/win32_api/console_input_events_spec.rb
|
162
|
+
- spec/vigilem/win32_api/dom/adapter_spec.rb
|
163
|
+
- spec/vigilem/win32_api/dom/code_values_tables_spec.rb
|
164
|
+
- spec/vigilem/win32_api/dom/input_record_utils_spec.rb
|
165
|
+
- spec/vigilem/win32_api/dom/key_values_tables_spec.rb
|
166
|
+
- spec/vigilem/win32_api/eventable_spec.rb
|
167
|
+
- spec/vigilem/win32_api/input__record_spec.rb
|
168
|
+
- spec/vigilem/win32_api/input_system_handler_spec.rb
|
169
|
+
- spec/vigilem/win32_api/p_input__record_spec.rb
|
170
|
+
- spec/vigilem/win32_api/rubyized_spec.rb
|
171
|
+
- spec/vigilem/win32_api/types_spec.rb
|
172
|
+
- spec/vigilem/win32_api/utils/keyboard_spec.rb
|
173
|
+
- spec/vigilem/win32_api/virtual_keys/map_spec.rb
|
174
|
+
- spec/vigilem/win32_api/virtual_keys_spec.rb
|
175
|
+
homepage: http://rubygems.org/gems/vigilem-win_api
|
176
|
+
licenses:
|
177
|
+
- MIT
|
178
|
+
metadata: {}
|
179
|
+
post_install_message:
|
180
|
+
rdoc_options: []
|
181
|
+
require_paths:
|
182
|
+
- lib
|
183
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
|
+
requirements:
|
190
|
+
- - ">="
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubyforge_project:
|
195
|
+
rubygems_version: 2.4.6
|
196
|
+
signing_key:
|
197
|
+
specification_version: 4
|
198
|
+
summary: Windows API Bindings and DOM converter for Vigilem
|
199
|
+
test_files:
|
200
|
+
- spec/acceptance/custom_input_system.feature
|
201
|
+
- spec/acceptance/dom_adapter.feature
|
202
|
+
- spec/acceptance/rubyized.feature
|
203
|
+
- spec/acceptance/steps/custom_input_system_steps.rb
|
204
|
+
- spec/acceptance/steps/dom_adapter_steps.rb
|
205
|
+
- spec/acceptance/steps/rubyized_steps.rb
|
206
|
+
- spec/attributes_and_size_test.rb
|
207
|
+
- spec/input_helper.rb
|
208
|
+
- spec/spec_helper.rb
|
209
|
+
- spec/turnip_helper.rb
|
210
|
+
- spec/vigilem/api_spec.rb
|
211
|
+
- spec/vigilem/win32_api/console_input_events_spec.rb
|
212
|
+
- spec/vigilem/win32_api/dom/adapter_spec.rb
|
213
|
+
- spec/vigilem/win32_api/dom/code_values_tables_spec.rb
|
214
|
+
- spec/vigilem/win32_api/dom/input_record_utils_spec.rb
|
215
|
+
- spec/vigilem/win32_api/dom/key_values_tables_spec.rb
|
216
|
+
- spec/vigilem/win32_api/eventable_spec.rb
|
217
|
+
- spec/vigilem/win32_api/input__record_spec.rb
|
218
|
+
- spec/vigilem/win32_api/input_system_handler_spec.rb
|
219
|
+
- spec/vigilem/win32_api/p_input__record_spec.rb
|
220
|
+
- spec/vigilem/win32_api/rubyized_spec.rb
|
221
|
+
- spec/vigilem/win32_api/types_spec.rb
|
222
|
+
- spec/vigilem/win32_api/utils/keyboard_spec.rb
|
223
|
+
- spec/vigilem/win32_api/virtual_keys/map_spec.rb
|
224
|
+
- spec/vigilem/win32_api/virtual_keys_spec.rb
|
225
|
+
has_rdoc:
|