AXElements 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. data/.yardopts +4 -0
  2. data/History.markdown +41 -0
  3. data/README.markdown +59 -62
  4. data/Rakefile +1 -1
  5. data/ext/accessibility/key_coder/extconf.rb +1 -1
  6. data/ext/accessibility/key_coder/key_coder.c +8 -5
  7. data/lib/accessibility/dsl.rb +261 -87
  8. data/lib/accessibility/enumerators.rb +14 -11
  9. data/lib/accessibility/errors.rb +4 -3
  10. data/lib/accessibility/factory.rb +159 -108
  11. data/lib/accessibility/graph.rb +13 -9
  12. data/lib/accessibility/{pp_inspector.rb → pretty_printer.rb} +4 -5
  13. data/lib/accessibility/qualifier.rb +23 -13
  14. data/lib/accessibility/string.rb +4 -4
  15. data/lib/accessibility/system_info.rb +230 -0
  16. data/lib/accessibility/translator.rb +38 -28
  17. data/lib/accessibility/version.rb +24 -2
  18. data/lib/accessibility.rb +25 -8
  19. data/lib/ax/application.rb +207 -77
  20. data/lib/ax/element.rb +62 -65
  21. data/lib/ax/menu.rb +5 -1
  22. data/lib/ax/row.rb +1 -1
  23. data/lib/ax/scroll_area.rb +7 -6
  24. data/lib/ax/systemwide.rb +38 -5
  25. data/lib/ax_elements/active_support_selections.rb +10 -0
  26. data/lib/ax_elements/mri.rb +57 -0
  27. data/lib/ax_elements/nsarray_compat.rb +97 -17
  28. data/lib/ax_elements.rb +9 -1
  29. data/rakelib/gem.rake +11 -11
  30. data/rakelib/test.rake +0 -9
  31. data/test/helper.rb +10 -18
  32. data/test/integration/accessibility/test_dsl.rb +52 -42
  33. data/test/integration/accessibility/test_enumerators.rb +0 -1
  34. data/test/integration/accessibility/test_graph.rb +1 -0
  35. data/test/integration/accessibility/test_qualifier.rb +2 -2
  36. data/test/integration/ax/test_application.rb +9 -2
  37. data/test/integration/ax/test_element.rb +41 -1
  38. data/test/sanity/accessibility/test_factory.rb +23 -56
  39. data/test/sanity/accessibility/{test_pp_inspector.rb → test_pretty_printer.rb} +9 -9
  40. data/test/sanity/accessibility/test_translator.rb +2 -5
  41. data/test/sanity/accessibility/test_version.rb +15 -0
  42. data/test/sanity/ax/test_application.rb +17 -2
  43. data/test/sanity/ax/test_element.rb +2 -2
  44. data/test/sanity/ax_elements/test_nsobject_inspect.rb +4 -2
  45. data/test/sanity/test_ax_elements.rb +1 -0
  46. metadata +69 -39
  47. data/lib/accessibility/core.rb +0 -973
  48. data/lib/accessibility/highlighter.rb +0 -86
  49. data/lib/ax_elements/vendor/inflection_data.rb +0 -66
  50. data/lib/ax_elements/vendor/inflections.rb +0 -172
  51. data/lib/ax_elements/vendor/inflector.rb +0 -306
  52. data/lib/minitest/ax_elements.rb +0 -175
  53. data/lib/mouse.rb +0 -223
  54. data/lib/rspec/expectations/ax_elements.rb +0 -234
  55. data/test/integration/accessibility/test_core.rb +0 -18
  56. data/test/integration/minitest/test_ax_elements.rb +0 -89
  57. data/test/integration/rspec/expectations/test_ax_elements.rb +0 -102
  58. data/test/sanity/accessibility/test_core.rb +0 -561
  59. data/test/sanity/accessibility/test_highlighter.rb +0 -56
  60. data/test/sanity/minitest/test_ax_elements.rb +0 -17
  61. data/test/sanity/rspec/expectations/test_ax_elements.rb +0 -15
  62. 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