Ignore:
Timestamp:
Nov 15, 2007, 11:22:55 PM (12 years ago)
Author:
Pascal Terjan
Message:
  • Add more tests for the ruby binding
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/ruby/t/tc_canvas.rb

    r1965 r1966  
    88    def test_create
    99        c = Cucul::Canvas.new(3, 3)
    10         assert(c, 'Canvas creation failed')
     10        assert_not_nil(c, 'Canvas creation failed')
    1111        assert(c.width == 3 && c.height == 3, 'Wrong size for new canvas')
    1212    end
    1313    def test_width
    14     @c.width=42
    15         assert_equal(c.width, 42, 'Failed to set width')
     14        @c.width = 42
     15        assert_equal(42, @c.width, 'Failed to set width with =')
     16        @c.set_width(24)
     17        assert_equal(24, @c.width, 'Failed to set width')
    1618    end
    1719    def test_height
    18         @c.height=42
    19         assert_equal(c.height, 42, 'Failed to set width')
     20        @c.height = 42
     21        assert_equal(42, @c.height, 'Failed to set height with =')
     22        @c.set_height(24)
     23        assert_equal(24, @c.height, 'Failed to set height')
    2024    end
    2125    def test_size
    22     @c.set_size(100,100)
     26        @c.set_size(100,100)
    2327        assert(@c.width == 100 && @c.height == 100, 'Failed to set size')
    2428    end
    2529    def test_import
    2630        @c.import_memory("foo", "")
    27         assert_equal(@c.export_memory("irc"), "foo\r\n", "Import/Export failed")
     31        assert_equal("foo\r\n", @c.export_memory("irc"), "Import/Export failed")
     32    end
     33    def test_cursor
     34        @c.gotoxy(1,1)
     35        assert_equal(1, @c.cursor_x)
     36        assert_equal(1, @c.cursor_y)
     37    end
     38    def test_clear
     39        @c.put_char(1, 1, 64)
     40        @c.clear
     41        assert_equal("", @c.export_memory("irc").strip, "Failed to clear canvas")
     42    end
     43    def test_char
     44        @c.put_char(1, 1, 42)
     45        assert_equal(42, @c.get_char(1,1))
    2846    end
    2947end
Note: See TracChangeset for help on using the changeset viewer.