forked from ruby-gnome/ruby-gnome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_gtk_buildable.rb
56 lines (45 loc) · 1.29 KB
/
test_gtk_buildable.rb
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
50
51
52
53
54
55
56
class TestGtkBuildable < Test::Unit::TestCase
include GtkTestUtils
def setup
@buildable = Gtk::Box.new(:horizontal)
end
def test_name
assert_equal("", @buildable.name)
@buildable.name = "YYY"
assert_equal("YYY", @buildable.name)
@buildable.name = nil
assert_equal("", @buildable.name)
end
def test_add_child
assert_equal([], @buildable.children)
builder = Gtk::Builder.new
entry = Gtk::Entry.new
@buildable.add_child(builder, entry)
assert_equal([entry], @buildable.children)
end
def test_set_buildable_property
assert_nil(@buildable.parent)
builder = Gtk::Builder.new
parent = Gtk::Box.new(:horizontal)
@buildable.set_buildable_property(builder, "parent", parent)
assert_equal(parent, @buildable.parent)
end
def test_construct_child
assert_nil(@buildable.parent)
@buildable = Gtk::UIManager.new
@buildable.add_ui(<<-EOU)
<ui>
<toolbar name='Toolbar'>
</toolbar>
</ui>
EOU
builder = Gtk::Builder.new
assert_kind_of(Gtk::Toolbar, @buildable.construct_child(builder, "Toolbar"))
end
def test_get_internal_child
assert_nil(@buildable.parent)
@buildable = Gtk::Dialog.new
builder = Gtk::Builder.new
assert_kind_of(Gtk::Box, @buildable.get_internal_child(builder, "vbox"))
end
end