context 0.0.16 → 0.0.22
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS +1 -0
- data/COPYING +679 -0
- data/README +188 -0
- data/Rakefile.rb +64 -18
- data/lib/Context/Bridge.rb +7 -6
- data/lib/Context/Context.rb +14 -35
- data/lib/Context/Gtk/Widget.rb +139 -33
- data/lib/Context/Log.rb +10 -0
- data/lib/Context/Publisher.rb +108 -0
- data/lib/Context/Spec.rb +8 -0
- data/lib/Context/Version.rb +1 -1
- data/lib/Context/View.rb +16 -15
- data/lib/Context/Views/Gtk/PageView.rb +3 -23
- data/lib/Context/Views/Gtk/Widgets/MainWindow.rb +70 -0
- data/lib/Context/Views/Gtk/Widgets/VBox.rb +29 -0
- data/lib/Context/Widget.rb +18 -27
- data/spec/Context/Bridge_spec.rb +19 -20
- data/spec/Context/Context_spec.rb +77 -63
- data/spec/Context/Gtk/Widget_spec.rb +23 -23
- data/spec/Context/Publisher_spec.rb +53 -0
- data/spec/Context/View_spec.rb +10 -14
- data/spec/Context/Views/Gtk/PageView_spec.rb +25 -9
- data/spec/Context/require_all_spec.rb +14 -7
- data/test_results.html +84 -121
- metadata +74 -128
- data/coverage/-usr-local-lib-site_ruby-1_8-atk_rb.html +0 -612
- data/coverage/-usr-local-lib-site_ruby-1_8-gdk_pixbuf2_rb.html +0 -637
- data/coverage/-usr-local-lib-site_ruby-1_8-glib2_rb.html +0 -829
- data/coverage/-usr-local-lib-site_ruby-1_8-gtk2-base_rb.html +0 -709
- data/coverage/-usr-local-lib-site_ruby-1_8-gtk2_rb.html +0 -623
- data/coverage/-usr-local-lib-site_ruby-1_8-pango_rb.html +0 -665
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-color_rb.html +0 -865
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-colors_rb.html +0 -1266
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-constants_rb.html +0 -632
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-blur_rb.html +0 -655
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-circle_rb.html +0 -619
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-color_rb.html +0 -621
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-path_rb.html +0 -726
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-rectangle_rb.html +0 -643
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-triangle_rb.html +0 -622
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context_rb.html +0 -639
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-paper_rb.html +0 -793
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-papers_rb.html +0 -651
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-path_rb.html +0 -625
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-point_rb.html +0 -617
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo_rb.html +0 -756
- data/coverage/index.html +0 -1170
- data/coverage/lib-Context-Bridge_rb.html +0 -673
- data/coverage/lib-Context-Context_rb.html +0 -756
- data/coverage/lib-Context-EnumeratedType_rb.html +0 -661
- data/coverage/lib-Context-ExecutionProxy_rb.html +0 -671
- data/coverage/lib-Context-Gtk-App_rb.html +0 -638
- data/coverage/lib-Context-Gtk-Key_rb.html +0 -664
- data/coverage/lib-Context-Gtk-Widget_rb.html +0 -667
- data/coverage/lib-Context-KeyAssignment_rb.html +0 -641
- data/coverage/lib-Context-KeyMap_rb.html +0 -653
- data/coverage/lib-Context-Key_rb.html +0 -667
- data/coverage/lib-Context-View_rb.html +0 -659
- data/coverage/lib-Context-Views-Gtk-PageView_rb.html +0 -660
- data/coverage/lib-Context-Views-PageView_rb.html +0 -627
- data/coverage/lib-Context-Widget_rb.html +0 -650
- data/coverage/lib-Context-require_all_rb.html +0 -623
- data/doc/classes/Context.html +0 -174
- data/doc/classes/Context/Bridge.html +0 -296
- data/doc/classes/Context/Context.html +0 -564
- data/doc/classes/Context/EnumeratedType.html +0 -283
- data/doc/classes/Context/ExecutionProxy.html +0 -228
- data/doc/classes/Context/Gtk.html +0 -126
- data/doc/classes/Context/Gtk/App.html +0 -217
- data/doc/classes/Context/Gtk/Key.html +0 -292
- data/doc/classes/Context/Gtk/PageView.html +0 -245
- data/doc/classes/Context/Gtk/PageView/MainWindow.html +0 -200
- data/doc/classes/Context/Gtk/Widget.html +0 -311
- data/doc/classes/Context/Key.html +0 -305
- data/doc/classes/Context/Key/Modifier.html +0 -117
- data/doc/classes/Context/KeyAssignment.html +0 -234
- data/doc/classes/Context/KeyMap.html +0 -273
- data/doc/classes/Context/PageView.html +0 -180
- data/doc/classes/Context/View.html +0 -334
- data/doc/classes/Context/Widget.html +0 -298
- data/doc/classes/Kernel.html +0 -148
- data/doc/classes/Object.html +0 -196
- data/doc/created.rid +0 -1
- data/doc/files/lib/Context/Bridge_rb.html +0 -108
- data/doc/files/lib/Context/Context_rb.html +0 -109
- data/doc/files/lib/Context/EnumeratedType_rb.html +0 -101
- data/doc/files/lib/Context/ExecutionProxy_rb.html +0 -101
- data/doc/files/lib/Context/Gtk/App_rb.html +0 -110
- data/doc/files/lib/Context/Gtk/Key_rb.html +0 -109
- data/doc/files/lib/Context/Gtk/Widget_rb.html +0 -109
- data/doc/files/lib/Context/KeyAssignment_rb.html +0 -108
- data/doc/files/lib/Context/KeyMap_rb.html +0 -109
- data/doc/files/lib/Context/Key_rb.html +0 -108
- data/doc/files/lib/Context/Version_rb.html +0 -101
- data/doc/files/lib/Context/View_rb.html +0 -101
- data/doc/files/lib/Context/Views/Gtk/PageView_rb.html +0 -111
- data/doc/files/lib/Context/Views/PageView_rb.html +0 -108
- data/doc/files/lib/Context/Widget_rb.html +0 -101
- data/doc/files/lib/Context/require_all_rb.html +0 -101
- data/doc/fr_class_index.html +0 -46
- data/doc/fr_file_index.html +0 -42
- data/doc/fr_method_index.html +0 -103
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
- data/lib/Context/EnumeratedType.rb +0 -51
- data/lib/Context/ExecutionProxy.rb +0 -61
- data/lib/Context/Gtk/Key.rb +0 -54
- data/lib/Context/Key.rb +0 -57
- data/lib/Context/KeyAssignment.rb +0 -31
- data/lib/Context/KeyMap.rb +0 -43
- data/spec/Context/EnumeratedType_spec.rb +0 -51
- data/spec/Context/ExecutionProxy_spec.rb +0 -28
- data/spec/Context/Gtk/Key_spec.rb +0 -45
- data/spec/Context/KeyAssignment_spec.rb +0 -26
- data/spec/Context/KeyMap_spec.rb +0 -64
- data/spec/Context/Key_spec.rb +0 -22
- data/spec/Context/Widget_spec.rb +0 -15
@@ -1,102 +1,116 @@
|
|
1
|
+
require 'Context/Spec'
|
1
2
|
require 'Context/Context'
|
2
3
|
require 'Context/Bridge'
|
3
4
|
require 'Context/View'
|
4
5
|
|
5
|
-
|
6
|
+
# To see an example for creating a new context class, please see
|
7
|
+
# Context::Spec::ContextStory::TestContext
|
8
|
+
module Context::Spec::ContextStory
|
6
9
|
|
7
|
-
|
10
|
+
# This is an example of a Context.
|
11
|
+
# To make a Context, simply derive it from the base Context class.
|
12
|
+
# You will have to override some methods as described below.
|
13
|
+
class TestContext < Context::Context
|
14
|
+
|
15
|
+
# The initialize method must always call super(bridge)
|
16
|
+
# after that you can add any other initialization that
|
17
|
+
# you want (including creating other sub Contexts).
|
8
18
|
def initialize(bridge)
|
9
19
|
super(bridge)
|
10
20
|
end
|
11
|
-
|
21
|
+
|
22
|
+
# You must also override createViews() to create a new
|
23
|
+
# new view and assign it to the variable @mainView.
|
24
|
+
# You can create more than one view, but one must
|
25
|
+
# be chosen as the main view.
|
12
26
|
def createViews
|
13
|
-
@mainView = View.new(self)
|
27
|
+
@mainView = Context::View.new(self)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Finally, you must usually override the destroyViews()
|
31
|
+
# method. First you should call the method that
|
32
|
+
# will clean up the concreate view structures. Then
|
33
|
+
# you should set the variable @mainView to nil
|
34
|
+
def destroyViews
|
35
|
+
# In this example, I am only using the abstract
|
36
|
+
# view class, so there is no need to clean anything
|
37
|
+
# up. I'll just set the mainView to nil
|
38
|
+
@mainView = nil
|
14
39
|
end
|
40
|
+
|
15
41
|
end
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
42
|
+
|
43
|
+
describe Context::Context do
|
44
|
+
|
45
|
+
before(:each) do
|
46
|
+
@bridge = Context::Bridge.new(Context::Context)
|
47
|
+
@parent = TestContext.new(@bridge)
|
48
|
+
@context = TestContext.new(@bridge)
|
49
|
+
end
|
24
50
|
|
25
|
-
|
26
|
-
|
27
|
-
|
51
|
+
it "should not have a parent set on creation" do
|
52
|
+
@context.parent.should be_nil
|
53
|
+
end
|
28
54
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
55
|
+
it "should set the parent on entry" do
|
56
|
+
@parent.createViews
|
57
|
+
@parent.should_receive(:addView)
|
58
|
+
@context.enter(@parent)
|
59
|
+
@context.parent.should equal(@parent)
|
60
|
+
end
|
35
61
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
62
|
+
it "should add new views to the main view" do
|
63
|
+
newContext = TestContext.new(@bridge)
|
64
|
+
newContext.createViews
|
65
|
+
@context.createViews
|
66
|
+
@context.mainView.should_receive(:addView).with(newContext.mainView)
|
67
|
+
|
68
|
+
@context.addView(newContext.mainView)
|
69
|
+
end
|
70
|
+
|
45
71
|
it "should remove views on exit" do
|
46
72
|
@parent.createViews
|
47
73
|
@parent.mainView.should_receive(:removeView).with(@context.peekAtView)
|
48
|
-
|
74
|
+
@parent.should_receive(:addView)
|
49
75
|
@context.enter(@parent)
|
50
76
|
@context.exit
|
51
77
|
end
|
52
78
|
|
53
|
-
it "should
|
54
|
-
|
55
|
-
|
56
|
-
@context.exit
|
79
|
+
it "should create the views on entry" do
|
80
|
+
@context.should_receive(:setupViews) do
|
81
|
+
@context.createViews
|
57
82
|
end
|
58
|
-
@
|
59
|
-
@
|
60
|
-
@context.
|
61
|
-
@context.should_receive(:exit)
|
62
|
-
@context.notifyKey(mock("View"), key)
|
83
|
+
@parent.should_receive(:addView)
|
84
|
+
@parent.createViews
|
85
|
+
@context.enter(@parent)
|
63
86
|
end
|
64
87
|
|
65
|
-
it "should create the views on entry" do
|
66
|
-
@context.should_receive(:setupViews) do
|
67
|
-
@context.createViews
|
68
|
-
end
|
69
|
-
@parent.should_receive(:addView)
|
70
|
-
@parent.createViews
|
71
|
-
@context.enter(@parent)
|
72
|
-
end
|
73
|
-
|
74
88
|
it "should destroy the views on exit" do
|
75
89
|
@parent.createViews
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
90
|
+
@context.should_receive(:setupViews).exactly(2).times do
|
91
|
+
@context.createViews
|
92
|
+
end
|
93
|
+
@parent.should_receive(:addView)
|
94
|
+
@context.enter(@parent)
|
81
95
|
@parent.mainView.should_receive(:removeView).with(@context.peekAtView)
|
82
|
-
|
83
|
-
|
96
|
+
@context.should_receive(:destroyViews)
|
97
|
+
@context.exit
|
84
98
|
end
|
85
99
|
|
86
100
|
it "should keep track if the context has been entered or not" do
|
87
101
|
@parent.createViews
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
102
|
+
@context.should_receive(:setupViews).exactly(2).times do
|
103
|
+
@context.createViews
|
104
|
+
end
|
105
|
+
@parent.should_receive(:addView)
|
92
106
|
@context.isEntered?.should be(false)
|
93
107
|
@context.enter(@parent)
|
94
108
|
@context.isEntered?.should be(true)
|
95
109
|
@parent.mainView.should_receive(:removeView).with(@context.peekAtView)
|
96
|
-
|
110
|
+
@context.should_receive(:destroyViews)
|
97
111
|
@context.exit
|
98
112
|
@context.isEntered?.should be(false)
|
99
113
|
end
|
100
|
-
|
101
|
-
end
|
114
|
+
end
|
102
115
|
end
|
116
|
+
|
@@ -4,41 +4,41 @@ module Context::Gtk
|
|
4
4
|
|
5
5
|
describe Widget do
|
6
6
|
|
7
|
+
class FakeWidget
|
8
|
+
include Widget
|
9
|
+
end
|
10
|
+
|
7
11
|
before(:each) do
|
8
|
-
@widget =
|
9
|
-
@newWidget =
|
10
|
-
@oldWidget =
|
12
|
+
@widget = FakeWidget.new()
|
13
|
+
@newWidget = FakeWidget.new()
|
14
|
+
@oldWidget = FakeWidget.new()
|
11
15
|
end
|
12
16
|
|
13
17
|
it "should add and show the widget when add is called." do
|
14
|
-
@widget.
|
15
|
-
@widget.
|
16
|
-
@widget.
|
18
|
+
@widget.should_receive(:gtkAddWidget).with(@newWidget)
|
19
|
+
@widget.should_receive(:show_all)
|
20
|
+
@widget.addToThisWidget(@newWidget)
|
17
21
|
end
|
18
22
|
|
19
|
-
it "should remove the widget, reshow the container
|
20
|
-
@widget.
|
21
|
-
@widget.
|
22
|
-
|
23
|
-
@widget.remove(@oldWidget)
|
23
|
+
it "should remove the widget, reshow the container when removed is called." do
|
24
|
+
@widget.should_receive(:gtkRemoveWidget).with(@oldWidget)
|
25
|
+
@widget.should_receive(:show_all)
|
26
|
+
@widget.removeFromThisWidget(@oldWidget)
|
24
27
|
end
|
25
28
|
|
26
29
|
it "should keep track of the main Window" do
|
27
|
-
@widget.
|
30
|
+
@widget.gtkWidgetMainWindow.should be_nil
|
28
31
|
@widget.isAMainWindow
|
29
|
-
@widget.
|
32
|
+
@widget.gtkWidgetMainWindow.should be_eql(@widget)
|
30
33
|
|
31
|
-
@widget.
|
32
|
-
@widget.
|
33
|
-
@widget.
|
34
|
-
@newWidget.
|
34
|
+
@widget.should_receive(:gtkAddWidget).with(@newWidget)
|
35
|
+
@widget.should_receive(:show_all).exactly(2).times
|
36
|
+
@widget.addToThisWidget(@newWidget)
|
37
|
+
@newWidget.gtkWidgetMainWindow.should be_eql(@widget)
|
35
38
|
|
36
|
-
@widget.
|
37
|
-
|
38
|
-
|
39
|
-
@newWidget.mainWindow.should be_nil
|
39
|
+
@widget.should_receive(:gtkRemoveWidget).with(@newWidget)
|
40
|
+
@widget.removeFromThisWidget(@newWidget)
|
41
|
+
@newWidget.gtkWidgetMainWindow.should be_nil
|
40
42
|
end
|
41
|
-
|
42
|
-
|
43
43
|
end
|
44
44
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'Context/Publisher'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
|
5
|
+
describe Publisher do
|
6
|
+
|
7
|
+
it "should have a source" do
|
8
|
+
source = mock("Source")
|
9
|
+
publisher = Publisher.new(source)
|
10
|
+
publisher.source.should be(source)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should be able to subscribe to a publisher" do
|
14
|
+
source = mock("Source")
|
15
|
+
target = mock("Target")
|
16
|
+
publisher = Publisher.new(source)
|
17
|
+
publisher.subscribe(target, "status")
|
18
|
+
target.should_receive(:statusUpdated).with(source)
|
19
|
+
publisher.update("status")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should be able to update streams that aren't subscribed to" do
|
23
|
+
source = mock("Source")
|
24
|
+
target = mock("Target")
|
25
|
+
publisher = Publisher.new(source)
|
26
|
+
publisher.subscribe(target, "newProblem")
|
27
|
+
target.should_not_receive(:statusUpdated).with(source)
|
28
|
+
publisher.update("status")
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should be able to subscribe multiple targets to a publisher" do
|
32
|
+
source = mock("Source")
|
33
|
+
target1 = mock("Target")
|
34
|
+
target2 = mock("Target")
|
35
|
+
publisher = Publisher.new(source)
|
36
|
+
publisher.subscribe(target1, "status")
|
37
|
+
publisher.subscribe(target2, "status")
|
38
|
+
target1.should_receive(:statusUpdated).with(source)
|
39
|
+
target2.should_receive(:statusUpdated).with(source)
|
40
|
+
publisher.update("status")
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be able to change the source" do
|
44
|
+
source = mock("Source")
|
45
|
+
source2 = mock("Source")
|
46
|
+
target = mock("Target")
|
47
|
+
publisher = Publisher.new(source)
|
48
|
+
publisher.subscribe(target, "status")
|
49
|
+
target.should_receive(:statusUpdated).with(source2)
|
50
|
+
publisher.update("status", source2)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/spec/Context/View_spec.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
require 'Context/Spec'
|
1
2
|
require 'Context/View'
|
2
3
|
|
3
|
-
module Context
|
4
|
+
module Context::Spec::ViewStory
|
4
5
|
|
5
|
-
describe View do
|
6
|
+
describe Context::View do
|
6
7
|
|
7
8
|
# Since this is an abstract class, we need to override getWidget with
|
8
9
|
# something that does something
|
@@ -17,7 +18,7 @@ module Context
|
|
17
18
|
|
18
19
|
before(:each) do
|
19
20
|
@context = mock("Context")
|
20
|
-
@view = View.new(@context)
|
21
|
+
@view = Context::View.new(@context)
|
21
22
|
@widget = mock("Widget")
|
22
23
|
|
23
24
|
# Override the getWidget method
|
@@ -32,31 +33,26 @@ module Context
|
|
32
33
|
end
|
33
34
|
|
34
35
|
it "should use the widgets to add a view" do
|
35
|
-
newView = View.new(@context)
|
36
|
+
newView = Context::View.new(@context)
|
36
37
|
overrideGetWidget(newView)
|
37
38
|
newWidget = mock("Widget")
|
38
39
|
newView.setWidget(newWidget)
|
39
40
|
|
40
|
-
@widget.should_receive(:
|
41
|
-
newWidget.should_receive(:
|
41
|
+
@widget.should_receive(:addToThisWidget).with(newWidget)
|
42
|
+
newWidget.should_receive(:widgetWasAddedTo).with(@widget)
|
42
43
|
@view.addView(newView)
|
43
44
|
end
|
44
45
|
|
45
46
|
it "should use the widgets to remove a view" do
|
46
|
-
oldView = View.new(@context)
|
47
|
+
oldView = Context::View.new(@context)
|
47
48
|
overrideGetWidget(oldView)
|
48
49
|
oldWidget = mock("Widget")
|
49
50
|
oldView.setWidget(oldWidget)
|
50
51
|
|
51
|
-
@widget.should_receive(:
|
52
|
-
oldWidget.should_receive(:
|
52
|
+
@widget.should_receive(:removeFromThisWidget).with(oldWidget)
|
53
|
+
oldWidget.should_receive(:widgetWasRemovedFrom).with(@widget)
|
53
54
|
@view.removeView(oldView)
|
54
55
|
end
|
55
56
|
|
56
|
-
it "should pass key notifications on to the context" do
|
57
|
-
key = mock("Key")
|
58
|
-
@context.should_receive(:notifyKey).with(@view, key)
|
59
|
-
@view.notifyKey(mock("Widget"), key)
|
60
|
-
end
|
61
57
|
end
|
62
58
|
end
|
@@ -4,6 +4,26 @@ require 'Context/Views/Gtk/PageView'
|
|
4
4
|
|
5
5
|
module Context::Gtk
|
6
6
|
|
7
|
+
class FakeView < Context::View
|
8
|
+
class FakeWidget < Gtk::Button
|
9
|
+
include Widget
|
10
|
+
|
11
|
+
def initialize(name)
|
12
|
+
super(name)
|
13
|
+
setupWidget
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(context)
|
18
|
+
super(context)
|
19
|
+
@widget = FakeWidget.new("Button")
|
20
|
+
end
|
21
|
+
|
22
|
+
def getWidget
|
23
|
+
@widget
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
7
27
|
describe PageView do
|
8
28
|
|
9
29
|
before(:each) do
|
@@ -16,22 +36,18 @@ module Context::Gtk
|
|
16
36
|
@view.getWidget.should_not be_nil
|
17
37
|
end
|
18
38
|
|
19
|
-
it "should show the widgets when opened" do
|
20
|
-
@view.mainWindow.should_receive(:show_all)
|
21
|
-
@view.open
|
22
|
-
end
|
23
|
-
|
24
39
|
it "should add widgets from another view when added" do
|
25
40
|
newContext = mock("Context::Context")
|
26
|
-
newView =
|
27
|
-
@view.getWidget().should_receive(:
|
41
|
+
newView = FakeView.new(newContext)
|
42
|
+
@view.getWidget().should_receive(:gtkAddWidget).with(newView.getWidget)
|
28
43
|
@view.addView(newView)
|
29
44
|
end
|
30
45
|
|
31
46
|
it "should remove widgets from another view when removed" do
|
32
47
|
oldContext = mock("Context::MainContext")
|
33
|
-
oldView =
|
34
|
-
|
48
|
+
oldView = FakeView.new(oldContext)
|
49
|
+
@view.addView(oldView)
|
50
|
+
@view.getWidget().should_receive(:gtkRemoveWidget).with(oldView.getWidget)
|
35
51
|
@view.removeView(oldView)
|
36
52
|
end
|
37
53
|
|
@@ -1,13 +1,20 @@
|
|
1
|
+
require 'Context/Spec'
|
1
2
|
require 'Context/require_all'
|
2
3
|
require 'Context/Context'
|
3
4
|
|
4
|
-
|
5
|
+
module Context::Spec::Require_AllStory
|
6
|
+
describe Kernel do
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
it "should have a unit test for require_all" do
|
9
|
+
require_all 'Context/Gtk/*'
|
10
|
+
Context::Gtk::App.new(Context, Context::Context).should_not be_nil
|
11
|
+
class FakeWidget
|
12
|
+
include Context::Gtk::Widget
|
13
|
+
end
|
14
|
+
# We haven't overriden this method yet, so it will return false
|
15
|
+
# Really, wer're just making sure it it exists
|
16
|
+
FakeWidget.new.isInTests?.should be(false)
|
17
|
+
end
|
18
|
+
end
|
12
19
|
end
|
13
20
|
|
data/test_results.html
CHANGED
@@ -16,9 +16,6 @@
|
|
16
16
|
font-size: 80%;
|
17
17
|
}
|
18
18
|
</style>
|
19
|
-
</head>
|
20
|
-
<body>
|
21
|
-
<div class="rspec-report">
|
22
19
|
<script type="text/javascript">
|
23
20
|
// <![CDATA[
|
24
21
|
function moveProgressBar(percentDone) {
|
@@ -46,7 +43,7 @@ function makeYellow(element_id) {
|
|
46
43
|
</script>
|
47
44
|
<style type="text/css">
|
48
45
|
#rspec-header {
|
49
|
-
background: #65C400; color: #fff;
|
46
|
+
background: #65C400; color: #fff; height: 4em;
|
50
47
|
}
|
51
48
|
|
52
49
|
.rspec-report h1 {
|
@@ -54,15 +51,16 @@ function makeYellow(element_id) {
|
|
54
51
|
padding: 10px;
|
55
52
|
font-family: "Lucida Grande", Helvetica, sans-serif;
|
56
53
|
font-size: 1.8em;
|
54
|
+
position: absolute;
|
57
55
|
}
|
58
56
|
|
59
57
|
#summary {
|
60
58
|
margin: 0; padding: 5px 10px;
|
61
59
|
font-family: "Lucida Grande", Helvetica, sans-serif;
|
62
60
|
text-align: right;
|
63
|
-
position: absolute;
|
64
61
|
top: 0px;
|
65
62
|
right: 0px;
|
63
|
+
float:right;
|
66
64
|
}
|
67
65
|
|
68
66
|
#summary p {
|
@@ -165,9 +163,14 @@ a {
|
|
165
163
|
}
|
166
164
|
|
167
165
|
</style>
|
166
|
+
</head>
|
167
|
+
<body>
|
168
|
+
<div class="rspec-report">
|
168
169
|
|
169
170
|
<div id="rspec-header">
|
170
|
-
<
|
171
|
+
<div id="label">
|
172
|
+
<h1>RSpec Code Examples</h1>
|
173
|
+
</div>
|
171
174
|
|
172
175
|
<div id="summary">
|
173
176
|
<p id="totals"> </p>
|
@@ -178,165 +181,125 @@ a {
|
|
178
181
|
<div class="results">
|
179
182
|
<div class="example_group">
|
180
183
|
<dl>
|
181
|
-
<dt id="example_group_1">Context::
|
182
|
-
<script type="text/javascript">moveProgressBar('
|
183
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
184
|
-
<script type="text/javascript">moveProgressBar('4
|
185
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
186
|
-
<script type="text/javascript">moveProgressBar('
|
187
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
188
|
-
<script type="text/javascript">moveProgressBar('9.5');</script>
|
189
|
-
<dd class="spec passed"><span class="passed_spec_name">should remove views on exit</span></dd>
|
190
|
-
<script type="text/javascript">moveProgressBar('11.9');</script>
|
191
|
-
<dd class="spec passed"><span class="passed_spec_name">should be able to set key bindings</span></dd>
|
192
|
-
<script type="text/javascript">moveProgressBar('14.2');</script>
|
193
|
-
<dd class="spec passed"><span class="passed_spec_name">should create the views on entry</span></dd>
|
194
|
-
<script type="text/javascript">moveProgressBar('16.6');</script>
|
195
|
-
<dd class="spec passed"><span class="passed_spec_name">should destroy the views on exit</span></dd>
|
196
|
-
<script type="text/javascript">moveProgressBar('19.0');</script>
|
197
|
-
<dd class="spec passed"><span class="passed_spec_name">should keep track if the context has been entered or not</span></dd>
|
184
|
+
<dt id="example_group_1">Context::View</dt>
|
185
|
+
<script type="text/javascript">moveProgressBar('3.7');</script>
|
186
|
+
<dd class="spec passed"><span class="passed_spec_name">should set the context on creation</span></dd>
|
187
|
+
<script type="text/javascript">moveProgressBar('7.4');</script>
|
188
|
+
<dd class="spec passed"><span class="passed_spec_name">should use the widgets to add a view</span></dd>
|
189
|
+
<script type="text/javascript">moveProgressBar('11.1');</script>
|
190
|
+
<dd class="spec passed"><span class="passed_spec_name">should use the widgets to remove a view</span></dd>
|
198
191
|
</dl>
|
199
192
|
</div>
|
200
193
|
<div class="example_group">
|
201
194
|
<dl>
|
202
|
-
<dt id="example_group_2">Context::
|
203
|
-
<script type="text/javascript">moveProgressBar('
|
204
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
205
|
-
<script type="text/javascript">moveProgressBar('23.8');</script>
|
206
|
-
<dd class="spec passed"><span class="passed_spec_name">should increment by one for each value</span></dd>
|
207
|
-
<script type="text/javascript">moveProgressBar('26.1');</script>
|
208
|
-
<dd class="spec passed"><span class="passed_spec_name">should start at the number specified</span></dd>
|
209
|
-
<script type="text/javascript">moveProgressBar('28.5');</script>
|
210
|
-
<dd class="spec passed"><span class="passed_spec_name">should only respond to the names of the defined symbols</span></dd>
|
195
|
+
<dt id="example_group_2">Context::PageView</dt>
|
196
|
+
<script type="text/javascript">moveProgressBar('14.8');</script>
|
197
|
+
<dd class="spec passed"><span class="passed_spec_name">should close the context when the view is closed</span></dd>
|
211
198
|
</dl>
|
212
199
|
</div>
|
213
200
|
<div class="example_group">
|
214
201
|
<dl>
|
215
|
-
<dt id="example_group_3">Context::Gtk::
|
216
|
-
<script type="text/javascript">moveProgressBar('
|
217
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
218
|
-
<script type="text/javascript">moveProgressBar('
|
219
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
202
|
+
<dt id="example_group_3">Context::Gtk::PageView</dt>
|
203
|
+
<script type="text/javascript">moveProgressBar('18.5');</script>
|
204
|
+
<dd class="spec passed"><span class="passed_spec_name">should have a widget when initialized</span></dd>
|
205
|
+
<script type="text/javascript">moveProgressBar('22.2');</script>
|
206
|
+
<dd class="spec passed"><span class="passed_spec_name">should add widgets from another view when added</span></dd>
|
207
|
+
<script type="text/javascript">moveProgressBar('25.9');</script>
|
208
|
+
<dd class="spec passed"><span class="passed_spec_name">should remove widgets from another view when removed</span></dd>
|
209
|
+
<script type="text/javascript">moveProgressBar('29.6');</script>
|
210
|
+
<dd class="spec passed"><span class="passed_spec_name">should react to destroy signals</span></dd>
|
220
211
|
</dl>
|
221
212
|
</div>
|
222
213
|
<div class="example_group">
|
223
214
|
<dl>
|
224
|
-
<dt id="example_group_4">Context::
|
225
|
-
<script type="text/javascript">moveProgressBar('
|
226
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
227
|
-
<script type="text/javascript">moveProgressBar('38.0');</script>
|
228
|
-
<dd class="spec passed"><span class="passed_spec_name">should convert characters with no modifier and back</span></dd>
|
229
|
-
<script type="text/javascript">moveProgressBar('40.4');</script>
|
230
|
-
<dd class="spec passed"><span class="passed_spec_name">should create a null character if it doesn't know how to make it</span></dd>
|
215
|
+
<dt id="example_group_4">Context::Bridge</dt>
|
216
|
+
<script type="text/javascript">moveProgressBar('33.3');</script>
|
217
|
+
<dd class="spec passed"><span class="passed_spec_name">should reference classes in the namespace provided</span></dd>
|
231
218
|
</dl>
|
232
219
|
</div>
|
233
220
|
<div class="example_group">
|
234
221
|
<dl>
|
235
|
-
<dt id="example_group_5">Context::
|
236
|
-
<script type="text/javascript">moveProgressBar('
|
237
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
238
|
-
<script type="text/javascript">moveProgressBar('
|
239
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
240
|
-
<script type="text/javascript">moveProgressBar('
|
241
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
222
|
+
<dt id="example_group_5">Context::Publisher</dt>
|
223
|
+
<script type="text/javascript">moveProgressBar('37.0');</script>
|
224
|
+
<dd class="spec passed"><span class="passed_spec_name">should have a source</span></dd>
|
225
|
+
<script type="text/javascript">moveProgressBar('40.7');</script>
|
226
|
+
<dd class="spec passed"><span class="passed_spec_name">should be able to subscribe to a publisher</span></dd>
|
227
|
+
<script type="text/javascript">moveProgressBar('44.4');</script>
|
228
|
+
<dd class="spec passed"><span class="passed_spec_name">should be able to update streams that aren't subscribed to</span></dd>
|
229
|
+
<script type="text/javascript">moveProgressBar('48.1');</script>
|
230
|
+
<dd class="spec passed"><span class="passed_spec_name">should be able to subscribe multiple targets to a publisher</span></dd>
|
231
|
+
<script type="text/javascript">moveProgressBar('51.8');</script>
|
232
|
+
<dd class="spec passed"><span class="passed_spec_name">should be able to change the source</span></dd>
|
242
233
|
</dl>
|
243
234
|
</div>
|
244
235
|
<div class="example_group">
|
245
236
|
<dl>
|
246
|
-
<dt id="example_group_6">Context::
|
247
|
-
<script type="text/javascript">moveProgressBar('
|
248
|
-
<dd class="spec passed"><span class="passed_spec_name">should have
|
249
|
-
<script type="text/javascript">moveProgressBar('
|
250
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
237
|
+
<dt id="example_group_6">Context::Context</dt>
|
238
|
+
<script type="text/javascript">moveProgressBar('55.5');</script>
|
239
|
+
<dd class="spec passed"><span class="passed_spec_name">should not have a parent set on creation</span></dd>
|
240
|
+
<script type="text/javascript">moveProgressBar('59.2');</script>
|
241
|
+
<dd class="spec passed"><span class="passed_spec_name">should set the parent on entry</span></dd>
|
242
|
+
<script type="text/javascript">moveProgressBar('62.9');</script>
|
243
|
+
<dd class="spec passed"><span class="passed_spec_name">should add new views to the main view</span></dd>
|
244
|
+
<script type="text/javascript">moveProgressBar('66.6');</script>
|
245
|
+
<dd class="spec passed"><span class="passed_spec_name">should remove views on exit</span></dd>
|
246
|
+
<script type="text/javascript">moveProgressBar('70.3');</script>
|
247
|
+
<dd class="spec passed"><span class="passed_spec_name">should create the views on entry</span></dd>
|
248
|
+
<script type="text/javascript">moveProgressBar('74.0');</script>
|
249
|
+
<dd class="spec passed"><span class="passed_spec_name">should destroy the views on exit</span></dd>
|
250
|
+
<script type="text/javascript">moveProgressBar('77.7');</script>
|
251
|
+
<dd class="spec passed"><span class="passed_spec_name">should keep track if the context has been entered or not</span></dd>
|
251
252
|
</dl>
|
252
253
|
</div>
|
253
254
|
<div class="example_group">
|
254
255
|
<dl>
|
255
256
|
<dt id="example_group_7">Kernel</dt>
|
256
|
-
<script type="text/javascript">moveProgressBar('
|
257
|
+
<script type="text/javascript">moveProgressBar('81.4');</script>
|
257
258
|
<dd class="spec passed"><span class="passed_spec_name">should have a unit test for require_all</span></dd>
|
258
259
|
</dl>
|
259
260
|
</div>
|
260
261
|
<div class="example_group">
|
261
262
|
<dl>
|
262
|
-
<dt id="example_group_8">Context::
|
263
|
-
<script type="text/javascript">moveProgressBar('
|
264
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
265
|
-
|
266
|
-
</
|
267
|
-
<div class="example_group">
|
268
|
-
<dl>
|
269
|
-
<dt id="example_group_9">Context::View</dt>
|
270
|
-
<script type="text/javascript">moveProgressBar('59.5');</script>
|
271
|
-
<dd class="spec passed"><span class="passed_spec_name">should set the context on creation</span></dd>
|
272
|
-
<script type="text/javascript">moveProgressBar('61.9');</script>
|
273
|
-
<dd class="spec passed"><span class="passed_spec_name">should use the widgets to add a view</span></dd>
|
274
|
-
<script type="text/javascript">moveProgressBar('64.2');</script>
|
275
|
-
<dd class="spec passed"><span class="passed_spec_name">should use the widgets to remove a view</span></dd>
|
276
|
-
<script type="text/javascript">moveProgressBar('66.6');</script>
|
277
|
-
<dd class="spec passed"><span class="passed_spec_name">should pass key notifications on to the context</span></dd>
|
278
|
-
</dl>
|
279
|
-
</div>
|
280
|
-
<div class="example_group">
|
281
|
-
<dl>
|
282
|
-
<dt id="example_group_10">Context::KeyAssignment</dt>
|
283
|
-
<script type="text/javascript">moveProgressBar('69.0');</script>
|
284
|
-
<dd class="spec passed"><span class="passed_spec_name">should have a key and a proc</span></dd>
|
285
|
-
</dl>
|
286
|
-
</div>
|
287
|
-
<div class="example_group">
|
288
|
-
<dl>
|
289
|
-
<dt id="example_group_11">Context::KeyMap</dt>
|
290
|
-
<script type="text/javascript">moveProgressBar('71.4');</script>
|
291
|
-
<dd class="spec passed"><span class="passed_spec_name">should be able to contain a KeyAssignment</span></dd>
|
292
|
-
<script type="text/javascript">moveProgressBar('73.8');</script>
|
293
|
-
<dd class="spec passed"><span class="passed_spec_name">should be able to contain many KeyAssignments</span></dd>
|
294
|
-
<script type="text/javascript">moveProgressBar('76.1');</script>
|
295
|
-
<dd class="spec passed"><span class="passed_spec_name">should be able to press a key</span></dd>
|
296
|
-
<script type="text/javascript">moveProgressBar('78.5');</script>
|
297
|
-
<dd class="spec passed"><span class="passed_spec_name">should return false if a non-handled key is pressed</span></dd>
|
298
|
-
</dl>
|
299
|
-
</div>
|
300
|
-
<div class="example_group">
|
301
|
-
<dl>
|
302
|
-
<dt id="example_group_12">Context::Gtk::PageView</dt>
|
303
|
-
<script type="text/javascript">moveProgressBar('80.9');</script>
|
304
|
-
<dd class="spec passed"><span class="passed_spec_name">should have a widget when initialized</span></dd>
|
305
|
-
<script type="text/javascript">moveProgressBar('83.3');</script>
|
306
|
-
<dd class="spec passed"><span class="passed_spec_name">should show the widgets when opened</span></dd>
|
307
|
-
<script type="text/javascript">moveProgressBar('85.7');</script>
|
308
|
-
<dd class="spec passed"><span class="passed_spec_name">should add widgets from another view when added</span></dd>
|
309
|
-
<script type="text/javascript">moveProgressBar('88.0');</script>
|
310
|
-
<dd class="spec passed"><span class="passed_spec_name">should remove widgets from another view when removed</span></dd>
|
311
|
-
<script type="text/javascript">moveProgressBar('90.4');</script>
|
312
|
-
<dd class="spec passed"><span class="passed_spec_name">should react to destroy signals</span></dd>
|
263
|
+
<dt id="example_group_8">Context::Gtk::App</dt>
|
264
|
+
<script type="text/javascript">moveProgressBar('85.1');</script>
|
265
|
+
<dd class="spec passed"><span class="passed_spec_name">should start the Gtk main loop when run</span></dd>
|
266
|
+
<script type="text/javascript">moveProgressBar('88.8');</script>
|
267
|
+
<dd class="spec passed"><span class="passed_spec_name">should quit the Gtk main loop when quit</span></dd>
|
313
268
|
</dl>
|
314
269
|
</div>
|
315
270
|
<div class="example_group">
|
316
271
|
<dl>
|
317
|
-
<dt id="
|
318
|
-
<script type="text/javascript">moveProgressBar('92.
|
319
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
272
|
+
<dt id="example_group_9">Context::Gtk::Widget</dt>
|
273
|
+
<script type="text/javascript">moveProgressBar('92.5');</script>
|
274
|
+
<dd class="spec passed"><span class="passed_spec_name">should add and show the widget when add is called.</span></dd>
|
275
|
+
<script type="text/javascript">moveProgressBar('96.2');</script>
|
276
|
+
<dd class="spec passed"><span class="passed_spec_name">should remove the widget, reshow the container when removed is called.</span></dd>
|
277
|
+
<script type="text/javascript">moveProgressBar('100.0');</script>
|
278
|
+
<dd class="spec passed"><span class="passed_spec_name">should keep track of the main Window</span></dd>
|
320
279
|
</dl>
|
321
280
|
</div>
|
322
281
|
<div class="example_group">
|
323
282
|
<dl>
|
324
|
-
<dt id="
|
325
|
-
<script type="text/javascript">moveProgressBar('
|
326
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
327
|
-
<script type="text/javascript">moveProgressBar('
|
328
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
283
|
+
<dt id="example_group_10">Context::Gtk::App</dt>
|
284
|
+
<script type="text/javascript">moveProgressBar('103.7');</script>
|
285
|
+
<dd class="spec passed"><span class="passed_spec_name">should start the Gtk main loop when run</span></dd>
|
286
|
+
<script type="text/javascript">moveProgressBar('107.4');</script>
|
287
|
+
<dd class="spec passed"><span class="passed_spec_name">should quit the Gtk main loop when quit</span></dd>
|
329
288
|
</dl>
|
330
289
|
</div>
|
331
290
|
<div class="example_group">
|
332
291
|
<dl>
|
333
|
-
<dt id="
|
334
|
-
<script type="text/javascript">moveProgressBar('
|
335
|
-
<dd class="spec passed"><span class="passed_spec_name">should
|
292
|
+
<dt id="example_group_11">Context::Gtk::Widget</dt>
|
293
|
+
<script type="text/javascript">moveProgressBar('111.1');</script>
|
294
|
+
<dd class="spec passed"><span class="passed_spec_name">should add and show the widget when add is called.</span></dd>
|
295
|
+
<script type="text/javascript">moveProgressBar('114.8');</script>
|
296
|
+
<dd class="spec passed"><span class="passed_spec_name">should remove the widget, reshow the container when removed is called.</span></dd>
|
297
|
+
<script type="text/javascript">moveProgressBar('118.5');</script>
|
298
|
+
<dd class="spec passed"><span class="passed_spec_name">should keep track of the main Window</span></dd>
|
336
299
|
</dl>
|
337
300
|
</div>
|
338
|
-
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0.
|
339
|
-
<script type="text/javascript">document.getElementById('totals').innerHTML = "
|
301
|
+
<script type="text/javascript">document.getElementById('duration').innerHTML = "Finished in <strong>0.069648 seconds</strong>";</script>
|
302
|
+
<script type="text/javascript">document.getElementById('totals').innerHTML = "32 examples, 0 failures";</script>
|
340
303
|
</div>
|
341
304
|
</div>
|
342
305
|
</body>
|