Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,33 @@ name: .NET

on:
push:
branches: [ "develop" ]
branches: [ "master", "develop" ]
pull_request:
branches: [ "develop" ]
branches: [ "master", "develop" ]

jobs:
build:

runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
- name: Setup .NET (8 + 9)
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: |
8.0.x
9.0.x
- name: Restore dependencies
run: dotnet restore
run: dotnet restore Svg.Editor.Avalon.CI.slnf
- name: Build
run: dotnet build --no-restore
run: dotnet build Svg.Editor.Avalon.CI.slnf --configuration Release --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
run: dotnet test Svg.Editor.Avalon.CI.slnf --configuration Release --no-build --framework net9.0 --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ${{ github.workspace }}/TestResults
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: ${{ github.workspace }}/TestResults/**/*.trx
if-no-files-found: warn
14 changes: 14 additions & 0 deletions Svg.Editor.Avalon.CI.slnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"solution": {
"path": "Svg.Editor.Avalon.sln",
"projects": [
"Svg\\Svg.csproj",
"Svg.Editor.Core\\Svg.Editor.Core.csproj",
"Svg.Editor.Avalonia.Forms\\Svg.Editor.Avalon.Forms.csproj",
"Svg.Editor.Avalonia.Views\\Svg.Editor.Avalon.Views.csproj",
"Svg.Editor.Core.Tests\\Svg.Editor.Core.Tests.csproj",
"Svg.Tests.Win\\Svg.Tests.Win.csproj",
"Svg.Tests.Benchmarks\\Svg.Tests.Benchmarks.csproj"
]
}
}
10 changes: 9 additions & 1 deletion Svg.Editor.Avalon.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.3.11505.172 d18.3
VisualStudioVersion = 18.3.11505.172
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Svg", "Svg", "{ACC8B9D3-7E55-4F2E-B0D1-955BDA751FCF}"
EndProject
Expand Down Expand Up @@ -35,6 +35,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Svg.Editor.CrossSample.Aval
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Svg.Editor.CrossSample.Avalon.iOS", "Svg.Editor.CrossSample.Avalon\Svg.Editor.CrossSample.Avalon.iOS\Svg.Editor.CrossSample.Avalon.iOS.csproj", "{61FC8A8D-0520-4881-94CC-CABD15A27B57}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution-items", "solution-items", "{A5712C80-A0CF-465C-8557-A28265B56E38}"
ProjectSection(SolutionItems) = preProject
.github\workflows\dotnet.yml = .github\workflows\dotnet.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -113,6 +118,9 @@ Global
{897540BE-6373-4565-AEF4-41E19EB8DFEE} = {64382118-1FD0-4891-A24F-9C065103DEAB}
{61FC8A8D-0520-4881-94CC-CABD15A27B57} = {64382118-1FD0-4891-A24F-9C065103DEAB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {569660EA-F35A-4750-8199-48494389F23F}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Svg.Tests\Svg.Tests.projitems*{92bce9d4-6968-4533-9785-a240ee123faa}*SharedItemsImports = 13
Svg.Tests\Svg.Tests.projitems*{ed6ab6fc-ad44-4dfa-afc4-b0f127b87d5e}*SharedItemsImports = 5
Expand Down
4 changes: 3 additions & 1 deletion Svg.Editor.Avalonia.Forms/Svg.Editor.Avalon.Forms.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>3.1.2-optiq06</Version>
<Version>3.1.3-optiq01</Version>
<PackageReleaseNotes>
#3.1.3-optiq01
Updated SkiaSharp from 2.88.8 to 3.119.1
#3.1.2-optiq06
Fixed: Sketch, when setting text and cancel dialog, opens new dialog and asks for font size
#3.1.2-optiq05
Expand Down
4 changes: 3 additions & 1 deletion Svg.Editor.Avalonia.Views/Svg.Editor.Avalon.Views.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<Version>3.1.2-optiq06</Version>
<Version>3.1.3-optiq01</Version>
<PackageReleaseNotes>
#3.1.3-optiq01
Updated SkiaSharp from 2.88.8 to 3.119.1
#3.1.2-optiq06
Fixed: Sketch, when setting text and cancel dialog, opens new dialog and asks for font size
#3.1.2-optiq05
Expand Down
8 changes: 4 additions & 4 deletions Svg.Editor.Core.Tests/PerformanceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task IfPointerIsMoved_AndNoElementIsSelected_NothingIsMoved()
Canvas.CanvasInvalidated += async (sender, args) =>
{

using (var surface = SkiaSharp.SKSurface.Create(800, 600, SKImageInfo.PlatformColorType, SKAlphaType.Premul))
using (var surface = SkiaSharp.SKSurface.Create(new SKImageInfo(800, 600, SKImageInfo.PlatformColorType, SKAlphaType.Premul)))
{
await Canvas.OnDraw(new SKCanvasRenderer(surface, 800, 600));
}
Expand Down Expand Up @@ -69,7 +69,7 @@ public async Task IfPointerIsMoved_AndNoElementIsSelected_NothingIsMoved_OpenGL(
Canvas.CanvasInvalidated += async (sender, args) =>
{

using (var surface = SkiaSharp.SKSurface.Create(GRContext.Create(GRBackend.OpenGL), new GRBackendRenderTargetDesc()))
using (var surface = SkiaSharp.SKSurface.Create(GRContext.CreateGl(), new GRBackendRenderTarget(800, 600, 0, 8, new GRGlFramebufferInfo()), GRSurfaceOrigin.BottomLeft, SKColorType.Rgba8888))
{
await Canvas.OnDraw(new SKCanvasRenderer(surface, 800, 600));
}
Expand Down Expand Up @@ -98,13 +98,13 @@ public async Task CachesSvgRendererAndUpdatesGraphics()
Canvas.Document = d;

// Act: draw 2x with different SKCanvasRenderers
using var surface1 = SkiaSharp.SKSurface.Create(800, 600, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
using var surface1 = SkiaSharp.SKSurface.Create(new SKImageInfo(800, 600, SKImageInfo.PlatformColorType, SKAlphaType.Premul));
var renderer1 = new SKCanvasRenderer(surface1, 800, 600);
await Canvas.OnDraw(renderer1);
var svgR1 = d.UsedRenderers[0];
var svgR1Graphics = svgR1.Graphics;

using var surface2 = SkiaSharp.SKSurface.Create(800, 600, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
using var surface2 = SkiaSharp.SKSurface.Create(new SKImageInfo(800, 600, SKImageInfo.PlatformColorType, SKAlphaType.Premul));
var renderer2 = new SKCanvasRenderer(surface2, 800, 600);
await Canvas.OnDraw(renderer2);
var svgR2 = d.UsedRenderers[1];
Expand Down
20 changes: 0 additions & 20 deletions Svg.Editor.Core.Tests/Properties/AssemblyInfo.cs

This file was deleted.

152 changes: 30 additions & 122 deletions Svg.Editor.Core.Tests/Svg.Editor.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,122 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{18A8F892-730A-489C-9803-BCD9E2B67E6E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Svg.Editor.Core.Tests</RootNamespace>
<AssemblyName>Svg.Editor.Core.Tests</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Mono.Android">
<HintPath>..\..\..\..\..\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v9.0\Mono.Android.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="ArrangeToolTests.cs" />
<Compile Include="ColorToolTests.cs" />
<Compile Include="FileLoader.cs" />
<Compile Include="FreeDrawingToolTests.cs" />
<Compile Include="IFIleLoader.cs" />
<Compile Include="LineToolTests.cs" />
<Compile Include="Mocks\MockTextInputService.cs" />
<Compile Include="PanToolTests.cs" />
<Compile Include="MoveToolTests.cs" />
<Compile Include="PerformanceTests.cs" />
<Compile Include="RotationToolTests.cs" />
<Compile Include="SelectionToolTests.cs" />
<Compile Include="StrokeStyleToolTests.cs" />
<Compile Include="SvgDrawingCanvasTestBase.cs" />
<Compile Include="SvgDrawingCanvasTests.cs" />
<Compile Include="TextToolTests.cs" />
<Compile Include="TransformationTests.cs" />
<Compile Include="UndoRedoToolTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="PlaceAsBackgroundToolTests.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia.Skia">
<Version>11.2.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.Reactive.Testing">
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="NUnit">
<Version>3.12.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Content Include="Assets\iso_sketch_large.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\nested_transformed_text.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Svg.Editor.Core\Svg.Editor.Core.csproj">
<Project>{4cf34d1c-662c-400d-beaf-e87ce1d08fab}</Project>
<Name>Svg.Editor.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Svg\Svg.csproj">
<Project>{2c5671c4-9c70-4d74-80dc-5e0ec17d27b4}</Project>
<Name>Svg</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net48;net9.0</TargetFrameworks>
<OutputType>Library</OutputType>
<RootNamespace>Svg.Editor.Core.Tests</RootNamespace>
<AssemblyName>Svg.Editor.Core.Tests</AssemblyName>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.0.0" />
<PackageReference Include="Avalonia.Skia" Version="11.2.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Svg.Editor.Core\Svg.Editor.Core.csproj" />
<ProjectReference Include="..\Svg\Svg.csproj" />
</ItemGroup>

<ItemGroup>
<Content Include="Assets\iso_sketch_large.svg" CopyToOutputDirectory="PreserveNewest" />
<Content Include="Assets\nested_transformed_text.svg" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion Svg.Editor.Core.Tests/SvgDrawingCanvasTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ public async Task CalculatesZoomFactorAndTranslateCorrectly(
Canvas.ScreenHeight = screenHeight;
Canvas.Document = d;

using var surface1 = SKSurface.Create(screenWidth, screenHeight, SKImageInfo.PlatformColorType, SKAlphaType.Premul);
using var surface1 = SKSurface.Create(new SKImageInfo(screenWidth, screenHeight, SKImageInfo.PlatformColorType, SKAlphaType.Premul));
var renderer1 = new SKCanvasRenderer(surface1, screenWidth, screenHeight);
await Canvas.OnDraw(renderer1);

Expand Down
4 changes: 3 additions & 1 deletion Svg.Editor.Core/Svg.Editor.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
<AssemblyName>Svg.Editor</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>3.1.2-optiq06</Version>
<Version>3.1.3-optiq01</Version>
<LangVersion>latest</LangVersion>
<PackageReleaseNotes>
#3.1.3-optiq01
Updated SkiaSharp from 2.88.8 to 3.119.1
#3.1.2-optiq06
Fixed: Sketch, when setting text and cancel dialog, opens new dialog and asks for font size
#3.1.2-optiq05
Expand Down
2 changes: 1 addition & 1 deletion Svg.Tests.Benchmarks/Svg.Tests.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion Svg.Tests.Win/Svg.Tests.Win.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<RootNamespace>Svg.Tests.Win</RootNamespace>
<AssemblyName>Svg.Tests.Win</AssemblyName>
<LangVersion>latest</LangVersion>
<PlatformTarget>x86</PlatformTarget>
<UseWPF>false</UseWPF>
<UseWindowsForms>false</UseWindowsForms>
</PropertyGroup>
Expand Down
11 changes: 7 additions & 4 deletions Svg.Tests.Win/SvgClipPathTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Linq;
using System;
using System.IO;
using System.Linq;
using Shouldly;
using NUnit.Framework;
using SkiaSharp;
Expand All @@ -22,8 +24,8 @@ public void WhenClipPathRendered_GroupElementShouldBeCLipped()
// Arrange
var pngPath = "test_matrix.png";
var svgPath = "testBosPlan.svg";

var svgDoc = SvgDocument.Open<SvgDocument>("Assets\\"+ svgPath);
var path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "Assets", svgPath);
var svgDoc = SvgDocument.Open<SvgDocument>(path);


//var bitMap = svgDoc.Draw();
Expand Down Expand Up @@ -72,7 +74,8 @@ public void WhenGettingCliPathBounds_BasedOnClipPathsChildren_GetBounds()
// Arrange
var svgPath = "ClipPathBounds.svg";

var svgDoc = SvgDocument.Open<SvgDocument>("Assets\\" + svgPath);
var path = Path.Combine(TestContext.CurrentContext.WorkDirectory, "Assets", svgPath);
var svgDoc = SvgDocument.Open<SvgDocument>(path);

var clip = svgDoc.Children.First().Children.OfType<SvgClipPath>().First();

Expand Down
Loading
Loading