Sha256: 19e0ce6b10e4a3d0209445ecb848612bc345a91bf0c8fa275547a01a52066d98

Contents?: true

Size: 1.84 KB

Versions: 22

Compression:

Stored size: 1.84 KB

Contents

# -*- encoding : utf-8 -*-
require File.expand_path(File.dirname(__FILE__)) + '/../helper'

class SyntheyesImportTest < Test::Unit::TestCase
  DELTA = 0.01 # our SynthEyes sample is somewhat inaccurate :-P
  
  def test_introspects_properly
    i = Tracksperanto::Import::Syntheyes
    assert_equal "Syntheyes 2D tracker paths file", i.human_name
    assert !i.autodetects_size?
  end
  
  def test_parsing_from_importable
    fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/shake_tracker_nodes_to_syntheyes.txt')
    trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 2560, :height => 1080).to_a
    
    assert_equal 50, trackers.length
    
    first_kf = trackers[0].keyframes[0]
    
    assert_equal "Tracker1", trackers[0].name
    
    assert_equal 0, first_kf.frame
    assert_in_delta 715.221, first_kf.abs_x, DELTA
    assert_in_delta 885.679, first_kf.abs_y, DELTA
    assert_in_delta 0.0, first_kf.residual, DELTA
  end
  
  def test_parsing_cola_plate
    fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/cola_plate.txt')
    trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 1920, :height => 1080).to_a
    
    assert_equal 6, trackers.length
  end
  
  def test_parsing_with_one_tracker
    fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/one_tracker.txt')
    trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 1920, :height => 1080).to_a
    
    assert_equal 1, trackers.length
    assert_equal 49, trackers[0].length
  end
  
  def test_parsing_from_sy_2010
    fixture = File.open(File.dirname(__FILE__) + '/samples/syntheyes_2d_paths/morePoints_sy2010.txt')
    trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 1920, :height => 1080).to_a
    
    assert_equal 26, trackers.length
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
tracksperanto-3.5.5 test/import/test_syntheyes_import.rb
tracksperanto-3.5.4 test/import/test_syntheyes_import.rb
tracksperanto-3.5.2 test/import/test_syntheyes_import.rb
tracksperanto-3.5.1 test/import/test_syntheyes_import.rb
tracksperanto-3.5.0 test/import/test_syntheyes_import.rb
tracksperanto-3.4.1 test/import/test_syntheyes_import.rb
tracksperanto-3.4.0 test/import/test_syntheyes_import.rb
tracksperanto-3.3.13 test/import/test_syntheyes_import.rb
tracksperanto-3.3.12 test/import/test_syntheyes_import.rb
tracksperanto-3.3.11 test/import/test_syntheyes_import.rb
tracksperanto-3.3.10 test/import/test_syntheyes_import.rb
tracksperanto-3.3.9 test/import/test_syntheyes_import.rb
tracksperanto-3.3.8 test/import/test_syntheyes_import.rb
tracksperanto-3.3.7 test/import/test_syntheyes_import.rb
tracksperanto-3.3.6 test/import/test_syntheyes_import.rb
tracksperanto-3.3.0.pre test/import/test_syntheyes_import.rb
tracksperanto-3.2.2 test/import/test_syntheyes_import.rb
tracksperanto-3.2.1 test/import/test_syntheyes_import.rb
tracksperanto-3.2.0 test/import/test_syntheyes_import.rb
tracksperanto-3.1.0 test/import/test_syntheyes_import.rb