Merge games and plugins.
[kaya.git] / test / test_utils.rb
blobff462a8b9861841a561f0460c711ccc3850d7462
1 require 'test/unit'
2 require 'rubygems'
3 require 'mocha'
4 require 'qtutils'
6 class TestQtUtils < Test::Unit::TestCase
7   def test_painter_bracket
8     p = Qt::Painter.new
9     p.expects(:fill_rect).once
10     p.expects(:end).once
11     
12     p.paint do |painter|
13       painter.fill_rect
14     end
15   end
16   
17   def test_detect_index
18     alphabet = ('a'..'z')
19     h = alphabet.detect_index {|l| "hello"[0, 1] == l }
20     
21     assert_equal 7, h
22     
23     result = alphabet.detect_index {|l| 0 == 1 }
24     assert_nil result
25   end
26 end