Sha256: 900d5ff58a29cac9a111407d9e8249cebe184c05c9176fded016f8225f9c531f
Contents?: true
Size: 969 Bytes
Versions: 4
Compression:
Stored size: 969 Bytes
Contents
require_relative 'helper' class TestImage < Test::Unit::TestCase P = Processing def image(w = 10, h = 10, &block) img = Rays::Image.new w, h img.paint(&block) if block P::Image.new img end def test_set_color() g = graphics i = image(2, 2) {fill 0; rect 0, 0, 1, 1} assert_equal g.color(0, 0, 0), i.get(0, 0) i.set 0, 0, g.color(0, 255, 0) assert_equal g.color(0, 255, 0), i.get(0, 0) i.set 0, 0, g.color(0, 0, 255) assert_equal g.color(0, 0, 255), i.get(0, 0) end def test_get_color() g = graphics i = image 2, 2 do fill 1, 0, 0; rect 0, 0, 1, 1 fill 0, 1, 0; rect 1, 0, 1, 1 fill 0, 0, 1; rect 0, 1, 1, 1 end assert_equal g.color(255, 0, 0), i.get(0, 0) assert_equal g.color(0, 255, 0), i.get(1, 0) assert_equal g.color(0, 0, 255), i.get(0, 1) end def test_inspect() assert_match %r|#<Processing::Image:0x\w{16}>|, image.inspect end end# TestImage
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
processing-0.5.31 | test/test_image.rb |
processing-0.5.30 | test/test_image.rb |
processing-0.5.29 | test/test_image.rb |
processing-0.5.28 | test/test_image.rb |