"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ruby/t/tc_canvas.rb" between
libcaca-0.99.beta19.tar.gz and libcaca-0.99.beta20.tar.bz2

About: libcaca is a graphics library that outputs text instead of pixels, so that it can work on older video cards or text terminals (something like an advanced AAlib library).

tc_canvas.rb  (libcaca-0.99.beta19):tc_canvas.rb  (libcaca-0.99.beta20.tar.bz2)
require 'caca' require 'caca'
class TC_Canvas < Test::Unit::TestCase class TC_Canvas < MiniTest::Test
def setup def setup
@c = Caca::Canvas.new(3, 3) @c = Caca::Canvas.new(3, 3)
end end
def test_create def test_create
c = Caca::Canvas.new(3, 3) c = Caca::Canvas.new(3, 3)
assert_not_nil(c, 'Canvas creation failed') refute_nil(c, 'Canvas creation failed')
assert(c.width == 3 && c.height == 3, 'Wrong size for new canvas') assert(c.width == 3 && c.height == 3, 'Wrong size for new canvas')
end end
def test_width def test_width
@c.width = 42 @c.width = 42
assert_equal(42, @c.width, 'Failed to set width with =') assert_equal(42, @c.width, 'Failed to set width with =')
@c.set_width(24) @c.set_width(24)
assert_equal(24, @c.width, 'Failed to set width') assert_equal(24, @c.width, 'Failed to set width')
end end
def test_height def test_height
@c.height = 42 @c.height = 42
skipping to change at line 50 skipping to change at line 50
@c.put_char(1, 1, 64) @c.put_char(1, 1, 64)
@c.clear @c.clear
assert_equal("", @c.export_to_memory("irc").strip, "Failed to clear canv as") assert_equal("", @c.export_to_memory("irc").strip, "Failed to clear canv as")
end end
def test_char def test_char
@c.put_char(1, 1, 42) @c.put_char(1, 1, 42)
assert_equal(42, @c.get_char(1,1)) assert_equal(42, @c.get_char(1,1))
end end
def test_render def test_render
c = Caca::Canvas.new(4,4) c = Caca::Canvas.new(4,4)
c.put_str(0,0,"plop") c.put_str(0,0,"plop")
f = Caca::Font.new(Caca::Font.list[0]) f = Caca::Font.new(Caca::Font.list[0])
assert_not_nil(c.render(f, c.width*f.width, c.height*f.height, c.width*f. refute_nil(c.render(f, c.width*f.width, c.height*f.height, c.width*f.wid
width*4)) th*4))
end end
def test_fail_render def test_fail_render
c = Caca::Canvas.new(4,4) c = Caca::Canvas.new(4,4)
assert_raise(ArgumentError) { assert_raises(ArgumentError) {
c.render(nil, c.width, c.height, c.width*4) c.render(nil, c.width, c.height, c.width*4)
} }
end end
end end
 End of changes. 4 change blocks. 
7 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)