diff options
| author | Tom Black <[email protected]> | 2017-12-10 22:41:20 -0800 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2017-12-10 22:41:20 -0800 |
| commit | 1ef9b9a1e629d82bd9b4b62bad86e0b94085434a (patch) | |
| tree | dd97f25d9ee0125c0da9cf851935ef7d6541928f | |
| parent | ab0eb170356a94e4152b009440457df7c00c0f8c (diff) | |
| download | ruby2d-1ef9b9a1e629d82bd9b4b62bad86e0b94085434a.tar.gz ruby2d-1ef9b9a1e629d82bd9b4b62bad86e0b94085434a.zip | |
Allow colors beyond 0.0..1.0 range
| -rw-r--r-- | lib/ruby2d/color.rb | 2 | ||||
| -rw-r--r-- | test/color_spec.rb | 6 |
2 files changed, 1 insertions, 7 deletions
diff --git a/lib/ruby2d/color.rb b/lib/ruby2d/color.rb index 768ebce..a41e6c7 100644 --- a/lib/ruby2d/color.rb +++ b/lib/ruby2d/color.rb @@ -84,7 +84,7 @@ module Ruby2D # Array of Floats from 0.0..1.0 c.class == Array && c.length == 4 && c.all? { |el| - el.is_a?(Numeric) && (0.0..1.0).include?(el) + el.is_a?(Numeric) } end diff --git a/test/color_spec.rb b/test/color_spec.rb index 76ebe24..c2f2cfa 100644 --- a/test/color_spec.rb +++ b/test/color_spec.rb @@ -18,12 +18,6 @@ RSpec.describe Ruby2D::Color do expect(Ruby2D::Color.is_valid? [1, 0, 0.0, 1.0]).to eq true expect(Ruby2D::Color.is_valid? [1.0, 0, 0]).to eq false end - - it 'prevents color values that are out of range' do - expect(Ruby2D::Color.is_valid? [1.2, 0, 0, 0]).to eq false - expect(Ruby2D::Color.is_valid? [0, 0, -0.1, 0]).to eq false - expect(Ruby2D::Color.is_valid? [0, 0, 0, 2]).to eq false - end end describe '#new' do |
