Sha256: 3d2f0720dc02b62d501bd68ac665c9de010f0ec8867d00f49600d80ff27a77ed

Contents?: true

Size: 1.52 KB

Versions: 8

Compression:

Stored size: 1.52 KB

Contents

require 'test/unit'

require 'fox16'

include Fox

class TC_FXAccelTable < Test::Unit::TestCase
  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

8 entries across 8 versions & 1 rubygems

Version Path
fxruby-1.6.20-x86-mingw32 test/TC_FXAccelTable.rb
fxruby-1.6.20-x86-linux test/TC_FXAccelTable.rb
fxruby-1.6.20 test/TC_FXAccelTable.rb
fxruby-1.6.20-universal-darwin-10 test/TC_FXAccelTable.rb
fxruby-1.6.19-x86-mingw32 tests/TC_FXAccelTable.rb
fxruby-1.6.19-universal-darwin-9 tests/TC_FXAccelTable.rb
fxruby-1.6.19-x86-mswin32-60 tests/TC_FXAccelTable.rb
fxruby-1.6.19 tests/TC_FXAccelTable.rb