Sha256: 66f3e499ecaaf11fbacc5b4d6b28e46b40ffa7e46b042ad464a7d31932cae259

Contents?: true

Size: 1.06 KB

Versions: 24

Compression:

Stored size: 1.06 KB

Contents

require 'cairo'
require 'stringio'

class ScriptDeviceTest < Test::Unit::TestCase
  include Helper

  def setup
    only_device("Script")
  end

  def test_new
    output = StringIO.new
    device = Cairo::ScriptDevice.new(output)
    assert_equal("%!CairoScript\n", output.string)
    device.finish
    assert_equal("%!CairoScript\n", output.string)
  end

  def test_new_with_block
    output = StringIO.new
    string = nil
    Cairo::ScriptDevice.new(output) do |device|
      string = output.string
    end
    assert_equal("%!CairoScript\n", string)
  end

  def test_write_comment
    output = StringIO.new
    Cairo::ScriptDevice.new(output) do |device|
      device.write_comment("Hello!")
    end
    assert_equal("%!CairoScript\n" +
                 "% Hello!\n",
                 output.string)
  end

  def test_mode
    output = StringIO.new
    Cairo::ScriptDevice.new(output) do |device|
      assert_equal(Cairo::ScriptMode::ASCII, device.mode)
      device.mode = Cairo::ScriptMode::BINARY
      assert_equal(Cairo::ScriptMode::BINARY, device.mode)
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
cairo-1.17.13 test/test_script_device.rb
cairo-1.17.12 test/test_script_device.rb
cairo-1.17.11 test/test_script_device.rb
cairo-1.17.10 test/test_script_device.rb
cairo-1.17.9 test/test_script_device.rb
cairo-1.17.8 test/test_script_device.rb
cairo-1.17.7 test/test_script_device.rb
cairo-1.17.6 test/test_script_device.rb
cairo-1.17.5 test/test_script_device.rb
cairo-1.17.4 test/test_script_device.rb
cairo-1.16.6 test/test_script_device.rb
cairo-1.16.5 test/test_script_device.rb
cairo-1.16.4 test/test_script_device.rb
cairo-1.16.3 test/test_script_device.rb
cairo-1.16.2 test/test_script_device.rb
cairo-1.16.1-x86-mingw32 test/test_script_device.rb
cairo-1.16.1-x64-mingw32 test/test_script_device.rb
cairo-1.16.1 test/test_script_device.rb
cairo-1.16.0-x86-mingw32 test/test_script_device.rb
cairo-1.16.0-x64-mingw32 test/test_script_device.rb