spec/unit/pixel_spec.rb in chunky_png-0.0.3 vs spec/unit/pixel_spec.rb in chunky_png-0.0.4

- old
+ new

@@ -26,7 +26,22 @@ it "should convert the individual color values back correctly" do @opaque.to_truecolor_bytes.should == [10, 100, 150] @non_opaque.to_truecolor_alpha_bytes.should == [10, 100, 150, 100] end + + describe '#compose' do + it "should use the foregorund pixel as is when an opaque pixel is given" do + (@white & @opaque).should == @opaque + end + + it "should use the background pixel as is when a fully_transparent pixel is given" do + (@white & @fully_transparent).should == @white + end + + it "should compose pixels correctly" do + (@white.compose_quick(@non_opaque)).should == ChunkyPNG::Pixel.new(0x9fc2d6ff) + (@white.compose_precise(@non_opaque)).should == ChunkyPNG::Pixel.new(0x9fc2d6ff) + end + end end