From 02f72e3dd256d1ef0affb515efd7c7512be7a236 Mon Sep 17 00:00:00 2001 From: Shmuel Zeigerman Date: Mon, 2 Mar 2015 17:06:47 +0000 Subject: [PATCH] 1. LuaFAR: removed function far.LuafarVersion. 2. More tests. --- enc/enc_lua/luafar_manual.tsi | 35 ------------------- plugins/luamacro/_globalinfo.lua | 2 +- plugins/luamacro/changelog | 6 +++- plugins/luamacro/luafar/service.c | 15 -------- plugins/luamacro/luamacro.rc | 2 +- plugins/luamacro/macrotest.lua | 58 +++++++++++++++++++++++++------ 6 files changed, 55 insertions(+), 63 deletions(-) diff --git a/enc/enc_lua/luafar_manual.tsi b/enc/enc_lua/luafar_manual.tsi index 0cf952dfa0..9a1719fb1c 100644 --- a/enc/enc_lua/luafar_manual.tsi +++ b/enc/enc_lua/luafar_manual.tsi @@ -8580,41 +8580,6 @@ mtime=3526661259 -id=191 -lv=2 -dt=Text -nm=far.LuafarVersion -mtime=3558792319 -
-#_**-------------------------------------------** -#_** THE INFORMATION BELOW IS OUTDATED. ** -#_**DO NOT USE THIS FUNCTION UNTIL IT IS FIXED.** -#_**-------------------------------------------** -#_ -#_version = far.LuafarVersion ([mode]) -#_ -#_**Parameters:** -#_ mode : boolean -#_ -#_**Returns:** -#_ version: string, if mode==false; -#_ 3 numbers (MAJOR,MINOR,MICRO), if mode==true; -#_ -#_**Description:** -#_ Returns version of the LuaFAR library, e.g.: -#_ "1.2.3" - string representation, or -#_ 1, 2, 3 - three number representation. -#_ -#_**Note:** -#_ The version of Far SDK used *in building LuaFAR* can be -#_ determined as follows: -#_ local F = far.Flags -#_ far.Show(F.FARMANAGERVERSION_MAJOR, F.FARMANAGERVERSION_MINOR, -#_ F.FARMANAGERVERSION_BUILD) -#_ -
-
- id=280 lv=2 dt=Text diff --git a/plugins/luamacro/_globalinfo.lua b/plugins/luamacro/_globalinfo.lua index b4aaef4b28..9c4d03a358 100644 --- a/plugins/luamacro/_globalinfo.lua +++ b/plugins/luamacro/_globalinfo.lua @@ -1,6 +1,6 @@ function export.GetGlobalInfo() return { - Version = { 1, 0, 0, 486 }, + Version = { 1, 0, 0, 487 }, MinFarVersion = { 3, 0, 0, 4276 }, Guid = win.Uuid("4EBBEFC8-2084-4B7F-94C0-692CE136894D"), Title = "LuaMacro", diff --git a/plugins/luamacro/changelog b/plugins/luamacro/changelog index 6e265e8be2..a15b4648ca 100644 --- a/plugins/luamacro/changelog +++ b/plugins/luamacro/changelog @@ -1,4 +1,8 @@ -shmuel 21.02.2015 19:30:30 +0200 - build 486 +shmuel 02.03.2015 19:01:59 +0200 - build 487 + +1. LuaFAR: убрана функция far.LuafarVersion. + +shmuel 21.02.2015 19:30:30 +0200 - build 486 1. Рефакторинг. diff --git a/plugins/luamacro/luafar/service.c b/plugins/luamacro/luafar/service.c index a8bee8aea1..926e02b0af 100644 --- a/plugins/luamacro/luafar/service.c +++ b/plugins/luamacro/luafar/service.c @@ -420,20 +420,6 @@ static int far_GetNumberOfLinks(lua_State *L) return lua_pushinteger(L, num), 1; } -static int far_LuafarVersion(lua_State *L) -{ - if(lua_toboolean(L, 1)) - { - lua_pushinteger(L, PLUGIN_MAJOR_VER); - lua_pushinteger(L, PLUGIN_MINOR_VER); - lua_pushinteger(L, PLUGIN_BUILD); - return 3; - } - - lua_pushliteral(L, FARPRODUCTVERSION); - return 1; -} - static void GetMouseEvent(lua_State *L, MOUSE_EVENT_RECORD* rec) { rec->dwMousePosition.X = GetOptIntFromTable(L, "MousePositionX", 0); @@ -5972,7 +5958,6 @@ const luaL_Reg far_funcs[] = {"GetCurrentDirectory", far_GetCurrentDirectory}, {"GetFileOwner", far_GetFileOwner}, {"GetNumberOfLinks", far_GetNumberOfLinks}, - {"LuafarVersion", far_LuafarVersion}, {"MakeMenuItems", far_MakeMenuItems}, {"Show", far_Show}, {"Timer", far_Timer}, diff --git a/plugins/luamacro/luamacro.rc b/plugins/luamacro/luamacro.rc index 004e61a644..e206473e8e 100644 --- a/plugins/luamacro/luamacro.rc +++ b/plugins/luamacro/luamacro.rc @@ -1,6 +1,6 @@ #include -#define PLUGIN_BUILD 486 +#define PLUGIN_BUILD 487 #define PLUGIN_DESC "Lua Macros for Far Manager" #define PLUGIN_NAME "LuaMacro" #define PLUGIN_FILENAME "luamacro.dll" diff --git a/plugins/luamacro/macrotest.lua b/plugins/luamacro/macrotest.lua index dbcb8cd9ac..23e4a71d31 100644 --- a/plugins/luamacro/macrotest.lua +++ b/plugins/luamacro/macrotest.lua @@ -1374,17 +1374,42 @@ function MT.test_mantis_1722() assert(Dlg[1][10] == "W123") end -local function test_far_AdvControl() - assert(type(far.AdvControl("ACTL_GETWINDOWCOUNT"))=="number") +local function test_AdvControl() + local num, t + + num = far.AdvControl("ACTL_GETWINDOWCOUNT") + mf.acall(far.Show); mf.acall(far.Show) + assert(num+2 == far.AdvControl("ACTL_GETWINDOWCOUNT")) + Keys("Esc Esc") + assert(num == far.AdvControl("ACTL_GETWINDOWCOUNT")) + assert(type(far.AdvControl("ACTL_GETFARHWND"))=="userdata") - assert(type(far.AdvControl("ACTL_GETCOLOR",0))=="table") - assert(type(far.AdvControl("ACTL_GETARRAYCOLOR"))=="table") + + t = far.AdvControl("ACTL_GETCOLOR",0) + assert(t.Flags and t.ForegroundColor and t.BackgroundColor) + + t = far.AdvControl("ACTL_GETARRAYCOLOR")[1] + assert(t.Flags and t.ForegroundColor and t.BackgroundColor) + assert(far.AdvControl("ACTL_GETFARMANAGERVERSION"):sub(1,1)=="3") assert(far.AdvControl("ACTL_GETFARMANAGERVERSION",true)==3) - assert(type(far.AdvControl("ACTL_GETWINDOWINFO"))=="table") - assert(type(far.AdvControl("ACTL_GETFARRECT"))=="table") - assert(type(far.AdvControl("ACTL_GETCURSORPOS"))=="table") - assert(type(far.AdvControl("ACTL_GETWINDOWTYPE"))=="table") + + t = far.AdvControl("ACTL_GETWINDOWINFO") + assert(t.Type and t.Id and t.Pos and t.Flags and t.TypeName and t.Name) + + t = far.AdvControl("ACTL_GETFARRECT") + assert(t.Left and t.Top and t.Right and t.Bottom) + + t = far.AdvControl("ACTL_GETCURSORPOS") + assert(t.X and t.Y) + + t = far.AdvControl("ACTL_GETWINDOWTYPE") + assert(t.Type) + + mf.acall(far.AdvControl, "ACTL_WAITKEY", nil, "F1") + Keys("F1") + mf.acall(far.AdvControl, "ACTL_WAITKEY") + Keys("F2") end local function test_far_GetMsg() @@ -1403,12 +1428,25 @@ local function test_clipboard() assert(far.PasteFromClipboard() == orig) end +local function test_far_FarClock() + local temp = far.FarClock() + mf.sleep(50) + temp = far.FarClock() - temp + assert(temp > 40000 and temp < 70000) +end + +local function test_FarStandardFunctions() + test_clipboard() + test_far_FarClock() +end + function MT.test_luafar() - test_far_AdvControl() test_far_GetMsg() + + test_AdvControl() test_MacroControl() test_RegexControl() - test_clipboard() + test_FarStandardFunctions() end function MT.test_all()