context 0.0.16 → 0.0.22

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.
Files changed (117) hide show
  1. data/AUTHORS +1 -0
  2. data/COPYING +679 -0
  3. data/README +188 -0
  4. data/Rakefile.rb +64 -18
  5. data/lib/Context/Bridge.rb +7 -6
  6. data/lib/Context/Context.rb +14 -35
  7. data/lib/Context/Gtk/Widget.rb +139 -33
  8. data/lib/Context/Log.rb +10 -0
  9. data/lib/Context/Publisher.rb +108 -0
  10. data/lib/Context/Spec.rb +8 -0
  11. data/lib/Context/Version.rb +1 -1
  12. data/lib/Context/View.rb +16 -15
  13. data/lib/Context/Views/Gtk/PageView.rb +3 -23
  14. data/lib/Context/Views/Gtk/Widgets/MainWindow.rb +70 -0
  15. data/lib/Context/Views/Gtk/Widgets/VBox.rb +29 -0
  16. data/lib/Context/Widget.rb +18 -27
  17. data/spec/Context/Bridge_spec.rb +19 -20
  18. data/spec/Context/Context_spec.rb +77 -63
  19. data/spec/Context/Gtk/Widget_spec.rb +23 -23
  20. data/spec/Context/Publisher_spec.rb +53 -0
  21. data/spec/Context/View_spec.rb +10 -14
  22. data/spec/Context/Views/Gtk/PageView_spec.rb +25 -9
  23. data/spec/Context/require_all_spec.rb +14 -7
  24. data/test_results.html +84 -121
  25. metadata +74 -128
  26. data/coverage/-usr-local-lib-site_ruby-1_8-atk_rb.html +0 -612
  27. data/coverage/-usr-local-lib-site_ruby-1_8-gdk_pixbuf2_rb.html +0 -637
  28. data/coverage/-usr-local-lib-site_ruby-1_8-glib2_rb.html +0 -829
  29. data/coverage/-usr-local-lib-site_ruby-1_8-gtk2-base_rb.html +0 -709
  30. data/coverage/-usr-local-lib-site_ruby-1_8-gtk2_rb.html +0 -623
  31. data/coverage/-usr-local-lib-site_ruby-1_8-pango_rb.html +0 -665
  32. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-color_rb.html +0 -865
  33. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-colors_rb.html +0 -1266
  34. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-constants_rb.html +0 -632
  35. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-blur_rb.html +0 -655
  36. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-circle_rb.html +0 -619
  37. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-color_rb.html +0 -621
  38. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-path_rb.html +0 -726
  39. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-rectangle_rb.html +0 -643
  40. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-triangle_rb.html +0 -622
  41. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context_rb.html +0 -639
  42. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-paper_rb.html +0 -793
  43. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-papers_rb.html +0 -651
  44. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-path_rb.html +0 -625
  45. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-point_rb.html +0 -617
  46. data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo_rb.html +0 -756
  47. data/coverage/index.html +0 -1170
  48. data/coverage/lib-Context-Bridge_rb.html +0 -673
  49. data/coverage/lib-Context-Context_rb.html +0 -756
  50. data/coverage/lib-Context-EnumeratedType_rb.html +0 -661
  51. data/coverage/lib-Context-ExecutionProxy_rb.html +0 -671
  52. data/coverage/lib-Context-Gtk-App_rb.html +0 -638
  53. data/coverage/lib-Context-Gtk-Key_rb.html +0 -664
  54. data/coverage/lib-Context-Gtk-Widget_rb.html +0 -667
  55. data/coverage/lib-Context-KeyAssignment_rb.html +0 -641
  56. data/coverage/lib-Context-KeyMap_rb.html +0 -653
  57. data/coverage/lib-Context-Key_rb.html +0 -667
  58. data/coverage/lib-Context-View_rb.html +0 -659
  59. data/coverage/lib-Context-Views-Gtk-PageView_rb.html +0 -660
  60. data/coverage/lib-Context-Views-PageView_rb.html +0 -627
  61. data/coverage/lib-Context-Widget_rb.html +0 -650
  62. data/coverage/lib-Context-require_all_rb.html +0 -623
  63. data/doc/classes/Context.html +0 -174
  64. data/doc/classes/Context/Bridge.html +0 -296
  65. data/doc/classes/Context/Context.html +0 -564
  66. data/doc/classes/Context/EnumeratedType.html +0 -283
  67. data/doc/classes/Context/ExecutionProxy.html +0 -228
  68. data/doc/classes/Context/Gtk.html +0 -126
  69. data/doc/classes/Context/Gtk/App.html +0 -217
  70. data/doc/classes/Context/Gtk/Key.html +0 -292
  71. data/doc/classes/Context/Gtk/PageView.html +0 -245
  72. data/doc/classes/Context/Gtk/PageView/MainWindow.html +0 -200
  73. data/doc/classes/Context/Gtk/Widget.html +0 -311
  74. data/doc/classes/Context/Key.html +0 -305
  75. data/doc/classes/Context/Key/Modifier.html +0 -117
  76. data/doc/classes/Context/KeyAssignment.html +0 -234
  77. data/doc/classes/Context/KeyMap.html +0 -273
  78. data/doc/classes/Context/PageView.html +0 -180
  79. data/doc/classes/Context/View.html +0 -334
  80. data/doc/classes/Context/Widget.html +0 -298
  81. data/doc/classes/Kernel.html +0 -148
  82. data/doc/classes/Object.html +0 -196
  83. data/doc/created.rid +0 -1
  84. data/doc/files/lib/Context/Bridge_rb.html +0 -108
  85. data/doc/files/lib/Context/Context_rb.html +0 -109
  86. data/doc/files/lib/Context/EnumeratedType_rb.html +0 -101
  87. data/doc/files/lib/Context/ExecutionProxy_rb.html +0 -101
  88. data/doc/files/lib/Context/Gtk/App_rb.html +0 -110
  89. data/doc/files/lib/Context/Gtk/Key_rb.html +0 -109
  90. data/doc/files/lib/Context/Gtk/Widget_rb.html +0 -109
  91. data/doc/files/lib/Context/KeyAssignment_rb.html +0 -108
  92. data/doc/files/lib/Context/KeyMap_rb.html +0 -109
  93. data/doc/files/lib/Context/Key_rb.html +0 -108
  94. data/doc/files/lib/Context/Version_rb.html +0 -101
  95. data/doc/files/lib/Context/View_rb.html +0 -101
  96. data/doc/files/lib/Context/Views/Gtk/PageView_rb.html +0 -111
  97. data/doc/files/lib/Context/Views/PageView_rb.html +0 -108
  98. data/doc/files/lib/Context/Widget_rb.html +0 -101
  99. data/doc/files/lib/Context/require_all_rb.html +0 -101
  100. data/doc/fr_class_index.html +0 -46
  101. data/doc/fr_file_index.html +0 -42
  102. data/doc/fr_method_index.html +0 -103
  103. data/doc/index.html +0 -24
  104. data/doc/rdoc-style.css +0 -208
  105. data/lib/Context/EnumeratedType.rb +0 -51
  106. data/lib/Context/ExecutionProxy.rb +0 -61
  107. data/lib/Context/Gtk/Key.rb +0 -54
  108. data/lib/Context/Key.rb +0 -57
  109. data/lib/Context/KeyAssignment.rb +0 -31
  110. data/lib/Context/KeyMap.rb +0 -43
  111. data/spec/Context/EnumeratedType_spec.rb +0 -51
  112. data/spec/Context/ExecutionProxy_spec.rb +0 -28
  113. data/spec/Context/Gtk/Key_spec.rb +0 -45
  114. data/spec/Context/KeyAssignment_spec.rb +0 -26
  115. data/spec/Context/KeyMap_spec.rb +0 -64
  116. data/spec/Context/Key_spec.rb +0 -22
  117. 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
