AXElements 1.0.0.alpha6 → 1.0.0.alpha7
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +3 -0
- data/History.markdown +6 -0
- data/README.markdown +2 -2
- data/ext/accessibility/key_coder/extconf.rb +1 -1
- data/lib/accessibility/core.rb +1 -1
- data/lib/accessibility/dsl.rb +1 -18
- data/lib/accessibility/{pp_inspector.rb → pretty_printer.rb} +1 -1
- data/lib/accessibility/qualifier.rb +3 -3
- data/lib/accessibility/translator.rb +17 -8
- data/lib/accessibility/version.rb +1 -1
- data/lib/ax/element.rb +2 -2
- data/lib/mouse.rb +1 -1
- data/test/sanity/accessibility/{test_pp_inspector.rb → test_pretty_printer.rb} +3 -3
- data/test/test_core.rb +2 -2
- metadata +9 -8
data/.yardopts
CHANGED
data/History.markdown
ADDED
data/README.markdown
CHANGED
@@ -127,8 +127,8 @@ as some of the technical the technical underpinnings of AXElements.
|
|
127
127
|
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/Marketcircle/AXElements)
|
128
128
|
|
129
129
|
AXElements has reached a point where the main focus is stability,
|
130
|
-
|
131
|
-
code naming the next version "Lunatone".
|
130
|
+
documentation, and additional conveniences. It will be out of this
|
131
|
+
world, so we're code naming the next version "Lunatone".
|
132
132
|
|
133
133
|
![The Moon](https://github.com/Marketcircle/AXElements/raw/gh-pages/images/next_version.png)
|
134
134
|
|
@@ -10,7 +10,7 @@ else
|
|
10
10
|
clang = `which clang`.chomp
|
11
11
|
if clang.empty?
|
12
12
|
$stdout.puts "Clang not installed. Cannot build C extension"
|
13
|
-
|
13
|
+
raise "Clang not installed. Cannot build C extension"
|
14
14
|
else
|
15
15
|
RbConfig::MAKEFILE_CONFIG["CC"] = clang
|
16
16
|
RbConfig::MAKEFILE_CONFIG["CXX"] = clang
|
data/lib/accessibility/core.rb
CHANGED
data/lib/accessibility/dsl.rb
CHANGED
@@ -550,6 +550,7 @@ module Accessibility::DSL
|
|
550
550
|
move_mouse_to obj, wait: 0 if obj
|
551
551
|
Mouse.click_down
|
552
552
|
yield if block_given?
|
553
|
+
ensure
|
553
554
|
Mouse.click_up
|
554
555
|
sleep wait
|
555
556
|
end
|
@@ -628,24 +629,6 @@ module Accessibility::DSL
|
|
628
629
|
Accessibility::Highlighter.new obj.bounds, opts
|
629
630
|
end
|
630
631
|
|
631
|
-
##
|
632
|
-
# @deprecated Use {AX::Element#inspect_subtree} instead.
|
633
|
-
#
|
634
|
-
# Get the dump of the subtree of children and descendants for the given
|
635
|
-
# element. Each generation down the tree will be indented another level,
|
636
|
-
# and each element will be inspected.
|
637
|
-
#
|
638
|
-
# @example
|
639
|
-
#
|
640
|
-
# puts subtree app
|
641
|
-
#
|
642
|
-
# @param element [AX::Element]
|
643
|
-
# @return [String]
|
644
|
-
def subtree element
|
645
|
-
element.inspect_subtree
|
646
|
-
end
|
647
|
-
alias_method :subtree_for, :subtree
|
648
|
-
|
649
632
|
##
|
650
633
|
# @note You will need to have GraphViz command line tools installed
|
651
634
|
# in order for this to work.
|
@@ -10,7 +10,7 @@
|
|
10
10
|
# - `#attribute` returns the value of a given attribute
|
11
11
|
# - `#size_of` returns the size for an attribute
|
12
12
|
#
|
13
|
-
module Accessibility::
|
13
|
+
module Accessibility::PrettyPrinter
|
14
14
|
|
15
15
|
##
|
16
16
|
# Create an identifier for the receiver by using various attributes
|
@@ -29,7 +29,7 @@ class Accessibility::Qualifier
|
|
29
29
|
@klass = TRANSLATOR.classify(klass)
|
30
30
|
@criteria = criteria
|
31
31
|
@block = Proc.new if block_given?
|
32
|
-
compile
|
32
|
+
compile!
|
33
33
|
end
|
34
34
|
|
35
35
|
##
|
@@ -63,8 +63,8 @@ class Accessibility::Qualifier
|
|
63
63
|
# {#qualifies?}.
|
64
64
|
#
|
65
65
|
# @param criteria [Hash]
|
66
|
-
def compile
|
67
|
-
@filters = criteria.map do |key, value|
|
66
|
+
def compile!
|
67
|
+
@filters = @criteria.map do |key, value|
|
68
68
|
if value.kind_of? Hash
|
69
69
|
[:subsearch, key, value]
|
70
70
|
elsif key.kind_of? Array
|
@@ -72,7 +72,9 @@ class Accessibility::Translator
|
|
72
72
|
# @param keys [Array<String>]
|
73
73
|
# @return [Array<Symbol>]
|
74
74
|
def rubyize keys
|
75
|
-
keys.map { |x| @rubyisms[x] }
|
75
|
+
keys = keys.map { |x| @rubyisms[x] }
|
76
|
+
keys.flatten!
|
77
|
+
keys
|
76
78
|
end
|
77
79
|
|
78
80
|
##
|
@@ -133,6 +135,17 @@ class Accessibility::Translator
|
|
133
135
|
|
134
136
|
private
|
135
137
|
|
138
|
+
def preloads
|
139
|
+
{
|
140
|
+
# basic preloads
|
141
|
+
id: KAXIdentifierAttribute,
|
142
|
+
placeholder: KAXPlaceholderValueAttribute,
|
143
|
+
# workarounds for known case where AX uses "Is" for a boolean attribute
|
144
|
+
application_running: KAXIsApplicationRunningAttribute,
|
145
|
+
application_running?: KAXIsApplicationRunningAttribute
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
136
149
|
# @return [Hash{String=>String}]
|
137
150
|
def init_unprefixes
|
138
151
|
@unprefixes = Hash.new do |hash, key|
|
@@ -143,8 +156,9 @@ class Accessibility::Translator
|
|
143
156
|
# @return [Hash{String=>Symbol}]
|
144
157
|
def init_rubyisms
|
145
158
|
@rubyisms = Hash.new do |hash, key|
|
146
|
-
hash[key] = Accessibility::Inflector.underscore(@unprefixes[key]).to_sym
|
159
|
+
hash[key] = [Accessibility::Inflector.underscore(@unprefixes[key]).to_sym]
|
147
160
|
end
|
161
|
+
preloads.each_pair do |k,v| @rubyisms[v] << k end
|
148
162
|
end
|
149
163
|
|
150
164
|
# @return [Hash{Symbol=>String}]
|
@@ -152,12 +166,7 @@ class Accessibility::Translator
|
|
152
166
|
@cocoaifications = Hash.new do |hash, key|
|
153
167
|
hash[key] = "AX#{Accessibility::Inflector.camelize(key.chomp QUESTION_MARK)}"
|
154
168
|
end
|
155
|
-
|
156
|
-
@cocoaifications[:id] = KAXIdentifierAttribute
|
157
|
-
@cocoaifications[:placeholder] = KAXPlaceholderValueAttribute
|
158
|
-
# workaround the one known case where AX uses "Is" for a boolean attribute
|
159
|
-
@cocoaifications[:application_running] = # let the value all fall through
|
160
|
-
@cocoaifications[:application_running?] = KAXIsApplicationRunningAttribute
|
169
|
+
preloads.each_pair do |k, v| @cocoaifications[k] = v end
|
161
170
|
end
|
162
171
|
|
163
172
|
# @return [Hash{String=>String}]
|
data/lib/ax/element.rb
CHANGED
@@ -6,7 +6,7 @@ require 'accessibility/translator'
|
|
6
6
|
require 'accessibility/enumerators'
|
7
7
|
require 'accessibility/qualifier'
|
8
8
|
require 'accessibility/errors'
|
9
|
-
require 'accessibility/
|
9
|
+
require 'accessibility/pretty_printer'
|
10
10
|
|
11
11
|
|
12
12
|
##
|
@@ -19,7 +19,7 @@ require 'accessibility/pp_inspector'
|
|
19
19
|
# This abstract base class provides generic functionality that all
|
20
20
|
# accessibility objects require.
|
21
21
|
class AX::Element
|
22
|
-
include Accessibility::
|
22
|
+
include Accessibility::PrettyPrinter
|
23
23
|
|
24
24
|
# @param ref [AXUIElementRef]
|
25
25
|
def initialize ref
|
data/lib/mouse.rb
CHANGED
@@ -224,7 +224,7 @@ module Mouse
|
|
224
224
|
# Executes a mouse movement animation. It can be a simple cursor
|
225
225
|
# move or a drag depending on what is passed to `type`.
|
226
226
|
def animate type, button, from, to, duration
|
227
|
-
current =
|
227
|
+
current = from
|
228
228
|
xstep = (to.x - current.x) / (FPS * duration)
|
229
229
|
ystep = (to.y - current.y) / (FPS * duration)
|
230
230
|
start = NSDate.date
|
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
|
-
class
|
4
|
-
include Accessibility::
|
3
|
+
class TestAccessibilityPrettyPrinter < MiniTest::Unit::TestCase
|
4
|
+
include Accessibility::PrettyPrinter
|
5
5
|
|
6
|
-
# expected API for
|
6
|
+
# expected API for PrettyPrinter module
|
7
7
|
attr_reader :attributes
|
8
8
|
def attribute attr; @attribute; end
|
9
9
|
def size_of attr; @size_of; end
|
data/test/test_core.rb
CHANGED
@@ -63,8 +63,8 @@ class TestAccessibilityElement < MiniTest::Unit::TestCase
|
|
63
63
|
|
64
64
|
assert_nil window.attribute(KAXGrowAreaAttribute), 'KAXErrorNoValue == nil'
|
65
65
|
|
66
|
-
assert_nil
|
67
|
-
|
66
|
+
assert_nil invalid_ref.attribute(KAXRoleAttribute), 'Dead element == nil'
|
67
|
+
assert_nil invalid_ref.attribute(KAXChildrenAttribute)
|
68
68
|
|
69
69
|
assert_raises(ArgumentError) { app.attribute('MADE_UP_ATTR') }
|
70
70
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: AXElements
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 1.0.0.
|
5
|
+
version: 1.0.0.alpha7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Mark Rada
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-05 00:00:00 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -44,21 +44,21 @@ dependencies:
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: 0.8.3
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
|
-
name:
|
47
|
+
name: kramdown
|
48
48
|
prerelease: false
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.14.1
|
55
55
|
type: :development
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
none: false
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.14.1
|
62
62
|
description: 'AXElements is a UI automation DSL built on top of the Mac OS X Accessibility
|
63
63
|
|
64
64
|
Framework that allows code to be written in a very natural and declarative
|
@@ -79,7 +79,7 @@ files:
|
|
79
79
|
- lib/accessibility/factory.rb
|
80
80
|
- lib/accessibility/graph.rb
|
81
81
|
- lib/accessibility/highlighter.rb
|
82
|
-
- lib/accessibility/
|
82
|
+
- lib/accessibility/pretty_printer.rb
|
83
83
|
- lib/accessibility/qualifier.rb
|
84
84
|
- lib/accessibility/screen_recorder.rb
|
85
85
|
- lib/accessibility/statistics.rb
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- rakelib/test.rake
|
119
119
|
- Rakefile
|
120
120
|
- README.markdown
|
121
|
+
- History.markdown
|
121
122
|
- .yardopts
|
122
123
|
- test/integration/accessibility/test_core.rb
|
123
124
|
- test/integration/accessibility/test_dsl.rb
|
@@ -136,7 +137,7 @@ files:
|
|
136
137
|
- test/sanity/accessibility/test_errors.rb
|
137
138
|
- test/sanity/accessibility/test_factory.rb
|
138
139
|
- test/sanity/accessibility/test_highlighter.rb
|
139
|
-
- test/sanity/accessibility/
|
140
|
+
- test/sanity/accessibility/test_pretty_printer.rb
|
140
141
|
- test/sanity/accessibility/test_qualifier.rb
|
141
142
|
- test/sanity/accessibility/test_statistics.rb
|
142
143
|
- test/sanity/accessibility/test_string.rb
|
@@ -196,7 +197,7 @@ test_files:
|
|
196
197
|
- test/sanity/accessibility/test_errors.rb
|
197
198
|
- test/sanity/accessibility/test_factory.rb
|
198
199
|
- test/sanity/accessibility/test_highlighter.rb
|
199
|
-
- test/sanity/accessibility/
|
200
|
+
- test/sanity/accessibility/test_pretty_printer.rb
|
200
201
|
- test/sanity/accessibility/test_qualifier.rb
|
201
202
|
- test/sanity/accessibility/test_statistics.rb
|
202
203
|
- test/sanity/accessibility/test_string.rb
|