golden-color/spec/golden-color_spec.cr

28 lines
805 B
Crystal

require "./spec_helper"
describe GoldenColor do
describe ".from_rgb" do
it "Correctly creates a color from red, green and blue" do
c = GoldenColor::Color.from_rgb 0.0, 0.5, 1.0
c.r.should eq 0.0
c.g.should eq 0.5
c.b.should eq 1.0
end
it "Correctly creates a color from hue, saturation and value" do
c = GoldenColor::Color.from_hsv 0.0, 0.5, 0.95
c.r.should eq 0.95
c.g.should eq 0.475
c.b.should eq 0.475
end
it "Correctly reports a tuple of red, green, and blue" do
c = GoldenColor::Color.from_rgb 0.0, 0.5, 1.0
r, g, b = c.rgb
r.should eq c.r
g.should eq c.g
b.should eq c.b
end
end
end