Sha256: 70213d97761a3f22bdd9a246c250837de002735add508a0a184901ec5219e504

Contents?: true

Size: 531 Bytes

Versions: 3

Compression:

Stored size: 531 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 do
        main_loop.quit
      end

      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

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.9.2 test/ffi-glib/main_loop_test.rb
gir_ffi-0.9.1 test/ffi-glib/main_loop_test.rb
gir_ffi-0.9.0 test/ffi-glib/main_loop_test.rb