tc_dither.rb (libcaca-0.99.beta19) | : | tc_dither.rb (libcaca-0.99.beta20.tar.bz2) | ||
---|---|---|---|---|
require 'caca' | require 'caca' | |||
class TC_Canvas < Test::Unit::TestCase | class TC_Canvas < MiniTest::Test | |||
def test_create | def test_create | |||
assert_nothing_raised { | d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | |||
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | ||||
} | ||||
end | end | |||
def test_fail_create | def test_fail_create | |||
assert_raise(RuntimeError) { | assert_raises(RuntimeError) { | |||
d = Caca::Dither.new(-1, 32, 32, 32, 0, 0, 0, 0) | d = Caca::Dither.new(-1, 32, 32, 32, 0, 0, 0, 0) | |||
} | } | |||
end | end | |||
def test_set_palette | def test_set_palette | |||
assert_nothing_raised { | d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | |||
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | d.palette = [[0xfff, 0xfff, 0xfff, 0xfff]] * 256 | |||
d.palette=[[0xfff, 0xfff, 0xfff, 0xfff]]*256 | ||||
} | ||||
end | end | |||
def test_fail_set_palette | def test_fail_set_palette | |||
assert_raise(ArgumentError) { | assert_raises(ArgumentError) { | |||
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | |||
d.palette=[] | d.palette = [] | |||
} | } | |||
end | end | |||
def test_fail_set_palette2 | def test_fail_set_palette2 | |||
assert_raise(RuntimeError) { | assert_raises(RuntimeError) { | |||
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | |||
d.palette=[[0xffff, 0, 0, 0]]*256 | d.palette = [[0xffff, 0, 0, 0]] * 256 | |||
} | } | |||
end | end | |||
def test_set_brightness | def test_set_brightness | |||
assert_nothing_raised { | d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | |||
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | d.brightness = 0.5 | |||
d.brightness=0.5 | ||||
} | ||||
end | end | |||
def test_set_gamma | def test_set_gamma | |||
assert_nothing_raised { | d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | |||
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | d.gamma = 0.5 | |||
d.gamma=0.5 | ||||
} | ||||
end | end | |||
def test_set_contrast | def test_set_contrast | |||
assert_nothing_raised { | d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | |||
d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0) | d.contrast = 0.5 | |||
d.contrast=0.5 | ||||
} | ||||
end | end | |||
end | end | |||
End of changes. 12 change blocks. | ||||
28 lines changed or deleted | 18 lines changed or added |