Debian Codegraph @

ruby/t/tc_dither.rb

raw
1 require 'caca'
2
3 class TC_Canvas < MiniTest::Test
4 def test_create
5 d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
6 end
7 def test_fail_create
8 assert_raises(RuntimeError) {
9 d = Caca::Dither.new(-1, 32, 32, 32, 0, 0, 0, 0)
10 }
11 end
12 def test_set_palette
13 d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
14 d.palette = [[0xfff, 0xfff, 0xfff, 0xfff]] * 256
15 end
16 def test_fail_set_palette
17 assert_raises(ArgumentError) {
18 d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
19 d.palette = []
20 }
21 end
22 def test_fail_set_palette2
23 assert_raises(RuntimeError) {
24 d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
25 d.palette = [[0xffff, 0, 0, 0]] * 256
26 }
27 end
28 def test_set_brightness
29 d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
30 d.brightness = 0.5
31 end
32 def test_set_gamma
33 d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
34 d.gamma = 0.5
35 end
36 def test_set_contrast
37 d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
38 d.contrast = 0.5
39 end
40 end
41