context 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile.rb +107 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-atk_rb.html +612 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-gdk_pixbuf2_rb.html +637 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-glib2_rb.html +829 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-gtk2-base_rb.html +709 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-gtk2_rb.html +623 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-pango_rb.html +665 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-color_rb.html +865 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-colors_rb.html +1266 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-constants_rb.html +632 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-blur_rb.html +655 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-circle_rb.html +619 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-color_rb.html +621 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-path_rb.html +726 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-rectangle_rb.html +643 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-triangle_rb.html +622 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context_rb.html +639 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-paper_rb.html +793 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-papers_rb.html +651 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-path_rb.html +625 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-point_rb.html +617 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo_rb.html +756 -0
- data/coverage/index.html +1170 -0
- data/coverage/lib-Context-Bridge_rb.html +673 -0
- data/coverage/lib-Context-Context_rb.html +756 -0
- data/coverage/lib-Context-EnumeratedType_rb.html +661 -0
- data/coverage/lib-Context-ExecutionProxy_rb.html +671 -0
- data/coverage/lib-Context-Gtk-App_rb.html +638 -0
- data/coverage/lib-Context-Gtk-Key_rb.html +664 -0
- data/coverage/lib-Context-Gtk-Widget_rb.html +667 -0
- data/coverage/lib-Context-KeyAssignment_rb.html +641 -0
- data/coverage/lib-Context-KeyMap_rb.html +653 -0
- data/coverage/lib-Context-Key_rb.html +667 -0
- data/coverage/lib-Context-View_rb.html +659 -0
- data/coverage/lib-Context-Views-Gtk-PageView_rb.html +660 -0
- data/coverage/lib-Context-Views-PageView_rb.html +627 -0
- data/coverage/lib-Context-Widget_rb.html +650 -0
- data/coverage/lib-Context-require_all_rb.html +623 -0
- data/doc/classes/Context.html +174 -0
- data/doc/classes/Context/Bridge.html +296 -0
- data/doc/classes/Context/Context.html +564 -0
- data/doc/classes/Context/EnumeratedType.html +283 -0
- data/doc/classes/Context/ExecutionProxy.html +228 -0
- data/doc/classes/Context/Gtk.html +126 -0
- data/doc/classes/Context/Gtk/App.html +217 -0
- data/doc/classes/Context/Gtk/Key.html +292 -0
- data/doc/classes/Context/Gtk/PageView.html +245 -0
- data/doc/classes/Context/Gtk/PageView/MainWindow.html +200 -0
- data/doc/classes/Context/Gtk/Widget.html +311 -0
- data/doc/classes/Context/Key.html +305 -0
- data/doc/classes/Context/Key/Modifier.html +117 -0
- data/doc/classes/Context/KeyAssignment.html +234 -0
- data/doc/classes/Context/KeyMap.html +273 -0
- data/doc/classes/Context/PageView.html +180 -0
- data/doc/classes/Context/View.html +334 -0
- data/doc/classes/Context/Widget.html +298 -0
- data/doc/classes/Kernel.html +148 -0
- data/doc/classes/Object.html +196 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/Context/Bridge_rb.html +108 -0
- data/doc/files/lib/Context/Context_rb.html +109 -0
- data/doc/files/lib/Context/EnumeratedType_rb.html +101 -0
- data/doc/files/lib/Context/ExecutionProxy_rb.html +101 -0
- data/doc/files/lib/Context/Gtk/App_rb.html +110 -0
- data/doc/files/lib/Context/Gtk/Key_rb.html +109 -0
- data/doc/files/lib/Context/Gtk/Widget_rb.html +109 -0
- data/doc/files/lib/Context/KeyAssignment_rb.html +108 -0
- data/doc/files/lib/Context/KeyMap_rb.html +109 -0
- data/doc/files/lib/Context/Key_rb.html +108 -0
- data/doc/files/lib/Context/Version_rb.html +101 -0
- data/doc/files/lib/Context/View_rb.html +101 -0
- data/doc/files/lib/Context/Views/Gtk/PageView_rb.html +111 -0
- data/doc/files/lib/Context/Views/PageView_rb.html +108 -0
- data/doc/files/lib/Context/Widget_rb.html +101 -0
- data/doc/files/lib/Context/require_all_rb.html +101 -0
- data/doc/fr_class_index.html +46 -0
- data/doc/fr_file_index.html +42 -0
- data/doc/fr_method_index.html +103 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/Context/Bridge.rb +63 -0
- data/lib/Context/Context.rb +146 -0
- data/lib/Context/EnumeratedType.rb +51 -0
- data/lib/Context/ExecutionProxy.rb +61 -0
- data/lib/Context/Gtk/App.rb +28 -0
- data/lib/Context/Gtk/Key.rb +54 -0
- data/lib/Context/Gtk/Widget.rb +57 -0
- data/lib/Context/Key.rb +57 -0
- data/lib/Context/KeyAssignment.rb +31 -0
- data/lib/Context/KeyMap.rb +43 -0
- data/lib/Context/Version.rb +5 -0
- data/lib/Context/View.rb +49 -0
- data/lib/Context/Views/Gtk/PageView.rb +50 -0
- data/lib/Context/Views/PageView.rb +17 -0
- data/lib/Context/Widget.rb +40 -0
- data/lib/Context/require_all.rb +13 -0
- data/spec/Context/Bridge_spec.rb +40 -0
- data/spec/Context/Context_spec.rb +102 -0
- data/spec/Context/EnumeratedType_spec.rb +51 -0
- data/spec/Context/ExecutionProxy_spec.rb +28 -0
- data/spec/Context/Gtk/App_spec.rb +24 -0
- data/spec/Context/Gtk/Key_spec.rb +45 -0
- data/spec/Context/Gtk/Widget_spec.rb +44 -0
- data/spec/Context/KeyAssignment_spec.rb +26 -0
- data/spec/Context/KeyMap_spec.rb +64 -0
- data/spec/Context/Key_spec.rb +22 -0
- data/spec/Context/View_spec.rb +62 -0
- data/spec/Context/Views/Gtk/PageView_spec.rb +44 -0
- data/spec/Context/Views/PageView_spec.rb +20 -0
- data/spec/Context/Widget_spec.rb +15 -0
- data/spec/Context/require_all_spec.rb +13 -0
- data/test_results.html +343 -0
- metadata +179 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'Context/ExecutionProxy'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
|
5
|
+
describe ExecutionProxy do
|
6
|
+
|
7
|
+
it "should execute methods" do
|
8
|
+
a = nil
|
9
|
+
a.unless_nil.fake.should be(nil)
|
10
|
+
|
11
|
+
a = 5
|
12
|
+
a.unless_nil.self.should be(5)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should execute code blocks" do
|
16
|
+
a = nil
|
17
|
+
a.unless_nil do
|
18
|
+
fake
|
19
|
+
end.should be(nil)
|
20
|
+
|
21
|
+
a = 5
|
22
|
+
a.unless_nil do
|
23
|
+
self
|
24
|
+
end.should be(5)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'Context/Gtk/App'
|
2
|
+
require 'gtk2'
|
3
|
+
|
4
|
+
module Context::Gtk
|
5
|
+
|
6
|
+
describe App do
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
Gtk.should_receive(:init)
|
10
|
+
@app = App.new(Context::Gtk, Context::Context)
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should start the Gtk main loop when run" do
|
14
|
+
Gtk.should_receive(:main)
|
15
|
+
@app.mainContext.should_receive(:enter)
|
16
|
+
@app.enter
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should quit the Gtk main loop when quit" do
|
20
|
+
Gtk.should_receive(:main_quit)
|
21
|
+
@app.exit
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'Context/Gtk/Key'
|
2
|
+
|
3
|
+
module Context::Gtk
|
4
|
+
|
5
|
+
describe Key do
|
6
|
+
|
7
|
+
it "should have a factory method to convert from a GTK KeyPressEvent and back" do
|
8
|
+
event = Gdk::EventKey.new(Gdk::Event::KEY_PRESS)
|
9
|
+
event.set_state(Gdk::Window::CONTROL_MASK)
|
10
|
+
event.set_keyval(Gdk::Keyval::GDK_o)
|
11
|
+
|
12
|
+
key = Key.createFromGtkEvent(event)
|
13
|
+
key.should_not be_nil
|
14
|
+
key.should eql(Key.new(Context::Key::Modifier::CONTROL, 'o'))
|
15
|
+
key.getGtkState.should be_eql(Gdk::Window::CONTROL_MASK)
|
16
|
+
key.getGtkKeyval.should be_eql(Gdk::Keyval::GDK_o)
|
17
|
+
e = key.createGtkEvent
|
18
|
+
e.state.should be_eql(Gdk::Window::CONTROL_MASK)
|
19
|
+
e.keyval.should be_eql(Gdk::Keyval::GDK_o)
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should convert characters with no modifier and back" do
|
23
|
+
event = Gdk::EventKey.new(Gdk::Event::KEY_PRESS)
|
24
|
+
event.set_state(0)
|
25
|
+
event.set_keyval(Gdk::Keyval::GDK_Tab)
|
26
|
+
|
27
|
+
key = Key.createFromGtkEvent(event)
|
28
|
+
key.should_not be_nil
|
29
|
+
key.should eql(Key.new(Context::Key::Modifier::NONE, 'Tab'))
|
30
|
+
e = key.createGtkEvent
|
31
|
+
e.state.should be_eql(0)
|
32
|
+
e.keyval.should be_eql(Gdk::Keyval::GDK_Tab)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should create a null character if it doesn't know how to make it" do
|
36
|
+
event = Gdk::EventKey.new(Gdk::Event::KEY_PRESS)
|
37
|
+
event.set_state(Gdk::Window::META_MASK)
|
38
|
+
event.set_keyval(Gdk::Keyval::GDK_q)
|
39
|
+
|
40
|
+
key = Key.createFromGtkEvent(event)
|
41
|
+
key.should_not be_nil
|
42
|
+
key.should be_null
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'Context/Gtk/Widget.rb'
|
2
|
+
|
3
|
+
module Context::Gtk
|
4
|
+
|
5
|
+
describe Widget do
|
6
|
+
|
7
|
+
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"))
|
11
|
+
end
|
12
|
+
|
13
|
+
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)
|
17
|
+
end
|
18
|
+
|
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)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should keep track of the main Window" do
|
27
|
+
@widget.mainWindow.should be_nil
|
28
|
+
@widget.isAMainWindow
|
29
|
+
@widget.mainWindow.should be_eql(@widget.delegate)
|
30
|
+
|
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)
|
35
|
+
|
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
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'Context/Key'
|
2
|
+
require 'Context/KeyAssignment'
|
3
|
+
|
4
|
+
module Context
|
5
|
+
|
6
|
+
describe KeyAssignment do
|
7
|
+
|
8
|
+
it "should have a key and a proc" do
|
9
|
+
run = false
|
10
|
+
ctlD = Key.new(Key::Modifier.CONTROL, 'd')
|
11
|
+
d = Key.new(Key::Modifier.NONE, 'd')
|
12
|
+
ka = KeyAssignment.new(ctlD) do
|
13
|
+
run = true
|
14
|
+
end
|
15
|
+
newCtlD = Key.new(Key::Modifier.CONTROL, 'd')
|
16
|
+
newD = Key.new(Key::Modifier.NONE, 'd')
|
17
|
+
ka.handles?(newD).should be(false)
|
18
|
+
ka.handles?(newCtlD).should be(true)
|
19
|
+
ka.try(newD).should be(false)
|
20
|
+
run.should be(false)
|
21
|
+
ka.try(newCtlD).should be(true)
|
22
|
+
run.should be(true)
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'Context/Key'
|
2
|
+
require 'Context/KeyAssignment'
|
3
|
+
require 'Context/KeyMap'
|
4
|
+
|
5
|
+
module Context
|
6
|
+
|
7
|
+
describe KeyMap do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@map = KeyMap.new
|
11
|
+
@ctlD = Key.new(Key::Modifier.CONTROL, 'd')
|
12
|
+
@ctlDPressed = false
|
13
|
+
@ctlDAssignment = KeyAssignment.new(@ctlD) do
|
14
|
+
@ctlDPressed = true
|
15
|
+
end
|
16
|
+
@d = Key.new(Key::Modifier.NONE, 'd')
|
17
|
+
@dPressed = false
|
18
|
+
@dAssignment = KeyAssignment.new(@ctlD) do
|
19
|
+
@dPressed = true
|
20
|
+
end
|
21
|
+
@newCtlD = Key.new(Key::Modifier.CONTROL, 'd')
|
22
|
+
@newD = Key.new(Key::Modifier.NONE, 'd')
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should be able to contain a KeyAssignment" do
|
26
|
+
@map.handles?(@newCtlD).should be(false)
|
27
|
+
@map.handles?(@newD).should be(false)
|
28
|
+
@map.add(@ctlDAssignment)
|
29
|
+
@map.handles?(@newCtlD).should be(true)
|
30
|
+
@map.handles?(@newD).should be(false)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should be able to contain many KeyAssignments" do
|
34
|
+
@map.handles?(@newCtlD).should be(false)
|
35
|
+
@map.handles?(@newD).should be(false)
|
36
|
+
@map.add(@ctlDAssignment)
|
37
|
+
@map.handles?(@newCtlD).should be(true)
|
38
|
+
@map.handles?(@newD).should be(false)
|
39
|
+
@map.add(@dAssignment)
|
40
|
+
@map.handles?(@newD).should be(false)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should be able to press a key" do
|
44
|
+
@map.add(@ctlDAssignment)
|
45
|
+
@map.add(@dAssignment)
|
46
|
+
@ctlDPressed.should be(false)
|
47
|
+
@dPressed.should be(false)
|
48
|
+
@map.press(@newCtlD).should be(true)
|
49
|
+
@ctlDPressed.should be(true)
|
50
|
+
@dPressed.should be(false)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "should return false if a non-handled key is pressed" do
|
54
|
+
@map.add(@ctlDAssignment)
|
55
|
+
@ctlDPressed.should be(false)
|
56
|
+
@dPressed.should be(false)
|
57
|
+
@map.handles?(@d).should be(false)
|
58
|
+
@map.press(@d).should be(false)
|
59
|
+
@dPressed.should be(false)
|
60
|
+
@ctlDPressed.should be(false)
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'Context/Key'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
|
5
|
+
describe Key do
|
6
|
+
|
7
|
+
it "should have unique hash values" do
|
8
|
+
key1 = Key.new(Key::Modifier.NONE, 'o')
|
9
|
+
key2 = Key.new(Key::Modifier.CONTROL, 'o')
|
10
|
+
key1.hash.should_not eql(key2.hash)
|
11
|
+
key3 = Key.new(Key::Modifier.CONTROL, 'n')
|
12
|
+
key2.hash.should_not eql(key3.hash)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should produce the same hash for equivalent values" do
|
16
|
+
key1 = Key.new(Key::Modifier.CONTROL, 'o')
|
17
|
+
key2 = Key.new(Key::Modifier.CONTROL, 'o')
|
18
|
+
key1.hash.should eql(key2.hash)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'Context/View'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
|
5
|
+
describe View do
|
6
|
+
|
7
|
+
# Since this is an abstract class, we need to override getWidget with
|
8
|
+
# something that does something
|
9
|
+
def overrideGetWidget(view)
|
10
|
+
def view.getWidget
|
11
|
+
@widget
|
12
|
+
end
|
13
|
+
def view.setWidget(widget)
|
14
|
+
@widget = widget
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
before(:each) do
|
19
|
+
@context = mock("Context")
|
20
|
+
@view = View.new(@context)
|
21
|
+
@widget = mock("Widget")
|
22
|
+
|
23
|
+
# Override the getWidget method
|
24
|
+
@view.getWidget.should be_nil
|
25
|
+
overrideGetWidget(@view)
|
26
|
+
@view.setWidget(@widget)
|
27
|
+
@view.getWidget.should be(@widget)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should set the context on creation" do
|
31
|
+
@view.context.should be(@context)
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should use the widgets to add a view" do
|
35
|
+
newView = View.new(@context)
|
36
|
+
overrideGetWidget(newView)
|
37
|
+
newWidget = mock("Widget")
|
38
|
+
newView.setWidget(newWidget)
|
39
|
+
|
40
|
+
@widget.should_receive(:add).with(newWidget)
|
41
|
+
newWidget.should_receive(:addedTo).with(@widget)
|
42
|
+
@view.addView(newView)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should use the widgets to remove a view" do
|
46
|
+
oldView = View.new(@context)
|
47
|
+
overrideGetWidget(oldView)
|
48
|
+
oldWidget = mock("Widget")
|
49
|
+
oldView.setWidget(oldWidget)
|
50
|
+
|
51
|
+
@widget.should_receive(:remove).with(oldWidget)
|
52
|
+
oldWidget.should_receive(:removedFrom).with(@widget)
|
53
|
+
@view.removeView(oldView)
|
54
|
+
end
|
55
|
+
|
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
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'Context/Bridge'
|
2
|
+
require 'Context/Context'
|
3
|
+
require 'Context/Views/Gtk/PageView'
|
4
|
+
|
5
|
+
module Context::Gtk
|
6
|
+
|
7
|
+
describe PageView do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@bridge = Context::Bridge.new(Context::Gtk)
|
11
|
+
@context = Context::Context.new(@bridge)
|
12
|
+
@view = @bridge.PageView.new(@context)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should have a widget when initialized" do
|
16
|
+
@view.getWidget.should_not be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should show the widgets when opened" do
|
20
|
+
@view.mainWindow.should_receive(:show_all)
|
21
|
+
@view.open
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should add widgets from another view when added" do
|
25
|
+
newContext = mock("Context::Context")
|
26
|
+
newView = @bridge.PageView.new(newContext)
|
27
|
+
@view.getWidget().should_receive(:add).with(newView.getWidget)
|
28
|
+
@view.addView(newView)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should remove widgets from another view when removed" do
|
32
|
+
oldContext = mock("Context::MainContext")
|
33
|
+
oldView = @bridge.PageView.new(oldContext)
|
34
|
+
@view.getWidget().should_receive(:remove).with(oldView.getWidget)
|
35
|
+
@view.removeView(oldView)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should react to destroy signals" do
|
39
|
+
@view.should_receive(:close)
|
40
|
+
@view.emitDestroyEvent
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'Context/Bridge'
|
2
|
+
require 'Context/Context'
|
3
|
+
require 'Context/Views/PageView'
|
4
|
+
|
5
|
+
module Context
|
6
|
+
|
7
|
+
describe PageView do
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
@bridge = Bridge.new(Context)
|
11
|
+
@context = Context.new(@bridge)
|
12
|
+
@view = @bridge.PageView.new(@context)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should close the context when the view is closed" do
|
16
|
+
@context.should_receive(:close)
|
17
|
+
@view.close
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'Context/Widget'
|
2
|
+
|
3
|
+
module Context
|
4
|
+
|
5
|
+
describe Widget do
|
6
|
+
|
7
|
+
it "should do equivalence based on the delagate in the widget" do
|
8
|
+
widget1 = Widget.new("Hello")
|
9
|
+
widget2 = Widget.new("Hello")
|
10
|
+
widget1.should eql(widget2)
|
11
|
+
widget3 = Widget.new("Goodbye")
|
12
|
+
widget3.should_not eql(widget2)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'Context/require_all'
|
2
|
+
require 'Context/Context'
|
3
|
+
|
4
|
+
describe Kernel do
|
5
|
+
|
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
|
12
|
+
end
|
13
|
+
|
data/test_results.html
ADDED
@@ -0,0 +1,343 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
5
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
6
|
+
<head>
|
7
|
+
<title>RSpec results</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
9
|
+
<meta http-equiv="Expires" content="-1" />
|
10
|
+
<meta http-equiv="Pragma" content="no-cache" />
|
11
|
+
<style type="text/css">
|
12
|
+
body {
|
13
|
+
margin: 0;
|
14
|
+
padding: 0;
|
15
|
+
background: #fff;
|
16
|
+
font-size: 80%;
|
17
|
+
}
|
18
|
+
</style>
|
19
|
+
</head>
|
20
|
+
<body>
|
21
|
+
<div class="rspec-report">
|
22
|
+
<script type="text/javascript">
|
23
|
+
// <![CDATA[
|
24
|
+
function moveProgressBar(percentDone) {
|
25
|
+
document.getElementById("rspec-header").style.width = percentDone +"%";
|
26
|
+
}
|
27
|
+
function makeRed(element_id) {
|
28
|
+
document.getElementById(element_id).style.background = '#C40D0D';
|
29
|
+
document.getElementById(element_id).style.color = '#FFFFFF';
|
30
|
+
}
|
31
|
+
|
32
|
+
function makeYellow(element_id) {
|
33
|
+
if (element_id == "rspec-header" && document.getElementById(element_id).style.background != '#C40D0D')
|
34
|
+
{
|
35
|
+
document.getElementById(element_id).style.background = '#FAF834';
|
36
|
+
document.getElementById(element_id).style.color = '#000000';
|
37
|
+
}
|
38
|
+
else
|
39
|
+
{
|
40
|
+
document.getElementById(element_id).style.background = '#FAF834';
|
41
|
+
document.getElementById(element_id).style.color = '#000000';
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
// ]]>
|
46
|
+
</script>
|
47
|
+
<style type="text/css">
|
48
|
+
#rspec-header {
|
49
|
+
background: #65C400; color: #fff;
|
50
|
+
}
|
51
|
+
|
52
|
+
.rspec-report h1 {
|
53
|
+
margin: 0px 10px 0px 10px;
|
54
|
+
padding: 10px;
|
55
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
56
|
+
font-size: 1.8em;
|
57
|
+
}
|
58
|
+
|
59
|
+
#summary {
|
60
|
+
margin: 0; padding: 5px 10px;
|
61
|
+
font-family: "Lucida Grande", Helvetica, sans-serif;
|
62
|
+
text-align: right;
|
63
|
+
position: absolute;
|
64
|
+
top: 0px;
|
65
|
+
right: 0px;
|
66
|
+
}
|
67
|
+
|
68
|
+
#summary p {
|
69
|
+
margin: 0 0 0 2px;
|
70
|
+
}
|
71
|
+
|
72
|
+
#summary #totals {
|
73
|
+
font-size: 1.2em;
|
74
|
+
}
|
75
|
+
|
76
|
+
.example_group {
|
77
|
+
margin: 0 10px 5px;
|
78
|
+
background: #fff;
|
79
|
+
}
|
80
|
+
|
81
|
+
dl {
|
82
|
+
margin: 0; padding: 0 0 5px;
|
83
|
+
font: normal 11px "Lucida Grande", Helvetica, sans-serif;
|
84
|
+
}
|
85
|
+
|
86
|
+
dt {
|
87
|
+
padding: 3px;
|
88
|
+
background: #65C400;
|
89
|
+
color: #fff;
|
90
|
+
font-weight: bold;
|
91
|
+
}
|
92
|
+
|
93
|
+
dd {
|
94
|
+
margin: 5px 0 5px 5px;
|
95
|
+
padding: 3px 3px 3px 18px;
|
96
|
+
}
|
97
|
+
|
98
|
+
dd.spec.passed {
|
99
|
+
border-left: 5px solid #65C400;
|
100
|
+
border-bottom: 1px solid #65C400;
|
101
|
+
background: #DBFFB4; color: #3D7700;
|
102
|
+
}
|
103
|
+
|
104
|
+
dd.spec.failed {
|
105
|
+
border-left: 5px solid #C20000;
|
106
|
+
border-bottom: 1px solid #C20000;
|
107
|
+
color: #C20000; background: #FFFBD3;
|
108
|
+
}
|
109
|
+
|
110
|
+
dd.spec.not_implemented {
|
111
|
+
border-left: 5px solid #FAF834;
|
112
|
+
border-bottom: 1px solid #FAF834;
|
113
|
+
background: #FCFB98; color: #131313;
|
114
|
+
}
|
115
|
+
|
116
|
+
dd.spec.pending_fixed {
|
117
|
+
border-left: 5px solid #0000C2;
|
118
|
+
border-bottom: 1px solid #0000C2;
|
119
|
+
color: #0000C2; background: #D3FBFF;
|
120
|
+
}
|
121
|
+
|
122
|
+
.backtrace {
|
123
|
+
color: #000;
|
124
|
+
font-size: 12px;
|
125
|
+
}
|
126
|
+
|
127
|
+
a {
|
128
|
+
color: #BE5C00;
|
129
|
+
}
|
130
|
+
|
131
|
+
/* Ruby code, style similar to vibrant ink */
|
132
|
+
.ruby {
|
133
|
+
font-size: 12px;
|
134
|
+
font-family: monospace;
|
135
|
+
color: white;
|
136
|
+
background-color: black;
|
137
|
+
padding: 0.1em 0 0.2em 0;
|
138
|
+
}
|
139
|
+
|
140
|
+
.ruby .keyword { color: #FF6600; }
|
141
|
+
.ruby .constant { color: #339999; }
|
142
|
+
.ruby .attribute { color: white; }
|
143
|
+
.ruby .global { color: white; }
|
144
|
+
.ruby .module { color: white; }
|
145
|
+
.ruby .class { color: white; }
|
146
|
+
.ruby .string { color: #66FF00; }
|
147
|
+
.ruby .ident { color: white; }
|
148
|
+
.ruby .method { color: #FFCC00; }
|
149
|
+
.ruby .number { color: white; }
|
150
|
+
.ruby .char { color: white; }
|
151
|
+
.ruby .comment { color: #9933CC; }
|
152
|
+
.ruby .symbol { color: white; }
|
153
|
+
.ruby .regex { color: #44B4CC; }
|
154
|
+
.ruby .punct { color: white; }
|
155
|
+
.ruby .escape { color: white; }
|
156
|
+
.ruby .interp { color: white; }
|
157
|
+
.ruby .expr { color: white; }
|
158
|
+
|
159
|
+
.ruby .offending { background-color: gray; }
|
160
|
+
.ruby .linenum {
|
161
|
+
width: 75px;
|
162
|
+
padding: 0.1em 1em 0.2em 0;
|
163
|
+
color: #000000;
|
164
|
+
background-color: #FFFBD3;
|
165
|
+
}
|
166
|
+
|
167
|
+
</style>
|
168
|
+
|
169
|
+
<div id="rspec-header">
|
170
|
+
<h1>RSpec Results</h1>
|
171
|
+
|
172
|
+
<div id="summary">
|
173
|
+
<p id="totals"> </p>
|
174
|
+
<p id="duration"> </p>
|
175
|
+
</div>
|
176
|
+
</div>
|
177
|
+
|
178
|
+
<div class="results">
|
179
|
+
<div class="example_group">
|
180
|
+
<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>
|
198
|
+
</dl>
|
199
|
+
</div>
|
200
|
+
<div class="example_group">
|
201
|
+
<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>
|
211
|
+
</dl>
|
212
|
+
</div>
|
213
|
+
<div class="example_group">
|
214
|
+
<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>
|
220
|
+
</dl>
|
221
|
+
</div>
|
222
|
+
<div class="example_group">
|
223
|
+
<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>
|
231
|
+
</dl>
|
232
|
+
</div>
|
233
|
+
<div class="example_group">
|
234
|
+
<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>
|
242
|
+
</dl>
|
243
|
+
</div>
|
244
|
+
<div class="example_group">
|
245
|
+
<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>
|
251
|
+
</dl>
|
252
|
+
</div>
|
253
|
+
<div class="example_group">
|
254
|
+
<dl>
|
255
|
+
<dt id="example_group_7">Kernel</dt>
|
256
|
+
<script type="text/javascript">moveProgressBar('54.7');</script>
|
257
|
+
<dd class="spec passed"><span class="passed_spec_name">should have a unit test for require_all</span></dd>
|
258
|
+
</dl>
|
259
|
+
</div>
|
260
|
+
<div class="example_group">
|
261
|
+
<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>
|
313
|
+
</dl>
|
314
|
+
</div>
|
315
|
+
<div class="example_group">
|
316
|
+
<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>
|
320
|
+
</dl>
|
321
|
+
</div>
|
322
|
+
<div class="example_group">
|
323
|
+
<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>
|
329
|
+
</dl>
|
330
|
+
</div>
|
331
|
+
<div class="example_group">
|
332
|
+
<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>
|
336
|
+
</dl>
|
337
|
+
</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>
|
340
|
+
</div>
|
341
|
+
</div>
|
342
|
+
</body>
|
343
|
+
</html>
|