AXElements 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +4 -0
- data/History.markdown +41 -0
- data/README.markdown +59 -62
- data/Rakefile +1 -1
- data/ext/accessibility/key_coder/extconf.rb +1 -1
- data/ext/accessibility/key_coder/key_coder.c +8 -5
- data/lib/accessibility/dsl.rb +261 -87
- data/lib/accessibility/enumerators.rb +14 -11
- data/lib/accessibility/errors.rb +4 -3
- data/lib/accessibility/factory.rb +159 -108
- data/lib/accessibility/graph.rb +13 -9
- data/lib/accessibility/{pp_inspector.rb → pretty_printer.rb} +4 -5
- data/lib/accessibility/qualifier.rb +23 -13
- data/lib/accessibility/string.rb +4 -4
- data/lib/accessibility/system_info.rb +230 -0
- data/lib/accessibility/translator.rb +38 -28
- data/lib/accessibility/version.rb +24 -2
- data/lib/accessibility.rb +25 -8
- data/lib/ax/application.rb +207 -77
- data/lib/ax/element.rb +62 -65
- data/lib/ax/menu.rb +5 -1
- data/lib/ax/row.rb +1 -1
- data/lib/ax/scroll_area.rb +7 -6
- data/lib/ax/systemwide.rb +38 -5
- data/lib/ax_elements/active_support_selections.rb +10 -0
- data/lib/ax_elements/mri.rb +57 -0
- data/lib/ax_elements/nsarray_compat.rb +97 -17
- data/lib/ax_elements.rb +9 -1
- data/rakelib/gem.rake +11 -11
- data/rakelib/test.rake +0 -9
- data/test/helper.rb +10 -18
- data/test/integration/accessibility/test_dsl.rb +52 -42
- data/test/integration/accessibility/test_enumerators.rb +0 -1
- data/test/integration/accessibility/test_graph.rb +1 -0
- data/test/integration/accessibility/test_qualifier.rb +2 -2
- data/test/integration/ax/test_application.rb +9 -2
- data/test/integration/ax/test_element.rb +41 -1
- data/test/sanity/accessibility/test_factory.rb +23 -56
- data/test/sanity/accessibility/{test_pp_inspector.rb → test_pretty_printer.rb} +9 -9
- data/test/sanity/accessibility/test_translator.rb +2 -5
- data/test/sanity/accessibility/test_version.rb +15 -0
- data/test/sanity/ax/test_application.rb +17 -2
- data/test/sanity/ax/test_element.rb +2 -2
- data/test/sanity/ax_elements/test_nsobject_inspect.rb +4 -2
- data/test/sanity/test_ax_elements.rb +1 -0
- metadata +69 -39
- data/lib/accessibility/core.rb +0 -973
- data/lib/accessibility/highlighter.rb +0 -86
- data/lib/ax_elements/vendor/inflection_data.rb +0 -66
- data/lib/ax_elements/vendor/inflections.rb +0 -172
- data/lib/ax_elements/vendor/inflector.rb +0 -306
- data/lib/minitest/ax_elements.rb +0 -175
- data/lib/mouse.rb +0 -223
- data/lib/rspec/expectations/ax_elements.rb +0 -234
- data/test/integration/accessibility/test_core.rb +0 -18
- data/test/integration/minitest/test_ax_elements.rb +0 -89
- data/test/integration/rspec/expectations/test_ax_elements.rb +0 -102
- data/test/sanity/accessibility/test_core.rb +0 -561
- data/test/sanity/accessibility/test_highlighter.rb +0 -56
- data/test/sanity/minitest/test_ax_elements.rb +0 -17
- data/test/sanity/rspec/expectations/test_ax_elements.rb +0 -15
- data/test/sanity/test_mouse.rb +0 -19
data/.yardopts
CHANGED
data/History.markdown
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# 0.9.0
|
2
|
+
|
3
|
+
* AXElements can now run on MRI as well as MacRuby
|
4
|
+
|
5
|
+
* Added `DSL#pinch` to simulate pinch gestures
|
6
|
+
* Added `DSL#rotate` to simulate rotation gestures
|
7
|
+
* Added `DSL#swipe` to simulate swipe gestures
|
8
|
+
* Added `DSL#smart_magnify` to simulate smart magnification (two finger double tap)
|
9
|
+
* Added `DSL#horizontal_scroll`
|
10
|
+
* Added `DSL#contextual_menu` hack for finding contextual menus (WIP)
|
11
|
+
* Added `NSScreen.wakeup` to the `NSScreen` class to wake up sleeping displays
|
12
|
+
* Added `Accessibility::SystemInfo` for getting information about the running system
|
13
|
+
- Added a `Battery` module for querying information about the battery status
|
14
|
+
* Added `DSL#record` to run a screen recording of the given block (actual video!)
|
15
|
+
* Added `Application.frontmost_application`
|
16
|
+
* Added `Application.menu_bar_owner`
|
17
|
+
* Added `Application.finder`
|
18
|
+
* Added `Application.dock`
|
19
|
+
* Added `SystemWide.focused_application` as override of built in attribute
|
20
|
+
* Added `SystemWide.status_items`
|
21
|
+
* Added `SystemWide.desktop`
|
22
|
+
* Added History.markdown to track notable changes
|
23
|
+
* Added CONTRIBUTING.markdown with much less stringent guidelines
|
24
|
+
|
25
|
+
* Moved MiniTest extensions to their own gem/repository [minitest-ax\_elements](https://github.com/AXElements/minitest-ax_elements)
|
26
|
+
* Moved RSpec extensions to their own gem/repository [rspec-ax\_elements](https://github.com/AXElements/rspec-ax_elements)
|
27
|
+
|
28
|
+
* Ported `mouse.rb` to C and moved code to [mouse](https://github.com/AXElements/mouse)
|
29
|
+
* Ported `core.rb` to C and moved code to [accessibility\_core](https://github.com/AXElements/accessibility_core)
|
30
|
+
* Ported `screen_recorder.rb` to C and moved code to [screen\_recorder](https://github.com/AXElements/screen_recorder)
|
31
|
+
|
32
|
+
* Changed `DSL#right_click` to accept a block; block is yielded to between click down and click up events
|
33
|
+
* Changed `AX::Element#rect` to `AX::Element#to_rect`
|
34
|
+
|
35
|
+
* Deprecate `AX::DOCK` constant, use `AX::Application.dock` instead
|
36
|
+
* Remove `Accessibility.application_with_bundle_identifier`; use `AX::Application.new` instead
|
37
|
+
* Remove `Accessibility.application_with_name; use `AX::Application.new` instead
|
38
|
+
* Remove `DSL#subtree_for`; use `Element#inspect_subtree` instead
|
39
|
+
|
40
|
+
* Fixed fetching parameterized attributes through `Element#method_missing`
|
41
|
+
* Fixed `Element#parameterized_attribute` automatically normalizing `Range` parameters
|
data/README.markdown
CHANGED
@@ -12,75 +12,75 @@ computer.
|
|
12
12
|
|
13
13
|
## Demo
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
from
|
15
|
+
[Demo Video](http://www.youtube.com/watch?v=G9O5wzb7oTY)
|
16
|
+
|
17
|
+
The code from the demo video is right here:
|
18
18
|
|
19
19
|
```ruby
|
20
20
|
require 'rubygems'
|
21
21
|
require 'ax_elements'
|
22
22
|
|
23
|
+
# Highlight objects that the mouse will move to
|
24
|
+
Accessibility.debug = true
|
25
|
+
|
26
|
+
# Get a reference to the Finder and bring it to the front
|
23
27
|
finder = app_with_bundle_identifier 'com.apple.finder'
|
24
|
-
set_focus_to finder
|
28
|
+
set_focus_to finder
|
25
29
|
|
30
|
+
# Open a new window
|
26
31
|
type "\\COMMAND+n"
|
27
|
-
sleep 1 #
|
32
|
+
sleep 1 # pause for "slow motion"
|
28
33
|
|
34
|
+
# Find and click the "Applications" item in the sidebar
|
29
35
|
window = finder.main_window
|
30
36
|
click window.outline.row(static_text: { value: 'Applications' })
|
31
37
|
|
38
|
+
# Find the Utilities folder
|
32
39
|
utilities = window.row(text_field: { filename: 'Utilities' })
|
33
40
|
scroll_to utilities
|
34
41
|
double_click utilities
|
35
42
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
sleep 1
|
41
|
-
|
42
|
-
click finder.quick_look.button(id: 'QLControlOpen')
|
43
|
-
```
|
43
|
+
# Wait for the folder to open and find the Activity Monitor app
|
44
|
+
app = wait_for :text_field, ancestor: window, filename: /Activity Monitor/
|
45
|
+
scroll_to app
|
46
|
+
click app
|
44
47
|
|
45
|
-
|
46
|
-
|
48
|
+
# Bring up QuickLook
|
49
|
+
type " "
|
50
|
+
sleep 1 # pause for "slow motion"
|
47
51
|
|
48
|
-
|
49
|
-
|
50
|
-
|
52
|
+
# Click the Quick Look button that opens the app
|
53
|
+
click finder.quick_look.button(id: 'QLControlOpen')
|
54
|
+
sleep 1 # pause for "slow motion"
|
51
55
|
|
52
|
-
|
53
|
-
|
56
|
+
# Get a reference to activity monitor and close the app
|
57
|
+
activity_monitor = app_with_bundle_identifier 'com.apple.ActivityMonitor'
|
58
|
+
terminate activity_monitor
|
54
59
|
|
55
|
-
|
56
|
-
|
57
|
-
15.times { increment volume.slider }
|
60
|
+
# Close the Finder window
|
61
|
+
select_menu_item finder, 'File', 'Close Window'
|
58
62
|
```
|
59
63
|
|
60
64
|
|
61
65
|
## Getting Setup
|
62
66
|
|
63
|
-
You need
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
https://github.com/MacRuby/MacRuby/downloads.
|
70
|
-
If you are on Snow Leopard, you will also need to install the
|
71
|
-
[Bridge Support Preview](http://www.macruby.org/blog/2010/10/08/bridgesupport-preview.html).
|
67
|
+
You will need Ruby 1.9.3 or a MacRuby nightly build for
|
68
|
+
installation. You can get help installing Ruby 1.9.3 from the
|
69
|
+
[Ruby Website](http://www.ruby-lang.org), or help installing MacRuby
|
70
|
+
from the
|
71
|
+
[Setup MacRuby](https://github.com/MacRuby/MacRuby/wiki/Setting-up-MacRuby)
|
72
|
+
guide on Github.
|
72
73
|
|
73
|
-
|
74
|
-
|
74
|
+
You will also need to make sure you "enable access for assistive devices".
|
75
|
+
This can be done in System Preferences in the Universal Access section:
|
75
76
|
|
76
|
-
|
77
|
-
gem install AXElements
|
78
|
-
```
|
77
|
+
![Universal Access](http://ferrous26.com/images/enable_accessibility.png)
|
79
78
|
|
80
|
-
|
79
|
+
Then you can install AXElements either from RubyGems or from source. The
|
80
|
+
RubyGems install is as usual, but you may need `sudo` power:
|
81
81
|
|
82
82
|
```bash
|
83
|
-
|
83
|
+
gem install AXElements --pre
|
84
84
|
```
|
85
85
|
|
86
86
|
Or you can install from source:
|
@@ -91,19 +91,17 @@ Or you can install from source:
|
|
91
91
|
cd AXElements && rake install
|
92
92
|
```
|
93
93
|
|
94
|
-
|
95
|
-
gem dependencies, so from the AXElements source directory you can just
|
96
|
-
run the `console` task:
|
94
|
+
Once all the setup is finished, you can start up AXElements in IRB:
|
97
95
|
|
98
96
|
```bash
|
99
|
-
|
97
|
+
irb -rubygems -rax_elements
|
100
98
|
```
|
101
99
|
|
102
|
-
__NOTE__: If you are not using RVM,
|
103
|
-
instead of `rake`, and `macirb` instead of `irb`,
|
104
|
-
need to add `sudo` to your command when you install
|
105
|
-
are not using RVM with MacRuby, but have RVM
|
106
|
-
disable it like so:
|
100
|
+
__NOTE__: If you are not using RVM, but are using MacRuby, then you
|
101
|
+
should use `macrake` instead of `rake`, and `macirb` instead of `irb`,
|
102
|
+
etc.. You may also need to add `sudo` to your command when you install
|
103
|
+
the gem. If you are not using RVM with MacRuby, but have RVM
|
104
|
+
installed, remember to disable it like so:
|
107
105
|
|
108
106
|
```bash
|
109
107
|
rvm use system
|
@@ -114,20 +112,22 @@ disable it like so:
|
|
114
112
|
|
115
113
|
The [wiki](http://github.com/Marketcircle/AXElements/wiki)
|
116
114
|
is the best place to get started, it includes tutorials to help you get
|
117
|
-
started
|
118
|
-
|
115
|
+
started. API documentation is also available on
|
116
|
+
[rdoc.info](http://rdoc.info/gems/AXElements/frames).
|
119
117
|
|
120
118
|
Though it is not required, you may want to read Apple's
|
121
119
|
[Accessibility Overview](http://developer.apple.com/library/mac/#documentation/Accessibility/Conceptual/AccessibilityMacOSX/OSXAXModel/OSXAXmodel.html)
|
122
120
|
as a primer on some the rationale for the accessibility APIs as well
|
123
|
-
as the technical underpinnings of AXElements.
|
121
|
+
as some of the technical the technical underpinnings of AXElements.
|
124
122
|
|
125
123
|
|
126
124
|
## Development
|
127
125
|
|
128
|
-
AXElements
|
129
|
-
|
130
|
-
the
|
126
|
+
[![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/Marketcircle/AXElements)
|
127
|
+
|
128
|
+
AXElements has reached a point where the main focus is stability,
|
129
|
+
documentation, and additional conveniences. It will be out of this
|
130
|
+
world, so we're code naming the next version "Lunatone".
|
131
131
|
|
132
132
|
![The Moon](https://github.com/Marketcircle/AXElements/raw/gh-pages/images/next_version.png)
|
133
133
|
|
@@ -155,6 +155,9 @@ you simply need to run the `test` task:
|
|
155
155
|
rake test
|
156
156
|
```
|
157
157
|
|
158
|
+
If there is a test that crashes MacRuby then you will need to run tests
|
159
|
+
in verbose mode.
|
160
|
+
|
158
161
|
__NOTE__: There may be some tests are dependent on Accessibility
|
159
162
|
features that are new in OS X Lion which will cause test failures on
|
160
163
|
OS X Snow Leopard. If you have any issues then you should look at the
|
@@ -176,18 +179,12 @@ disabled by default. In order to enable them you need to set the
|
|
176
179
|
|
177
180
|
## Contributing to AXElements
|
178
181
|
|
179
|
-
|
180
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
181
|
-
* Fork the project
|
182
|
-
* Start a feature/bugfix branch
|
183
|
-
* Commit and push until you are happy with your contribution
|
184
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
185
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
182
|
+
See {file:CONTRIBUTING.markdown}
|
186
183
|
|
187
184
|
|
188
185
|
## Copyright
|
189
186
|
|
190
|
-
Copyright (c) 2010-
|
187
|
+
Copyright (c) 2010-2013, Marketcircle Inc.
|
191
188
|
All rights reserved.
|
192
189
|
|
193
190
|
Redistribution and use in source and binary forms, with or without
|
data/Rakefile
CHANGED
@@ -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
|
@@ -3,7 +3,7 @@
|
|
3
3
|
* KeyCoder
|
4
4
|
*
|
5
5
|
* Created by Mark Rada on 11-07-27.
|
6
|
-
* Copyright 2011 Marketcircle Incorporated. All rights reserved.
|
6
|
+
* Copyright 2011-2012 Marketcircle Incorporated. All rights reserved.
|
7
7
|
*/
|
8
8
|
|
9
9
|
|
@@ -26,7 +26,8 @@
|
|
26
26
|
* @return [Hash{String=>Number}]
|
27
27
|
*/
|
28
28
|
|
29
|
-
static
|
29
|
+
static
|
30
|
+
VALUE
|
30
31
|
keycoder_dynamic_mapping()
|
31
32
|
{
|
32
33
|
|
@@ -45,7 +46,8 @@ keycoder_dynamic_mapping()
|
|
45
46
|
UniCharCount string_length = 0;
|
46
47
|
UInt32 dead_key_state = 0;
|
47
48
|
UCKeyTranslate(
|
48
|
-
layout,
|
49
|
+
layout,
|
50
|
+
key_code,
|
49
51
|
kUCKeyActionDown,
|
50
52
|
0,
|
51
53
|
LMGetKbdType(), // kb type
|
@@ -90,7 +92,8 @@ keycoder_dynamic_mapping()
|
|
90
92
|
* @return [true]
|
91
93
|
*/
|
92
94
|
|
93
|
-
static
|
95
|
+
static
|
96
|
+
VALUE
|
94
97
|
keycoder_post_event(VALUE self, VALUE event)
|
95
98
|
{
|
96
99
|
VALUE code = rb_ary_entry(event, 0);
|
@@ -99,7 +102,7 @@ keycoder_post_event(VALUE self, VALUE event)
|
|
99
102
|
CGEventRef event_ref = CGEventCreateKeyboardEvent(NULL, FIX2LONG(code), state);
|
100
103
|
CGEventPost(kCGHIDEventTap, event_ref);
|
101
104
|
|
102
|
-
usleep(9000);
|
105
|
+
usleep(9000); // 9000 is a magic number
|
103
106
|
return Qtrue;
|
104
107
|
}
|
105
108
|
|