Sha256: bc43df193a51850d1c8d092c8a78ee4af3404e3d4b30a9225c152a38b3af1326

Contents?: true

Size: 985 Bytes

Versions: 38

Compression:

Stored size: 985 Bytes

Contents

require File.dirname(__FILE__) + '/helper'

class KeyframeTest < Test::Unit::TestCase
  def test_supports_block_init
    keyframe = Tracksperanto::Keyframe.new do |k| 
      k.frame = 0
      k.abs_x = 10.3
      k.abs_y = 12.5
    end
    
    assert_equal 0, keyframe.frame
    assert_equal 10.3, keyframe.abs_x
    assert_equal 12.5, keyframe.abs_y
  end
  
  def test_inspect
    kf = Tracksperanto::Keyframe.new(:frame => 0, :abs_x => 10, :abs_y => 12.0)
    assert_equal "[0, 10.0, 12.0]", kf.inspect
  end
  
  def test_frame_translated_to_int
    kf = Tracksperanto::Keyframe.new {|k|  k.frame = '0' }
    assert_equal 0, kf.frame
  end
  
  def test_residual_defaults_to_zero
    kf = Tracksperanto::Keyframe.new
    assert_in_delta 0.0, kf.residual, 0.01
  end

  def test_abs_x_abs_y_translated_to_float
    kf = Tracksperanto::Keyframe.new {|k|  k.abs_x = '123.45678'; k.abs_y = '321.45678' }
    assert_kind_of Float, kf.abs_x
    assert_kind_of Float, kf.abs_y
  end

end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
tracksperanto-1.8.2 test/test_keyframe.rb
tracksperanto-1.8.1 test/test_keyframe.rb
tracksperanto-1.8.0 test/test_keyframe.rb
tracksperanto-1.7.5 test/test_keyframe.rb
tracksperanto-1.7.4 test/test_keyframe.rb
tracksperanto-1.7.3 test/test_keyframe.rb
tracksperanto-1.7.2 test/test_keyframe.rb
tracksperanto-1.7.1 test/test_keyframe.rb
tracksperanto-1.7.0 test/test_keyframe.rb
tracksperanto-1.6.9 test/test_keyframe.rb
tracksperanto-1.6.8 test/test_keyframe.rb
tracksperanto-1.6.7 test/test_keyframe.rb
tracksperanto-1.6.6 test/test_keyframe.rb
tracksperanto-1.6.5 test/test_keyframe.rb
tracksperanto-1.6.4 test/test_keyframe.rb
tracksperanto-1.6.3 test/test_keyframe.rb
tracksperanto-1.6.2 test/test_keyframe.rb
tracksperanto-1.6.1 test/test_keyframe.rb
tracksperanto-1.6.0 test/test_keyframe.rb
tracksperanto-1.5.7 test/test_keyframe.rb