Jldrill Git C0 Coverage Information - RCov

lib/Context/Views/Gtk/Widgets/MainWindow.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/Context/Views/Gtk/Widgets/MainWindow.rb 70 40
85.71%
75.00%

Key

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.

Coverage Details

1 require 'gtk2'
2 
3 module Context::Gtk
4 
5     # A Gtk widget representing a main window.
6     # It is simply a Gtk::Window into which you can add new widgets.
7     # You must implement the following methods on the view that
8     # you pass to initialize:
9     #
10     #     close() -- closes the view.
11     class MainWindow < Gtk::Window
12         include Context::Gtk::Widget
13         # Create a main window with a given title corresponding to
14         # a Context::View.
15         def initialize(title, view)
16             super(title)
17             @view = view
18             setupWidget
19             isAMainWindow
20             @closed = false
21             connectSignals unless @view.nil?
22         end
23 
24         # Connect the Gtk signals we care about.
25         def connectSignals
26             signal_connect('destroy') do
27                 if !@closed
28                     closeView
29                 end
30             end
31             signal_connect('delete-event') do
32                 if !@closed
33                     closeView
34                 end
35                 true
36             end
37         end
38         
39         # Explicitly destroy the window through the code rather
40         # than having the window destroyed by pressing the close
41         # button.
42         def explicitDestroy
43             @closed = true
44             self.destroy
45         end
46         
47         # Close the view. This is called when the destroy
48         # signal has been emitted.
49         # Note: the View *must* implement close()
50         def closeView
51             @view.close
52         end
53 
54         # Context::Gtk::Widget requirements
55 
56         # Add a widget to this window.  
57         # Note that Gtk::Windows can only add a single item.
58         # If you want to add more items, you will have to make
59         # another widget (like a table or a vbox) and add it to
60         # this one.
61         def gtkAddWidget(widget)
62             add(widget)
63         end
64 
65         # Remove the contained widget from this window
66         def gtkRemoveWidget(widget)
67             remove(widget)
68         end
69     end
70 end

Generated on Mon May 23 16:17:45 +0900 2011 with rcov 0.9.8