AXElements 7.0.0.pre2 → 7.0.0.pre3
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 +4 -4
- data/History.markdown +1 -0
- data/README.markdown +2 -5
- data/lib/accessibility/factory.rb +25 -100
- data/lib/accessibility/translator.rb +1 -4
- data/lib/accessibility/version.rb +1 -1
- data/lib/ax/element.rb +5 -11
- data/lib/ax_elements.rb +1 -0
- data/lib/ax_elements/nsarray_compat.rb +5 -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: 5dbc6cd5044cfd1d0d997fa1af18f723d298480b
|
4
|
+
data.tar.gz: 300b119742fa97600c3b2c79445e208f0321eba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0773965241f98983ff4cd7941257b358e7d332d87e4a650ec9bfe8da716226201ff59ba02b46c365a0abaab4ae2ca694c1f75b3c479292759fbe872afab98ec
|
7
|
+
data.tar.gz: f1c8b184420efdc69da096d01a3c2027abf7ec589cfb5f36764ac343a76abefea8be1e993b1267e26dda5969a422a1b0a4adfe4b0688a3c4da8557f15bc87ceb
|
data/History.markdown
CHANGED
data/README.markdown
CHANGED
@@ -172,11 +172,8 @@ you simply need to run the `test` task:
|
|
172
172
|
|
173
173
|
__NOTE__: There may be some tests are dependent on Accessibility
|
174
174
|
features that are new in OS X Lion which will cause test failures on
|
175
|
-
OS X Snow Leopard.
|
176
|
-
|
177
|
-
will support Snow Leopard for as long as MacRuby does, but I do not
|
178
|
-
have easy access to a Snow Leopard machine to verify that things still
|
179
|
-
work.
|
175
|
+
OS X Snow Leopard. AXElements requires OS X versions with system Ruby
|
176
|
+
at version 2.0.0 or newer.
|
180
177
|
|
181
178
|
### Benchmarks
|
182
179
|
|
@@ -100,115 +100,40 @@ class << AX
|
|
100
100
|
end
|
101
101
|
|
102
102
|
|
103
|
-
|
103
|
+
##
|
104
|
+
# `AXElements` extensions to the `Accessibility::Element` class
|
105
|
+
class Accessibility::Element
|
104
106
|
|
105
107
|
##
|
106
|
-
#
|
108
|
+
# Override the default `#to_ruby` so that proper classes are
|
109
|
+
# chosen for each object.
|
107
110
|
#
|
108
|
-
#
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
# Wrap the low level wrapper with the appropriate high level wrapper.
|
118
|
-
# This involves determining the proper class in the {AX} namespace,
|
119
|
-
# possibly creating it on demand, and then instantiating the class to
|
120
|
-
# wrap the low level object.
|
121
|
-
#
|
122
|
-
# Some code paths have been unrolled for efficiency. Don't hate player,
|
123
|
-
# hate the game.
|
124
|
-
#
|
125
|
-
# @return [AX::Element]
|
126
|
-
def to_ruby
|
127
|
-
type = AXValueGetType(self)
|
128
|
-
if type.zero?
|
129
|
-
to_element
|
130
|
-
else
|
131
|
-
to_box type
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
|
136
|
-
private
|
137
|
-
|
138
|
-
##
|
139
|
-
# @private
|
140
|
-
#
|
141
|
-
# Reference to the singleton instance of the translator.
|
142
|
-
#
|
143
|
-
# @return [Accessibility::Translator]
|
144
|
-
TRANSLATOR = Accessibility::Translator.instance
|
145
|
-
|
146
|
-
def to_box type
|
147
|
-
ptr = Pointer.new ValueWrapper::BOX_TYPES[type]
|
148
|
-
AXValueGetValue(self, type, ptr)
|
149
|
-
ptr.value.to_ruby
|
150
|
-
end
|
151
|
-
|
152
|
-
def to_element
|
153
|
-
if roll = self.role
|
154
|
-
roll = TRANSLATOR.unprefix roll
|
155
|
-
if attributes.include? KAXSubroleAttribute
|
156
|
-
subroll = self.subrole
|
157
|
-
# Some objects claim to have a subrole but return nil
|
158
|
-
if subroll
|
159
|
-
AX.class_for2(TRANSLATOR.unprefix(subroll), roll).new self
|
160
|
-
else
|
161
|
-
AX.class_for(roll).new self
|
162
|
-
end
|
111
|
+
# @return [AX::Element]
|
112
|
+
def to_ruby
|
113
|
+
if roll = self.role
|
114
|
+
roll = TRANSLATOR.unprefix roll
|
115
|
+
if attributes.include? KAXSubroleAttribute
|
116
|
+
subroll = self.subrole
|
117
|
+
# Some objects claim to have a subrole but return nil
|
118
|
+
if subroll
|
119
|
+
AX.class_for2(TRANSLATOR.unprefix(subroll), roll).new self
|
163
120
|
else
|
164
121
|
AX.class_for(roll).new self
|
165
122
|
end
|
166
|
-
else
|
167
|
-
AX
|
123
|
+
else
|
124
|
+
AX.class_for(roll).new self
|
168
125
|
end
|
126
|
+
else # failsafe in case object dies before we get the role
|
127
|
+
AX::Element.new self
|
169
128
|
end
|
170
|
-
|
171
129
|
end
|
172
130
|
|
173
|
-
|
174
|
-
else
|
175
|
-
|
176
|
-
|
177
131
|
##
|
178
|
-
#
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
#
|
185
|
-
# @return [AX::Element]
|
186
|
-
def to_ruby
|
187
|
-
if roll = self.role
|
188
|
-
roll = TRANSLATOR.unprefix roll
|
189
|
-
if attributes.include? KAXSubroleAttribute
|
190
|
-
subroll = self.subrole
|
191
|
-
# Some objects claim to have a subrole but return nil
|
192
|
-
if subroll
|
193
|
-
AX.class_for2(TRANSLATOR.unprefix(subroll), roll).new self
|
194
|
-
else
|
195
|
-
AX.class_for(roll).new self
|
196
|
-
end
|
197
|
-
else
|
198
|
-
AX.class_for(roll).new self
|
199
|
-
end
|
200
|
-
else # failsafe in case object dies before we get the role
|
201
|
-
AX::Element.new self
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
##
|
206
|
-
# @private
|
207
|
-
#
|
208
|
-
# Reference to the singleton instance of the translator.
|
209
|
-
#
|
210
|
-
# @return [Accessibility::Translator]
|
211
|
-
TRANSLATOR = Accessibility::Translator.instance
|
212
|
-
end
|
213
|
-
|
132
|
+
# @private
|
133
|
+
#
|
134
|
+
# Reference to the singleton instance of the translator.
|
135
|
+
#
|
136
|
+
# @return [Accessibility::Translator]
|
137
|
+
TRANSLATOR = Accessibility::Translator.instance
|
214
138
|
end
|
139
|
+
|
@@ -10,9 +10,6 @@ ActiveSupport::Inflector.inflections do |inflect|
|
|
10
10
|
inflect.acronym('AMPM')
|
11
11
|
end
|
12
12
|
|
13
|
-
framework 'ApplicationServices' if on_macruby?
|
14
|
-
|
15
|
-
|
16
13
|
##
|
17
14
|
# Maintain all the rules for transforming Cocoa constants into something
|
18
15
|
# a little more Rubyish and taking the Rubyish symbols and translating
|
@@ -126,7 +123,7 @@ class Accessibility::Translator
|
|
126
123
|
# @param name [#to_s]
|
127
124
|
# @return [String]
|
128
125
|
def guess_notification name
|
129
|
-
name = name.to_s.gsub
|
126
|
+
name = name.to_s.gsub(/(?:^|_)(.)/) do $1.upcase! || $1 end
|
130
127
|
const = "KAX#{name}Notification"
|
131
128
|
Object.const_defined?(const) ? Object.const_get(const) : name
|
132
129
|
end
|
data/lib/ax/element.rb
CHANGED
@@ -481,17 +481,11 @@ class AX::Element
|
|
481
481
|
@ref.invalid?
|
482
482
|
end
|
483
483
|
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
super.concat(attributes).concat(parameterized_attributes)
|
490
|
-
end
|
491
|
-
else
|
492
|
-
def methods include_super = true
|
493
|
-
super.concat(attributes).concat(parameterized_attributes)
|
494
|
-
end
|
484
|
+
##
|
485
|
+
# Like {#respond_to?}, this is overriden to include attribute methods.
|
486
|
+
# Though, it does include dynamic predicate methods at the moment.
|
487
|
+
def methods include_super = true
|
488
|
+
super.concat(attributes).concat(parameterized_attributes)
|
495
489
|
end
|
496
490
|
|
497
491
|
##
|
data/lib/ax_elements.rb
CHANGED
@@ -29,11 +29,13 @@ module Accessibility::ArrayCompatibility
|
|
29
29
|
# outline.rows.text_fields.values # all at once
|
30
30
|
#
|
31
31
|
def method_missing method, *args
|
32
|
+
super unless first.kind_of?(AX::Element) ||
|
33
|
+
(empty? && method != :to_hash) # hack for GH-9
|
34
|
+
|
32
35
|
smethod = TRANSLATOR.singularize(method.to_s.chomp('?'))
|
33
36
|
map do |x|
|
34
|
-
if
|
35
|
-
|
36
|
-
else x.send smethod, *args
|
37
|
+
if x.respond_to? method then x.send method, *args
|
38
|
+
else x.send smethod, *args
|
37
39
|
end
|
38
40
|
end
|
39
41
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: AXElements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.0.0.
|
4
|
+
version: 7.0.0.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Rada
|
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
version: 1.3.1
|
175
175
|
requirements: []
|
176
176
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.4.
|
177
|
+
rubygems_version: 2.4.3
|
178
178
|
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: UI Automation for OS X
|