- module Context
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
- class TestContext < Context
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
- describe Context do
18
-
19
- before(:each) do
20
- @bridge = Bridge.new(TestContext)
21
- @parent = TestContext.new(@bridge)
22
- @context = TestContext.new(@bridge)
23
- end
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
- it "should not have a parent set on creation" do
26
- @context.parent.should be_nil
27
- end
51
+ it "should not have a parent set on creation" do
52
+ @context.parent.should be_nil
53
+ end
28
54
 
29
- it "should set the parent on entry" do
30
- @parent.createViews
31
- @parent.should_receive(:addView)
32
- @context.enter(@parent)
33
- @context.parent.should equal(@parent)
34
- end
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
- it "should add new views to the main view" do
37
- newContext = TestContext.new(@bridge)
38
- newContext.createViews
39
- @context.createViews
40
- @context.mainView.should_receive(:addView).with(newContext.mainView)
41
-
42
- @context.addView(newContext.mainView)
43
- end
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
- @parent.should_receive(:addView)
74
+ @parent.should_receive(:addView)
49
75
  @context.enter(@parent)
50
76
  @context.exit
51
77
  end
52
78
 
53
- it "should be able to set key bindings" do
54
- key = Key.new(Key::Modifier.Control, 'k')
55
- exit = Proc.new do
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
- @context.getKeyBinding(key).should be_nil
59
- @context.setKeyBinding(key, &exit)
60
- @context.getKeyBinding(key).should be(exit)
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
- @context.should_receive(:setupViews).exactly(2).times do
77
- @context.createViews
78
- end
79
- @parent.should_receive(:addView)
80
- @context.enter(@parent)
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
- @context.should_receive(:destroyViews)
83
- @context.exit
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
- @context.should_receive(:setupViews).exactly(2).times do
89
- @context.createViews
90
- end
91
- @parent.should_receive(:addView)
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
- @context.should_receive(:destroyViews)
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 = Context::Gtk::Widget.new(mock("Gtk::Widget"))
9
- @newWidget = Context::Gtk::Widget.new(mock("Gtk::Widget"))
10
- @oldWidget = Context::Gtk::Widget.new(mock("Gtk::Widget"))
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.delegate.should_receive(:add).with(@newWidget.delegate)
15
- @widget.delegate.should_receive(:show_all)
16
- @widget.add(@newWidget)
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 and grab focus when removed is called." do
20
- @widget.delegate.should_receive(:remove).with(@oldWidget.delegate)
21
- @widget.delegate.should_receive(:show_all)
22
- @widget.delegate.should_receive(:grab_focus)
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.mainWindow.should be_nil
30
+ @widget.gtkWidgetMainWindow.should be_nil
28
31
  @widget.isAMainWindow
