AXElements 1.0.0.beta2 → 1.0.0.beta3

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.
@@ -22,8 +22,11 @@
22
22
  * Ported `core.rb` to C and moved code to [accessibility\_core](https://github.com/AXElements/accessibility_core)
23
23
  * Ported `screen_recorder.rb` to C and moved code to [screen\_recorder](https://github.com/AXElements/screen_recorder)
24
24
 
25
+ * Changed `DSL#right_click` to accept a block; block is yielded to between click down and click up events
26
+
25
27
  * Deprecate `AX::DOCK` constant, use `AX::Application.dock` instead
26
28
  * Remove `Accessibility.application_with_bundle_identifier`; use `AX::Application.new` instead
27
29
  * Remove `Accessibility.application_with_name; use `AX::Application.new` instead
28
30
  * Remove `DSL#subtree_for`; use `Element#inspect_subtree` instead
29
31
 
32
+ * Fixed fetching parameterized attributes through `Element#method_missing`
@@ -303,7 +303,7 @@ module Accessibility::DSL
303
303
  # @example
304
304
  #
305
305
  # click window.pop_up do
306
- # scroll_menu_to pop_up.menu_item(title: "Expensive Cake")
306
+ # scroll_menu_to pop_up.menu.item(title: "Expensive Cake")
307
307
  # end
308
308
  #
309
309
  # @param element [AX::Element]
@@ -560,15 +560,24 @@ module Accessibility::DSL
560
560
  end
561
561
 
562
562
  ##
563
- # Perform a right (aka secondary) click action.
563
+ # Perform a right (a.k.a. secondary) click action.
564
564
  #
565
565
  # If an argument is provided then the mouse will move to that point
566
566
  # first; the argument must respond to `#to_point`.
567
567
  #
568
+ # If a block is given, it will be yielded to between the click down
569
+ # and click up event. This behaviour is the same as passing a block
570
+ # to {DSL#click}.
571
+ #
572
+ # @yield Optionally take a block that is executed between click down
573
+ # and click up events.
568
574
  # @param obj [#to_point]
569
575
  def right_click obj = nil, wait = 0.2
570
576
  move_mouse_to obj, wait: 0 if obj
571
- Mouse.right_click
577
+ Mouse.right_click_down
578
+ yield if block_given?
579
+ ensure
580
+ Mouse.right_click_up
572
581
  sleep wait
573
582
  end
574
583
  alias_method :secondary_click, :right_click
@@ -4,7 +4,7 @@
4
4
  # The main AXElements namespace.
5
5
  module Accessibility
6
6
  # @return [String]
7
- VERSION = '1.0.0.beta2'
7
+ VERSION = '1.0.0.beta3'
8
8
 
9
9
  # @return [String]
10
10
  CODE_NAME = 'ルナトーン'
@@ -339,7 +339,7 @@ class AX::Element
339
339
  return attribute(method)
340
340
 
341
341
  elsif @ref.parameterized_attributes.include? key
342
- return paramaterized_attribute(method, args.first)
342
+ return parameterized_attribute(method, args.first)
343
343
 
344
344
  elsif @ref.attributes.include? KAXChildrenAttribute
345
345
  if (result = search(method, *args, &block)).blank?
@@ -22,12 +22,13 @@ class AX::ScrollArea < AX::Element
22
22
  def scroll_to element
23
23
  return if NSContainsRect(self.bounds, element.bounds)
24
24
  Mouse.move_to self.to_point
25
- # calculate direction to scroll
25
+
26
+ # calculate direction and velocity for scrolling
26
27
  direction = element.position.y > self.position.y ? -5 : 5
27
- until NSContainsRect(self.bounds, element.bounds)
28
- Mouse.scroll direction
29
- end
30
- sleep 0.1
28
+
29
+ Mouse.scroll direction until NSContainsRect(self.bounds, element.bounds)
30
+
31
+ spin 0.1
31
32
  end
32
33
 
33
34
  end
@@ -201,6 +201,18 @@ class TestAccessibilityDSL < MiniTest::Unit::TestCase
201
201
  app.main_window.set :position, orig_window_position if orig_window_position
202
202
  end
203
203
 
204
+ def test_right_click_with_block
205
+ area = app.main_window.web_area
206
+
207
+ got_called = false
208
+ dsl.right_click area do
209
+ got_called = true
210
+ end
211
+ assert got_called
212
+ ensure
213
+ dsl.click area
214
+ end
215
+
204
216
  def test_triple_click
205
217
  dummy_text = 'Lorem ipsum dolor.' * 15
206
218
  text_area.set :value, dummy_text
@@ -43,6 +43,13 @@ class TestAXElement < MiniTest::Unit::TestCase
43
43
  box.set :value, '' if box
44
44
  end
45
45
 
46
+ def test_parameterized_attribute_through_method_missing
47
+ field = app.window.static_text
48
+ expected = field.parameterized_attribute :string_for_range, 0..2
49
+ actual = field.string_for_range 0..2
50
+ assert_equal expected, actual
51
+ end
52
+
46
53
  def test_invalid
47
54
  refute app.invalid?
48
55
 
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: 1.0.0.beta2
4
+ version: 1.0.0.beta3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-02 00:00:00.000000000 Z
12
+ date: 2013-01-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mouse
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.6
21
+ version: 1.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 1.0.6
29
+ version: 1.1.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: screen_recorder
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ~>
52
52
  - !ruby/object:Gem::Version
53
- version: 0.4.0
53
+ version: 0.4.1
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 0.4.0
61
+ version: 0.4.1
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: activesupport
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ~>
68
68
  - !ruby/object:Gem::Version
69
- version: 3.2.9
69
+ version: 3.2.10
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ~>
76
76
  - !ruby/object:Gem::Version
77
- version: 3.2.9
77
+ version: 3.2.10
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: yard
80
80
  requirement: !ruby/object:Gem::Requirement