Merge pull request #51 from smoogipoo/add-ios-tests

Add iOS tests
This commit is contained in:
Dan Balasescu 2024-04-20 20:21:04 +09:00 committed by GitHub
commit 56b9eb7076
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 211 additions and 32 deletions

View File

@ -0,0 +1 @@
SDL3-CS.Android

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="vcsConfiguration" value="2" />
</component>
</project>

11
.run/Android.run.xml Normal file
View File

@ -0,0 +1,11 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Android" type="XamarinAndroidProject" factoryName="Xamarin.Android">
<option name="PROJECT_PATH" value="$PROJECT_DIR$/SDL3-CS.Tests.Android/SDL3-CS.Tests.Android.csproj" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="TARGET_SELECTION_MODE" value="DEVICE_AND_SNAPSHOT_COMBO_BOX" />
<option name="DEPLOY_BEHAVIOUR_NAME" value="Default" />
<method v="2">
<option name="Build" />
</method>
</configuration>
</component>

View File

@ -1,13 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SDL3-CS.Tests" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/SDL3-CS.Tests/bin/Debug/net8.0/SDL3-CS.Tests" />
<configuration default="false" name="Desktop" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/SDL3-CS.Tests.Desktop/bin/Debug/net8.0/SDL3-CS.Tests.Desktop" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/SDL3-CS.Tests/bin/Debug/net8.0" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/SDL3-CS.Tests.Desktop/bin/Debug/net8.0" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
<option name="RUNTIME_ARGUMENTS" value="" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/SDL3-CS.Tests/SDL3-CS.Tests.csproj" />
<option name="PROJECT_PATH" value="$PROJECT_DIR$/SDL3-CS.Tests.Desktop/SDL3-CS.Tests.Desktop.csproj" />
<option name="PROJECT_EXE_PATH_TRACKING" value="1" />
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="1" />

9
.run/iOS.run.xml Normal file
View File

@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="iOS" type="XamarinIOSProject" factoryName="Xamarin.iOS">
<option name="PROJECT_PATH" value="$PROJECT_DIR$/SDL3-CS.Tests.iOS/SDL3-CS.Tests.iOS.csproj" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="IS_PASS_PARENT_ENVS" value="false" />
<option name="EXTRA_MLAUNCH_PARAMETERS" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -4,8 +4,8 @@
"projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj",
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj",
"SDL3-CS.Android\\SDL3-CS.Android.csproj",
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj",
"SDL3-CS.Tests.Android\\SDL3-CS.Tests.Android.csproj"
]
}

View File

@ -4,7 +4,8 @@
"projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj",
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj"
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj",
"SDL3-CS.Tests.Desktop\\SDL3-CS.Tests.Desktop.csproj"
]
}
}

View File

@ -12,7 +12,6 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS\SDL3-CS.csproj"/>
<ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj"/>
<ProjectReference Include="..\SDL3-CS.Android\SDL3-CS.Android.csproj"/>
</ItemGroup>

View File

@ -0,0 +1,7 @@
internal class Program
{
public static void Main(string[] args)
{
SDL.Tests.Program.Main();
}
}

View File

@ -0,0 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SDL3.Tests.Desktop</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj"/>
</ItemGroup>
<PropertyGroup>
<SDLArch>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</SDLArch>
<!-- If RID is specified -->
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('win')) ">$(RuntimeIdentifier)\SDL3.dll</SDLNativeLib>
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('linux')) ">$(RuntimeIdentifier)\libSDL3.so</SDLNativeLib>
<SDLNativeLib Condition=" $(RuntimeIdentifier.StartsWith('osx')) ">$(RuntimeIdentifier)\libSDL3.dylib</SDLNativeLib>
<!-- If RID is not specified -->
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(Windows))' ">win-$(SDLArch.ToLower())\SDL3.dll</SDLNativeLib>
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(Linux))' ">linux-$(SDLArch.ToLower())\libSDL3.so</SDLNativeLib>
<SDLNativeLib Condition=" '$(SDLNativeLib)' == '' And '$([MSBuild]::IsOSPlatform(OSX))' ">osx-$(SDLArch.ToLower())\libSDL3.dylib</SDLNativeLib>
</PropertyGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)..\native\$(SDLNativeLib)">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?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>
</dict>
</plist>

View File

