30 行
799 B

  1. require 'test/unit'
  2. require 'cucul'
  3. class TC_Canvas < Test::Unit::TestCase
  4. def setup
  5. @c = Cucul::Canvas.new(3, 3)
  6. end
  7. def test_create
  8. c = Cucul::Canvas.new(3, 3)
  9. assert(c, 'Canvas creation failed')
  10. assert(c.width == 3 && c.height == 3, 'Wrong size for new canvas')
  11. end
  12. def test_width
  13. @c.width=42
  14. assert_equal(c.width, 42, 'Failed to set width')
  15. end
  16. def test_height
  17. @c.height=42
  18. assert_equal(c.height, 42, 'Failed to set width')
  19. end
  20. def test_size
  21. @c.set_size(100,100)
  22. assert(@c.width == 100 && @c.height == 100, 'Failed to set size')
  23. end
  24. def test_import
  25. @c.import_memory("foo", "")
  26. assert_equal(@c.export_memory("irc"), "foo\r\n", "Import/Export failed")
  27. end
  28. end