phew 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b94dbd3721ae380ca776eed3fd1c820e5c9f895
4
- data.tar.gz: b8d26527d75e047e32ffa30c6c44e4721027eafe
3
+ metadata.gz: 77b4ad7bcdd167fc10b7ba80145217cc833f2fc1
4
+ data.tar.gz: 24d2b4f26a4cc6c74c2b0e979006069b467bae87
5
5
  SHA512:
6
- metadata.gz: 335812593a7d0acdcf098c01f02405a8d89aef3445f2f033759d873d9747c125dd84ed225fe05adc75683c53b4beb2d1073b8aa98192a28715fd4659b8ba4cf5
7
- data.tar.gz: fb2951fd355517a3a2d6ec7e36a6d8f0b01eb887baa14c600e48aad665eb87972cd19f17945e19969c25bede63b5e3807543f8c5ef9466fd464cd449bb619fac
6
+ metadata.gz: 1d6819401d22edf6df33042eb9632c5bcd4f558540acf6c3245eeda5c4d988c24a7cb9fca9b58ad84c54f97fb2bcf822a3d2dee8b762eafb0d5b35e917bf9fd5
7
+ data.tar.gz: 050afc7ffa55d0c1f89845a5fa89b6396b5e914f56ded42623bc313af77561d51cf159c239f0a4b1e92551d13bd1172ef03acf8957aa32294b84f8bc719d34ed
@@ -1,116 +1,11 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
1
+ require_relative '../test_helper'
2
+ require 'atspi_app_driver'
2
3
 
3
- require 'gir_ffi'
4
-
5
- GirFFI.setup :Atspi
6
- Atspi.load_class :Accessible
7
-
8
- module Atspi
9
- # Utility monkey-patches for the Atspi::Accessible class
10
- class Accessible
11
- def each_child
12
- child_count.times do |i|
13
- yield get_child_at_index i
14
- end
15
- end
16
-
17
- def find_role role, regex = //
18
- return self if role == self.role && name =~ regex
19
- each_child do |child|
20
- result = child.find_role role, regex
21
- return result if result
22
- end
23
- nil
24
- end
25
-
26
- def inspect_recursive level = 0, maxlevel = 4
27
- each_child do |child|
28
- puts "#{' ' * level} > name: #{child.name}; role: #{child.role}"
29
- child.inspect_recursive(level + 1) unless level >= maxlevel
30
- end
31
- end
32
- end
33
- end
34
-
35
- def find_app name
36
- desktop = Atspi.get_desktop(0)
37
- desktop.each_child do |child|
38
- next if child.nil?
39
- return child if child.name == name
40
- end
41
- nil
42
- end
43
-
44
- def try_repeatedly
45
- 100.times.each do |num|
46
- result = yield
47
- return result if result
48
- sleep_time = 0.01 * (num + 1)
49
- sleep sleep_time
50
- end
51
- yield
52
- end
53
-
54
- def press_ctrl_q
55
- Atspi.generate_keyboard_event(37, nil, :press)
56
- Atspi.generate_keyboard_event(24, nil, :pressrelease)
57
- Atspi.generate_keyboard_event(37, nil, :release)
58
- end
59
-
60
- # Test driver for the Phew application. Takes care of boot and shutdown, and
61
- # provides a handle on the GUI's main UI frame.
62
- class PhewDriver
4
+ # Test driver for the Phew application.
5
+ class PhewDriver < AtspiAppDriver
63
6
  def initialize
64
- @app_file = File.expand_path('../../bin/phew', File.dirname(__FILE__))
65
- @lib_dir = File.expand_path('../../lib', File.dirname(__FILE__))
66
- @pid = nil
67
- @killed = false
68
- end
69
-
70
- def boot timeout = 10
71
- raise 'Already booted' if @pid
72
- @pid = Process.spawn "ruby -I#{@lib_dir} #{@app_file}"
73
-
74
- @killed = false
75
- @cleanup = false
76
-
77
- Thread.new do
78
- ((timeout - 1) * 10).times do
79
- break if @cleanup
80
- sleep 0.1
81
- end
82
-
83
- 10.times do
84
- break unless @pid
85
- sleep 0.1
86
- end
87
-
88
- if @pid
89
- warn "About to kill child process #{@pid}"
90
- @killed = true
91
- Process.kill 'KILL', @pid
92
- end
93
- end
94
- end
95
-
96
- def cleanup
97
- return unless @pid
98
- @cleanup = true
99
- _, status = Process.wait2 @pid
100
- @pid = nil
101
- status
102
- end
103
-
104
- def find_and_focus_frame
105
- acc = try_repeatedly { find_app 'phew' }
106
- acc.wont_be_nil
107
-
108
- frame = acc.get_child_at_index 0
109
- frame.role.must_equal :frame
110
- frame.grab_focus
111
- sleep 0.1
112
-
113
- frame
7
+ verbose = ENV['VERBOSE'] == 'true'
8
+ super 'phew', verbose: verbose
114
9
  end
115
10
  end
116
11
 
@@ -121,16 +16,15 @@ describe 'The Phew application' do
121
16
  end
122
17
 
123
18
  it 'starts and can be quit with Ctrl-q' do
124
- @driver.find_and_focus_frame
125
-
126
- press_ctrl_q
19
+ sleep 0.05
20
+ @driver.press_ctrl_q
127
21
 
128
22
  status = @driver.cleanup
129
23
  status.exitstatus.must_equal 0
130
24
  end
131
25
 
132
26
  it 'shows a dropdown list of scripts' do
133
- frame = @driver.find_and_focus_frame
27
+ frame = @driver.frame
134
28
 
135
29
  box = frame.find_role :combo_box
136
30
 
@@ -148,7 +42,7 @@ describe 'The Phew application' do
148
42
 
149
43
  textbox.get_text(0, 100).must_equal 'The quick brown fox jumps over the lazy dog.'
150
44
 
151
- press_ctrl_q
45
+ @driver.press_ctrl_q
152
46
  status = @driver.cleanup
153
47
  status.exitstatus.must_equal 0
154
48
  end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
1
+ require_relative '../test_helper'
2
2
 
3
3
  describe Phew::FontRepository do
4
4
  describe '#get_font' do
@@ -1,6 +1,4 @@
1
- require File.expand_path('../test_helper.rb', File.dirname(__FILE__))
2
-
3
- require 'gir_ffi-pango'
1
+ require_relative '../test_helper'
4
2
 
5
3
  describe Phew::Font do
6
4
  describe '#coverage_summary' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phew
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-13 00:00:00.000000000 Z
11
+ date: 2015-09-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gir_ffi-gtk
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.7.0
19
+ version: 0.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.7.0
26
+ version: 0.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gir_ffi-pango
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.5
33
+ version: 0.0.6
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.5
40
+ version: 0.0.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '5.5'
69
+ - !ruby/object:Gem::Dependency
70
+ name: atspi_app_driver
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.0.2
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.0.2
69
83
  description: List and compare installed fonts on GNOME
70
84
  email:
71
85
  - matijs@matijs.net
@@ -114,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
128
  version: '0'
115
129
  requirements: []
116
130
  rubyforge_project:
117
- rubygems_version: 2.4.5
131
+ rubygems_version: 2.4.5.1
118
132
  signing_key:
119
133
  specification_version: 4
120
134
  summary: A GNOME Font Viewer