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
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'test/integration/helper'
|
2
|
-
require 'minitest/ax_elements'
|
3
|
-
|
4
|
-
class TestMiniTestAssertions < MiniTest::Unit::TestCase
|
5
|
-
|
6
|
-
def test_assert_has_child
|
7
|
-
expected = app.window
|
8
|
-
|
9
|
-
assert_equal expected, assert_has_child(app, :window)
|
10
|
-
assert_equal expected, assert_has_child(app, :window, title: 'AXElementsTester')
|
11
|
-
|
12
|
-
assert_has_child(app, :window) { |_| @got_called = true }
|
13
|
-
assert @got_called
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_assert_has_child_raises_in_failure_cases
|
17
|
-
e = assert_raises(MiniTest::Assertion) { assert_has_child app, :button }
|
18
|
-
assert_match /to have Button as a child/, e.message
|
19
|
-
|
20
|
-
e = assert_raises(MiniTest::Assertion) { assert_has_child app, :button, title: "Press" }
|
21
|
-
assert_match %r{to have Button\(title: "Press"\) as a child}, e.message
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_assert_has_descendent
|
25
|
-
expected = app.main_window.check_box
|
26
|
-
|
27
|
-
assert_equal expected, assert_has_descendent(app,:check_box)
|
28
|
-
assert_equal expected, assert_has_descendent(app,:check_box, title: /Box/)
|
29
|
-
|
30
|
-
assert_has_descendent(app, :check_box) { |_| @got_called = true }
|
31
|
-
assert @got_called
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_assert_has_descendent_raises_in_failure_cases
|
35
|
-
e = assert_raises(MiniTest::Assertion) {
|
36
|
-
assert_has_descendent(app.main_window.slider, :window, title: /Cake/)
|
37
|
-
}
|
38
|
-
assert_match /to have Window\(title: \/Cake\/\) as a descendent/, e.message
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_assert_shortly_has
|
42
|
-
assert_equal app.window, assert_shortly_has(:window, parent: app)
|
43
|
-
assert_equal app.check_box, assert_shortly_has(:check_box, ancestor: app)
|
44
|
-
|
45
|
-
assert_shortly_has(:window, parent: app) { @got_called = true }
|
46
|
-
assert @got_called
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_assert_shortly_has_raises_in_failure_cases
|
50
|
-
e = assert_raises(MiniTest::Assertion) { assert_shortly_has(:button, parent: app, timeout: 0) }
|
51
|
-
assert_match /to have child Button before a timeout occurred/, e.message
|
52
|
-
|
53
|
-
e = assert_raises(MiniTest::Assertion) { assert_shortly_has(:table, ancestor: app.menu_bar_item, timeout: 0) }
|
54
|
-
assert_match /to have descendent Table before a timeout occurred/, e.message
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_refute_has_child
|
58
|
-
assert_nil refute_has_child(app, :button)
|
59
|
-
assert_nil refute_has_child(app, :window, title: 'Herp Derp')
|
60
|
-
|
61
|
-
result = refute_has_child(app, :window) { |x| x.title == 'Herp Derp' }
|
62
|
-
assert_nil result
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_refute_has_child_raises_in_failure_cases
|
66
|
-
e = assert_raises(MiniTest::Assertion) { refute_has_child app, :window }
|
67
|
-
assert_match /NOT to have #{Regexp.escape(app.window.inspect)} as a child/, e.message
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_refute_has_descendent
|
71
|
-
slider = app.main_window.slider
|
72
|
-
|
73
|
-
assert_nil refute_has_descendent(slider, :window)
|
74
|
-
assert_nil refute_has_descendent(slider, :element, title: 'Rhubarb')
|
75
|
-
|
76
|
-
result = refute_has_descendent slider, :element do |x|
|
77
|
-
@got_called = true
|
78
|
-
x.attributes.include?(:title) && x.title == 'Rhubarb'
|
79
|
-
end
|
80
|
-
assert_nil result
|
81
|
-
assert @got_called
|
82
|
-
end
|
83
|
-
|
84
|
-
def test_refute_has_descendent_raises_in_failure_cases
|
85
|
-
e = assert_raises(MiniTest::Assertion) { refute_has_descendent app, :window }
|
86
|
-
assert_match /#{Regexp.escape(app.window.inspect)} as a descendent/, e.message
|
87
|
-
end
|
88
|
-
|
89
|
-
end
|
@@ -1,102 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'test/integration/helper'
|
3
|
-
require 'rspec/expectations/ax_elements'
|
4
|
-
|
5
|
-
class TestRSpecMatchers < MiniTest::Unit::TestCase
|
6
|
-
|
7
|
-
|
8
|
-
def test_have_child_should_failure_message
|
9
|
-
e = app.main_window.slider
|
10
|
-
m = have_child(:window)
|
11
|
-
|
12
|
-
refute m.matches?(e)
|
13
|
-
assert_equal "Expected #{e.inspect} to have child Window", m.failure_message_for_should
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_have_child_should_not_failure_message
|
17
|
-
e = app.window
|
18
|
-
m = have_child(:window)
|
19
|
-
|
20
|
-
refute m.does_not_match?(app)
|
21
|
-
assert_equal "Expected #{app.inspect} to NOT have child #{e.inspect}", m.failure_message_for_should_not
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_have_child_description
|
25
|
-
m = have_child(:window) { }
|
26
|
-
assert_equal 'should have a child that matches Window[✔]', m.description
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
def test_have_descendent_should_failure_message
|
32
|
-
m = have_descendent(:button)
|
33
|
-
e = app.main_window.slider
|
34
|
-
|
35
|
-
refute m.matches?(e)
|
36
|
-
assert_equal "Expected #{e.inspect} to have descendent Button", m.failure_message_for_should
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_have_descendent_should_not_failure_message
|
40
|
-
m = have_descendant(:window)
|
41
|
-
e = app.window
|
42
|
-
|
43
|
-
refute m.does_not_match?(app)
|
44
|
-
assert_equal "Expected #{app.inspect} to NOT have descendent #{e.inspect}", m.failure_message_for_should_not
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_have_descendent_description
|
48
|
-
m = have_descendent(:button)
|
49
|
-
assert_equal 'should have a descendent matching Button', m.description
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
def test_shortly_have_child_should_failure_message
|
55
|
-
m = shortly_have_child(:button, timeout: 0) { }
|
56
|
-
e = app.main_window.slider
|
57
|
-
|
58
|
-
refute m.matches?(e)
|
59
|
-
assert_equal "Expected #{e.inspect} to have child Button[✔] before a timeout occurred",
|
60
|
-
m.failure_message_for_should
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_shortly_have_child_should_not_failure_message
|
64
|
-
m = shortly_have_child(:window)
|
65
|
-
e = app
|
66
|
-
|
67
|
-
refute m.does_not_match?(e)
|
68
|
-
assert_equal "Expected #{e.inspect} to NOT have child #{e.window.inspect} before a timeout occurred",
|
69
|
-
m.failure_message_for_should_not
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_shortly_have_child_description
|
73
|
-
m = shortly_have_child(:button)
|
74
|
-
assert_equal 'should have a child that matches Button before a timeout occurs', m.description
|
75
|
-
end
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
def test_shortly_have_descendent_should_failure_message
|
80
|
-
m = shortly_have_descendent(:button, timeout: 0)
|
81
|
-
e = app.main_window.slider
|
82
|
-
|
83
|
-
refute m.matches?(e)
|
84
|
-
assert_equal "Expected #{e.inspect} to have descendent Button before a timeout occurred",
|
85
|
-
m.failure_message_for_should
|
86
|
-
end
|
87
|
-
|
88
|
-
def test_shortly_have_descendent_should_not_failure_message
|
89
|
-
m = shortly_have_descendent(:window)
|
90
|
-
e = app
|
91
|
-
|
92
|
-
refute m.does_not_match?(e)
|
93
|
-
assert_equal "Expected #{e.inspect} to NOT have descendent #{e.window.inspect} before a timeout occurred",
|
94
|
-
m.failure_message_for_should_not
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_shortly_have_descendent_description
|
98
|
-
m = shortly_have_descendent(:button)
|
99
|
-
assert_equal 'should have a descendent matching Button before a timeout occurs', m.description
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|