Sha256: e27c12e5c58e126d7c3eba9af629352a5da5b5ddaf3adda0f8f71f0f05ea2cf6

Contents?: true

Size: 1.3 KB

Versions: 7

Compression:

Stored size: 1.3 KB

Contents

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

class ShakeTextImportTest < Test::Unit::TestCase
  DELTA = 0.000001
  def test_parsing
    fixture = File.read(File.dirname(__FILE__) + '/samples/one_shake_tracker.txt')
    trackers = Tracksperanto::Import::ShakeText.new.parse(fixture)
    
    assert_kind_of Enumerable, trackers
    assert_equal 1, trackers.length
    
    t = trackers[0]
    
    assert_kind_of Tracksperanto::Tracker, t
    assert_equal 46, t.keyframes.length
    assert_equal "track1", t.name
    
    second_kf = t.keyframes[1]
    assert_in_delta 121, second_kf.frame, DELTA
    assert_in_delta 373.746, second_kf.abs_x, DELTA
    assert_in_delta 984.564, second_kf.abs_y, DELTA
    assert_in_delta 0.002, second_kf.residual, DELTA
  end
  
  def test_parsing_two_trackers
    fixture = File.read(File.dirname(__FILE__) + '/samples/two_shake_trackers.txt')
    trackers = Tracksperanto::Import::ShakeText.new.parse(fixture)
    
    assert_kind_of Enumerable, trackers
    assert_equal 2, trackers.length
    
    t = trackers[0]
    
    assert_equal "track1", t.name
    assert_kind_of Tracksperanto::Tracker, t
    assert_equal 6, t.keyframes.length
    
    second_kf = t.keyframes[1]
    assert_in_delta 111, second_kf.frame, DELTA
    
    t2 = trackers[-1]
    assert_equal "track2", t2.name
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tracksperanto-1.1.1 test/test_shake_text_import.rb
tracksperanto-1.1.0 test/test_shake_text_import.rb
tracksperanto-1.0.6 test/test_shake_text_import.rb
tracksperanto-1.0.4 test/test_shake_text_import.rb
tracksperanto-1.0.2 test/test_shake_text_import.rb
tracksperanto-1.0.1 test/test_shake_text_import.rb
tracksperanto-1.0.0 test/test_shake_text_import.rb