25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
974 B

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