You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
997 B

  1. require 'test/unit'
  2. require 'caca'
  3. class TC_Canvas < Test::Unit::TestCase
  4. def test_create
  5. d = Caca::Display.new
  6. assert_not_nil(d, 'Display creation failed')
  7. end
  8. def test_create_with_driver
  9. d = Caca::Display.new(Caca::Display.driver_list[0])
  10. assert_not_nil(d, 'Display creation failed')
  11. end
  12. def test_create_wrong_args
  13. assert_raise(RuntimeError){Caca::Display.new("plop")}
  14. driver = Caca::Display.driver_list[0]
  15. assert_raise(ArgumentError){Caca::Display.new(driver, driver)}
  16. c = Cucul::Canvas.new(3, 3)
  17. assert_raise(ArgumentError){Caca::Display.new(c, c)}
  18. end
  19. def test_create_from_canvas
  20. c = Cucul::Canvas.new(3, 3)
  21. d = Caca::Display.new(c)
  22. assert_not_nil(d, 'Display creation failed')
  23. assert_equal(d.canvas, c, 'Wrong canvas')
  24. end
  25. def test_set_title
  26. c = Cucul::Canvas.new(3, 3)
  27. d = Caca::Display.new(c)
  28. d.title = "Test !"
  29. end
  30. end