Sha256: 536c57fca09c75b4b1b5578e8eaed80f65e1ff6ef00b9b1340189cd0c312d91e

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

require 'test/unit'
require 'test/unit/ui/console/testrunner'
require 'wx'

module Wx::SF

  module Test

    class App < Wx::App
      def initialize(test_runner, start_mtd)
        super()
        @test_runner = test_runner
        @start_mtd = start_mtd
      end

      def on_init
        @result = @start_mtd.bind(@test_runner).call
        false
      end

      attr_reader :result
    end

    if defined? ::IntelliJ
      require 'test/unit/ui/teamcity/testrunner'
      BaseRunner = ::Test::Unit::UI::TeamCity::TestRunner
    else
      BaseRunner = ::Test::Unit::UI::Console::TestRunner
    end

    class Runner < BaseRunner

      org_start_mtd = instance_method :start
      define_method :start do
        (app = Wx::SF::Test::App.new(self, org_start_mtd)).run
        app.result
      end

    end

  end

end

module Test
  module Unit
    AutoRunner.register_runner(:wxapp) do |auto_runner|
      Wx::SF::Test::Runner
    end
    AutoRunner.default_runner = :wxapp
    if defined? ::IntelliJ
      class AutoRunner
        alias :wx_initialize :initialize
        private :wx_initialize

        def initialize(*args)
          wx_initialize(*args)
          @runner = AutoRunner.default_runner
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wxruby3-0.9.0.pre.beta.14 tests/lib/wxapp_runner.rb
wxruby3-0.9.0.pre.beta.13 tests/lib/wxapp_runner.rb
wxruby3-0.9.0.pre.beta.11 tests/lib/wxapp_runner.rb