"Fossies" - the Fresh Open Source Software Archive

Member "libcaca-0.99.beta20/ruby/t/tc_dither.rb" (4 Dec 2015, 1140 Bytes) of package /linux/privat/libcaca-0.99.beta20.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Ruby source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "tc_dither.rb": 0.99.beta19_vs_0.99.beta20.

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