Name | Total Lines | Lines of Code | Total Coverage | Code Coverage |
---|---|---|---|---|
lib/jldrill/spec/storyFunctionality/Gtk.rb | 57 | 35 | 91.23%
|
85.71%
|
Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.
1 require 'jldrill/spec/StoryMemento' |
2 require 'gtk2' |
3 require 'Context/require_all' |
4 # We're requiring all the gtk views here since that's |
5 # what the app would normally be doing. |
6 require_all 'jldrill/views/gtk/*.rb' |
7 |
8 # Story functionality for Gtk. Used as a mixin within a |
9 # StoryMemento |
10 module JLDrill::StoryFunctionality |
11 module Gtk |
12 # Starts Gtk and runs the code in the block. Note it doesn't |
13 # quit the main loop, so you will have to call ::Gtk::main_quit |
14 # somewhere in the block. See UserLoadsDictionary_story.rb |
15 # for an example of usage. |
16 def startGtk(&block) |
17 ::Gtk.init_add do |
18 block.call |
19 end |
20 ::Gtk.main |
21 end |
22 |
23 # Overrides the method on the object with the closure |
24 # that's passed in. |
25 def override_method(object, method, &block) |
26 class << object |
27 self |
28 end.send(:define_method, method, &block) |
29 end |
30 |
31 # Override the run method in views that contain |
32 # dialogs so that once the context has been entered |
33 # the specified button is pressed. |
34 def pressButtonAfterEntry(dialog, button, &block) |
35 override_method(dialog, :run) do |
36 if !block.nil? |
37 block.call |
38 end |
39 button |
40 end |
41 end |
42 |
43 # Enter a dialog and press OK |
44 def pressOKAfterEntry(dialog, &block) |
45 pressButtonAfterEntry(dialog, ::Gtk::Dialog::RESPONSE_ACCEPT, |
46 &block) |
47 end |
48 |
49 # Enter a dialog and press Cancel |
50 def pressCancelAfterEntry(dialog, &block) |
51 pressButtonAfterEntry(dialog, ::Gtk::Dialog::RESPONSE_CANCEL, |
52 &block) |
53 end |
54 |
55 end |
56 end |
57 |
Generated on Mon May 23 16:17:46 +0900 2011 with rcov 0.9.8