Sha256: 3377ce65fcebc9d759de5f72ae537bdfd41d84a6e91337d569ab29620ee2fd03

Contents?: true

Size: 1.64 KB

Versions: 84

Compression:

Stored size: 1.64 KB

Contents

#encoding: utf-8
require 'test/unit'
require 'testcase'
require 'fox16'

class TC_FXComboBox < Fox::TestCase
  include Fox

  def setup
    super(self.class.name)
    @comboBox = FXComboBox.new(mainWindow, 1)
  end

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

  def test_first
    assert_instance_of(FXTextField, @comboBox.first)
  end

  def test_children
    assert_instance_of(FXTextField, @comboBox.children[0])
    assert_instance_of(FXMenuButton, @comboBox.children[1])
  end

  def test_set_current_to_none
    assert_nothing_raised do
      @comboBox.currentItem = -1
    end
  end

  def test_fill_items_returns_num_items_added
    assert_equal(3, @comboBox.fillItems(%w{one two three}))
  end

  def test_fill_items
    @comboBox.fillItems(%w{one two three})
    items = @comboBox.map { |text, data| text }
    assert_equal("one", items[0])
    assert_equal("two", items[1])
    assert_equal("three", items[2])
  end

  if ''.respond_to?(:encoding)
    def test_encoding
      assert_equal(3, @comboBox.fillItems(%w{"世界 線航跡 蔵"}))
      assert_equal(Encoding::UTF_8, @comboBox.getItem(2).encoding)
      assert_equal('線航跡', @comboBox.getItem(1))
    end
  end
end

Version data entries

84 entries across 84 versions & 1 rubygems

Version Path
fxruby-1.6.48 test/TC_FXComboBox.rb
fxruby-1.6.48-x64-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.48-x64-mingw-ucrt test/TC_FXComboBox.rb
fxruby-1.6.48-x86-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.47 test/TC_FXComboBox.rb
fxruby-1.6.47-x64-mingw-ucrt test/TC_FXComboBox.rb
fxruby-1.6.47-x64-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.47-x86-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.46 test/TC_FXComboBox.rb
fxruby-1.6.46-x64-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.46-x64-mingw-ucrt test/TC_FXComboBox.rb
fxruby-1.6.46-x86-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.45 test/TC_FXComboBox.rb
fxruby-1.6.45-x64-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.45-x64-mingw-ucrt test/TC_FXComboBox.rb
fxruby-1.6.45-x86-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.44 test/TC_FXComboBox.rb
fxruby-1.6.44-x64-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.44-x86-mingw32 test/TC_FXComboBox.rb
fxruby-1.6.43 test/TC_FXComboBox.rb