Class: Test::Unit::UI::GTK2::TestRunner

Inherits:
Object
  • Object
show all
Extended by:
TestRunnerUtilities
Defined in:
lib/test/unit/ui/gtk2/testrunner.rb

Instance Method Summary collapse

Methods included from TestRunnerUtilities

run, start_command_line_test

Constructor Details

#initialize(suite, output_level = NORMAL) ⇒ TestRunner

def start



443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
# File 'lib/test/unit/ui/gtk2/testrunner.rb', line 443

def initialize(suite, output_level = NORMAL)
  if suite.respond_to?(:suite) then
    @suite = suite.suite
  else
    @suite = suite
  end
  @result = nil

  @runner = Thread.current
  @restart_signal = Class.new(Exception)
  @viewer = Thread.start do
    @runner.join rescue @runner.run
    Gtk.main
  end
  @viewer.join rescue nil # wait deadlock to handshake
end

Instance Method Details

#progress_panelObject



237
238
239
240
241
242
243
# File 'lib/test/unit/ui/gtk2/testrunner.rb', line 237

def progress_panel
  lazy_initialize(:progress_panel) do
    @progress_panel = Gtk::HBox.new(false, 10)
    @progress_panel.border_width = 10
    @progress_panel.pack_start(test_progress_bar, true, true, 0)
  end
end

#run_buttonObject

def progress_panel



245
246
247
248
249
# File 'lib/test/unit/ui/gtk2/testrunner.rb', line 245

def run_button
  lazy_initialize(:run_button) do
    @run_button = Gtk::Button.new("Run")
  end
end

#startObject



435
436
437
438
439
440
441
# File 'lib/test/unit/ui/gtk2/testrunner.rb', line 435

def start
  setup_mediator
  setup_ui
  attach_to_mediator
  start_ui
  @result
end

#test_finished(result) ⇒ Object



330
331
332
# File 'lib/test/unit/ui/gtk2/testrunner.rb', line 330

def test_finished(result)
  test_progress_bar.fraction += 1.0 / @count
end