Sha256: be4a3050abfa9b3602bf94cb3509885fe1e3b315f2ce23f7d6145206754db1c8

Contents?: true

Size: 577 Bytes

Versions: 9

Compression:

Stored size: 577 Bytes

Contents

require 'gir_ffi_test_helper'

describe GLib::MainLoop do
  describe '#run' do
    it 'allows other threads to run' do
      main_loop = GLib::MainLoop.new nil, false

      a = []
      GLib.timeout_add(GLib::PRIORITY_DEFAULT, 150,
                       proc { main_loop.quit },
                       nil, nil)

      slow_thread = Thread.new do
        sleep 0.001
        a << 'During run'
      end

      a << 'Before run'
      main_loop.run
      a << 'After run'

      slow_thread.join

      a.must_equal ['Before run', 'During run', 'After run']
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gir_ffi-0.8.6 test/ffi-glib/main_loop_test.rb
gir_ffi-0.8.5 test/ffi-glib/main_loop_test.rb
gir_ffi-0.8.4 test/ffi-glib/main_loop_test.rb
gir_ffi-0.8.3 test/ffi-glib/main_loop_test.rb
gir_ffi-0.8.2 test/ffi-glib/main_loop_test.rb
gir_ffi-0.8.1 test/ffi-glib/main_loop_test.rb
gir_ffi-0.8.0 test/ffi-glib/main_loop_test.rb
gir_ffi-0.7.10 test/ffi-glib/main_loop_test.rb
gir_ffi-0.7.9 test/ffi-glib/main_loop_test.rb