Commit 533e6b92 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

lua_camera: getter for gui.mode (missed in 706b1311f786) + API tests

--HG--
branch : lua_fix
parent 485997b4cad1
......@@ -744,6 +744,11 @@ static int luaCB_gui_index(lua_State * L)
/// Get whether the camera is "idle" (i.e. in standby, with no other dialogs active)
// @tfield bool idle
else if(!strcmp(key,"idle")) lua_pushboolean(L, display_idle());
/// Get/Set current GUI mode from Canon (model-dependent).
///
/// On DIGIC 4/5: 0 is "idle", 1 is PLAY, 2 is MENU, others are model-dependent.
// @tfield int mode
else if(!strcmp(key,"mode")) lua_pushinteger(L, get_gui_mode());
else lua_rawget(L, 1);
return 1;
}
......
......@@ -235,11 +235,13 @@ function test_camera_gui()
camera.gui.play = true
assert(camera.gui.play == true)
assert(camera.gui.mode == 1)
-- half-shutter should exit playback mode
key.press(KEY.HALFSHUTTER)
msleep(1000)
assert(camera.gui.play == false)
assert(camera.gui.mode == 0)
key.press(KEY.UNPRESS_HALFSHUTTER)
-- randomly switch between PLAY, MENU and IDLE (with or without LiveView)
......@@ -253,12 +255,14 @@ function test_camera_gui()
assert(camera.gui.play == true)
assert(camera.gui.menu == false)
assert(camera.gui.idle == false)
assert(camera.gui.mode == 1)
elseif camera.gui.play then
printf("Exit PLAY mode...\n");
camera.gui.play = false
assert(camera.gui.play == false)
assert(camera.gui.menu == false)
assert(camera.gui.idle == true)
assert(camera.gui.mode == 0)
end
else
if math.random(1,2) == 1 then
......@@ -267,12 +271,14 @@ function test_camera_gui()
assert(camera.gui.menu == true)
assert(camera.gui.play == false)
assert(camera.gui.idle == false)
assert(camera.gui.mode == 2)
elseif camera.gui.menu then
printf("Exit MENU mode...\n");
camera.gui.menu = false
assert(camera.gui.menu == false)
assert(camera.gui.play == false)
assert(camera.gui.idle == true)
assert(camera.gui.mode == 0)
end
end
......
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