summaryrefslogtreecommitdiffhomepage
path: root/test/text_spec.rb
diff options
context:
space:
mode:
authorlstrzebinczyk <[email protected]>2017-03-29 21:28:14 +0200
committerTom Black <[email protected]>2017-04-02 12:22:49 -0400
commit5cb0c0581b2ba9b9c436edb7b6699c2b44243e2f (patch)
tree8f3308dc986139e0e4ed69d7e6c266afab8a4eaf /test/text_spec.rb
parent02c1353d4fe6b4eef5c45d1ad45af53c782d2824 (diff)
downloadruby2d-5cb0c0581b2ba9b9c436edb7b6699c2b44243e2f.tar.gz
ruby2d-5cb0c0581b2ba9b9c436edb7b6699c2b44243e2f.zip
Implement Text#height and Text#width
Diffstat (limited to 'test/text_spec.rb')
-rw-r--r--test/text_spec.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/text_spec.rb b/test/text_spec.rb
index 22e17a3..1dc6189 100644
--- a/test/text_spec.rb
+++ b/test/text_spec.rb
@@ -15,4 +15,30 @@ RSpec.describe Ruby2D::Text do
expect(t.text).to eq "0"
end
end
+
+ describe "#width" do
+ it "is known after creation" do
+ t = Text.new(0, 0, "Hello world!", 40, "test/media/bitstream_vera/vera.ttf")
+ expect(t.width).to eq(239)
+ end
+
+ it "is known after updating" do
+ t = Text.new(0, 0, "Good morning world!", 40, "test/media/bitstream_vera/vera.ttf")
+ t.text = "Hello world!"
+ expect(t.width).to eq(239)
+ end
+ end
+
+ describe "#height" do
+ it "is known after creation" do
+ t = Text.new(0, 0, "Hello world!", 40, "test/media/bitstream_vera/vera.ttf")
+ expect(t.height).to eq(48)
+ end
+
+ it "is known after updating" do
+ t = Text.new(0, 0, "Good morning world!", 40, "test/media/bitstream_vera/vera.ttf")
+ t.text = "Hello world!"
+ expect(t.height).to eq(48)
+ end
+ end
end