diff options
| author | Tom Black <[email protected]> | 2018-12-12 00:10:14 -0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2018-12-12 00:10:14 -0800 |
| commit | 241093f3ea07255af6d36fa9e07c2a1ecb7c712f (patch) | |
| tree | c9987a2eb4d98820ba5a8845909e4c9430d31307 /test/rectangle_spec.rb | |
| parent | 0f52b2115a5f910ae4d3350f7400bb11622ea899 (diff) | |
| download | ruby2d-241093f3ea07255af6d36fa9e07c2a1ecb7c712f.tar.gz ruby2d-241093f3ea07255af6d36fa9e07c2a1ecb7c712f.zip | |
Make `contains?` inclusive (#137)
If point is over the visual area, it's true. Also add default rectangle implementation to `renderable.rb`.
Diffstat (limited to 'test/rectangle_spec.rb')
| -rw-r--r-- | test/rectangle_spec.rb | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/test/rectangle_spec.rb b/test/rectangle_spec.rb deleted file mode 100644 index bbf1616..0000000 --- a/test/rectangle_spec.rb +++ /dev/null @@ -1,20 +0,0 @@ -require 'ruby2d' - -RSpec.describe Ruby2D::Rectangle do - - describe "#contains?" do - it "returns true if point is inside the rectangle" do - rectangle = Rectangle.new(x: 0, y: 0, width: 50, height: 50) - expect(rectangle.contains?(25, 25)).to be true - end - - it "returns true if point is outside the rectangle" do - rectangle = Rectangle.new(x: 0, y: 0, width: 50, height: 50) - expect(rectangle.contains?(-25, 25)).to be false - expect(rectangle.contains?( 25, -25)).to be false - expect(rectangle.contains?( 25, 50)).to be false - expect(rectangle.contains?( 50, 25)).to be false - end - end - -end |
