Commit 0b3634b3 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

api_test.lua: tests for camera.shoot, burst and bulb

--HG--
branch : lua_fix
parent ab649ff0af48
......@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment