"vscode:/vscode.git/clone" did not exist on "a7bec7fb031b862a5d6054c0183ddaca927d8d04"
Commit 035bbcd0 authored by Vinicius Jarina's avatar Vinicius Jarina
Browse files

Fixed delegate tests on iOS.

parent f585054f
...@@ -153,9 +153,9 @@ namespace LuaInterface ...@@ -153,9 +153,9 @@ namespace LuaInterface
if(luatype == LuaTypes.Function) if(luatype == LuaTypes.Function)
return extractValues[runtimeHandleValue]; return extractValues[runtimeHandleValue];
} }
#if !MONOTOUCH
else if(typeof(Delegate).IsAssignableFrom(paramType) && luatype == LuaTypes.Function) else if(typeof(Delegate).IsAssignableFrom(paramType) && luatype == LuaTypes.Function)
return new ExtractValue(new DelegateGenerator(translator, paramType).extractGenerated); return new ExtractValue(new DelegateGenerator(translator, paramType).extractGenerated);
#if !MONOTOUCH
else if(paramType.IsInterface && luatype == LuaTypes.Table) else if(paramType.IsInterface && luatype == LuaTypes.Table)
return new ExtractValue(new ClassGenerator(translator, paramType).extractGenerated); return new ExtractValue(new ClassGenerator(translator, paramType).extractGenerated);
#endif #endif
......
...@@ -134,7 +134,7 @@ namespace LuaInterface ...@@ -134,7 +134,7 @@ namespace LuaInterface
private Type GenerateDelegate(Type delegateType) private Type GenerateDelegate(Type delegateType)
{ {
#if MONOTOUCH #if MONOTOUCH
throw new NotImplementedException (" Emit not available on MonoTouch "); throw new NotImplementedException ("GenerateDelegate is not available on iOS, please register your LuaDelegate type with Lua.RegisterLuaDelegateType( yourDelegate, theLuaDelegateHandler) ");
#else #else
string typeName; string typeName;
lock(this) lock(this)
...@@ -656,15 +656,17 @@ namespace LuaInterface ...@@ -656,15 +656,17 @@ namespace LuaInterface
#endif #endif
} }
public void RegisterLuaDelegateType (Type delegateType, Type luaDelegateType)
{
delegateCollection[delegateType] = luaDelegateType;
}
/* /*
* Gets a delegate with delegateType that calls the luaFunc Lua function * Gets a delegate with delegateType that calls the luaFunc Lua function
* Caches the generated type. * Caches the generated type.
*/ */
public Delegate GetDelegate(Type delegateType, LuaFunction luaFunc) public Delegate GetDelegate(Type delegateType, LuaFunction luaFunc)
{ {
#if MONOTOUCH
throw new NotImplementedException (" Emit not available on MonoTouch ");
#else
var returnTypes = new List<Type>(); var returnTypes = new List<Type>();
Type luaDelegateType; Type luaDelegateType;
...@@ -688,8 +690,8 @@ namespace LuaInterface ...@@ -688,8 +690,8 @@ namespace LuaInterface
var luaDelegate = (LuaDelegate)Activator.CreateInstance(luaDelegateType); var luaDelegate = (LuaDelegate)Activator.CreateInstance(luaDelegateType);
luaDelegate.function = luaFunc; luaDelegate.function = luaFunc;
luaDelegate.returnTypes = returnTypes.ToArray(); luaDelegate.returnTypes = returnTypes.ToArray();
return Delegate.CreateDelegate(delegateType, luaDelegate, "CallFunction"); return Delegate.CreateDelegate(delegateType, luaDelegate, "CallFunction");
#endif
} }
/* /*
......
...@@ -634,6 +634,15 @@ namespace LuaInterface ...@@ -634,6 +634,15 @@ namespace LuaInterface
return (obj is LuaCore.lua_CFunction ? new LuaFunction((LuaCore.lua_CFunction)obj, this) : (LuaFunction)obj); return (obj is LuaCore.lua_CFunction ? new LuaFunction((LuaCore.lua_CFunction)obj, this) : (LuaFunction)obj);
} }
/*
* Register a delegate type to be used to convert Lua funcitions to C# delegates (useful for iOS where there is no dynamic code generation)
* type delegateType
*/
public void RegisterLuaDelegateType (Type delegateType, Type luaDelegateType)
{
CodeGeneration.Instance.RegisterLuaDelegateType (delegateType, luaDelegateType);
}
/* /*
* Gets a function global variable as a delegate of * Gets a function global variable as a delegate of
* type delegateType * type delegateType
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\KopiLua\KopiLua.IOS.csproj"> <ProjectReference Include="..\KopiLua\KopiLua.IOS.csproj">
<Project>{23997AB1-C4A3-49BA-A7B5-4C14F97C236B}</Project> <Project>{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}</Project>
<Name>KopiLua.IOS</Name> <Name>KopiLua.IOS</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
<Folder Include="LuaLib\" /> <Folder Include="LuaLib\" />
<Folder Include="Method\" /> <Folder Include="Method\" />
<Folder Include="Properties\" /> <Folder Include="Properties\" />
<Folder Include="GenerateEventAssembly\ios\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Config\LuaInterfaceConfig.cs" /> <Compile Include="Config\LuaInterfaceConfig.cs" />
......
...@@ -3,24 +3,72 @@ Microsoft Visual Studio Solution File, Format Version 11.00 ...@@ -3,24 +3,72 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterface.IOS", "Core\LuaInterface\LuaInterface.IOS.csproj", "{7064B157-DD57-4828-94C5-CA149B25CB40}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterface.IOS", "Core\LuaInterface\LuaInterface.IOS.csproj", "{7064B157-DD57-4828-94C5-CA149B25CB40}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KopiLua.IOS", "Core\KopiLua\KopiLua.IOS.csproj", "{23997AB1-C4A3-49BA-A7B5-4C14F97C236B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KopiLua.IOS", "Core\KopiLua\KopiLua.IOS.csproj", "{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterfaceTest", "ios\LuaInterfaceTest\LuaInterfaceTest.csproj", "{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
Ad-Hoc|iPhone = Ad-Hoc|iPhone
AppStore|iPhone = AppStore|iPhone
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{23997AB1-C4A3-49BA-A7B5-4C14F97C236B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{23997AB1-C4A3-49BA-A7B5-4C14F97C236B}.Debug|Any CPU.Build.0 = Debug|Any CPU {44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{23997AB1-C4A3-49BA-A7B5-4C14F97C236B}.Release|Any CPU.ActiveCfg = Release|Any CPU {44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{23997AB1-C4A3-49BA-A7B5-4C14F97C236B}.Release|Any CPU.Build.0 = Release|Any CPU {44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.AppStore|iPhone.Build.0 = Debug|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Debug|Any CPU.Build.0 = Debug|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Debug|iPhone.Build.0 = Debug|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Release|Any CPU.ActiveCfg = Release|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Release|Any CPU.Build.0 = Release|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Release|iPhone.ActiveCfg = Release|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Release|iPhone.Build.0 = Release|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.AppStore|iPhone.Build.0 = AppStore|iPhone
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Debug|iPhone.ActiveCfg = Debug|iPhone
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Debug|iPhone.Build.0 = Debug|iPhone
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Release|iPhone.ActiveCfg = Release|iPhone
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Release|iPhone.Build.0 = Release|iPhone
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{7064B157-DD57-4828-94C5-CA149B25CB40}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.AppStore|iPhone.Build.0 = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7064B157-DD57-4828-94C5-CA149B25CB40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Debug|Any CPU.Build.0 = Debug|Any CPU {7064B157-DD57-4828-94C5-CA149B25CB40}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Debug|iPhone.Build.0 = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Release|Any CPU.ActiveCfg = Release|Any CPU {7064B157-DD57-4828-94C5-CA149B25CB40}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Release|Any CPU.Build.0 = Release|Any CPU {7064B157-DD57-4828-94C5-CA149B25CB40}.Release|Any CPU.Build.0 = Release|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Release|iPhone.ActiveCfg = Release|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Release|iPhone.Build.0 = Release|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{7064B157-DD57-4828-94C5-CA149B25CB40}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Core\LuaInterface\LuaInterface.IOS.csproj StartupItem = ios\LuaInterfaceTest\LuaInterfaceTest.csproj
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal
...@@ -13,7 +13,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KopiLua", "Core\KopiLua\Kop ...@@ -13,7 +13,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KopiLua", "Core\KopiLua\Kop
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterface", "Core\LuaInterface\LuaInterface.csproj", "{F55CABBB-4108-4A39-94E1-581FD46DC021}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterface", "Core\LuaInterface\LuaInterface.csproj", "{F55CABBB-4108-4A39-94E1-581FD46DC021}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterface.Test", "LuaInterface.Test\LuaInterface.Test.csproj", "{D5FCADFA-5047-40C2-B392-256875862920}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LuaInterfaceTest", "LuaInterfaceTest\LuaInterfaceTest.csproj", "{D5FCADFA-5047-40C2-B392-256875862920}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
...@@ -44,7 +44,7 @@ Global ...@@ -44,7 +44,7 @@ Global
{F55CABBB-4108-4A39-94E1-581FD46DC021} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3} {F55CABBB-4108-4A39-94E1-581FD46DC021} = {B8664957-CB71-4F11-A4DB-59E7514BC5F3}
EndGlobalSection EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = LuaInterface.Test\LuaInterface.Test.csproj StartupItem = LuaInterfaceTest\LuaInterfaceTest.csproj
description = LuaInterface description = LuaInterface
version = 2.x version = 2.x
EndGlobalSection EndGlobalSection
......
...@@ -8,8 +8,8 @@ ...@@ -8,8 +8,8 @@
<ProjectGuid>{D5FCADFA-5047-40C2-B392-256875862920}</ProjectGuid> <ProjectGuid>{D5FCADFA-5047-40C2-B392-256875862920}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>LuaInterface.Test</RootNamespace> <RootNamespace>LuaInterfaceTest</RootNamespace>
<AssemblyName>LuaInterface.Test</AssemblyName> <AssemblyName>LuaInterfaceTest</AssemblyName>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<ReleaseVersion>2.x</ReleaseVersion> <ReleaseVersion>2.x</ReleaseVersion>
</PropertyGroup> </PropertyGroup>
......
...@@ -5,11 +5,11 @@ using System.Runtime.InteropServices; ...@@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle ("LuaInterface.Test")] [assembly: AssemblyTitle ("LuaInterfaceTest")]
[assembly: AssemblyDescription ("")] [assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")] [assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")] [assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("LuaInterface.Test")] [assembly: AssemblyProduct ("LuaInterfaceTest")]
[assembly: AssemblyCopyright ("Copyright © 2013")] [assembly: AssemblyCopyright ("Copyright © 2013")]
[assembly: AssemblyTrademark ("")] [assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")] [assembly: AssemblyCulture ("")]
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>MinimumOSVersion</key>
<string>3.2</string>
</dict>
</plist>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>10.0.0</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{60D0D65D-F831-4AC4-A4F5-6C143299B0F3}</ProjectGuid>
<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>LuaInterface.Test</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>LuaInterfaceTest</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchLink>None</MtouchLink>
<MtouchDebug>True</MtouchDebug>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<MtouchDebug>True</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Ad-Hoc|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\Ad-Hoc</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<BuildIpa>True</BuildIpa>
<ConsolePause>False</ConsolePause>
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
<CodesignKey>iPhone Distribution</CodesignKey>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\iPhone\AppStore</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
<CodesignKey>iPhone Distribution</CodesignKey>
<CodesignProvision>Automatic:AppStore</CodesignProvision>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="monotouch" />
<Reference Include="MonoTouch.NUnitLite" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="UnitTestAppDelegate.cs" />
<Compile Include="..\..\tests\Entity.cs">
<Link>Entity.cs</Link>
</Compile>
<Compile Include="..\..\tests\LuaTests.cs">
<Link>LuaTests.cs</Link>
</Compile>
<Compile Include="..\..\tests\TestLua.cs">
<Link>TestLua.cs</Link>
</Compile>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\..\Core\LuaInterface\LuaInterface.IOS.csproj">
<Project>{7064B157-DD57-4828-94C5-CA149B25CB40}</Project>
<Name>LuaInterface.IOS</Name>
</ProjectReference>
<ProjectReference Include="..\..\Core\KopiLua\KopiLua.IOS.csproj">
<Project>{44DA9778-C0B0-4C6F-8617-79BA2E0F1361}</Project>
<Name>KopiLua.IOS</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BundleResource Include="..\..\tests\test.lua">
<Link>test.lua</Link>
</BundleResource>
</ItemGroup>
</Project>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace LuaInterfaceTest
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "UnitTestAppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "UnitTestAppDelegate");
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.NUnit.UI;
namespace LuaInterfaceTest
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register ("UnitTestAppDelegate")]
public partial class UnitTestAppDelegate : UIApplicationDelegate
{
// class-level declarations
UIWindow window;
TouchRunner runner;
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
runner = new TouchRunner (window);
// register every tests included in the main application/assembly
runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());
window.RootViewController = new UINavigationController (runner.GetViewController ());
// make the window visible
window.MakeKeyAndVisible ();
return true;
}
}
}
...@@ -3,7 +3,7 @@ using System.Collections.Generic; ...@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
namespace LuaInterface.Test.Mock namespace LuaInterfaceTest.Mock
{ {
public class Entity public class Entity
{ {
......
This diff is collapsed.
//note: this should be cleaned up and replaced with moq mocks where possible //note: this should be cleaned up and replaced with moq mocks where possible
namespace LuaInterface.Test.Mock namespace LuaInterfaceTest.Mock
{ {
using System; using System;
...@@ -20,6 +20,109 @@ namespace LuaInterface.Test.Mock ...@@ -20,6 +20,109 @@ namespace LuaInterface.Test.Mock
public delegate int TestDelegate6(int a, out TestClass b); public delegate int TestDelegate6(int a, out TestClass b);
public delegate void TestDelegate7(int a, ref TestClass b); public delegate void TestDelegate7(int a, ref TestClass b);
/* Delegate Lua-handlers */
class LuaTestDelegate1Handler : LuaInterface.Method.LuaDelegate
{
int CallFunction (int a, int b)
{
object [] args = new object [] { a, b };
object [] inArgs = new object [] { a, b };
int [] outArgs = new int [] { };
object ret = base.callFunction (args, inArgs, outArgs);
return (int) ret;
}
}
class LuaTestDelegate2Handler : LuaInterface.Method.LuaDelegate
{
int CallFunction (int a, out int b)
{
object [] args = new object [] { a, 0 };
object [] inArgs = new object [] { a };
int [] outArgs = new int [] { 1 };
object ret = base.callFunction (args, inArgs, outArgs);
b = (int)args [1];
return (int) ret;
}
}
class LuaTestDelegate3Handler : LuaInterface.Method.LuaDelegate
{
void CallFunction (int a, ref int b)
{
object [] args = new object [] { a, b };
object [] inArgs = new object [] { a, b };
int [] outArgs = new int [] { 1 };
base.callFunction (args, inArgs, outArgs);
b = (int)args [1];
}
}
class LuaTestDelegate4Handler : LuaInterface.Method.LuaDelegate
{
TestClass CallFunction (int a, int b)
{
object [] args = new object [] { a, b };
object [] inArgs = new object [] { a, b };
int [] outArgs = new int [] { };
object ret = base.callFunction (args, inArgs, outArgs);
return (TestClass) ret;
}
}
class LuaTestDelegate5Handler : LuaInterface.Method.LuaDelegate
{
int CallFunction (TestClass a, TestClass b)
{
object [] args = new object [] { a, b };
object [] inArgs = new object [] { a, b };
int [] outArgs = new int [] { };
object ret = base.callFunction (args, inArgs, outArgs);
return (int) ret;
}
}
class LuaTestDelegate6Handler : LuaInterface.Method.LuaDelegate
{
int CallFunction (int a, ref TestClass b)
{
object [] args = new object [] { a, b };
object [] inArgs = new object [] { a };
int [] outArgs = new int [] { 1 };
object ret = base.callFunction (args, inArgs, outArgs);
b = (TestClass)args [1];
return (int) ret;
}
}
class LuaTestDelegate7Handler : LuaInterface.Method.LuaDelegate
{
void CallFunction (int a, ref TestClass b)
{
object [] args = new object [] { a, b };
object [] inArgs = new object [] { a , b};
int [] outArgs = new int [] { 1 };
base.callFunction (args, inArgs, outArgs);
b = (TestClass)args [1];
}
}
/* /*
* Interface used for testing Lua table -> interface translation * Interface used for testing Lua table -> interface translation
*/ */
......
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