diff options
| author | lstrzebinczyk <[email protected]> | 2017-05-21 21:26:12 +0200 |
|---|---|---|
| committer | Tom Black <[email protected]> | 2017-05-31 23:36:04 -0400 |
| commit | 65187cd5126227778146ec33c2857a391fbab620 (patch) | |
| tree | 328c21a2bdf9365d5c018326c229760986cf412f /test/line_spec.rb | |
| parent | 09ed2811ad3ccb9af50028447fabbcee5b5c5ae2 (diff) | |
| download | ruby2d-65187cd5126227778146ec33c2857a391fbab620.tar.gz ruby2d-65187cd5126227778146ec33c2857a391fbab620.zip | |
Implement #contains? for all renderables
Diffstat (limited to 'test/line_spec.rb')
| -rw-r--r-- | test/line_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/line_spec.rb b/test/line_spec.rb new file mode 100644 index 0000000..04445d1 --- /dev/null +++ b/test/line_spec.rb @@ -0,0 +1,23 @@ +require 'ruby2d' + +RSpec.describe Ruby2D::Triangle do + describe '#contains?' do + it "returns true if point is inside line" do + line = Line.new( + 0, 0, + 100, 100 + ) + expect(line.contains?(25, 25)).to be true + end + + it "returns true if point is inside text" do + line = Line.new( + 0, 0, + 100, 100 + ) + + expect(line.contains?(0, 10)).to be false + expect(line.contains?(10, 0)).to be false + end + end +end |
