File: tc_dither.rb

package info (click to toggle)
libcaca 0.99.beta14-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 6,720 kB
  • ctags: 2,334
  • sloc: ansic: 18,652; cs: 1,171; objc: 835; cpp: 741; makefile: 446; sh: 289; python: 215; ruby: 190; asm: 93
file content (51 lines) | stat: -rw-r--r-- 1,331 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'test/unit'
require 'cucul'

class TC_Canvas < Test::Unit::TestCase
    def test_create
	assert_nothing_raised {
            d = Cucul::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
	}
    end
    def test_fail_create
	assert_raise(RuntimeError) {
            d = Cucul::Dither.new(-1, 32, 32, 32, 0, 0, 0, 0)
	}
    end
    def test_set_palette
	assert_nothing_raised {
            d = Cucul::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
            d.palette=[[0xfff, 0xfff, 0xfff, 0xfff]]*256
	}
    end
    def test_fail_set_palette
	assert_raise(ArgumentError) {
            d = Cucul::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
            d.palette=[]
	}
    end
    def test_fail_set_palette2
	assert_raise(RuntimeError) {
            d = Cucul::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
            d.palette=[[0xffff, 0, 0, 0]]*256
	}
    end
    def test_set_brightness
        assert_nothing_raised {
            d = Cucul::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
            d.brightness=0.5
        }
    end
    def test_set_gamma
        assert_nothing_raised {
            d = Cucul::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
            d.gamma=0.5
        }
    end
    def test_set_contrast
        assert_nothing_raised {
            d = Cucul::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
            d.contrast=0.5
        }
    end
end