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

42 lines
1.1 KiB

  1. require 'caca'
  2. class TC_Canvas < MiniTest::Test
  3. def test_create
  4. d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
  5. end
  6. def test_fail_create
  7. assert_raises(RuntimeError) {
  8. d = Caca::Dither.new(-1, 32, 32, 32, 0, 0, 0, 0)
  9. }
  10. end
  11. def test_set_palette
  12. d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
  13. d.palette = [[0xfff, 0xfff, 0xfff, 0xfff]] * 256
  14. end
  15. def test_fail_set_palette
  16. assert_raises(ArgumentError) {
  17. d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
  18. d.palette = []
  19. }
  20. end
  21. def test_fail_set_palette2
  22. assert_raises(RuntimeError) {
  23. d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
  24. d.palette = [[0xffff, 0, 0, 0]] * 256
  25. }
  26. end
  27. def test_set_brightness
  28. d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
  29. d.brightness = 0.5
  30. end
  31. def test_set_gamma
  32. d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
  33. d.gamma = 0.5
  34. end
  35. def test_set_contrast
  36. d = Caca::Dither.new(8, 32, 32, 32, 0, 0, 0, 0)
  37. d.contrast = 0.5
  38. end
  39. end