This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit 9f6e2182 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

lua_movie: some more preconditions + API tests

--HG--
branch : lua_fix
parent f249ba4936bc
......@@ -21,18 +21,12 @@
*/
static int luaCB_movie_start(lua_State* L)
{
if (!is_movie_mode())
{
return luaL_error(L, "Not in movie mode");
}
else if (RECORDING)
{
return luaL_error(L, "Already recording");
}
else
{
movie_start();
}
if (!is_movie_mode()) return luaL_error(L, "Not in movie mode.");
if (!lv) return luaL_error(L, "Not in LiveView.");
if (gui_menu_shown()) return luaL_error(L, "Please close ML menu.");
if (RECORDING) return luaL_error(L, "Already recording.");
movie_start();
return 0;
}
......@@ -42,18 +36,12 @@ static int luaCB_movie_start(lua_State* L)
*/
static int luaCB_movie_stop(lua_State* L)
{
if (!is_movie_mode())
{
return luaL_error(L, "Not in movie mode");
}
else if (!RECORDING)
{
return luaL_error(L, "Not recording");
}
else
{
movie_end();
}
if (!is_movie_mode()) return luaL_error(L, "Not in movie mode.");
if (!lv) return luaL_error(L, "Not in LiveView.");
if (gui_menu_shown()) return luaL_error(L, "Please close ML menu.");
if (!RECORDING) return luaL_error(L, "Not recording.");
movie_end();
return 0;
}
......
......@@ -777,6 +777,50 @@ function test_lens_focus()
printf("\n")
end
function test_movie()
printf("\n")
printf("Testing movie recording...\n")
-- we must be in photo mode (from previous tests)
assert(camera.mode ~= MODE.MOVIE)
-- this should raise error
local s,e = pcall(movie.start)
assert(s == false)
assert(e:find("movie mode"))
request_mode(MODE.MOVIE, "Movie")
-- this should also raise error, as we are not exactly in LiveView
lv.pause()
local s,e = pcall(movie.start)
assert(s == false)
assert(e:find("LiveView"))
menu.close()
lv.resume()
-- this should raise error, because the LiveView button has a special
-- function in ML menu (so we can't just press it to start recording)
menu.open()
local s,e = pcall(movie.start)
assert(s == false)
assert(e:find("menu"))
menu.close()
-- now it should work
-- hide the console for a nicer look
console.hide()
movie.start()
assert(movie.recording)
msleep(1000)
movie.stop()
assert(not movie.recording)
console.show()
printf("Movie recording tests completed.\n")
printf("\n")
end
function api_tests()
menu.close()
console.clear()
......@@ -789,12 +833,13 @@ function api_tests()
printf("Module tests...\n")
test_io()
test_multitasking()
--test_multitasking()
test_keys()
test_lv()
test_lens_focus()
test_camera_take_pics()
test_camera_exposure()
test_movie()
printf("Done!\n")
......
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