1 # Copyright (c) 2009 Paolo Capriotti <p.capriotti@gmail.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
9 require 'animation_field'
13 class TestSimpleAnimation < Test::Unit::TestCase
15 anim = SimpleAnimation.new "test", 10,
16 mock("init") {|x| x.expects(:[]).once.with },
17 mock("step") {|x| x.expects(:[]).once.with(0.0) },
18 mock("post") {|x| x.expects(:[]).never }
25 step_mock = mock("step") do |x|
26 x.expects(:[]).once.with(0.0)
27 x.expects(:[]).once.with(1.0)
30 anim = SimpleAnimation.new "test", 10,
31 mock("init") {|x| x.expects(:[]).once.with },
33 mock("post") {|x| x.expects(:[]).once.with }
40 steps = [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]
41 step_mock = mock("step") do |x|
43 x.expects(:[]).once.with(s)
46 anim = SimpleAnimation.new "test", 10, nil, step_mock
49 anim[start + s * 10.0]
54 anim = SimpleAnimation.new "hello", 10, nil, lambda {}
55 assert_match /hello/, anim.to_s