File: tc_dither.rb

package info (click to toggle)
libcaca 0.99.beta20-5
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,512 kB
  • sloc: ansic: 25,091; php: 2,763; python: 2,637; cs: 1,213; cpp: 1,127; java: 916; objc: 836; makefile: 543; perl: 505; sh: 472; asm: 297; ruby: 215; xml: 33
file content (41 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download | duplicates (3)
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
require 'caca'

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