您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

tc_display.rb 1.0 KiB

12345678910111213141516171819202122232425262728293031323334
  1. require 'caca'
  2. class TC_Canvas < MiniTest::Test
  3. def test_create
  4. d = Caca::Display.new()
  5. refute_nil(d, 'Display creation failed')
  6. end
  7. def test_create_with_driver
  8. d = Caca::Display.new(Caca::Display.driver_list[0])
  9. refute_nil(d, 'Display creation failed')
  10. end
  11. def test_create_wrong_args
  12. c = Caca::Canvas.new(3, 3)
  13. assert_raises(RuntimeError){Caca::Display.new("plop")}
  14. assert_raises(RuntimeError){Caca::Display.new(c, "plop")}
  15. assert_raises(ArgumentError){Caca::Display.new("plop", "plop")}
  16. assert_raises(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. refute_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. def test_set_cursor
  30. d = Caca::Display.new()
  31. d.cursor = 1
  32. end
  33. end