Commit 34a6af70 authored by alex@thinkpad's avatar alex@thinkpad
Browse files

Lua: console.visible (status)

API tests updated

--HG--
branch : lua_fix
parent 254314a2010f
...@@ -53,7 +53,19 @@ static int luaCB_console_write(lua_State * L) ...@@ -53,7 +53,19 @@ static int luaCB_console_write(lua_State * L)
return 0; return 0;
} }
static int luaCB_console_index(lua_State * L) { lua_rawget(L, 1); return 1; } static int luaCB_console_index(lua_State * L)
{
LUA_PARAM_STRING_OPTIONAL(key, 2, "");
/// Whether or not the console is displayed.
// @tfield bool visible
if(!strcmp(key, "visible"))
{
extern int console_visible;
lua_pushboolean(L, console_visible);
}
else lua_rawget(L, 1);
return 1;
}
static int luaCB_console_newindex(lua_State * L) { lua_rawset(L, 1); return 0; } static int luaCB_console_newindex(lua_State * L) { lua_rawset(L, 1); return 0; }
......
...@@ -15,7 +15,7 @@ function request_mode(mode, mode_str) ...@@ -15,7 +15,7 @@ function request_mode(mode, mode_str)
while camera.mode ~= mode do while camera.mode ~= mode do
printf("Please switch to %s mode.\n", mode_str, mode) printf("Please switch to %s mode.\n", mode_str, mode)
while camera.mode ~= mode do while camera.mode ~= mode do
console.show() console.show(); assert(console.visible)
msleep(1000) msleep(1000)
end end
end end
...@@ -1013,7 +1013,7 @@ function test_lens_focus() ...@@ -1013,7 +1013,7 @@ function test_lens_focus()
printf("Please enable autofocus.\n") printf("Please enable autofocus.\n")
printf("(or, remove the lens from the camera to skip this test)\n") printf("(or, remove the lens from the camera to skip this test)\n")
while not lens.af and lens.name ~= "" do while not lens.af and lens.name ~= "" do
console.show() console.show(); assert(console.visible)
msleep(1000) msleep(1000)
end end
msleep(1000) msleep(1000)
...@@ -1161,13 +1161,13 @@ function test_movie() ...@@ -1161,13 +1161,13 @@ function test_movie()
-- now it should work -- now it should work
-- hide the console for a nicer look -- hide the console for a nicer look
console.hide() console.hide(); assert(not console.visible)
movie.start() movie.start()
assert(movie.recording) assert(movie.recording)
msleep(1000) msleep(1000)
movie.stop() movie.stop()
assert(not movie.recording) assert(not movie.recording)
console.show() console.show(); assert(console.visible)
printf("Movie recording tests completed.\n") printf("Movie recording tests completed.\n")
printf("\n") printf("\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