Sha256: 3e47366b21a670e69a081b6c27457ad1d235d37a82fc062c7c0943ef875ee678

Contents?: true

Size: 1.05 KB

Versions: 6

Compression:

Stored size: 1.05 KB

Contents

require 'test/unit'
require 'testcase'
require 'fox12'

include Fox

class TC_FXListBox < TestCase
  def setup
    super(self.class.name)
    @listBox = FXListBox.new(mainWindow, 1)
  end
  
  def test_appendItem
    assert_equal(0, @listBox.numItems)
    @listBox.appendItem("An item")
    assert_equal(1, @listBox.numItems)
  end

  def test_appendOp
    assert_equal(0, @listBox.numItems)
    @listBox << "An item"
    assert_equal(1, @listBox.numItems)
  end

  def test_moveItem
    @listBox.appendItem("First")
    @listBox.appendItem("Second")
    assert_raises(IndexError) {
      @listBox.moveItem(0, -1)
    }
    assert_raises(IndexError) {
      @listBox.moveItem(0, 2)
    }
    assert_raises(IndexError) {
      @listBox.moveItem(-1, 0)
    }
    assert_raises(IndexError) {
      @listBox.moveItem(2, 0)
    }
    assert_nothing_raised {
      @listBox.moveItem(0, 0)
      @listBox.moveItem(0, 1)
      @listBox.moveItem(1, 0)
      @listBox.moveItem(1, 1)
    }
    assert_equal(0, @listBox.moveItem(0, 1))
    assert_equal(1, @listBox.moveItem(1, 0))
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fxruby-1.2.3 tests/TC_FXListBox.rb
fxruby-1.2.2 tests/TC_FXListBox.rb
fxruby-1.2.4 tests/TC_FXListBox.rb
fxruby-1.2.5 tests/TC_FXListBox.rb
fxruby-1.2.6 tests/TC_FXListBox.rb
fxruby-1.4.0 tests/TC_FXListBox.rb