Jldrill Git C0 Coverage Information - RCov

lib/jldrill/views/gtk/ProblemView.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/jldrill/views/gtk/ProblemView.rb 73 59
65.75%
59.32%

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 'jldrill/contexts/DisplayProblemContext'
2 require 'jldrill/views/gtk/widgets/ProblemDisplay'
3 require 'gtk2'
4 
5 module JLDrill::Gtk
6 
7 	class ProblemView < JLDrill::DisplayProblemContext::ProblemView
8 
9         attr_reader :problemDisplay
10         	
11 		def initialize(context)
12 			super(context)
13 			@problemDisplay = ProblemDisplay.new(self)
14 			@problemDisplay.expandWidgetWidth
15 			@problemDisplay.expandWidgetHeight
16             @timeoutID = nil
17 		end
18 		
19 		def getWidget
20 			@problemDisplay
21 		end
22 		
23 		def mainWindow
24 		    getWidget.gtkWidgetMainWindow
25 		end
26 		
27         def stopTimer
28             if !@timeoutID.nil?
29                 Gtk.timeout_remove(@timeoutID)
30                 @timeoutID = nil
31             end
32         end
33 
34         def startTimer(timeLimit)
35             if timeLimit != 0.0 && @timeoutID.nil?
36                 @timeoutID = Gtk.timeout_add((timeLimit * 1000).to_i) do
37                     @timeoutID = nil
38                     expire
39                     false
40                 end
41             end
42         end
43 
44 		def newProblem(problem)
45             super(problem)
46 		    @problemDisplay.newProblem(problem)
47             stopTimer
48             if !problem.nil?
49                 startTimer(problem.item.itemStats.timeLimit)
50             end
51 		end
52 		
53 		def showAnswer
54 		    @problemDisplay.showAnswer
55             stopTimer
56 		end
57 
58         def expire
59             @problemDisplay.expire
60         end
61 
62         def updateProblem(problem)
63             super(problem)
64             @problemDisplay.updateProblem(problem)
65             stopTimer
66             if !problem.nil?
67                 startTimer(problem.item.itemStats.timeLimit)
68             end
69         end
70     end
71     
72 end
73 

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