Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
1. LuaFAR: removed function far.LuafarVersion.
2. More tests.
  • Loading branch information
shmuz committed Mar 2, 2015
1 parent 074d44d commit 02f72e3
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 63 deletions.
35 changes: 0 additions & 35 deletions enc/enc_lua/luafar_manual.tsi
Expand Up @@ -8580,41 +8580,6 @@ mtime=3526661259
</article>
</node>
<node>
id=191
lv=2
dt=Text
nm=far.LuafarVersion
mtime=3558792319
<article>
#_**-------------------------------------------**
#_** 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)
#_
</article>
</node>
<node>
id=280
lv=2
dt=Text
Expand Down
2 changes: 1 addition & 1 deletion 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",
Expand Down
6 changes: 5 additions & 1 deletion 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. Рефакторинг.

Expand Down
15 changes: 0 additions & 15 deletions plugins/luamacro/luafar/service.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion plugins/luamacro/luamacro.rc
@@ -1,6 +1,6 @@
#include <farversion.hpp>

#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"
Expand Down
58 changes: 48 additions & 10 deletions plugins/luamacro/macrotest.lua
Expand Up @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 02f72e3

Please sign in to comment.