Sha256: 8a886a8c866eabb45ba2ac0c483a4bbc519eaccbbbf22d64845753ead0f76786
Contents?: true
Size: 1016 Bytes
Versions: 5
Compression:
Stored size: 1016 Bytes
Contents
require_relative 'helper' class TestBitmap < Test::Unit::TestCase W = 32 H = 16 def bitmap(w = W, h = H) Rays::Bitmap.new w, h end def color(*args) Rays::Color.new(*args) end def test_initialize() assert_equal W, bitmap.width assert_equal H, bitmap.height end def test_dup() o = bitmap assert_equal color(0, 0, 0, 0), o[0, 0] o[0, 0] = color(1, 0, 0, 0) assert_equal color(1, 0, 0, 0), o[0, 0] x = o.dup assert_equal color(1, 0, 0, 0), x[0, 0] x[0, 0] = color(0, 1, 0, 0) assert_equal color(0, 1, 0, 0), x[0, 0] assert_equal color(1, 0, 0, 0), o[0, 0] end def test_at() o = bitmap assert_equal color(0, 0, 0, 0), o[0, 0] o[0, 0] = 1 assert_equal color(1, 1, 1, 1), o[0, 0] end def test_to_a() colors = %w[#f00 #0f0 #00f #ff0].map {|s| color s} bmp = bitmap 2, 2 bmp[0, 0], bmp[1, 0], bmp[0, 1], bmp[1, 1] = colors assert_equal colors, bmp.to_a end end# TestBitmap
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rays-0.1.39 | test/test_bitmap.rb |
rays-0.1.38 | test/test_bitmap.rb |
rays-0.1.37 | test/test_bitmap.rb |
rays-0.1.36 | test/test_bitmap.rb |
rays-0.1.35 | test/test_bitmap.rb |