Sha256: c06bd82e9254b0d1279fc97025d1f3806c4d7bc557217a1a9a93776b95b0d0ac

Contents?: true

Size: 935 Bytes

Versions: 22

Compression:

Stored size: 935 Bytes

Contents

require 'fox16'
require 'test/unit'
require 'testcase'
require 'openssl'

class TC_FXJPGImage < Fox::TestCase
  include Fox

  def setup
    super(self.class.name)
  end

  def test_save_with_thread
    w, h = 4000, 3000
    img_data = OpenSSL::Random.random_bytes(w) * h * 4

    count = 0
    th = Thread.new do
      loop do
        count += 1
      end
    end

    img = FXJPGImage.new(app)
    img.setPixels( img_data, 0, w, h )

    jpeg_data = FXMemoryStream.open(FXStreamSave, nil) do |outfile|
      img.savePixels(outfile)
      outfile.takeBuffer
    end

    assert_operator(count, :>=, 1000000)
    assert_operator(jpeg_data.bytesize, :>=, 1000)

    count = 0
    img = FXJPGImage.new(app)
    FXMemoryStream.open(FXStreamLoad, jpeg_data) do |infile|
      img.loadPixels(infile)
    end

    th.kill

    assert_equal 4000, img.width
    assert_equal 3000, img.height
    assert_operator(count, :>=, 1000000)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
fxruby-1.6.35 test/TC_FXJPGImage.rb
fxruby-1.6.34-x86-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.34-x64-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.34 test/TC_FXJPGImage.rb
fxruby-1.6.33-x86-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.33-x64-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.33 test/TC_FXJPGImage.rb
fxruby-1.6.32-x86-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.32-x64-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.32 test/TC_FXJPGImage.rb
fxruby-1.6.32.pre2-x64-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.32.pre2-x86-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.32.pre2 test/TC_FXJPGImage.rb
fxruby-1.6.32.pre1 test/TC_FXJPGImage.rb
fxruby-1.6.32.pre1-x86-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.32.pre1-x64-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.31-x64-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.31-x86-mingw32 test/TC_FXJPGImage.rb
fxruby-1.6.31 test/TC_FXJPGImage.rb
fxruby-1.6.30-x86-mingw32 test/TC_FXJPGImage.rb