This commit is contained in:
Matthew Leibowitz 2021-02-21 18:11:28 +02:00 коммит произвёл GitHub
Родитель 39af14bd27
Коммит ec4f45adc3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
23 изменённых файлов: 634 добавлений и 32 удалений

Просмотреть файл

@ -139,7 +139,8 @@ Task ("tests")
.Description ("Run all tests.")
.IsDependentOn ("tests-netfx")
.IsDependentOn ("tests-netcore")
.IsDependentOn ("tests-android");
.IsDependentOn ("tests-android")
.IsDependentOn ("tests-ios");
Task ("tests-netfx")
.Description ("Run all Full .NET Framework tests.")
@ -240,7 +241,7 @@ Task ("tests-android")
// SkiaSharp.Android.Tests.csproj
try {
// build the solution to copy all the files
RunMSBuild ("./tests/SkiaSharp.Mobile.Tests.sln", configuration: "Debug");
RunMSBuild ("./tests/SkiaSharp.Android.Tests.sln", configuration: "Debug");
// package the app
FilePath csproj = "./tests/SkiaSharp.Android.Tests/SkiaSharp.Android.Tests.csproj";
RunMSBuild (csproj,
@ -267,6 +268,46 @@ Task ("tests-android")
}
});
Task ("tests-ios")
.Description ("Run all iOS tests.")
.IsDependentOn ("externals")
.Does (() =>
{
var failedTests = 0;
CleanDirectories ($"{PACKAGE_CACHE_PATH}/skiasharp*");
CleanDirectories ($"{PACKAGE_CACHE_PATH}/harfbuzzsharp*");
// SkiaSharp.iOS.Tests.csproj
try {
// build the solution to copy all the files
RunMSBuild ("./tests/SkiaSharp.iOS.Tests.sln", configuration: "Debug");
// package the app
FilePath csproj = "./tests/SkiaSharp.iOS.Tests/SkiaSharp.iOS.Tests.csproj";
RunMSBuild (csproj,
properties: new Dictionary<string, string> { { "BuildIpa", "true" } },
platform: "iPhoneSimulator",
configuration: "Debug");
// run the tests
DirectoryPath results = "./output/testlogs/SkiaSharp.iOS.Tests";
RunCake ("./cake/xharness-ios.cake", "Default", new Dictionary<string, string> {
{ "project", MakeAbsolute(csproj).FullPath },
{ "configuration", "Debug" },
{ "exclusive", "true" },
{ "results", MakeAbsolute(results).FullPath },
});
} catch {
failedTests++;
}
if (failedTests > 0) {
if (THROW_ON_TEST_FAILURE)
throw new Exception ($"There were {failedTests} failed tests.");
else
Warning ($"There were {failedTests} failed tests.");
}
});
Task ("tests-wasm")
.Description ("Run WASM tests.")
.IsDependentOn ("externals-wasm")

Просмотреть файл

