Jldrill Git C0 Coverage Information - RCov

lib/jldrill/contexts/FileProgressContext.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/jldrill/contexts/FileProgressContext.rb 86 62
100.00%
100.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 'Context/View'
2 require 'Context/Context'
3 
4 module JLDrill
5     class FileProgressContext < Context::Context
6 
7         class FileProgress < Context::View
8             def initialize(context)
9                 super(context)
10             end
11 
12             # Update the progress display to the fraction
13             def update(fraction)
14                 # Define in the concrete class
15             end
16 
17             # File loading is done during the idle times in the UI.
18             # This method must add a block to the idle loop in the UI.
19             # The block will return true when the file is finished loading.
20             # At that time the concrete class should call exit on the
21             # context.
22             def idle_add(&block)
23                 # Define in the concrete class
24             end
25         end
26 
27         def initialize(viewBridge)
28             super(viewBridge)
29         end
30 
31    		def createViews
32 			@mainView = @viewBridge.FileProgress.new(self)
33         end
34         
35         def destroyViews
36             @mainView = nil
37         end
38 
39         def exitFileProgressContext
40             self.exit
41         end
42 
43         def readFile
44             eof = false
45             filename = getFilename()
46             if !filename.nil? && !getFile.nil?
47                 getFile.load(filename)
48                 @mainView.idle_add do
49                     eof = getFile.parseChunk(getFile.stepSize)
50                     @mainView.update(getFile.fraction)
51                     fraction = getFile.fraction
52                     if eof
53                         exitFileProgressContext
54                     end
55                     eof
56                 end
57             end
58         end
59        
60         def isValid?(parent)
61             retVal = false
62             if !parent.nil?
63                 if (!getFilename.nil?) && 
64                     (!getFile.loaded? || (getFile.file != getFilename))
65                     retVal = true
66                 end
67             end
68             return retVal
69         end
70 
71 		def enter(parent)
72             if isValid?(parent)
73                 super(parent)
74                 readFile
75                 # The view will exit the context when the file
76                 # has finished loading.  This is because we
77                 # can't exit the context until the idle process
78                 # is removed, and this can only be done by the view.
79             end
80         end
81 
82 		def exit
83 		    super
84 		end
85     end   
86 end

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