glimmer 0.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/COPYING.LGPL +504 -0
- data/README +27 -0
- data/samples/contactmanager/contact.rb +12 -0
- data/samples/contactmanager/contact_manager.rb +65 -0
- data/samples/contactmanager/contact_manager_presenter.rb +23 -0
- data/samples/contactmanager/contact_repository.rb +27 -0
- data/samples/hello_world.rb +26 -0
- data/samples/login.rb +97 -0
- data/samples/tictactoe/tic_tac_toe.rb +67 -0
- data/samples/tictactoe/tic_tac_toe_board.rb +149 -0
- data/src/command_handler.rb +11 -0
- data/src/command_handler_chain_factory.rb +23 -0
- data/src/command_handler_chain_link.rb +22 -0
- data/src/command_handlers.rb +26 -0
- data/src/command_handlers/bind_command_handler.rb +29 -0
- data/src/command_handlers/data_binding_command_handler.rb +64 -0
- data/src/command_handlers/models/model_observer.rb +25 -0
- data/src/command_handlers/models/observable_array.rb +46 -0
- data/src/command_handlers/models/observable_model.rb +35 -0
- data/src/command_handlers/models/r_runnable.rb +14 -0
- data/src/command_handlers/models/r_shell.rb +27 -0
- data/src/command_handlers/models/r_widget.rb +146 -0
- data/src/command_handlers/models/r_widget_listener.rb +12 -0
- data/src/command_handlers/models/r_widget_packages.rb +9 -0
- data/src/command_handlers/models/table_items_updater.rb +39 -0
- data/src/command_handlers/models/widget_observer.rb +23 -0
- data/src/command_handlers/shell_command_handler.rb +18 -0
- data/src/command_handlers/swt_constant_command_handler.rb +22 -0
- data/src/command_handlers/table_column_properties_data_binding_command_handler.rb +24 -0
- data/src/command_handlers/table_items_data_binding_command_handler.rb +30 -0
- data/src/command_handlers/widget_command_handler.rb +26 -0
- data/src/command_handlers/widget_listener_command_handler.rb +35 -0
- data/src/command_handlers/widget_method_command_handler.rb +22 -0
- data/src/glimmer.rb +45 -0
- data/src/parent.rb +8 -0
- data/src/shine.rb +24 -0
- data/src/swt.rb +10 -0
- data/src/xml.rb +10 -0
- data/src/xml_command_handlers.rb +18 -0
- data/src/xml_command_handlers/html_command_handler.rb +49 -0
- data/src/xml_command_handlers/models/depth_first_search_iterator.rb +20 -0
- data/src/xml_command_handlers/models/name_space_visitor.rb +21 -0
- data/src/xml_command_handlers/models/node.rb +83 -0
- data/src/xml_command_handlers/models/node_visitor.rb +12 -0
- data/src/xml_command_handlers/models/xml_visitor.rb +62 -0
- data/src/xml_command_handlers/xml_command_handler.rb +22 -0
- data/src/xml_command_handlers/xml_name_space_command_handler.rb +34 -0
- data/src/xml_command_handlers/xml_tag_command_handler.rb +26 -0
- data/src/xml_command_handlers/xml_text_command_handler.rb +22 -0
- data/test/glimmer_constant_test.rb +36 -0
- data/test/glimmer_data_binding_test.rb +236 -0
- data/test/glimmer_listeners_test.rb +61 -0
- data/test/glimmer_shine_data_binding_test.rb +88 -0
- data/test/glimmer_table_data_binding_test.rb +135 -0
- data/test/glimmer_test.rb +233 -0
- data/test/observable_model_test.rb +27 -0
- data/test/r_widget_test.rb +52 -0
- data/test/samples/contactmanager/contact_manager_presenter_test.rb +60 -0
- data/test/samples/tictactoe/tic_tac_toe_test.rb +265 -0
- data/test/xml/glimmer_xml_test.rb +163 -0
- metadata +126 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require "test/unit"
|
5
|
+
require File.dirname(__FILE__) + "/../src/swt"
|
6
|
+
|
7
|
+
class GlimmerDataBindingTest < Test::Unit::TestCase
|
8
|
+
include Glimmer
|
9
|
+
|
10
|
+
include_package 'org.eclipse.swt'
|
11
|
+
include_package 'org.eclipse.swt.widgets'
|
12
|
+
include_package 'org.eclipse.swt.layout'
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
@target.display.dispose if @target.display
|
16
|
+
end
|
17
|
+
|
18
|
+
class Person
|
19
|
+
attr_accessor :name, :age, :adult
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_text_widget_verify_listener
|
23
|
+
@target = shell {
|
24
|
+
composite {
|
25
|
+
@text = text {
|
26
|
+
text "Howdy"
|
27
|
+
on_verify_text do |verify_event|
|
28
|
+
verify_event.doit = false if verify_event.text == "Hello"
|
29
|
+
end
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
@text.widget.setText("Hi")
|
35
|
+
assert_equal "Hi", @text.widget.getText
|
36
|
+
|
37
|
+
@text.widget.setText("Hello")
|
38
|
+
assert_equal "Hi", @text.widget.getText
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_button_widget_selection_listener
|
42
|
+
person = Person.new
|
43
|
+
person.name = "Bruce Ting"
|
44
|
+
|
45
|
+
@target = shell {
|
46
|
+
composite {
|
47
|
+
@button = button {
|
48
|
+
on_widget_selected do
|
49
|
+
person.name = "Bruce Lao"
|
50
|
+
end
|
51
|
+
}
|
52
|
+
}
|
53
|
+
}
|
54
|
+
assert_equal "Bruce Ting", person.name
|
55
|
+
@button.widget.setSelection(true)
|
56
|
+
@button.widget.notifyListeners(SWT::Selection, nil)
|
57
|
+
assert_equal "Bruce Lao", person.name
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require "test/unit"
|
5
|
+
require File.dirname(__FILE__) + "/../src/swt"
|
6
|
+
require File.dirname(__FILE__) + "/../src/shine"
|
7
|
+
|
8
|
+
class GlimmerDataBindingTest < Test::Unit::TestCase
|
9
|
+
include Glimmer
|
10
|
+
|
11
|
+
include_package 'org.eclipse.swt'
|
12
|
+
include_package 'org.eclipse.swt.widgets'
|
13
|
+
include_package 'org.eclipse.swt.layout'
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
@target.display.dispose if @target.display
|
17
|
+
end
|
18
|
+
|
19
|
+
class Person
|
20
|
+
attr_accessor :name, :age, :adult
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_text_widget_data_binding_string_property_spaceship
|
24
|
+
person = Person.new
|
25
|
+
person.name = "Bruce Ting"
|
26
|
+
|
27
|
+
@target = shell {
|
28
|
+
composite {
|
29
|
+
@text = text {
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
[@text, :text] <=> [person, :name]
|
35
|
+
|
36
|
+
assert_equal "Bruce Ting", @text.widget.getText
|
37
|
+
|
38
|
+
person.name = "Lady Butterfly"
|
39
|
+
assert_equal "Lady Butterfly", @text.widget.getText
|
40
|
+
|
41
|
+
@text.widget.setText("Allen Cork")
|
42
|
+
assert_equal "Allen Cork", person.name
|
43
|
+
|
44
|
+
comparison = ["he"] <=> ["he"]
|
45
|
+
assert_equal(0, comparison)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_multiple_widget_data_bindings_to_different_model_properties_spaceship
|
49
|
+
person = Person.new
|
50
|
+
person.name = "Nancy"
|
51
|
+
person.age = 15
|
52
|
+
person.adult = true
|
53
|
+
|
54
|
+
@target = shell {
|
55
|
+
composite {
|
56
|
+
@label = label {}
|
57
|
+
@text = text {}
|
58
|
+
@check_box = button(SWT::CHECK) {}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
[@label, :text] <=> [person, :name]
|
63
|
+
[@text, :text] <=> [person, :age, :fixnum]
|
64
|
+
[@check_box, :selection] <=> [person, :adult]
|
65
|
+
|
66
|
+
assert_equal "Nancy", @label.widget.getText
|
67
|
+
assert_equal "15", @text.widget.getText
|
68
|
+
assert_equal true, @check_box.widget.getSelection
|
69
|
+
|
70
|
+
person.name = "Drew"
|
71
|
+
assert_equal "Drew", @label.widget.getText
|
72
|
+
|
73
|
+
person.age = 27
|
74
|
+
assert_equal "27", @text.widget.getText
|
75
|
+
|
76
|
+
person.adult = false
|
77
|
+
assert_equal false, @check_box.widget.getSelection
|
78
|
+
|
79
|
+
@text.widget.setText("30")
|
80
|
+
assert_equal 30, person.age
|
81
|
+
|
82
|
+
@check_box.widget.setSelection(true)
|
83
|
+
@check_box.widget.notifyListeners(SWT::Selection, nil)
|
84
|
+
assert_equal true, person.adult
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
@@ -0,0 +1,135 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require "test/unit"
|
5
|
+
require File.dirname(__FILE__) + "/../src/swt"
|
6
|
+
|
7
|
+
class GlimmerTableDataBindingTest < Test::Unit::TestCase
|
8
|
+
include Glimmer
|
9
|
+
|
10
|
+
include_package 'org.eclipse.swt'
|
11
|
+
include_package 'org.eclipse.swt.widgets'
|
12
|
+
include_package 'org.eclipse.swt.layout'
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
@target.display.dispose if @target.display
|
16
|
+
end
|
17
|
+
|
18
|
+
class Group
|
19
|
+
def initialize
|
20
|
+
@people = []
|
21
|
+
end
|
22
|
+
|
23
|
+
attr_accessor :people
|
24
|
+
end
|
25
|
+
|
26
|
+
class Person
|
27
|
+
attr_accessor :name, :age, :adult
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_text_widget_data_binding_string_property
|
31
|
+
person1 = Person.new
|
32
|
+
person1.name = "Bruce Ting"
|
33
|
+
person1.age = 45
|
34
|
+
person1.adult = true
|
35
|
+
|
36
|
+
person2 = Person.new
|
37
|
+
person2.name = "Julia Fang"
|
38
|
+
person2.age = 17
|
39
|
+
person2.adult = false
|
40
|
+
|
41
|
+
group = Group.new
|
42
|
+
group.people << person1
|
43
|
+
group.people << person2
|
44
|
+
|
45
|
+
shell {
|
46
|
+
@table = table {
|
47
|
+
table_column {
|
48
|
+
text "Name"
|
49
|
+
width 120
|
50
|
+
}
|
51
|
+
table_column {
|
52
|
+
text "Age"
|
53
|
+
width 120
|
54
|
+
}
|
55
|
+
table_column {
|
56
|
+
text "Adult"
|
57
|
+
width 120
|
58
|
+
}
|
59
|
+
items bind(group, :people), column_properties(:name, :age, :adult)
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
assert_equal 3, @table.widget.getColumnCount
|
64
|
+
assert_equal 2, @table.widget.getItems.size
|
65
|
+
|
66
|
+
assert_equal "Bruce Ting", @table.widget.getItems[0].getText(0)
|
67
|
+
assert_equal "45", @table.widget.getItems[0].getText(1)
|
68
|
+
assert_equal "true", @table.widget.getItems[0].getText(2)
|
69
|
+
|
70
|
+
assert_equal "Julia Fang", @table.widget.getItems[1].getText(0)
|
71
|
+
assert_equal "17", @table.widget.getItems[1].getText(1)
|
72
|
+
assert_equal "false", @table.widget.getItems[1].getText(2)
|
73
|
+
|
74
|
+
person3 = Person.new
|
75
|
+
person3.name = "Andrea Shingle"
|
76
|
+
person3.age = 23
|
77
|
+
person3.adult = true
|
78
|
+
|
79
|
+
group.people << person3
|
80
|
+
|
81
|
+
assert_equal 3, @table.widget.getItems.size
|
82
|
+
assert_equal "Andrea Shingle", @table.widget.getItems[2].getText(0)
|
83
|
+
assert_equal "23", @table.widget.getItems[2].getText(1)
|
84
|
+
assert_equal "true", @table.widget.getItems[2].getText(2)
|
85
|
+
|
86
|
+
group.people.delete person2
|
87
|
+
|
88
|
+
assert_equal 2, @table.widget.getItems.size
|
89
|
+
assert_equal "Andrea Shingle", @table.widget.getItems[1].getText(0)
|
90
|
+
assert_equal "23", @table.widget.getItems[1].getText(1)
|
91
|
+
assert_equal "true", @table.widget.getItems[1].getText(2)
|
92
|
+
|
93
|
+
group.people.delete_at(0)
|
94
|
+
|
95
|
+
assert_equal 1, @table.widget.getItems.size
|
96
|
+
assert_equal "Andrea Shingle", @table.widget.getItems[0].getText(0)
|
97
|
+
assert_equal "23", @table.widget.getItems[0].getText(1)
|
98
|
+
assert_equal "true", @table.widget.getItems[0].getText(2)
|
99
|
+
|
100
|
+
group.people.clear
|
101
|
+
|
102
|
+
assert_equal 0, @table.widget.getItems.size
|
103
|
+
|
104
|
+
group.people = [person2, person1]
|
105
|
+
|
106
|
+
assert_equal 2, @table.widget.getItems.size
|
107
|
+
|
108
|
+
assert_equal "Julia Fang", @table.widget.getItems[0].getText(0)
|
109
|
+
assert_equal "17", @table.widget.getItems[0].getText(1)
|
110
|
+
assert_equal "false", @table.widget.getItems[0].getText(2)
|
111
|
+
|
112
|
+
assert_equal "Bruce Ting", @table.widget.getItems[1].getText(0)
|
113
|
+
assert_equal "45", @table.widget.getItems[1].getText(1)
|
114
|
+
assert_equal "true", @table.widget.getItems[1].getText(2)
|
115
|
+
|
116
|
+
group.people += [person1, person2]
|
117
|
+
|
118
|
+
assert_equal 4, @table.widget.getItems.size
|
119
|
+
|
120
|
+
assert_equal "Bruce Ting", @table.widget.getItems[2].getText(0)
|
121
|
+
assert_equal "45", @table.widget.getItems[2].getText(1)
|
122
|
+
assert_equal "true", @table.widget.getItems[2].getText(2)
|
123
|
+
|
124
|
+
assert_equal "Julia Fang", @table.widget.getItems[3].getText(0)
|
125
|
+
assert_equal "17", @table.widget.getItems[3].getText(1)
|
126
|
+
assert_equal "false", @table.widget.getItems[3].getText(2)
|
127
|
+
|
128
|
+
person1.name = "Bruce Flee"
|
129
|
+
|
130
|
+
assert_equal "Bruce Flee", @table.widget.getItems[1].getText(0)
|
131
|
+
assert_equal "Bruce Flee", @table.widget.getItems[2].getText(0)
|
132
|
+
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
@@ -0,0 +1,233 @@
|
|
1
|
+
# Copyright (C) 2007-2008 Annas Al Maleh
|
2
|
+
# Licensed under the LGPL. See /COPYING.LGPL for more details.
|
3
|
+
|
4
|
+
require "test/unit"
|
5
|
+
require File.dirname(__FILE__) + "/../src/swt"
|
6
|
+
|
7
|
+
class GlimmerTest < Test::Unit::TestCase
|
8
|
+
include Glimmer
|
9
|
+
|
10
|
+
include_package 'org.eclipse.swt'
|
11
|
+
include_package 'org.eclipse.swt.widgets'
|
12
|
+
include_package 'org.eclipse.swt.layout'
|
13
|
+
include_package 'org.eclipse.swt.graphics'
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
@target.display.dispose if @target.display
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_shell_with_default_layout
|
20
|
+
@target = shell
|
21
|
+
|
22
|
+
assert_not_nil @target
|
23
|
+
assert_not_nil @target.widget
|
24
|
+
assert_instance_of Shell, @target.widget
|
25
|
+
assert_not_nil @target.widget.getLayout
|
26
|
+
assert_instance_of FillLayout, @target.widget.getLayout
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_shell_with_title_and_layout
|
30
|
+
shell_layout = GridLayout.new
|
31
|
+
@target = shell {
|
32
|
+
text "Title"
|
33
|
+
layout shell_layout
|
34
|
+
}
|
35
|
+
|
36
|
+
assert_equal "Title", @target.widget.getText
|
37
|
+
assert_equal shell_layout, @target.widget.getLayout
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_shell_with_bounds
|
41
|
+
@target = shell {
|
42
|
+
bounds 50, 75, 800, 600
|
43
|
+
}
|
44
|
+
|
45
|
+
assert_equal Rectangle.new(50, 75, 800, 600), @target.widget.getBounds
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_shell_with_size
|
49
|
+
GlimmerTest.class_eval("undef_method :size") #hack to remove existing size method in test class
|
50
|
+
|
51
|
+
@target = shell {
|
52
|
+
size 800, 600
|
53
|
+
}
|
54
|
+
|
55
|
+
assert_equal Point.new(800, 600), @target.widget.getSize
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_shell_and_composite_with_default_style_and_layout
|
59
|
+
@target = shell {
|
60
|
+
composite
|
61
|
+
}
|
62
|
+
|
63
|
+
assert_equal 1, @target.widget.children.size
|
64
|
+
assert_instance_of Composite, @target.widget.children[0]
|
65
|
+
composite_widget = @target.widget.children[0]
|
66
|
+
assert_has_style SWT::NONE, composite_widget
|
67
|
+
assert_instance_of GridLayout, composite_widget.getLayout
|
68
|
+
grid_layout = composite_widget.getLayout
|
69
|
+
assert_equal 1, grid_layout.numColumns
|
70
|
+
assert_equal false, grid_layout.makeColumnsEqualWidth
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_shell_and_group_with_default_style_and_layout
|
74
|
+
@target = shell {
|
75
|
+
group {
|
76
|
+
text "Title"
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
assert_equal 1, @target.widget.children.size
|
81
|
+
assert_instance_of Group, @target.widget.children[0]
|
82
|
+
group_widget = @target.widget.children[0]
|
83
|
+
assert_has_style SWT::NONE, group_widget
|
84
|
+
assert_instance_of GridLayout, group_widget.getLayout
|
85
|
+
grid_layout = group_widget.getLayout
|
86
|
+
assert_equal 1, grid_layout.numColumns
|
87
|
+
assert_equal false, grid_layout.makeColumnsEqualWidth
|
88
|
+
assert_equal "Title", group_widget.getText
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_shell_and_composite_with_style_and_layout
|
92
|
+
composite_layout = RowLayout.new
|
93
|
+
@target = shell {
|
94
|
+
composite(SWT::NO_FOCUS) {
|
95
|
+
layout composite_layout
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
assert_equal 1, @target.widget.children.size
|
100
|
+
assert_instance_of Composite, @target.widget.children[0]
|
101
|
+
composite_widget = @target.widget.children[0]
|
102
|
+
assert_has_style SWT::NO_FOCUS, composite_widget
|
103
|
+
assert_equal composite_layout, composite_widget.getLayout
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_shell_and_composite_and_text_with_default_style
|
107
|
+
@target = shell {
|
108
|
+
composite {
|
109
|
+
text
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
composite_widget = @target.widget.children[0]
|
114
|
+
assert_equal 1, composite_widget.children.size
|
115
|
+
assert_instance_of Text, composite_widget.children[0]
|
116
|
+
text_widget = composite_widget.children[0]
|
117
|
+
assert_has_style SWT::BORDER, text_widget
|
118
|
+
end
|
119
|
+
|
120
|
+
def test_shell_and_composite_with_custom_layout_and_text_with_default_style
|
121
|
+
composite_layout = RowLayout.new
|
122
|
+
@target = shell {
|
123
|
+
composite {
|
124
|
+
text
|
125
|
+
layout composite_layout
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
composite_widget = @target.widget.children[0]
|
130
|
+
assert_equal composite_layout, composite_widget.getLayout
|
131
|
+
assert_equal 1, composite_widget.children.size
|
132
|
+
assert_instance_of Text, composite_widget.children[0]
|
133
|
+
text_widget = composite_widget.children[0]
|
134
|
+
assert_has_style SWT::BORDER, text_widget
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_shell_and_composite_and_text_with_style_and_text
|
138
|
+
@target = shell {
|
139
|
+
composite {
|
140
|
+
text(SWT::PASSWORD) {
|
141
|
+
text "Hello"
|
142
|
+
}
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
composite_widget = @target.widget.children[0]
|
147
|
+
assert_equal 1, composite_widget.children.size
|
148
|
+
assert_instance_of Text, composite_widget.children[0]
|
149
|
+
text_widget = composite_widget.children[0]
|
150
|
+
assert_has_style SWT::PASSWORD, text_widget
|
151
|
+
assert_equal "Hello", text_widget.getText
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_shell_and_spinner_default
|
155
|
+
@target = shell {
|
156
|
+
@spinner = spinner {
|
157
|
+
selection 55
|
158
|
+
}
|
159
|
+
}
|
160
|
+
|
161
|
+
assert_instance_of Spinner, @spinner.widget
|
162
|
+
assert_has_style SWT::BORDER, @spinner.widget
|
163
|
+
assert_equal 55, @spinner.widget.getSelection
|
164
|
+
end
|
165
|
+
|
166
|
+
def test_shell_and_button_default
|
167
|
+
@target = shell {
|
168
|
+
@button = button {
|
169
|
+
text "Push Me"
|
170
|
+
}
|
171
|
+
}
|
172
|
+
|
173
|
+
assert_instance_of Button, @button.widget
|
174
|
+
assert_has_style SWT::PUSH, @button.widget
|
175
|
+
assert_equal "Push Me", @button.widget.text
|
176
|
+
end
|
177
|
+
|
178
|
+
def test_shell_and_table_and_table_column_defaults
|
179
|
+
@target = shell {
|
180
|
+
@table = table {
|
181
|
+
@table_column = table_column
|
182
|
+
}
|
183
|
+
}
|
184
|
+
|
185
|
+
assert_has_style SWT::BORDER, @table.widget
|
186
|
+
assert @table.widget.getHeaderVisible
|
187
|
+
assert @table.widget.getLinesVisible
|
188
|
+
assert_equal 80, @table_column.widget.getWidth
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_shell_containing_undefined_command
|
192
|
+
@target = shell {
|
193
|
+
undefined_command(:undefined_parameter) {
|
194
|
+
}
|
195
|
+
}
|
196
|
+
|
197
|
+
assert_not_nil @target
|
198
|
+
assert_not_nil @target.widget
|
199
|
+
assert_instance_of Shell, @target.widget
|
200
|
+
assert_not_nil @target.widget.getLayout
|
201
|
+
assert_instance_of FillLayout, @target.widget.getLayout
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
def test_add_contents
|
206
|
+
@target = shell {
|
207
|
+
}
|
208
|
+
|
209
|
+
add_contents(@target) {
|
210
|
+
composite {
|
211
|
+
text(SWT::PASSWORD) {
|
212
|
+
text "Hello"
|
213
|
+
}
|
214
|
+
}
|
215
|
+
}
|
216
|
+
|
217
|
+
composite_widget = @target.widget.children[0]
|
218
|
+
assert_equal 1, composite_widget.children.size
|
219
|
+
assert_instance_of Text, composite_widget.children[0]
|
220
|
+
text_widget = composite_widget.children[0]
|
221
|
+
assert_has_style SWT::PASSWORD, text_widget
|
222
|
+
assert_equal "Hello", text_widget.getText
|
223
|
+
end
|
224
|
+
|
225
|
+
private
|
226
|
+
|
227
|
+
def assert_has_style(style, widget)
|
228
|
+
assert_equal style, widget.getStyle & style
|
229
|
+
end
|
230
|
+
|
231
|
+
|
232
|
+
end
|
233
|
+
|