Sha256: 61fb743363184f27e486cf60c243103bc63a7412708f4e25b1dba89121eec79c

Contents?: true

Size: 1.9 KB

Versions: 2

Compression:

Stored size: 1.9 KB

Contents

require 'test_helper'

class MXMLCTest < Test::Unit::TestCase
  include Sprout::TestHelper

  context "An MXMLC tool" do

    setup do
      @original_use_fcsh_value = ENV['USE_FCSH']
      @fixture                 = File.join fixtures, 'mxmlc', 'simple'
      @input                   = File.join @fixture, 'SomeFile.as'
      @expected_output         = File.join @fixture, "SomeFile.swf"
    end

    teardown do
      remove_file @expected_output
      ENV['USE_FCSH'] = @original_use_fcsh_value
    end

    should "compile a swf" do
      as_a_unix_system do
        mxmlc = FlashSDK::MXMLC.new
        # Comment out following line to use REAL Mxmlc:
        mxmlc.binary_path = File.join fixtures, 'sdk', 'mxmlc'
        mxmlc.input = @input
        mxmlc.output = @expected_output
        mxmlc.execute
        assert_file @expected_output
      end
    end

    should "accept input" do
      as_a_unix_system do
        mxmlc = FlashSDK::MXMLC.new
        mxmlc.input = 'test/fixtures/mxmlc/simple/SomeFile.as'
        mxmlc.source_path << 'test/fixtures/mxmlc/simple'
        assert_equal '-source-path+=test/fixtures/mxmlc/simple -static-link-runtime-shared-libraries test/fixtures/mxmlc/simple/SomeFile.as', mxmlc.to_shell
      end
    end

    should "assign default-size" do
      mxmlc = FlashSDK::MXMLC.new
      mxmlc.default_size = '800,500'
      mxmlc.static_link_runtime_shared_libraries = false
      assert_equal '-default-size=800,500', mxmlc.to_shell
    end

    should "assign simple output" do
      t = mxmlc 'bin/SomeProject.swf' do |t|
        t.input = @input
      end
      assert_equal 'bin/SomeProject.swf', t.output
    end

    should "use fcsh if specified" do
      Sprout::Executable.expects(:load).with(:mxmlc).never

      mxmlc          = FlashSDK::MXMLC.new
      mxmlc.expects(:execute_with_fcsh)
      mxmlc.input    = @input
      mxmlc.use_fcsh = true
      mxmlc.execute
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
flashsdk-1.0.29.pre test/unit/mxmlc_test.rb
flashsdk-1.0.28.pre test/unit/mxmlc_test.rb