adds the simple object dependency
where the next object is dependent on the previous one and just behind it, the padded_length away
This commit is contained in:
34
test/risc/position/test_object_listener.rb
Normal file
34
test/risc/position/test_object_listener.rb
Normal file
@ -0,0 +1,34 @@
|
||||
require_relative "../helper"
|
||||
|
||||
module Risc
|
||||
module Position
|
||||
class Dummy
|
||||
def padded_length
|
||||
4
|
||||
end
|
||||
end
|
||||
class TestObjectListener < MiniTest::Test
|
||||
|
||||
def setup
|
||||
@object = Dummy.new
|
||||
@dependent = Dummy.new
|
||||
@pos = Position.set(@object,0)
|
||||
Position.set(@dependent,0)
|
||||
@listener = ObjectListener.new(@dependent)
|
||||
end
|
||||
def test_register
|
||||
assert @pos.register_event(:position_changed , @listener)
|
||||
end
|
||||
def test_no_fire
|
||||
@pos.register_event(:position_changed , self)
|
||||
@pos = Position.set(@object,0)
|
||||
assert_equal 0 , Position.get(@dependent).at
|
||||
end
|
||||
def test_reset
|
||||
@pos.register_event(:position_changed , @listener)
|
||||
@pos = Position.set(@object,4)
|
||||
assert_equal 4 , Position.get(@dependent).at
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user