C0 code coverage information

Generated on Tue Oct 16 11:40:53 -0400 2007 with rcov 0.8.0


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.
Name Total lines Lines of code Total coverage Code coverage
lib/alexandria/ui/multi_drag_treeview.rb 149 110
38.3% 
25.5% 
  1 # Copyright (C) 2004-2006 Laurent Sansonetti
  2 #
  3 # Alexandria is free software; you can redistribute it and/or
  4 # modify it under the terms of the GNU General Public License as
  5 # published by the Free Software Foundation; either version 2 of the
  6 # License, or (at your option) any later version.
  7 #
  8 # Alexandria is distributed in the hope that it will be useful,
  9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 11 # General Public License for more details.
 12 #
 13 # You should have received a copy of the GNU General Public
 14 # License along with Alexandria; see the file COPYING.  If not,
 15 # write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 16 # Boston, MA 02111-1307, USA.
 17 
 18 class Gdk::Event
 19     def ==(obj)
 20         obj.is_a?(self.class) and self.time == obj.time \
 21             and self.x == obj.x and self.y == obj.y \
 22             and self.button == obj.button
 23     end
 24 end
 25 
 26 class Gtk::TreeView
 27     class Context < Struct.new(:pressed_button, 
 28                                :x, 
 29                                :y,
 30                                :cell_x,
 31                                :cell_y, 
 32                                :button_press_handler,
 33                                :motion_notify_handler,
 34                                :button_release_handler, 
 35                                :drag_data_get_handler,
 36                                :events,
 37                                :source_start_button_mask,
 38                                :source_targets,
 39                                :source_actions,
 40                                :pending_event,
 41                                :drag_context)
 42 
 43         def initialize(*ary)
 44             super
 45             self.events ||= []
 46         end
 47 
 48         def pending_event?
 49             self.pending_event
 50         end
 51     end
 52 
 53     alias_method :old_enable_model_drag_source, :enable_model_drag_source
 54     def enable_model_drag_source(start_button_mask, targets, actions)
 55         old_enable_model_drag_source(start_button_mask, targets, actions)
 56         
 57         @context = Context.new
 58         @context.source_start_button_mask = start_button_mask
 59         @context.source_targets = Gtk::TargetList.new(targets)
 60         @context.source_actions = actions
 61  
 62         @context.button_press_handler = 
 63             signal_connect('button_press_event') do |widget, event, data| 
 64             button_press_event(event)
 65         end
 66     end
 67    
 68     def drag_context
 69         @context.drag_context
 70     end
 71    
 72     #######
 73     private
 74     #######
 75 
 76     def stop_drag_check
 77         raise if @context.nil?
 78         @context.events.clear
 79         @context.pending_event = false
 80         self.signal_handler_disconnect(@context.motion_notify_handler)
 81         self.signal_handler_disconnect(@context.button_release_handler)
 82     end
 83 
 84     def button_release_event(event)
 85         @context.events.each { |event| Gtk.propagate_event(self, event) }
 86         stop_drag_check
 87         return false
 88     end
 89 
 90     def motion_notify_event(event)
 91         if Gtk::Drag.threshold?(self, @context.x, @context.y, event.x, event.y)
 92             stop_drag_check
 93             paths = []
 94             self.selection.selected_each { |model, path, iter| paths << path }
 95             @context.drag_context = Gtk::Drag.begin(self, 
 96                                                     @context.source_targets, 
 97                                                     @context.source_actions,
 98                                                     @context.pressed_button, 
 99                                                     event)
100         end
101         return true
102     end
103 
104     def button_press_event(event)
105         return false if event.button == 3
106         return false if event.window != self.bin_window
107         return false if @context.events.include?(event)
108 
109         if @context.pending_event?
110             @context.events << event
111             return true
112         end
113 
114         return false if event.event_type == Gdk::Event::BUTTON2_PRESS 
115         
116         path, column, cell_x, cell_y = get_path_at_pos(event.x, event.y)
117         return false if path.nil?
118 
119        #call_parent = (event.state.control_mask? or event.state.shift_mask?) or !selected or event.button != 1
120         call_parent = !self.selection.path_is_selected?(path) or 
121                       event.button != 1
122 
123         if call_parent
124             self.signal_handler_block(@context.button_press_handler) do
125                 self.signal_emit('button_press_event', event)
126             end
127         end
128         
129         if self.selection.path_is_selected?(path)
130             @context.pending_event = true
131             @context.pressed_button = event.button
132             @context.x = event.x
133             @context.y = event.y
134             @context.cell_x = cell_x
135             @context.cell_y = cell_y
136             @context.motion_notify_handler = 
137                 signal_connect('motion_notify_event') do |widget, event, data|
138                 motion_notify_event(event)
139             end
140             @context.button_release_handler = 
141                 signal_connect('button_release_event') do |widget, event, data|
142                 button_release_event(event)
143             end
144             @context.events << event unless call_parent
145         end
146  
147         return true
148     end
149 end

Generated using the rcov code coverage analysis tool for Ruby version 0.8.0.

Valid XHTML 1.0! Valid CSS!