source: libcaca/trunk/ruby/t/tc_display.rb @ 2298

Last change on this file since 2298 was 2298, checked in by Pascal Terjan, 12 years ago

Fix args type checks in Caca::Display.new

File size: 997 bytes
Line 
1require 'test/unit'
2require 'caca'
3
4class TC_Canvas < Test::Unit::TestCase
5    def test_create
6        d = Caca::Display.new
7        assert_not_nil(d, 'Display creation failed')
8    end
9    def test_create_with_driver
10        d = Caca::Display.new(Caca::Display.driver_list[0])
11        assert_not_nil(d, 'Display creation failed')
12    end
13    def test_create_wrong_args
14        assert_raise(RuntimeError){Caca::Display.new("plop")}
15        driver = Caca::Display.driver_list[0]
16        assert_raise(ArgumentError){Caca::Display.new(driver, driver)}
17        c = Cucul::Canvas.new(3, 3)
18        assert_raise(ArgumentError){Caca::Display.new(c, c)}
19    end
20    def test_create_from_canvas
21        c = Cucul::Canvas.new(3, 3)
22        d = Caca::Display.new(c)
23        assert_not_nil(d, 'Display creation failed')
24        assert_equal(d.canvas, c, 'Wrong canvas')
25    end
26    def test_set_title
27        c = Cucul::Canvas.new(3, 3)
28        d = Caca::Display.new(c)
29        d.title = "Test !"
30    end
31end
Note: See TracBrowser for help on using the repository browser.