Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
magic-lantern
magic-lantern
Commits
6b65461b8151
Commit
0b3634b3
authored
May 04, 2016
by
alex@thinkpad
Browse files
api_test.lua: tests for camera.shoot, burst and bulb
--HG-- branch : lua_fix
parent
ab649ff0af48
Changes
1
Hide whitespace changes
Inline
Side-by-side
scripts/api_test.lua
View file @
6b65461b
...
...
@@ -509,6 +509,52 @@ function test_camera_exposure()
printf
(
"
\n
"
)
end
function
test_camera_take_pics
()
printf
(
"Testing module 'camera', picture taking functions...\n"
)
local
initial_file_num
request_mode
(
MODE
.
M
,
"M"
)
camera
.
shutter
=
1
/
50
msleep
(
2000
)
printf
(
"Snap simulation test...\n"
)
assert
(
menu
.
set
(
"Shoot Preferences"
,
"Snap Simulation"
,
1
))
initial_file_num
=
dryos
.
shooting_card
.
file_number
camera
.
shoot
()
assert
(
dryos
.
shooting_card
.
file_number
==
initial_file_num
)
assert
(
menu
.
set
(
"Shoot Preferences"
,
"Snap Simulation"
,
0
))
msleep
(
2000
)
printf
(
"Single picture...\n"
)
initial_file_num
=
dryos
.
shooting_card
.
file_number
camera
.
shoot
()
assert
((
dryos
.
shooting_card
.
file_number
-
initial_file_num
)
%
10000
==
1
)
msleep
(
2000
)
printf
(
"Two burst pictures...\n"
)
printf
(
"Ideally, the camera should be in some continuous shooting mode (not checked).\n"
)
initial_file_num
=
dryos
.
shooting_card
.
file_number
camera
.
burst
(
2
)
assert
((
dryos
.
shooting_card
.
file_number
-
initial_file_num
)
%
10000
==
2
)
msleep
(
2000
)
printf
(
"Bulb picture...\n"
)
local
t0
=
dryos
.
ms_clock
initial_file_num
=
dryos
.
shooting_card
.
file_number
camera
.
bulb
(
10
)
local
t1
=
dryos
.
ms_clock
local
elapsed
=
t1
-
t0
printf
(
"Elapsed time: %s\n"
,
elapsed
)
-- we can't measure this time accurately, so we only do a very rough check
assert
(
elapsed
>
9900
and
elapsed
<
15000
)
assert
((
dryos
.
shooting_card
.
file_number
-
initial_file_num
)
%
10000
==
1
)
printf
(
"Picture taking tests completed.\n"
)
end
function
test_lv
()
printf
(
"Testing module 'lv'...\n"
)
if
lv
.
enabled
then
...
...
@@ -636,6 +682,7 @@ function api_tests()
printf
(
"Module tests...\n"
)
test_io
()
test_camera_exposure
()
test_camera_take_pics
()
test_lv
()
test_lens_focus
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment