Sha256: 3184574000cdcca9bee238176772e4cabe69abd8c2fa66853e431e1ba478103b

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

require 'test/unit'
require 'testcase'
require 'fox16'

class TC_FXListBox < Fox::TestCase
  include Fox

  def setup
    super(self.class.name)
    @listBox = FXListBox.new(mainWindow)
  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

4 entries across 4 versions & 2 rubygems

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