Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
require 'test/unit'
require 'testcase'
require 'fox16'
include Fox
class TC_FXListBox < TestCase
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