From: John L. <jr...@us...> - 2007-06-14 05:02:52
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv29717/wxLua/samples Modified Files: bindings.wx.lua unittest.wx.lua Log Message: Rename TLUA_NOTAG to WXLUA_NOTAG since it's only for wxLua Replace calls to lua_pushliteral with lua_pushlstring for better performance Change wxLuaState::Has/Get/SetDerivedMethods to C functions wxlua_has/get/setderivedmethods for a little better speed. Test wxLuaObject in unittest.wx.lua Index: bindings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/bindings.wx.lua,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** bindings.wx.lua 14 Jun 2007 01:23:20 -0000 1.7 --- bindings.wx.lua 14 Jun 2007 05:02:49 -0000 1.8 *************** *** 140,145 **** bindingList = {} -- Table of {"name space", "wxLuaBinding_XXX function"} - wxclassInfo = {} -- Table of all wxWidget wxClassInfo - -- ---------------------------------------------------------------------------- -- Load all the wxWidgets wxClassInfo --- 140,143 ---- *************** *** 210,217 **** end - wxclassInfo = CreatewxClassInfoTable() - -- ---------------------------------------------------------------------------- ! -- Find the bindings installed into wxLua -- ---------------------------------------------------------------------------- wxlua_tables = { "wxlua", "wx", "wxstc" } --- 208,213 ---- end -- ---------------------------------------------------------------------------- ! -- Find the bindings installed into wxLua, tables that might have wxLuaBinding_ -- ---------------------------------------------------------------------------- wxlua_tables = { "wxlua", "wx", "wxstc" } *************** *** 754,758 **** GotoBindingLevel(listCtrl, list_level) elseif itemText == "All wxWidgets wxClassInfo" then ! local t = wxclassInfo list_level = list_level + 1 --- 750,754 ---- GotoBindingLevel(listCtrl, list_level) elseif itemText == "All wxWidgets wxClassInfo" then ! local t = CreatewxClassInfoTable() list_level = list_level + 1 *************** *** 1162,1169 **** frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED, ! function (event) frame:Close(true) end ) frame:Connect(ID_STACK_DIALOG, wx.wxEVT_COMMAND_MENU_SELECTED, ! function (event) wxlua.LuaStackDialog() end ) -- connect the selection event of the about menu item --- 1158,1172 ---- frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED, ! function (event) ! frame:Close(true) ! end ) frame:Connect(ID_STACK_DIALOG, wx.wxEVT_COMMAND_MENU_SELECTED, ! function (event) ! local LocalNumberVariable = 2 ! local LocalStringVariable = "Hello" ! ! wxlua.LuaStackDialog() ! end ) -- connect the selection event of the about menu item Index: unittest.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/unittest.wx.lua,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** unittest.wx.lua 13 Jun 2007 00:09:04 -0000 1.11 --- unittest.wx.lua 14 Jun 2007 05:02:49 -0000 1.12 *************** *** 13,16 **** --- 13,17 ---- tests_run = 0 failed_tests = 0 + warnings = 0 function PrintOk(test, str) *************** *** 78,81 **** --- 79,101 ---- -- --------------------------------------------------------------------------- + print("\nTest loading multiple bindings.\n") + -- --------------------------------------------------------------------------- + + if wxstc then + PrintOk(wxstc.wxSTC_WRAP_WORD == 1, "Test wxstc bindings wxstc.wxSTC_WRAP_WORD == 1") + PrintOk(type(wxstc.wxStyledTextCtrl.new) == "function", "Test wxstc bindings type(wxstc.wxStyledTextCtrl.new) == \"function\"") + else + print("\nWARNING - unable to test wxstc bindings? Should they be here?\n\n") + warnings = warnings + 1 + end + + if wxlua.wxLuaDebuggerServer then + PrintOk(type(wxlua.wxLuaDebuggerServer) == "table", "Test wxstc bindings type(wxlua.wxLuaDebuggerServer) == \"table\"") + else + print("\nWARNING - unable to test wxluasocket bindings? Should they be here?\n\n") + warnings = warnings + 1 + end + + -- --------------------------------------------------------------------------- print("\nTest some automatic overload binding functions.\n") -- --------------------------------------------------------------------------- *************** *** 219,222 **** --- 239,260 ---- -- --------------------------------------------------------------------------- + print("\nTest the wxLuaObject.\n") + -- --------------------------------------------------------------------------- + + a = "Hello"; o = wxlua.wxLuaObject(a); b = o:GetObject() + PrintOk((b == "Hello") and (a == b), "Test wxLuaObject::GetObject(string).") + o = wxlua.wxLuaObject("hello"); b = o:GetObject() + PrintOk((b == "hello") and (a ~= b), "Test wxLuaObject::GetObject(string).") + o = wxlua.wxLuaObject(10); b = o:GetObject() + PrintOk(b == 10, "Test wxLuaObject::GetObject(number).") + a = {"hello"}; o = wxlua.wxLuaObject(a); b = o:GetObject() + PrintOk((a == b) and (b[1] == "hello"), "Test wxLuaObject::GetObject(table).") + + a = wx.wxPoint(1,2); o = wxlua.wxLuaObject(a); b = o:GetObject() + PrintOk(a == b, "Test wxLuaObject::GetObject(userdata).") + a = wx.wxPoint(1,2); o = wxlua.wxLuaObject(a); a = nil; b = o:GetObject() + PrintOk(b:GetX() == 1, "Test wxLuaObject::GetObject(userdata).") + + -- --------------------------------------------------------------------------- print("\nTest the bit library.\n") -- --------------------------------------------------------------------------- *************** *** 235,237 **** -- --------------------------------------------------------------------------- ! print("Tests run : "..tostring(tests_run)..", Tests that failed : "..tostring(failed_tests)..".\n") \ No newline at end of file --- 273,277 ---- -- --------------------------------------------------------------------------- ! print("Tests run : "..tostring(tests_run)) ! print("Tests that failed : "..tostring(failed_tests)) ! print("Warnings : "..tostring(warnings).."\n") |