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

Last change on this file since 3234 was 2825, checked in by Pascal Terjan, 12 years ago
  • No need to require test/unit in each testfile
File size: 974 bytes
Line 
1require 'caca'
2
3class TC_Canvas < Test::Unit::TestCase
4    def test_create
5        d = Caca::Display.new
6        assert_not_nil(d, 'Display creation failed')
7    end
8    def test_create_with_driver
9        d = Caca::Display.new(Caca::Display.driver_list[0])
10        assert_not_nil(d, 'Display creation failed')
11    end
12    def test_create_wrong_args
13        assert_raise(RuntimeError){Caca::Display.new("plop")}
14        driver = Caca::Display.driver_list[0]
15        assert_raise(ArgumentError){Caca::Display.new(driver, driver)}
16        c = Caca::Canvas.new(3, 3)
17        assert_raise(ArgumentError){Caca::Display.new(c, c)}
18    end
19    def test_create_from_canvas
20        c = Caca::Canvas.new(3, 3)
21        d = Caca::Display.new(c)
22        assert_not_nil(d, 'Display creation failed')
23        assert_equal(d.canvas, c, 'Wrong canvas')
24    end
25    def test_set_title
26        c = Caca::Canvas.new(3, 3)
27        d = Caca::Display.new(c)
28        d.title = "Test !"
29    end
30end
Note: See TracBrowser for help on using the repository browser.