-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxop-ccdcam-tests.ipf
131 lines (111 loc) · 2.47 KB
/
xop-ccdcam-tests.ipf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
// Test suite
// to "automate" this, run the following command
// igor.exe /i /x "Execute/P "LOADFILE C:\\path\\to\\tests.ipf"; Execute/P "COMPILEPROCEDURES"; Execute/P "run_all_tests()""
Function run_all_tests()
test_CcdCam_Reset()
test_CcdCam_Create()
test_CcdCam_GetSize()
test_CcdCam_SetVideoSettingsStatic()
test_CcdCam_Start()
test_CcdCam_Stop()
test_CcdCam_TryGetFrame()
//Execute/P "Quit /N"
End
Function test_CcdCam_Reset()
VARIABLE expected, actual
expected = 0
actual = CcdCam_Reset()
if (expected != actual)
Abort "test_CcdCam_reset() failed"
else
return 0
endif
End
// Valid camera device IDs
// 0 = fake
// 1 = QCam
// 2 = Orca ER
Function test_CcdCam_Create()
VARIABLE device
VARIABLE expected, actual
device = 0
expected = 0
actual = CcdCam_Create(device)
if (expected != actual)
Abort "test_CcdCam_Create() failed"
else
return 0
endif
End
Structure RectSize
uint32 DimX
uint32 DimY
EndStructure
Function test_CcdCam_GetSize()
STRUCT RectSize size
VARIABLE device
VARIABLE expected, actual
device = 0
expected = 0
actual = CcdCam_GetSize(device, size)
if (expected != actual)
Abort "test_CcdCam_GetDims() failed"
else
return 0
endif
End
// valid trigger modes:
//
// Freerun = 0
// Software = 1
// HardwareEdgeHigh = 2
// HardwareEdgeLow = 4
Structure VideoSettingsStatic
uint32 Binning
uint32 RoiX
uint32 RoiY
uint32 RoiWidth
uint32 RoiHeight
uint32 TriggerMode
EndStructure
Function test_CcdCam_SetVideoSettings()
STRUCT VideoSettingsStatic settings
VARIABLE device, expected, actual
device = 0
settings.Binning = 1
settings.RoiX = 16
settings.RoiY = 0
settings.RoiWidth = 128
settings.RoiHeight = 256
settings.TriggerMode = 0
expected = 0
actual = CcdCam_SetVideoSettingsStatic(device, settings)
if (expected != actual)
Abort "CcdCam_SetVideoSettingsStatic() failed"
else
return 0
endif
End
Function test_CcdCam_Start()
VARIABLE device, expected, actual
device = 0
expected = 0
actual = CcdCam_Start(device)
if (expected != actual)
Abort "CcdCam_Start() failed"
else
return 0
endif
End
Function test_CcdCam_Stop()
VARIABLE device, expected, actual
device = 0
expected = 0
actual = CcdCam_Stop(device)
if (expected != actual)
Abort "CcdCam_Stop() failed"
else
return 0
endif
End