test/middleware/test_scaler_middleware.rb in tracksperanto-2.0.1 vs test/middleware/test_scaler_middleware.rb in tracksperanto-2.0.2
- old
+ new
@@ -1,6 +1,6 @@
-require File.dirname(__FILE__) + '/../helper'
+require File.expand_path(File.dirname(__FILE__)) + '/../helper'
class ScalerMiddlewareTest < Test::Unit::TestCase
def test_default_factor_set_to_one
receiver = flexmock
m = Tracksperanto::Middleware::Scaler.new(receiver)
@@ -27,10 +27,20 @@
m.start_tracker_segment("Tracker")
m.export_point(1, 60, 30, 0)
m.end_tracker_segment
m.end_export
end
-
+
+ def test_flip_using_scaler
+ receiver = flexmock
+ receiver.should_receive(:start_export).once.with(120, 80)
+ receiver.should_receive(:export_point).once.with(1, 100, 20, 0)
+
+ m = Tracksperanto::Middleware::Scaler.new(receiver, :x_factor => -1, :y_factor => -1)
+ m.start_export(120, 80)
+ m.export_point(1, 20, 60, 0)
+ end
+
def test_scaler_properly_affects_residual
factor = Math.sqrt( (1.5 ** 2) + (1.4 ** 2))
receiver = flexmock
receiver.should_receive(:start_export).once.with((50 * 1.5).to_i, (60 * 1.4).to_i)
\ No newline at end of file