test/drawable_test.rb in ray-0.2.0 vs test/drawable_test.rb in ray-0.2.1
- old
+ new
@@ -69,20 +69,29 @@
end
context "with several transformations" do
attr = {:foo => 3}
+ transformation_matrix = Ray::Matrix.transformation([30, 40],
+ [10, 20],
+ 9,
+ [2, 0.5],
+ 90)
+
hookup do
topic.origin = [30, 40]
topic.pos = [10, 20]
topic.angle = 90
topic.scale = [2, 0.5]
topic.z = 9
topic.shader_attributes = attr
end
+ asserts(:default_matrix).equals transformation_matrix
+ asserts(:matrix).equals transformation_matrix
+
# (10, 30) => (-20, -10) (origin)
# (-20, -10) => (-40, -5) (scale)
# (-40, -5) => (5, -40) (rotate)
# (5, -40) => (15, -20) (translate)
@@ -111,10 +120,12 @@
hookup do
topic.matrix = Ray::Matrix.new
end
asserts(:matrix).equals Ray::Matrix.new
+ asserts(:default_matrix).equals transformation_matrix
+
asserts(:transform, [10, 30]).equals Ray::Vector3[10, 30, 0]
context "that has been disabled" do
hookup do
topic.matrix = nil
@@ -134,9 +145,10 @@
topic.matrix_proc = matrix_proc
topic.matrix # calls proc
end
asserts(:matrix).equals Ray::Matrix.new
+ asserts(:default_matrix).equals transformation_matrix
asserts(:matrix_proc).equals matrix_proc
asserts(:matrix_proc).received(:call) { topic }
context "when matrix is accessed twice" do
hookup { topic.matrix }