1
1
sub Main (args as dynamic )
2
- if ( type (Rooibos__Init ) = "Function" ) then Rooibos__Init (SetupGlobals , "AddTestUtils" , invalid , m )
2
+ if RBS_CC_1_reportLine ( 1 , 2 ) and (( type (Rooibos__Init ) = "Function" )) then Rooibos__Init (SetupGlobals , "AddTestUtils" , invalid , m )
3
3
4
- InitScreen ()
4
+ RBS_CC_1_reportLine ( 3 , 1 ): InitScreen ()
5
5
end sub
6
6
7
7
function InitScreen () as void
8
8
'this will be where you setup your typical roku app
9
9
'it will not be launched when running unit tests
10
- screen = CreateObject ("roSGScreen " )
11
- m .port = CreateObject ("roMessagePort " )
12
- screen .setMessagePort (m .port )
10
+ RBS_CC_1_reportLine ( 9 , 1 ): screen = CreateObject ("roSGScreen " )
11
+ RBS_CC_1_reportLine ( 10 , 1 ): m .port = CreateObject ("roMessagePort " )
12
+ RBS_CC_1_reportLine ( 11 , 1 ): screen .setMessagePort (m .port )
13
13
14
- rootScene = screen .CreateScene ("TestsScene" )
15
- rootScene .id = "ROOT"
14
+ RBS_CC_1_reportLine ( 13 , 1 ): rootScene = screen .CreateScene ("TestsScene" )
15
+ RBS_CC_1_reportLine ( 14 , 1 ): rootScene .id = "ROOT"
16
16
17
- screen .show ()
17
+ RBS_CC_1_reportLine ( 16 , 1 ): screen .show ()
18
18
19
- SetupGlobals (screen )
19
+ RBS_CC_1_reportLine ( 18 , 1 ): SetupGlobals (screen )
20
20
21
- while (true )
22
- msg = wait (0 , m .port )
23
- msgType = type (msg )
21
+ RBS_CC_1_reportLine ( 20 , 1 ): while (true )
22
+ RBS_CC_1_reportLine ( 21 , 1 ): msg = wait (0 , m .port )
23
+ RBS_CC_1_reportLine ( 22 , 1 ): msgType = type (msg )
24
24
25
- if msgType = "roSGScreenEvent "
26
- if msg .isScreenClosed ()
27
- return
25
+ if RBS_CC_1_reportLine ( 24 , 2 ) and ( msgType = "roSGScreenEvent " )
26
+ if RBS_CC_1_reportLine ( 25 , 2 ) and ( msg .isScreenClosed ())
27
+ RBS_CC_1_reportLine ( 26 , 1 ): return
28
28
end if
29
29
end if
30
30
end while
@@ -36,13 +36,13 @@ end function
36
36
'** @param screen as roScreen - screen to set globals on
37
37
'*************************************************************
38
38
function SetupGlobals (screen ) as void
39
- ? "SETTTING UP GLOBALS - do your standard setup stuff here"
39
+ RBS_CC_1_reportLine ( 38 , 1 ): ? "SETTTING UP GLOBALS - do your standard setup stuff here"
40
40
41
- m .global = screen .getGlobalNode ()
41
+ RBS_CC_1_reportLine ( 40 , 1 ): m .global = screen .getGlobalNode ()
42
42
43
- m .roDeviceInfo = CreateObject ("roDeviceInfo " )
43
+ RBS_CC_1_reportLine ( 42 , 1 ): m .roDeviceInfo = CreateObject ("roDeviceInfo " )
44
44
45
- m .displayInfo = {
45
+ RBS_CC_1_reportLine ( 44 , 1 ): m .displayInfo = {
46
46
resolution : m .roDeviceInfo .GetUIResolution ()
47
47
displayType : m .roDeviceInfo .GetDisplayType ()
48
48
width : m .roDeviceInfo .GetDisplaySize ().w
@@ -51,7 +51,34 @@ function SetupGlobals(screen) as void
51
51
hFactor : m .roDeviceInfo .GetDisplaySize ().h / 1080
52
52
}
53
53
54
- m .modelLocator = {"displayInfo" :m .displayInfo } ' contrived example : this would be a specifc modelLocator node/other setup thing
54
+ RBS_CC_1_reportLine ( 53 , 1 ): m .modelLocator = {"displayInfo" :m .displayInfo } ' contrived example : this would be a specifc modelLocator node/other setup thing
55
55
56
- m .global .addFields ({"modelLocator" : m .modelLocator })
56
+ RBS_CC_1_reportLine (55 , 1 ): m .global .addFields ({"modelLocator" : m .modelLocator })
57
+ end function
58
+
59
+
60
+
61
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
62
+ '++ rooibos code coverage util functions DO NOT MODIFY
63
+ '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
64
+
65
+ function RBS_CC_1_reportLine (lineNumber , reportType = 1 )
66
+ if m .global = invalid
67
+ '? "global is not available in this scope!! it is not possible to record coverage: #FILE_PATH#(lineNumber)"
68
+ return true
69
+ else
70
+ if m ._rbs_ccn = invalid
71
+ '? "Coverage maps are not created - creating now"
72
+ if m .global ._rbs_ccn = invalid
73
+ '? "Coverage maps are not created - creating now"
74
+ m .global .addFields ({
75
+ "_rbs_ccn" : createObject ("roSGnode " , "CodeCoverage" )
76
+ })
77
+ end if
78
+ m ._rbs_ccn = m .global ._rbs_ccn
79
+ end if
80
+ end if
81
+
82
+ m ._rbs_ccn .entry = {"f" :"1" , "l" :stri (lineNumber ), "r" :reportType }
83
+ return true
57
84
end function
0 commit comments