29
- @widget.mainWindow.should be_eql(@widget.delegate)
32
+ @widget.gtkWidgetMainWindow.should be_eql(@widget)
30
33
 
31
- @widget.delegate.should_receive(:add).with(@newWidget.delegate)
32
- @widget.delegate.should_receive(:show_all).exactly(2).times
33
- @widget.add(@newWidget)
34
- @newWidget.mainWindow.should be_eql(@widget.delegate)
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.delegate.should_receive(:remove).with(@newWidget.delegate)
37
- @widget.delegate.should_receive(:grab_focus)
38
- @widget.remove(@newWidget)
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
@@ -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(:add).with(newWidget)
41
- newWidget.should_receive(:addedTo).with(@widget)
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(:remove).with(oldWidget)
52
- oldWidget.should_receive(:removedFrom).with(@widget)
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 = @bridge.PageView.new(newContext)
27
- @view.getWidget().should_receive(:add).with(newView.getWidget)
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 = @bridge.PageView.new(oldContext)
34
- @view.getWidget().should_receive(:remove).with(oldView.getWidget)
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
- describe Kernel do
5
+ module Context::Spec::Require_AllStory
6
+ describe Kernel do
5
7
 
6
- it "should have a unit test for require_all" do
7
- require_all 'Context/Gtk/*'
8
- Context::Gtk::App.new(Context, Context::Context).should_not be_nil
9
- Context::Gtk::Key.new(mock("Modifier"), mock("Character")).should_not be_nil
10
- Context::Gtk::Widget.new(mock("Delegate")).should_not be_nil
11
- end
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
 
