Sha256: 81ed2192ba04f5b67e9bafa7ee69d149ac055f418f3b2813f0a67f48400c7242

Contents?: true

Size: 715 Bytes

Versions: 2

Compression:

Stored size: 715 Bytes

Contents

require_relative 'helper'


class TestGraphics < Test::Unit::TestCase

  P = Processing

  def graphics(w = 10, h = 10)
    P::Graphics.new w, h
  end

  def test_beginDraw()
    g = graphics
    g.beginDraw
    assert_raise {g.beginDraw}
  end

  def test_save()
    g = graphics 100, 100
    g.beginDraw do
      g.background 200
      g.fill 255
      g.stroke 0
      g.ellipseMode :corner
      g.ellipse 0, 0, g.width, g.height
    end
    temppath(ext: 'png') do |path|
      assert_nothing_raised {g.save path}
      assert_equal get_pixels(g), get_pixels(g.loadImage path)
    end
  end

  def test_inspect()
    assert_match %r|#<Processing::Graphics:0x\w{16}>|, graphics.inspect
  end

end# TestGraphics

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
processing-0.5.29 test/test_graphics.rb
processing-0.5.28 test/test_graphics.rb