@ -0,0 +1,40 @@
<?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>CFBundleDisplayName</key>
<string>SDL.Tests.iOS</string>
<key>CFBundleIdentifier</key>
<string>SDL.Tests.iOS</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</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>
</dict>
</plist>

20
SDL3-CS.Tests.iOS/Main.cs Normal file
View File

@ -0,0 +1,20 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SDL;
public class Program
{
public static unsafe void Main(string[] args)
{
NativeLibrary.SetDllImportResolver(typeof(SDL3).Assembly, (_, assembly, path) => NativeLibrary.Load("@rpath/SDL3.framework/SDL3", assembly, path));
SDL3.SDL_RunApp(0, null, &main, IntPtr.Zero);
}
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
private static unsafe int main(int argc, byte** argv)
{
SDL.Tests.Program.Main();
return 0;
}
}

View File

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0-ios</TargetFramework>
<RootNamespace>SDL3.Tests.iOS</RootNamespace>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
<ImplicitUsings>true</ImplicitUsings>
<SupportedOSPlatformVersion>13.0</SupportedOSPlatformVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\SDL3-CS.Tests\SDL3-CS.Tests.csproj" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>
<NativeReference Include="$(MSBuildThisFileDirectory)..\native\ios\SDL3.xcframework"/>
</ItemGroup>
</Project>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<OutputType>Library</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>SDL.Tests</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>

11
SDL3-CS.iOS.slnf Normal file
View File

@ -0,0 +1,11 @@
{
"solution": {
"path": "SDL3-CS.sln",
"projects": [
"SDL3-CS\\SDL3-CS.csproj",
"SDL3-CS.SourceGeneration\\SDL3-CS.SourceGeneration.csproj",
"SDL3-CS.Tests\\SDL3-CS.Tests.csproj",
"SDL3-CS.Tests.iOS\\SDL3-CS.Tests.iOS.csproj"
]
}
}

View File

@ -23,6 +23,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Android", "SDL3-CS.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Android", "SDL3-CS.Tests.Android\SDL3-CS.Tests.Android.csproj", "{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.iOS", "SDL3-CS.Tests.iOS\SDL3-CS.Tests.iOS.csproj", "{CCDD11EE-D552-4925-8B68-351AC9317589}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDL3-CS.Tests.Desktop", "SDL3-CS.Tests.Desktop\SDL3-CS.Tests.Desktop.csproj", "{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -49,6 +53,14 @@ Global
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E8469DA5-E437-4287-9E2A-8B8F4DC21C1A}.Release|Any CPU.Build.0 = Release|Any CPU
{CCDD11EE-D552-4925-8B68-351AC9317589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCDD11EE-D552-4925-8B68-351AC9317589}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCDD11EE-D552-4925-8B68-351AC9317589}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCDD11EE-D552-4925-8B68-351AC9317589}.Release|Any CPU.Build.0 = Release|Any CPU
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7E8D719A-5B69-43B7-A9D5-385B6FE7F411}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -29,46 +29,38 @@
</ItemGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)..\native\win-x64\SDL3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<None Include="$(MSBuildThisFileDirectory)..\native\win-x64\SDL3.dll">
<PackagePath>runtimes/win-x64/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\native\win-arm64\SDL3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\win-arm64\SDL3.dll">
<PackagePath>runtimes/win-arm64/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\native\win-x86\SDL3.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\win-x86\SDL3.dll">
<PackagePath>runtimes/win-x86/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\native\osx-x64\libSDL3.dylib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\osx-x64\libSDL3.dylib">
<PackagePath>runtimes/osx-x64/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\native\osx-arm64\libSDL3.dylib">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\osx-arm64\libSDL3.dylib">
<PackagePath>runtimes/osx-arm64/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\native\linux-x64\libSDL3.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x64\libSDL3.so">
<PackagePath>runtimes/linux-x64/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\native\linux-x86\libSDL3.so">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\linux-x86\libSDL3.so">
<PackagePath>runtimes/linux-x86/native</PackagePath>
<Pack>true</Pack>
</Content>
<Content Include="$(MSBuildThisFileDirectory)..\native\ios\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)..\native\ios\**\*">
<PackagePath>runtimes/ios/native</PackagePath>
<Pack>true</Pack>
</Content>
</None>
</ItemGroup>
</Project>