@@ -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
- <h1>RSpec Results</h1>
171
+ <div id="label">
172
+ <h1>RSpec Code Examples</h1>
173
+ </div>
171
174
 
172
175
  <div id="summary">
173
176
  <p id="totals">&nbsp;</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::Context</dt>
182
- <script type="text/javascript">moveProgressBar('2.3');</script>
183
- <dd class="spec passed"><span class="passed_spec_name">should not have a parent set on creation</span></dd>
184
- <script type="text/javascript">moveProgressBar('4.7');</script>
185
- <dd class="spec passed"><span class="passed_spec_name">should set the parent on entry</span></dd>
186
- <script type="text/javascript">moveProgressBar('7.1');</script>
187
- <dd class="spec passed"><span class="passed_spec_name">should add new views to the main view</span></dd>
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::EnumeratedType</dt>
203
- <script type="text/javascript">moveProgressBar('21.4');</script>
204
- <dd class="spec passed"><span class="passed_spec_name">should start at 0 by default</span></dd>
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::App</dt>
216
- <script type="text/javascript">moveProgressBar('30.9');</script>
217
- <dd class="spec passed"><span class="passed_spec_name">should start the Gtk main loop when run</span></dd>
218
- <script type="text/javascript">moveProgressBar('33.3');</script>
219
- <dd class="spec passed"><span class="passed_spec_name">should quit the Gtk main loop when quit</span></dd>
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::Gtk::Key</dt>
225
- <script type="text/javascript">moveProgressBar('35.7');</script>
226
- <dd class="spec passed"><span class="passed_spec_name">should have a factory method to convert from a GTK KeyPressEvent and back</span></dd>
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::Gtk::Widget</dt>
236
- <script type="text/javascript">moveProgressBar('42.8');</script>
237
- <dd class="spec passed"><span class="passed_spec_name">should add and show the widget when add is called.</span></dd>
238
- <script type="text/javascript">moveProgressBar('45.2');</script>
239
- <dd class="spec passed"><span class="passed_spec_name">should remove the widget, reshow the container and grab focus when removed is called.</span></dd>
240
- <script type="text/javascript">moveProgressBar('47.6');</script>
241
- <dd class="spec passed"><span class="passed_spec_name">should keep track of the main Window</span></dd>
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::Key</dt>
247
- <script type="text/javascript">moveProgressBar('50.0');</script>
248
- <dd class="spec passed"><span class="passed_spec_name">should have unique hash values</span></dd>
249
- <script type="text/javascript">moveProgressBar('52.3');</script>
250
- <dd class="spec passed"><span class="passed_spec_name">should produce the same hash for equivalent values</span></dd>
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('54.7');</script>
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::Widget</dt>
263
- <script type="text/javascript">moveProgressBar('57.1');</script>
264
- <dd class="spec passed"><span class="passed_spec_name">should do equivalence based on the delagate in the widget</span></dd>
265
- </dl>
266
- </div>
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="example_group_13">Context::PageView</dt>
318
- <script type="text/javascript">moveProgressBar('92.8');</script>
319
- <dd class="spec passed"><span class="passed_spec_name">should close the context when the view is closed</span></dd>
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="example_group_14">Context::ExecutionProxy</dt>
325
- <script type="text/javascript">moveProgressBar('95.2');</script>
326
- <dd class="spec passed"><span class="passed_spec_name">should execute methods</span></dd>
327
- <script type="text/javascript">moveProgressBar('97.6');</script>
328
- <dd class="spec passed"><span class="passed_spec_name">should execute code blocks</span></dd>
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="example_group_15">Context::Bridge</dt>
334
- <script type="text/javascript">moveProgressBar('100.0');</script>
335
- <dd class="spec passed"><span class="passed_spec_name">should reference classes in the namespace provided</span></dd>
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.086622 seconds</strong>";</script>
339
- <script type="text/javascript">document.getElementById('totals').innerHTML = "42 examples, 0 failures";</script>
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>