Sha256: ac5b0ce204f6677d8102f0780322d84151bea43df131652421e8344cb25143c3

Contents?: true

Size: 561 Bytes

Versions: 7

Compression:

Stored size: 561 Bytes

Contents

# frozen_string_literal: true
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

7 entries across 7 versions & 1 rubygems

Version Path
gir_ffi-0.10.2 test/ffi-glib/main_loop_test.rb
gir_ffi-0.10.1 test/ffi-glib/main_loop_test.rb
gir_ffi-0.10.0 test/ffi-glib/main_loop_test.rb
gir_ffi-0.10.0.pre1 test/ffi-glib/main_loop_test.rb
gir_ffi-0.9.5 test/ffi-glib/main_loop_test.rb
gir_ffi-0.9.4 test/ffi-glib/main_loop_test.rb
gir_ffi-0.9.3 test/ffi-glib/main_loop_test.rb