Sha256: ecefd6c8dcd6c19da11f6f3a92a64cbb203f004a465d7b4b3bb7dac0d63ab774

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

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

class EventTests < Test::Unit::TestCase

  def test_event
    evt = Wx::Event.new(100, 1)
    assert_equal(100, evt.event_type)
    assert_equal(1, evt.id)
    assert_boolean(!evt.should_propagate)
    evt.skip
    assert_boolean(evt.skipped)
    evt_dup = evt.clone
    assert_not_equal(evt, evt_dup)
    assert_equal(evt.event_type, evt_dup.event_type)
    assert_equal(evt.id, evt_dup.id)
  end

  def test_command_event
    evt = Wx::CommandEvent.new(100, 1)
    assert_equal(100, evt.event_type)
    assert_equal(1, evt.id)
    assert_boolean(evt.should_propagate)
    evt.skip
    assert_boolean(evt.skipped)
    evt.string = 'CommandEvent Test'
    assert_equal('CommandEvent Test', evt.string)
    evt_dup = evt.clone
    assert_not_equal(evt, evt_dup)
    assert_equal(evt.event_type, evt_dup.event_type)
    assert_equal(evt.id, evt_dup.id)
    assert_equal(evt.string, evt_dup.string)
  end
end

class TestApp < Wx::App
  def on_init
    Test::Unit::UI::Console::TestRunner.run(EventTests)
    false
  end
end

app = TestApp.new
app.run

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wxruby3-0.9.0.pre.beta.10 tests/test_events.rb
wxruby3-0.9.0.pre.beta.9 tests/test_events.rb
wxruby3-0.9.0.pre.beta.8 tests/test_events.rb