2 require 'board/square_tag'
3 require 'board/point_converter'
7 class FakeTaggableBoard
9 include TaggableSquares
14 def method_missing(m, *args)
32 class TestSquareTag < Test::Unit::TestCase
34 @board = FakeTaggableBoard.new
38 assert @board.respond_to?(:selection)
39 assert @board.respond_to?(:selection=)
42 def test_empty_initial_tag
43 assert_nil @board.selection
46 def test_set_retrieve_tag
47 @board.expects(:add_item).with do |name, pix, args|
48 name == :selection and args[:pos] == Point.new(30.0, 20.0)
50 @board.selection = Point.new(3, 2)
51 assert_equal Point.new(3, 2), @board.selection
54 def test_set_cancel_tag
55 @board.expects(:add_item).with do |name, pix, args|
56 name == :selection and args[:pos] == Point.new(50.0, 30.0)
58 @board.expects(:remove_item).with(:selection)
60 @board.selection = Point.new(5, 3)
61 @board.selection = nil
62 assert_nil @board.selection