Permalink
Browse files

Test the new ProxyObjectInterface#on_signal

Ensure the api is properly tested inside the test suite
  • Loading branch information...
stoffie committed Nov 3, 2012
1 parent 3bfc6a4 commit a601efe6f52aac66fdf3be0191fa04fefe3a2c2f
Showing with 9 additions and 5 deletions.
  1. +2 −0 test/service_newapi.rb
  2. +7 −5 test/signal_test.rb
View
@@ -94,6 +94,7 @@ def initialize(path)
# and sends a signal when done
dbus_method :LongTaskBegin, 'in delay:i' do |delay|
# FIXME did not complain about mismatch between signature and block args
+ self.LongTaskStart
DBus.logger.debug "Long task began"
task = Thread.new do
DBus.logger.debug "Long task thread started (#{delay}s)"
@@ -104,6 +105,7 @@ def initialize(path)
task.abort_on_exception = true # protect from test case bugs
end
+ dbus_signal :LongTaskStart
dbus_signal :LongTaskEnd
end
View
@@ -49,9 +49,13 @@ def test_overriding_a_handler
assert_equal 1, counter
end
- def test_on_signal_backward_compatibility
- DBus.logger.debug "Inside test_on_signal_backward_compatibility"
+ def test_on_signal_overload
+ DBus.logger.debug "Inside test_on_signal_overload"
counter = 0
+ started = false
+ @intf.on_signal "LongTaskStart" do
+ started = true
+ end
# Same as intf.on_signal("LongTaskEnd"), just the old way
@intf.on_signal @obj.bus, "LongTaskEnd" do
counter += 1
@@ -66,10 +70,8 @@ def test_on_signal_backward_compatibility
@loop.run
quitter.join
+ assert_equal true, started
assert_equal 1, counter
- end
-
- def test_on_signal_args_check
assert_raise(ArgumentError) {@intf.on_signal } # not enough
assert_raise(ArgumentError) {@intf.on_signal 'to', 'many', 'yarrrrr!'}
end

0 comments on commit a601efe

Please sign in to comment.