source: libcaca/trunk/ruby/t/tc_dither.rb @ 2822

Last change on this file since 2822 was 2822, checked in by Sam Hocevar, 12 years ago

Continuing the libcucul-libcaca merge.

File size: 1.3 KB
Line 
1require 'test/unit'
2require 'caca'
3
4class TC_Canvas < Test::Unit::TestCase
5    def test_create
6        assert_nothing_raised {
7            d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
8        }
9    end
10    def test_fail_create
11        assert_raise(RuntimeError) {
12            d = Caca::Dither.new(-1, 32, 32, 32, 0, 0, 0, 0)
13        }
14    end
15    def test_set_palette
16        assert_nothing_raised {
17            d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
18            d.palette=[[0xfff, 0xfff, 0xfff, 0xfff]]*256
19        }
20    end
21    def test_fail_set_palette
22        assert_raise(ArgumentError) {
23            d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
24            d.palette=[]
25        }
26    end
27    def test_fail_set_palette2
28        assert_raise(RuntimeError) {
29            d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
30            d.palette=[[0xffff, 0, 0, 0]]*256
31        }
32    end
33    def test_set_brightness
34        assert_nothing_raised {
35            d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
36            d.brightness=0.5
37        }
38    end
39    def test_set_gamma
40        assert_nothing_raised {
41            d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
42            d.gamma=0.5
43        }
44    end
45    def test_set_contrast
46        assert_nothing_raised {
47            d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
48            d.contrast=0.5
49        }
50    end
51end
Note: See TracBrowser for help on using the repository browser.