Sha256: d1a29b22a7d2ad8c14219b655ae1f072742882dc163e38e3195f85cd6c34997b

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

require 'test/unit'

require 'fox16'

class TC_FXAccelTable < Test::Unit::TestCase
  include Fox

  def setup
    @accelTable = FXAccelTable.new
    @hotKey = fxparseHotKey('&q')
  end

  def test_add_accel_with_nil_target
    @accelTable.addAccel(@hotKey)
    assert @accelTable.hasAccel?(@hotKey)
    assert_nil @accelTable.targetOfAccel(@hotKey)
  end
  
  def test_add_accel_with_default_seldn_selup
    target = FXObject.new
    @accelTable.addAccel(@hotKey, target)
    assert_same target, @accelTable.targetOfAccel(@hotKey)
  end

  def test_add_accel_with_default_selup
    @accelTable.addAccel(@hotKey, FXObject.new, FXSEL(SEL_COMMAND, FXWindow::ID_SHOW))
  end

  def test_add_accel_with_no_defaults
    @accelTable.addAccel(@hotKey, FXObject.new, FXSEL(SEL_COMMAND, FXWindow::ID_SHOW), FXSEL(SEL_COMMAND, FXWindow::ID_HIDE))
  end
  
  def test_add_accel_with_lambda_for_seldn
    @accelTable.addAccel(@hotKey, lambda { puts "hello" })
  end

  def test_add_accel_with_lambda_for_selup
    @accelTable.addAccel(@hotKey, nil, lambda { puts "goodbye" })
  end

  def test_add_accel_with_lambda_for_selup_and_seldn
    @accelTable.addAccel(@hotKey, lambda { puts "hello" }, lambda { puts "goodbye" })
  end

  def test_has_accel
    assert(!@accelTable.hasAccel?(@hotKey))
    @accelTable.addAccel(@hotKey)
    assert(@accelTable.hasAccel?(@hotKey))
  end
  
  def test_remove_accel
    @accelTable.addAccel(@hotKey)
    assert(@accelTable.hasAccel?(@hotKey))
    @accelTable.removeAccel(@hotKey)
    assert(!@accelTable.hasAccel?(@hotKey))
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
fxruby-1.6.22.pre2-x86-mingw32 test/TC_FXAccelTable.rb
fxruby-1.6.22.pre2 test/TC_FXAccelTable.rb
fxrubi-1.6.22.pre1-x86-mingw32 test/TC_FXAccelTable.rb
fxrubi-1.6.22.pre1 test/TC_FXAccelTable.rb