Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

51 rinda
1.3 KiB

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