test/text_test.rb in ray-0.1.0.pre1 vs test/text_test.rb in ray-0.1.0
- old
+ new
@@ -2,68 +2,57 @@
require File.expand_path(File.dirname(__FILE__)) + '/helpers.rb'
context "a text" do
setup { Ray::Text.new "Hello world!" }
- asserts(:content).equals "Hello world!"
+ asserts(:string).equals "Hello world!"
- asserts(:style).equals Ray::Font::STYLE_NORMAL
-
- asserts(:pos).equals Ray::Vector2[0, 0]
- asserts(:scale).equals Ray::Vector2[1, 1]
- asserts(:angle).equals 0
-
- asserts(:character_size).equals 12
-
+ asserts(:style).equals Ray::Text::Normal
+ asserts(:size).equals 12
asserts(:color).equals Ray::Color.white
context "after changing style" do
hookup { topic.style = [:bold, :italic] }
- asserts(:style).equals Ray::Font::STYLE_BOLD | Ray::Font::STYLE_ITALIC
+ asserts(:style).equals Ray::Text::Bold | Ray::Text::Italic
end
context "after changing string" do
hookup do
- topic.encoding = "utf-8" # Would be required in 1.8 (but utf-8 is the default)
- topic.content = "héllo"
+ topic.string = "héllo"
end
- asserts(:encoding).matches /utf-8/i
- asserts(:content).equals "héllo"
- end
+ asserts(:encoding).matches(/utf-8/i)
+ asserts(:string).equals "héllo"
- context "after changing position" do
- hookup { topic.pos = [13, 22] }
- asserts(:pos).equals Ray::Vector2[13, 22]
- end
+ context "copied" do
+ setup { topic.dup }
- context "after changing angle" do
- hookup { topic.angle = 90 }
- asserts(:angle).equals 90
- end
+ asserts(:style).equals Ray::Text::Normal
+ asserts(:size).equals 12
+ asserts(:color).equals Ray::Color.white
- context "after changing scale" do
- hookup { topic.scale = [2, 10] }
- asserts(:scale).equals Ray::Vector2[2, 10]
+ asserts(:encoding).matches(/utf-8/i)
+ asserts(:string).equals "héllo"
+ end
end
context "after changing character size" do
- hookup { topic.character_size = 120 }
- asserts(:character_size).equals 120
+ hookup { topic.size = 30 }
+ asserts(:size).equals 30
end
- context "with another position and scale" do
+ context "rect with another position and scale" do
hookup do
topic.pos = [10, 20]
topic.scale = [2, 10]
end
asserts("position of the rect") { topic.rect.pos }.equals Ray::Vector2[10, 20]
asserts("size / size without scale") {
- scaled_size = topic.size
+ scaled_size = topic.rect.size
topic.scale = [1, 1]
- size = topic.size
+ size = topic.rect.size
topic.scale = [2, 10]
scaled_size / size
}.equals Ray::Vector2[2, 10]
end