@ -9,7 +9,8 @@ void RunMSBuild(
bool restore = true,
bool bl = true,
string[] targets = null,
string configuration = null)
string configuration = null,
Dictionary<string, string> properties = null)
{
var nugetSources = new [] {
OUTPUT_NUGETS_PATH.FullPath,
@ -61,6 +62,12 @@ void RunMSBuild(
c.Properties ["RestoreNoCache"] = new [] { "true" };
c.Properties ["RestorePackagesPath"] = new [] { PACKAGE_CACHE_PATH.FullPath };
if (properties != null) {
foreach (var prop in properties) {
c.Properties [prop.Key] = new [] { prop.Value };
}
}
// c.Properties ["RestoreSources"] = nugetSources;
var sep = IsRunningOnWindows() ? ";" : "%3B";
c.ArgumentCustomization = args => args.Append($"/p:RestoreSources=\"{string.Join(sep, nugetSources)}\"");

Просмотреть файл

@ -173,7 +173,7 @@ Task("Default")
$"--output-directory=\"{TEST_RESULTS}\" " +
$"--verbosity=\"Debug\" ");
var failed = XmlPeek($"{TEST_RESULTS}/TestResults.xml", "/assemblies/assembly[@failed > 0]/@failed");
var failed = XmlPeek($"{TEST_RESULTS}/TestResults.xml", "/assemblies/assembly[@failed > 0 or @errors > 0]/@failed");
if (!string.IsNullOrEmpty(failed)) {
throw new Exception($"At least {failed} test(s) failed.");
}

60
cake/xharness-ios.cake Normal file
Просмотреть файл

@ -0,0 +1,60 @@
DirectoryPath ROOT_PATH = MakeAbsolute(Directory(".."));
#load "shared.cake"
// required
FilePath PROJECT = Argument("project", EnvironmentVariable("IOS_TEST_PROJECT") ?? "");
string TEST_DEVICE = Argument("device", EnvironmentVariable("IOS_TEST_DEVICE") ?? "ios-simulator-64_14.4"); // comma separated in the form <platform>-<device|simulator>[-<32|64>][_<version>] (eg: ios-simulator-64_13.4,[...])
// optional
var TEST_APP = Argument("app", EnvironmentVariable("IOS_TEST_APP") ?? "");
var TEST_RESULTS = Argument("results", EnvironmentVariable("IOS_TEST_RESULTS") ?? "");
// other
string PLATFORM = TEST_DEVICE.ToLower().Contains("simulator") ? "iPhoneSimulator" : "iPhone";
Information("Project File: {0}", PROJECT);
Task("Default")
.Does(() =>
{
if (string.IsNullOrEmpty(TEST_APP)) {
if (string.IsNullOrEmpty(PROJECT.FullPath))
throw new Exception("If no app was specified, an app must be provided.");
var binDir = PROJECT.GetDirectory().Combine("bin").Combine(PLATFORM).Combine(CONFIGURATION).FullPath;
var apps = GetDirectories(binDir + "/*.app");
TEST_APP = apps.First().FullPath;
}
if (string.IsNullOrEmpty(TEST_RESULTS)) {
TEST_RESULTS = TEST_APP + "-results";
}
Information("Test App: {0}", TEST_APP);
Information("Test Device: {0}", TEST_DEVICE);
Information("Test App: {0}", TEST_APP);
Information("Test Results Directory: {0}", TEST_RESULTS);
CleanDirectories(TEST_RESULTS);
try {
RunProcess("xharness", "apple test " +
$"--app=\"{TEST_APP}\" " +
$"--targets=\"{TEST_DEVICE}\" " +
$"--output-directory=\"{TEST_RESULTS}\" " +
$"--verbosity=\"Debug\" ");
} finally {
// ios test result files are weirdly named, so fix it up
var resultsFile = GetFiles($"{TEST_RESULTS}/xunit-test-*.xml").FirstOrDefault();
if (FileExists(resultsFile)) {
CopyFile(resultsFile, resultsFile.GetDirectory().CombineWithFilePath("TestResults.xml"));
}
}
// this _may_ not be needed, but just in case
var failed = XmlPeek($"{TEST_RESULTS}/TestResults.xml", "/assemblies/assembly[@failed > 0 or @errors > 0]/@failed");
if (!string.IsNullOrEmpty(failed)) {
throw new Exception($"At least {failed} test(s) failed.");
}
});
RunTarget(TARGET);

Просмотреть файл

@ -594,6 +594,38 @@ stages:
inputs:
artifactName: testlogs_android
pathToPublish: 'output/testlogs'
- template: azure-templates-bootstrapper.yml # Tests|ios (macOS)
parameters:
name: tests_ios_macos
displayName: iOS (macOS)
vmImage: $(VM_IMAGE_MAC)
target: tests-ios
additionalArgs: --device=ios-simulator-64 --skipExternals="all" --throwOnTestFailure=$(THROW_ON_TEST_FAILURE) --coverage=$(ENABLE_CODE_COVERAGE)
shouldPublish: false
requiredArtifacts:
- native_ios_macos
preBuildSteps:
- template: azure-templates-provisioning-profiles.yml
- pwsh: |
dotnet tool install Microsoft.DotNet.XHarness.CLI `
--global `
--add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json `
--version "1.0.0-prerelease*"
displayName: Install the xharness .NET Core tool
postBuildSteps:
- task: PublishTestResults@2
displayName: Publish the iOS test results
condition: always()
inputs:
testResultsFormat: xUnit
testResultsFiles: 'output/testlogs/SkiaSharp.iOS.Tests/**/TestResults.xml'
testRunTitle: 'iOS Tests'
- task: PublishBuildArtifacts@1
displayName: Publish the test logs
condition: always()
inputs:
artifactName: testlogs_ios
pathToPublish: 'output/testlogs'
- template: azure-templates-bootstrapper.yml # Tests|netfx (Linux)
parameters:
name: tests_netfx_linux
@ -722,21 +754,7 @@ stages:
requiredArtifacts:
- nuget
preBuildSteps:
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'SkiaSharp iOS Certificate.p12'
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'SkiaSharp Mac Certificate.p12'
- task: InstallAppleProvisioningProfile@1
inputs:
provProfileSecureFile: 'SkiaSharp iOS Provisioning.mobileprovision'
- task: InstallAppleProvisioningProfile@1
inputs:
provProfileSecureFile: 'SkiaSharp Mac Provisioning.provisionprofile'
- task: InstallAppleProvisioningProfile@1
inputs:
provProfileSecureFile: 'SkiaSharp tvOS Provisioning.mobileprovision'
- template: azure-templates-provisioning-profiles.yml
- pwsh: |
New-Item '.\output\nugets\' -Type Directory -Force | Out-Null
Get-ChildItem '.\output\*.nupkg' | Move-Item -Destination '.\output\nugets\'

Просмотреть файл

@ -0,0 +1,16 @@
steps:
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'SkiaSharp iOS Certificate.p12'
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'SkiaSharp Mac Certificate.p12'
- task: InstallAppleProvisioningProfile@1
inputs:
provProfileSecureFile: 'SkiaSharp iOS Provisioning.mobileprovision'
- task: InstallAppleProvisioningProfile@1
inputs:
provProfileSecureFile: 'SkiaSharp Mac Provisioning.provisionprofile'
- task: InstallAppleProvisioningProfile@1
inputs:
provProfileSecureFile: 'SkiaSharp tvOS Provisioning.mobileprovision'

Просмотреть файл

@ -13,6 +13,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.HarfBuzz", "..\so
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Android", "..\source\SkiaSharp.Views\SkiaSharp.Views.Android\SkiaSharp.Views.Android.csproj", "{16922662-C540-4865-876D-94ED3211521B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SkiaSharp.Views.Forms.Android", "..\source\SkiaSharp.Views.Forms\SkiaSharp.Views.Forms.Android\SkiaSharp.Views.Forms.Android.csproj", "{F962E49D-DC1F-4E93-9F6B-335E2746BCF1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -41,6 +43,10 @@ Global
{16922662-C540-4865-876D-94ED3211521B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{16922662-C540-4865-876D-94ED3211521B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{16922662-C540-4865-876D-94ED3211521B}.Release|Any CPU.Build.0 = Release|Any CPU
{F962E49D-DC1F-4E93-9F6B-335E2746BCF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F962E49D-DC1F-4E93-9F6B-335E2746BCF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F962E49D-DC1F-4E93-9F6B-335E2746BCF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F962E49D-DC1F-4E93-9F6B-335E2746BCF1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

Просмотреть файл

@ -13,7 +13,7 @@ namespace SkiaSharp.Tests
{
Xamarin.Essentials.Platform.Init(this, bundle);
AssetCopier.CopyAssets(this);
AssetCopier.CopyAssets();
AddTestAssembly(Assembly.GetExecutingAssembly());
AddExecutionAssembly(Assembly.GetExecutingAssembly());

Просмотреть файл

@ -9,7 +9,6 @@
<RootNamespace>SkiaSharp.Tests</RootNamespace>
<AssemblyName>SkiaSharp.Tests</AssemblyName>
<TargetFrameworkVersion>v10.0</TargetFrameworkVersion>
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
<AndroidApplication>True</AndroidApplication>
<AndroidUseIntermediateDesignerFile>true</AndroidUseIntermediateDesignerFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
@ -23,6 +22,7 @@
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
<SkipCopyToOutputDirectory>true</SkipCopyToOutputDirectory>
<SignAssembly>false</SignAssembly>
<AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -33,7 +33,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AndroidLinkMode>None</AndroidLinkMode>
<AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<AotAssemblies>false</AotAssemblies>
<EnableLLVM>false</EnableLLVM>
@ -52,7 +51,6 @@
<WarningLevel>4</WarningLevel>
<AndroidManagedSymbols>true</AndroidManagedSymbols>
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
<AndroidSupportedAbis>armeabi-v7a;x86;x86_64;arm64-v8a</AndroidSupportedAbis>
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
<JavaMaximumHeapSize>1G</JavaMaximumHeapSize>
<AndroidLinkMode>None</AndroidLinkMode>
@ -86,18 +84,21 @@
<Project>{4c5f53b5-9dfd-4cc6-8fae-98b4f40cb33a}</Project>
<Name>SkiaSharp.HarfBuzz</Name>
</ProjectReference>
<ProjectReference Include="..\..\source\SkiaSharp.Views.Forms\SkiaSharp.Views.Forms.Android\SkiaSharp.Views.Forms.Android.csproj">
<Project>{f962e49d-dc1f-4e93-9f6b-335e2746bcf1}</Project>
<Name>SkiaSharp.Views.Forms.Android</Name>
</ProjectReference>
<ProjectReference Include="..\..\source\SkiaSharp.Views\SkiaSharp.Views.Android\SkiaSharp.Views.Android.csproj">
<Project>{16922662-c540-4865-876d-94ed3211521b}</Project>
<Name>SkiaSharp.Views.Android</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssetCopier.cs" />
<Compile Include="MainActivity.cs" />
<Compile Include="TestInstrumentation.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Tests\**\*.cs" Link="%(RecursiveDir)%(FileName)%(Extension)" />
<Compile Include="..\Tests\**\*.cs" Link="%(RecursiveDir)%(FileName)%(Extension)" Exclude="..\Tests\GlContexts\*\*;..\Tests\PlatformUtils\*\*" />
<Compile Include="..\..\binding\Binding.Shared\LibraryLoader.cs" Link="PlatformUtils\LibraryLoader.cs" />
</ItemGroup>
<ItemGroup>

Просмотреть файл

@ -30,7 +30,7 @@ namespace SkiaSharp.Tests
{
base.OnCreate(arguments);
AssetCopier.CopyAssets(Context);
AssetCopier.CopyAssets();
resultsFileName = arguments.GetString("results-file-name", "TestResults.xml");

Просмотреть файл

@ -0,0 +1,107 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.808.5
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.iOS", "..\binding\SkiaSharp.iOS\SkiaSharp.iOS.csproj", "{A4146A87-DB60-4A17-A179-0E2E4255A08E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HarfBuzzSharp.iOS", "..\binding\HarfBuzzSharp.iOS\HarfBuzzSharp.iOS.csproj", "{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.HarfBuzz", "..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj", "{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Views.iOS", "..\source\SkiaSharp.Views\SkiaSharp.Views.iOS\SkiaSharp.Views.iOS.csproj", "{549F8E22-A756-4E99-A84A-C4E74832DA95}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.Views.Forms.iOS", "..\source\SkiaSharp.Views.Forms\SkiaSharp.Views.Forms.iOS\SkiaSharp.Views.Forms.iOS.csproj", "{0254162B-6B4A-459E-BD96-3A42A104C144}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SkiaSharp.iOS.Tests", "SkiaSharp.iOS.Tests\SkiaSharp.iOS.Tests.csproj", "{B73EB308-70BE-49FD-91A7-1D1495663D6D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|iPhoneSimulator = Release|iPhoneSimulator
Debug|iPhone = Debug|iPhone
Release|iPhone = Release|iPhone
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Release|Any CPU.Build.0 = Release|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Debug|iPhone.Build.0 = Debug|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Release|iPhone.ActiveCfg = Release|Any CPU
{A4146A87-DB60-4A17-A179-0E2E4255A08E}.Release|iPhone.Build.0 = Release|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Release|Any CPU.Build.0 = Release|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Debug|iPhone.Build.0 = Debug|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Release|iPhone.ActiveCfg = Release|Any CPU
{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}.Release|iPhone.Build.0 = Release|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Release|Any CPU.Build.0 = Release|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Debug|iPhone.Build.0 = Debug|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Release|iPhone.ActiveCfg = Release|Any CPU
{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}.Release|iPhone.Build.0 = Release|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Release|Any CPU.Build.0 = Release|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Debug|iPhone.Build.0 = Debug|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Release|iPhone.ActiveCfg = Release|Any CPU
{549F8E22-A756-4E99-A84A-C4E74832DA95}.Release|iPhone.Build.0 = Release|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Release|Any CPU.Build.0 = Release|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Debug|iPhone.Build.0 = Debug|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Release|iPhone.ActiveCfg = Release|Any CPU
{0254162B-6B4A-459E-BD96-3A42A104C144}.Release|iPhone.Build.0 = Release|Any CPU
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Debug|iPhone.ActiveCfg = Debug|iPhone
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Debug|iPhone.Build.0 = Debug|iPhone
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Release|iPhone.ActiveCfg = Release|iPhone
{B73EB308-70BE-49FD-91A7-1D1495663D6D}.Release|iPhone.Build.0 = Release|iPhone
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {35C58E22-5C43-4580-AE38-8F774B6C98EC}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -0,0 +1,21 @@
using System.Reflection;
using Foundation;
using UIKit;
namespace SkiaSharp.Tests
{
[Register(nameof(AppDelegate))]
public partial class AppDelegate : Xunit.Runner.RunnerAppDelegate
{
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
// We need this to ensure the execution assembly is part of the app bundle
AddExecutionAssembly(Assembly.GetExecutingAssembly());
// tests can be inside the main assembly
AddTestAssembly(Assembly.GetExecutingAssembly());
return base.FinishedLaunching(app, options);
}
}
}

Просмотреть файл

@ -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>

Просмотреть файл

@ -0,0 +1,39 @@
<?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>UIInterfaceOrientationPortraitUpsideDown</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>10.0</string>
<key>CFBundleDisplayName</key>
<string>Tests</string>
<key>CFBundleIdentifier</key>
<string>com.mono.skiasharp.tests</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>CFBundleName</key>
<string>Tests</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,18 @@
using System;
using UIKit;
namespace SkiaSharp.Tests
{
public class Application
{
static void Main(string[] args)
{
AssetCopier.CopyAssets();
if (args?.Length > 0 || Environment.GetEnvironmentVariable("NUNIT_AUTOEXIT")?.Length > 0) // usually means this is from xharness
UIApplication.Main(args, null, nameof(TestApplicationDelegate));
else
UIApplication.Main(args, null, nameof(AppDelegate));
}
}
}

Просмотреть файл

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="X5k-f2-b5h">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="gAE-YM-kbH">
<objects>
<viewController id="X5k-f2-b5h" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Y8P-hJ-Z43"/>
<viewControllerLayoutGuide type="bottom" id="9ZL-r4-8FZ"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="yd7-JS-zBw">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="23" firstAttribute="centerY" secondItem="yd7-JS-zBw" secondAttribute="centerY" priority="1" id="39"/>
<constraint firstItem="23" firstAttribute="centerX" secondItem="yd7-JS-zBw" secondAttribute="centerX" priority="1" id="41"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="XAI-xm-WK6" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="349" y="339"/>
</scene>
</scenes>
<resources>
</resources>
</document>

Просмотреть файл

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B73EB308-70BE-49FD-91A7-1D1495663D6D}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<AssemblyName>SkiaSharp.Tests</AssemblyName>
<RootNamespace>SkiaSharp.Tests</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<SkipGenerateAssemblyVersionInfo>true</SkipGenerateAssemblyVersionInfo>
<SkipMDocGenerateDocs>true</SkipMDocGenerateDocs>
<SkipCopyToOutputDirectory>true</SkipCopyToOutputDirectory>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;USE_LIBRARY_LOADER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<MtouchArch>x86_64</MtouchArch>
<MtouchLink>None</MtouchLink>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<DefineConstants>USE_LIBRARY_LOADER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchExtraArgs>--linkskip=Xamarin.Forms.Platform.iOS --linkskip=Xamarin.Forms.Platform --linkskip=Xamarin.Forms.Core --linkskip=Xamarin.Forms.Xaml</MtouchExtraArgs>
<MtouchArch>x86_64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;USE_LIBRARY_LOADER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchExtraArgs>--linkskip=Xamarin.Forms.Platform.iOS --linkskip=Xamarin.Forms.Platform --linkskip=Xamarin.Forms.Core --linkskip=Xamarin.Forms.Xaml</MtouchExtraArgs>
<ConsolePause>false</ConsolePause>
<MtouchArch>ARM64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<DefineConstants>USE_LIBRARY_LOADER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>SdkOnly</MtouchLink>
<MtouchExtraArgs>--linkskip=Xamarin.Forms.Platform.iOS --linkskip=Xamarin.Forms.Platform --linkskip=Xamarin.Forms.Core --linkskip=Xamarin.Forms.Xaml</MtouchExtraArgs>
<MtouchArch>ARM64</MtouchArch>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Xamarin.iOS" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Essentials" Version="1.6.1" />
<PackageReference Include="Xamarin.Forms" Version="4.5.0.725" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.devices" Version="2.5.25" />
<PackageReference Include="xunit.skippablefact" Version="1.4.13" />
<PackageReference Include="Validation" Version="2.4.22" />
<PackageReference Include="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.20602.1" />
<PackageReference Include="System.Memory" Version="4.5.3" ExcludeAssets="all" />
<PackageReference Include="System.Buffers" Version="4.5.1" ExcludeAssets="all" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" />
<Compile Include="TestApplicationDelegate.cs" />
<None Include="Entitlements.plist" />
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Tests\**\*.cs" Link="%(RecursiveDir)%(FileName)%(Extension)" Exclude="..\Tests\GlContexts\*\*;..\Tests\PlatformUtils\*\*" />
<Compile Include="..\..\binding\Binding.Shared\LibraryLoader.cs" Link="PlatformUtils\LibraryLoader.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\Content\**\*" Link="Content\%(RecursiveDir)%(FileName)%(Extension)" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\binding\HarfBuzzSharp.iOS\HarfBuzzSharp.iOS.csproj">
<Project>{D958E2E9-DE32-42E8-AB10-D25E4186C4E1}</Project>
<Name>HarfBuzzSharp.iOS</Name>
</ProjectReference>
<ProjectReference Include="..\..\source\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz\SkiaSharp.HarfBuzz.csproj">
<Project>{A5614B8C-31C8-43A3-9BF9-2719E4BE4D36}</Project>
<Name>SkiaSharp.HarfBuzz</Name>
</ProjectReference>
<ProjectReference Include="..\..\binding\SkiaSharp.iOS\SkiaSharp.iOS.csproj">
<Project>{A4146A87-DB60-4A17-A179-0E2E4255A08E}</Project>
<Name>SkiaSharp.iOS</Name>
</ProjectReference>
<ProjectReference Include="..\..\source\SkiaSharp.Views.Forms\SkiaSharp.Views.Forms.iOS\SkiaSharp.Views.Forms.iOS.csproj">
<Project>{0254162B-6B4A-459E-BD96-3A42A104C144}</Project>
<Name>SkiaSharp.Views.Forms.iOS</Name>
</ProjectReference>
<ProjectReference Include="..\..\source\SkiaSharp.Views\SkiaSharp.Views.iOS\SkiaSharp.Views.iOS.csproj">
<Project>{549F8E22-A756-4E99-A84A-C4E74832DA95}</Project>
<Name>SkiaSharp.Views.iOS</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<Import Project="..\..\output\SkiaSharp\nuget\build\xamarinios1.0\SkiaSharp.targets" Condition="Exists('..\..\output\SkiaSharp\nuget\build\xamarinios1.0\SkiaSharp.targets')" />
<Import Project="..\..\output\HarfBuzzSharp\nuget\build\xamarinios1.0\HarfBuzzSharp.targets" Condition="Exists('..\..\output\HarfBuzzSharp\nuget\build\xamarinios1.0\HarfBuzzSharp.targets')" />
</Project>

Просмотреть файл

@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Reflection;
using Foundation;
using Microsoft.DotNet.XHarness.TestRunners.Common;
using Microsoft.DotNet.XHarness.TestRunners.Xunit;
using UIKit;
using Xamarin.Essentials;
namespace SkiaSharp.Tests
{
[Register(nameof(TestApplicationDelegate))]
public class TestApplicationDelegate : UIApplicationDelegate
{
public override UIWindow Window { get; set; }
public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
{
Window = new UIWindow(UIScreen.MainScreen.Bounds)
{
RootViewController = new ViewController()
};
Window.MakeKeyAndVisible();
return true;
}
class ViewController : UIViewController
{
public override async void ViewDidLoad()
{
base.ViewDidLoad();
var entryPoint = new TestsEntryPoint();
await entryPoint.RunAsync();
}
}
class TestsEntryPoint : iOSApplicationEntryPoint
{
protected override bool LogExcludedTests => true;
protected override int? MaxParallelThreads => Environment.ProcessorCount;
protected override IDevice Device { get; } = new TestDevice();
protected override IEnumerable<TestAssemblyInfo> GetTestAssemblies()
{
yield return new TestAssemblyInfo(Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly().Location);
}
protected override void TerminateWithSuccess()
{
Console.WriteLine("Exiting test run with success");
var s = new ObjCRuntime.Selector("terminateWithSuccess");
UIApplication.SharedApplication.PerformSelector(s, UIApplication.SharedApplication, 0);
}
protected override TestRunner GetTestRunner(LogWriter logWriter)
{
var testRunner = base.GetTestRunner(logWriter);
return testRunner;
}
}
class TestDevice : IDevice
{
public string BundleIdentifier => AppInfo.PackageName;
public string UniqueIdentifier => Guid.NewGuid().ToString("N");
public string Name => DeviceInfo.Name;
public string Model => DeviceInfo.Model;
public string SystemName => DeviceInfo.Platform.ToString();
public string SystemVersion => DeviceInfo.VersionString;
public string Locale => CultureInfo.CurrentCulture.Name;
}
}
}

Просмотреть файл

@ -27,7 +27,7 @@ namespace SkiaSharp.Tests
static BaseTest()
{
// the the base paths
#if __ANDROID__
#if __ANDROID__ || __IOS__
PathToAssembly = Xamarin.Essentials.FileSystem.CacheDirectory;
#else
PathToAssembly = Directory.GetCurrentDirectory();
@ -36,7 +36,7 @@ namespace SkiaSharp.Tests
PathToImages = Path.Combine(PathToAssembly, "images");
// some platforms run the tests from a temporary location, so copy the native files
#if !NET_STANDARD && !__ANDROID__
#if !NET_STANDARD && !__ANDROID__ && !__IOS__
var skiaRoot = Path.GetDirectoryName(typeof(SkiaSharp.SKImageInfo).Assembly.Location);
var harfRoot = Path.GetDirectoryName(typeof(HarfBuzzSharp.Buffer).Assembly.Location);
@ -64,6 +64,9 @@ namespace SkiaSharp.Tests
#if __ANDROID__
DefaultFontFamily = "sans-serif";
UnicodeFontFamilies = new[] { "Noto Color Emoji" };
#elif __IOS__
DefaultFontFamily = "Arial";
UnicodeFontFamilies = new[] { "Apple Color Emoji" };
#else
DefaultFontFamily = IsLinux ? "DejaVu Sans" : "Arial";
UnicodeFontFamilies =

Просмотреть файл

@ -1,11 +1,10 @@
using System.IO;
using Android.Content;
namespace SkiaSharp.Tests
{
internal static class AssetCopier
{
public static void CopyAssets(Context context)
public static void CopyAssets()
{
var fontsRoot = BaseTest.PathToFonts;
var imagesRoot = BaseTest.PathToImages;

Просмотреть файл

@ -501,8 +501,8 @@ namespace SkiaSharp.Tests
mask.FreeImage();
}
#if __ANDROID__
[SkippableTheory(Skip = "Android runs out of memory.")]
#if __ANDROID__ || __IOS__
[SkippableTheory(Skip = "Mobile devices sometimes run out of memory.")]
#else
[SkippableTheory]
#endif

Просмотреть файл

@ -321,6 +321,7 @@ namespace SkiaSharp.Tests
}
}
#if !__ANDROID__ && !__IOS__
[SkippableFact]
public async Task DelayedConstructionDoesNotCreateInvalidState()
{
@ -437,6 +438,7 @@ namespace SkiaSharp.Tests
Assert.True(SKObject.GetInstance<DelayedDestructionObject>(handle, out var final));
Assert.Same(objSlow, final);
}
#endif
private class DelayedConstructionObject : SKObject
{

Просмотреть файл

@ -145,6 +145,7 @@ namespace SkiaSharp.Tests
{
try
{
#if !__ANDROID__ && !__IOS__
if (IsLinux)
{
return new GlxContext();
@ -158,6 +159,7 @@ namespace SkiaSharp.Tests
return new WglContext();
}
else
#endif
{
throw new PlatformNotSupportedException();
}