diff --git a/.gitattributes b/.gitattributes
index 7de2c15..e594c0e 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -84,12 +84,15 @@
# treat as binary
###############################################################################
*.basis binary
+*.a binary
*.dll binary
+*.dylib binary
*.exe binary
*.pdf binary
*.ppt binary
*.pptx binary
*.pvr binary
+*.so binary
*.snk binary
*.xls binary
*.xlsx binary
@@ -107,6 +110,7 @@
###############################################################################
# Handle image files by git lfs
###############################################################################
+*.pdf filter=lfs diff=lfs merge=lfs -text
*.jpg filter=lfs diff=lfs merge=lfs -text
*.jpeg filter=lfs diff=lfs merge=lfs -text
*.bmp filter=lfs diff=lfs merge=lfs -text
@@ -134,6 +138,12 @@
*.heic filter=lfs diff=lfs merge=lfs -text
*.hif filter=lfs diff=lfs merge=lfs -text
*.avif filter=lfs diff=lfs merge=lfs -text
+*.hvc1 filter=lfs diff=lfs merge=lfs -text
+*.hvcc filter=lfs diff=lfs merge=lfs -text
+*.ivf filter=lfs diff=lfs merge=lfs -text
+*.y4m filter=lfs diff=lfs merge=lfs -text
+*.yuv filter=lfs diff=lfs merge=lfs -text
+*.bit filter=lfs diff=lfs merge=lfs -text
###############################################################################
# Handle ICC files by git lfs
###############################################################################
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
new file mode 100644
index 0000000..5f9f694
--- /dev/null
+++ b/.github/copilot-instructions.md
@@ -0,0 +1,3 @@
+# GitHub Copilot Instructions
+
+Read and follow [AGENTS.md](../AGENTS.md) as the repository-wide source of coding, performance, and verification requirements. Prefer existing local patterns and repository configuration whenever generated code or suggestions are accepted.
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index b9837f2..64ef3bd 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -56,44 +56,44 @@ jobs:
- name: Git Pull LFS
shell: bash
run: git lfs pull
-
+
Build:
needs: WarmLFS
strategy:
matrix:
options:
- os: ubuntu-latest
- framework: net10.0
- sdk: 10.0.x
+ framework: net11.0
+ sdk: 11.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: macos-latest
- framework: net10.0
- sdk: 10.0.x
+ framework: net11.0
+ sdk: 11.0.x
sdk-preview: true
runtime: -x64
codecov: true
- os: windows-latest
- framework: net10.0
- sdk: 10.0.x
+ framework: net11.0
+ sdk: 11.0.x
sdk-preview: true
runtime: -x64
codecov: false
- os: ubuntu-latest
- framework: net8.0
- sdk: 8.0.x
+ framework: net10.0
+ sdk: 10.0.x
runtime: -x64
codecov: false
- os: macos-latest
- framework: net8.0
- sdk: 8.0.x
+ framework: net10.0
+ sdk: 10.0.x
runtime: -x64
codecov: false
- os: windows-latest
- framework: net8.0
- sdk: 8.0.x
+ framework: net10.0
+ sdk: 10.0.x
runtime: -x64
codecov: false
@@ -138,14 +138,14 @@ jobs:
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
- 8.0.x
+ 10.0.x
- name: DotNet Setup Preview
if: ${{ matrix.options.sdk-preview == true }}
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
- 10.0.x
+ 11.0.x
- name: DotNet Build
if: ${{ matrix.options.sdk-preview != true }}
diff --git a/AGENTS.md b/AGENTS.md
new file mode 100644
index 0000000..814e3ce
--- /dev/null
+++ b/AGENTS.md
@@ -0,0 +1,41 @@
+# Six Labors AI Coding Guidelines
+
+These instructions apply to the entire repository. More-specific `AGENTS.md` files may add to or override them for their directory tree.
+
+## Working Practices
+
+- Inspect the relevant implementation, tests, benchmarks, project files, and nearby code before proposing or making changes. Do not infer current behavior when the source is available.
+- Make the smallest complete change that solves the requested problem. Avoid unrelated cleanup, speculative abstractions, and formatting churn.
+- Match established architecture, naming, formatting, documentation, and test patterns. Treat `.editorconfig`, analyzers, and repository build settings as authoritative.
+- Preserve public API and observable behavior unless the task explicitly requires a change. Public API documentation must describe observable behavior, not implementation details.
+- Do not use reflection against built assemblies, ad hoc assembly loading, or temporary probe projects unless explicitly requested.
+- Build .NET projects in Release configuration unless explicitly instructed otherwise.
+
+## Performance
+
+- Treat throughput, latency, memory use, and binary size as design constraints, especially in pixel-processing, drawing, parsing, encoding, and other hot paths.
+- Avoid unnecessary allocations, copies, boxing, closures, interface dispatch, repeated enumeration, and extra passes over data.
+- Reuse the repository's existing memory ownership, pooling, span, vectorization, and parallelization patterns. Do not introduce a new mechanism when an established one fits.
+- Keep hot loops simple and bounds-check-friendly. Hoist invariant work, preserve locality, and use the narrowest suitable data types without sacrificing correctness.
+- Do not trade correctness or maintainability for assumed speed. Support non-obvious optimizations with measurements or clear evidence, and add or update benchmarks when performance is the purpose of the change.
+- Consider all supported target frameworks and runtime capabilities. Do not regress fallback paths while optimizing newer runtimes.
+
+## C# Conventions
+
+- Follow the existing code around the change; local patterns take precedence over generic preferences.
+- Do not use `record` or `record struct` types.
+- Prefer established invariants over redundant guards. Validate at real external boundaries and do not add defensive checks for internally controlled states.
+- Do not extract single-use helpers merely to name a block. Extract only for genuine reuse, an established local pattern, or meaningful complexity reduction.
+- Add vertical whitespace after multi-line statements and declarations and between distinct logical stages. Never add trailing whitespace.
+- Document every method, constructor, and property, regardless of whether it is public, internal, protected, or private. Keep public API documentation limited to observable behavior; use private and internal documentation to capture the contract and intent needed to maintain the code.
+- Add inline comments throughout complex code. Explain algorithms, formulas, invariants, ownership, compatibility behavior, and performance tradeoffs at the operations and decisions they govern. Explain why the code is shaped that way rather than narrating the syntax.
+- Document SIMD code especially thoroughly. Explain the vector layout, lane meaning, widening or narrowing, masks, shuffles, constants, alignment or remainder handling, supported instruction paths, scalar equivalence, and the reason each non-obvious operation is correct.
+- Write algorithm and SIMD comments for a maintainer who is unfamiliar with the implementation. The reader should not need to reconstruct intent from external documentation, issue history, or benchmark results.
+
+## Verification
+
+- Add or update focused tests when behavior changes, following the test framework and conventions already used by the project.
+- Never hack, weaken, skip, conditionally bypass, or otherwise manipulate a test to make it pass. Fix the production defect or the genuine test defect while preserving the test's intended coverage and sensitivity.
+- Do not update golden files, reference images, snapshots, baselines, or expected-output artifacts to resolve a test failure. Treat a mismatch as evidence to investigate and correct the implementation.
+- Run the narrowest relevant formatting, test, and Release build commands, then expand verification in proportion to the risk and scope of the change.
+- Report what changed, the verification performed, and any remaining risks or unverified assumptions.
diff --git a/CLAUDE.md b/CLAUDE.md
new file mode 100644
index 0000000..5f08a44
--- /dev/null
+++ b/CLAUDE.md
@@ -0,0 +1,3 @@
+# Claude Code Instructions
+
+Read and follow [AGENTS.md](AGENTS.md) as the repository-wide source of coding, performance, and verification requirements. Apply any more-specific `AGENTS.md` or `CLAUDE.md` found below the files being changed.
diff --git a/GEMINI.md b/GEMINI.md
new file mode 100644
index 0000000..b621d26
--- /dev/null
+++ b/GEMINI.md
@@ -0,0 +1,3 @@
+# Gemini CLI Instructions
+
+Read and follow [AGENTS.md](AGENTS.md) as the repository-wide source of coding, performance, and verification requirements. Apply any more-specific `AGENTS.md` or `GEMINI.md` found below the files being changed.
diff --git a/PolygonClipper.sln b/PolygonClipper.sln
deleted file mode 100644
index f714abb..0000000
--- a/PolygonClipper.sln
+++ /dev/null
@@ -1,97 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 18
-VisualStudioVersion = 18.2.11415.280
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PolygonClipper", "src\PolygonClipper\PolygonClipper.csproj", "{3C8D945E-6074-437E-B6EA-237BD0C80411}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{F0882E95-667C-48FE-B43A-24FC55D9F354}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{84C4B358-492B-46FC-9F11-FBB76B06BD3F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolygonClipper.Tests", "tests\PolygonClipper.Tests\PolygonClipper.Tests.csproj", "{6997B09A-A419-4469-A51C-D21973E4F800}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6B327CDE-88A5-4715-A8A3-E9A8C80EA10C}"
- ProjectSection(SolutionItems) = preProject
- .editorconfig = .editorconfig
- .gitattributes = .gitattributes
- .gitignore = .gitignore
- reference\10.1016@j.advengsoft.2013.04.004.pdf = reference\10.1016@j.advengsoft.2013.04.004.pdf
- reference\129902.129906.pdf = reference\129902.129906.pdf
- ci-build.ps1 = ci-build.ps1
- ci-pack.ps1 = ci-pack.ps1
- ci-test.ps1 = ci-test.ps1
- LICENSE = LICENSE
- README.md = README.md
- THIRD-PARTY-NOTICES.md = THIRD-PARTY-NOTICES.md
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GeoJson", "tests\GeoJson\GeoJson.csproj", "{F881441F-D3B6-4B48-8CEF-8DC0746D4578}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{6F7A3AE6-C7D1-441F-A203-BA6575931CE2}"
- ProjectSection(SolutionItems) = preProject
- .github\CONTRIBUTING.md = .github\CONTRIBUTING.md
- .github\dependabot.yml = .github\dependabot.yml
- .github\FUNDING.yml = .github\FUNDING.yml
- .github\PULL_REQUEST_TEMPLATE.md = .github\PULL_REQUEST_TEMPLATE.md
- EndProjectSection
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{EEA3B5E9-3337-42EE-B0BF-FA586A1BC435}"
- ProjectSection(SolutionItems) = preProject
- .github\workflows\build-and-test.yml = .github\workflows\build-and-test.yml
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolygonClipper.Benchmarks", "tests\PolygonClipper.Benchmarks\PolygonClipper.Benchmarks.csproj", "{F1965B36-D896-4BC1-8941-7FE6CEB82CD5}"
-EndProject
-Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedInfrastructure", "shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.shproj", "{68A8CC40-6AED-4E96-B524-31B1158FDEEA}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ISSUE_TEMPLATE", "ISSUE_TEMPLATE", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
- ProjectSection(SolutionItems) = preProject
- .github\ISSUE_TEMPLATE\config.yml = .github\ISSUE_TEMPLATE\config.yml
- .github\ISSUE_TEMPLATE\oss-bug-report.yml = .github\ISSUE_TEMPLATE\oss-bug-report.yml
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {3C8D945E-6074-437E-B6EA-237BD0C80411}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {3C8D945E-6074-437E-B6EA-237BD0C80411}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {3C8D945E-6074-437E-B6EA-237BD0C80411}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {3C8D945E-6074-437E-B6EA-237BD0C80411}.Release|Any CPU.Build.0 = Release|Any CPU
- {6997B09A-A419-4469-A51C-D21973E4F800}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {6997B09A-A419-4469-A51C-D21973E4F800}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {6997B09A-A419-4469-A51C-D21973E4F800}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {6997B09A-A419-4469-A51C-D21973E4F800}.Release|Any CPU.Build.0 = Release|Any CPU
- {F881441F-D3B6-4B48-8CEF-8DC0746D4578}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F881441F-D3B6-4B48-8CEF-8DC0746D4578}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F881441F-D3B6-4B48-8CEF-8DC0746D4578}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F881441F-D3B6-4B48-8CEF-8DC0746D4578}.Release|Any CPU.Build.0 = Release|Any CPU
- {F1965B36-D896-4BC1-8941-7FE6CEB82CD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {F1965B36-D896-4BC1-8941-7FE6CEB82CD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {F1965B36-D896-4BC1-8941-7FE6CEB82CD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {F1965B36-D896-4BC1-8941-7FE6CEB82CD5}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {3C8D945E-6074-437E-B6EA-237BD0C80411} = {F0882E95-667C-48FE-B43A-24FC55D9F354}
- {6997B09A-A419-4469-A51C-D21973E4F800} = {84C4B358-492B-46FC-9F11-FBB76B06BD3F}
- {F881441F-D3B6-4B48-8CEF-8DC0746D4578} = {84C4B358-492B-46FC-9F11-FBB76B06BD3F}
- {6F7A3AE6-C7D1-441F-A203-BA6575931CE2} = {6B327CDE-88A5-4715-A8A3-E9A8C80EA10C}
- {EEA3B5E9-3337-42EE-B0BF-FA586A1BC435} = {6F7A3AE6-C7D1-441F-A203-BA6575931CE2}
- {F1965B36-D896-4BC1-8941-7FE6CEB82CD5} = {84C4B358-492B-46FC-9F11-FBB76B06BD3F}
- {68A8CC40-6AED-4E96-B524-31B1158FDEEA} = {F0882E95-667C-48FE-B43A-24FC55D9F354}
- {02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {6F7A3AE6-C7D1-441F-A203-BA6575931CE2}
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {2C73BEEC-091B-45E4-A0BD-7D7CD16A8451}
- EndGlobalSection
- GlobalSection(SharedMSBuildProjectFiles) = preSolution
- shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{3c8d945e-6074-437e-b6ea-237bd0c80411}*SharedItemsImports = 5
- shared-infrastructure\src\SharedInfrastructure\SharedInfrastructure.projitems*{68a8cc40-6aed-4e96-b524-31b1158fdeea}*SharedItemsImports = 13
- EndGlobalSection
-EndGlobal
diff --git a/PolygonClipper.slnx b/PolygonClipper.slnx
new file mode 100644
index 0000000..52f2356
--- /dev/null
+++ b/PolygonClipper.slnx
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/global.json b/global.json
new file mode 100644
index 0000000..8ff67c2
--- /dev/null
+++ b/global.json
@@ -0,0 +1,18 @@
+// Pins the .NET SDK to major version 10 or later for all SixLabors repositories.
+// The build copies this file to consuming repositories together with .editorconfig and
+// the other shared config files (see msbuild/targets/SixLabors.Src.targets).
+{
+ "sdk": {
+ // The floor, not an exact build: resolution never selects an SDK below major 10.
+ "version": "10.0.0",
+
+ // Select the newest installed SDK at or above the floor. This spans feature bands,
+ // minor versions, and major versions, so a machine with only stable 10.0.x SDKs
+ // resolves the newest of those, and a machine with a newer SDK resolves that instead.
+ "rollForward": "latestMajor",
+
+ // Let the CLI and Visual Studio select preview SDKs when one is installed.
+ // Machines and CI lanes without a preview SDK are unaffected.
+ "allowPrerelease": true
+ }
+}
diff --git a/shared-infrastructure b/shared-infrastructure
index 20f15a2..a835a9d 160000
--- a/shared-infrastructure
+++ b/shared-infrastructure
@@ -1 +1 @@
-Subproject commit 20f15a2d47bba9d8375b5fd34fac283336ec9a5e
+Subproject commit a835a9d74e82b2d32b580a7902eb2699ebc47098
diff --git a/src/PolygonClipper/PolygonClipper.cs b/src/PolygonClipper/PolygonClipper.cs
index 3c9a5c0..3252c81 100644
--- a/src/PolygonClipper/PolygonClipper.cs
+++ b/src/PolygonClipper/PolygonClipper.cs
@@ -496,7 +496,7 @@ private static bool TryTrivialOperationForNonOverlappingBoundingBoxes(
if (operation is BooleanOperation.Union or BooleanOperation.Xor)
{
- result = new(subject.Count + clipping.Count);
+ result = new Polygon(subject.Count + clipping.Count);
result.Join(subject.DeepClone());
result.Join(clipping.DeepClone());
return true;
diff --git a/src/PolygonClipper/PolygonClipper.csproj b/src/PolygonClipper/PolygonClipper.csproj
index 15d8263..c731a06 100644
--- a/src/PolygonClipper/PolygonClipper.csproj
+++ b/src/PolygonClipper/PolygonClipper.csproj
@@ -25,16 +25,16 @@
1.0
-
+
- net8.0;net10.0
+ net10.0;net11.0
- net8.0
+ net10.0
diff --git a/tests/GeoJson/Converters/FeatureConverter.cs b/tests/GeoJson/Converters/FeatureConverter.cs
index 44b8aac..40253e6 100644
--- a/tests/GeoJson/Converters/FeatureConverter.cs
+++ b/tests/GeoJson/Converters/FeatureConverter.cs
@@ -55,7 +55,7 @@ public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS
genericArguments),
BindingFlags.Default,
binder: null,
- args: new object[] { typedGeometry, (IDictionary)properties, id },
+ args: [typedGeometry, (IDictionary)properties, id],
culture: null);
}
else
@@ -67,7 +67,7 @@ public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonS
genericArguments),
BindingFlags.Default,
binder: null,
- args: new object[] { typedGeometry, typedProperty, id },
+ args: [typedGeometry, typedProperty, id],
culture: null);
}
}
diff --git a/tests/GeoJson/Converters/GeometryEnumerableConverter.cs b/tests/GeoJson/Converters/GeometryEnumerableConverter.cs
index 93bb6d1..4026173 100644
--- a/tests/GeoJson/Converters/GeometryEnumerableConverter.cs
+++ b/tests/GeoJson/Converters/GeometryEnumerableConverter.cs
@@ -52,7 +52,7 @@ public override ReadOnlyCollection Read(
}
int startDepth = reader.CurrentDepth;
- List? result = new();
+ List? result = [];
while (reader.Read())
{
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)
diff --git a/tests/GeoJson/Converters/LineStringEnumerableConverter.cs b/tests/GeoJson/Converters/LineStringEnumerableConverter.cs
index c7e7c27..f7b917b 100644
--- a/tests/GeoJson/Converters/LineStringEnumerableConverter.cs
+++ b/tests/GeoJson/Converters/LineStringEnumerableConverter.cs
@@ -54,7 +54,7 @@ public override IReadOnlyCollection Read(
}
int startDepth = reader.CurrentDepth;
- List? result = new();
+ List? result = [];
while (reader.Read())
{
if(JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)
diff --git a/tests/GeoJson/Converters/PointEnumerableConverter.cs b/tests/GeoJson/Converters/PointEnumerableConverter.cs
index ec8fa48..36d277a 100644
--- a/tests/GeoJson/Converters/PointEnumerableConverter.cs
+++ b/tests/GeoJson/Converters/PointEnumerableConverter.cs
@@ -47,8 +47,8 @@ public override ReadOnlyCollection Read(
}
int startDepth = reader.CurrentDepth;
- List? result = new();
- List numbers = new();
+ List? result = [];
+ List numbers = [];
while (reader.Read())
{
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)
diff --git a/tests/GeoJson/Converters/PolygonEnumerableConverter.cs b/tests/GeoJson/Converters/PolygonEnumerableConverter.cs
index 858b4cf..56d54c8 100644
--- a/tests/GeoJson/Converters/PolygonEnumerableConverter.cs
+++ b/tests/GeoJson/Converters/PolygonEnumerableConverter.cs
@@ -55,7 +55,7 @@ public override IReadOnlyCollection Read(
}
int startDepth = reader.CurrentDepth;
- List? result = new();
+ List? result = [];
while (reader.Read())
{
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)
diff --git a/tests/GeoJson/Converters/PositionEnumerableConverter.cs b/tests/GeoJson/Converters/PositionEnumerableConverter.cs
index 9dcbce1..330b126 100644
--- a/tests/GeoJson/Converters/PositionEnumerableConverter.cs
+++ b/tests/GeoJson/Converters/PositionEnumerableConverter.cs
@@ -54,7 +54,7 @@ public override IReadOnlyCollection Read(
}
int startDepth = reader.CurrentDepth;
- List? result = new();
+ List? result = [];
while (reader.Read())
{
if (JsonTokenType.EndArray == reader.TokenType && reader.CurrentDepth == startDepth)
diff --git a/tests/GeoJson/Feature/FeatureCollection.cs b/tests/GeoJson/Feature/FeatureCollection.cs
index 3dc9351..a5e5bb4 100644
--- a/tests/GeoJson/Feature/FeatureCollection.cs
+++ b/tests/GeoJson/Feature/FeatureCollection.cs
@@ -16,7 +16,7 @@ public class FeatureCollection : GeoJSONObject, IEqualityComparer
/// Initializes a new instance of the class.
///
- public FeatureCollection() : this(new List())
+ public FeatureCollection() : this([])
{
}
@@ -135,7 +135,7 @@ public class FeatureCollection : FeatureCollection, IEqualityComparer
/// Initializes a new instance of the class.
///
- public FeatureCollection() : this(new List>())
+ public FeatureCollection() : this([])
{
}
diff --git a/tests/GeoJson/GeoJson.csproj b/tests/GeoJson/GeoJson.csproj
index 2bc29ed..4ba7990 100644
--- a/tests/GeoJson/GeoJson.csproj
+++ b/tests/GeoJson/GeoJson.csproj
@@ -1,6 +1,8 @@
+
+ false
disable
enable
@@ -9,12 +11,12 @@
- net8.0;net10.0
+ net10.0;net11.0
- net8.0
+ net10.0
diff --git a/tests/GeoJson/Geometry/MultiLineString.cs b/tests/GeoJson/Geometry/MultiLineString.cs
index 34ac78b..9d9b29a 100644
--- a/tests/GeoJson/Geometry/MultiLineString.cs
+++ b/tests/GeoJson/Geometry/MultiLineString.cs
@@ -30,7 +30,7 @@ public MultiLineString()
public MultiLineString(IEnumerable coordinates)
{
this.Coordinates =new ReadOnlyCollection(
- coordinates?.ToArray() ?? Array.Empty());
+ coordinates?.ToArray() ?? []);
}
///
diff --git a/tests/GeoJson/Geometry/MultiPoint.cs b/tests/GeoJson/Geometry/MultiPoint.cs
index 006cc23..a94f287 100644
--- a/tests/GeoJson/Geometry/MultiPoint.cs
+++ b/tests/GeoJson/Geometry/MultiPoint.cs
@@ -28,7 +28,7 @@ public MultiPoint()
/// The coordinates.
public MultiPoint(IEnumerable coordinates)
{
- this.Coordinates = new ReadOnlyCollection(coordinates?.ToArray() ?? Array.Empty());
+ this.Coordinates = new ReadOnlyCollection(coordinates?.ToArray() ?? []);
}
//[JsonConstructor]
diff --git a/tests/PolygonClipper.Benchmarks/PolygonClipper.Benchmarks.csproj b/tests/PolygonClipper.Benchmarks/PolygonClipper.Benchmarks.csproj
index 1077259..1bc8c3d 100644
--- a/tests/PolygonClipper.Benchmarks/PolygonClipper.Benchmarks.csproj
+++ b/tests/PolygonClipper.Benchmarks/PolygonClipper.Benchmarks.csproj
@@ -20,12 +20,12 @@
- net8.0;net10.0
+ net10.0;net11.0
- net8.0
+ net10.0
diff --git a/tests/PolygonClipper.Tests/ContourTests.cs b/tests/PolygonClipper.Tests/ContourTests.cs
index 5eb7f3e..10cd8c4 100644
--- a/tests/PolygonClipper.Tests/ContourTests.cs
+++ b/tests/PolygonClipper.Tests/ContourTests.cs
@@ -29,7 +29,7 @@ private static Contour CreateSquare(double x, double y, double size, bool counte
[Fact]
public void DefaultConstructor_CreatesEmptyContour()
{
- Contour contour = new();
+ Contour contour = [];
Assert.Equal(0, contour.Count);
Assert.Equal(0, contour.HoleCount);
@@ -49,7 +49,7 @@ public void CapacityConstructor_StartsEmpty()
[Fact]
public void Add_AppendsVertices_Indexer_ReturnsThem()
{
- Contour contour = new();
+ Contour contour = [];
Vertex a = new(1, 2);
Vertex b = new(3, 4);
@@ -91,7 +91,7 @@ public void Clear_RemovesAllVerticesAndHoles()
[Fact]
public void Holes_CanBeAddedReadAndCleared()
{
- Contour contour = new();
+ Contour contour = [];
contour.AddHoleIndex(3);
contour.AddHoleIndex(7);
@@ -108,7 +108,7 @@ public void Holes_CanBeAddedReadAndCleared()
[Fact]
public void ParentIndex_FlipsIsExternal()
{
- Contour contour = new();
+ Contour contour = [];
Assert.True(contour.IsExternal);
@@ -224,7 +224,7 @@ public void SetCounterClockwise_OnCcwContour_LeavesOrderUnchanged()
[Fact]
public void GetBoundingBox_EmptyContour_ReturnsDefault()
{
- Contour contour = new();
+ Contour contour = [];
Box2 box = contour.GetBoundingBox();
@@ -234,7 +234,7 @@ public void GetBoundingBox_EmptyContour_ReturnsDefault()
[Fact]
public void GetBoundingBox_SingleVertex_ReturnsDegenerateBox()
{
- Contour contour = new();
+ Contour contour = [];
Vertex v = new(2, 3);
contour.Add(v);
@@ -247,11 +247,13 @@ public void GetBoundingBox_SingleVertex_ReturnsDegenerateBox()
[Fact]
public void GetBoundingBox_ReturnsMinMaxAcrossAllVertices()
{
- Contour contour = new();
- contour.Add(new Vertex(2, -1));
- contour.Add(new Vertex(5, 4));
- contour.Add(new Vertex(-3, 2));
- contour.Add(new Vertex(0, 7));
+ Contour contour =
+ [
+ new Vertex(2, -1),
+ new Vertex(5, 4),
+ new Vertex(-3, 2),
+ new Vertex(0, 7)
+ ];
Box2 box = contour.GetBoundingBox();
diff --git a/tests/PolygonClipper.Tests/GenericTestCases.cs b/tests/PolygonClipper.Tests/GenericTestCases.cs
index 1f7b239..6252599 100644
--- a/tests/PolygonClipper.Tests/GenericTestCases.cs
+++ b/tests/PolygonClipper.Tests/GenericTestCases.cs
@@ -4,7 +4,6 @@
using GeoJson;
using GeoJson.Feature;
using GeoJson.Geometry;
-using Xunit.Abstractions;
using GeoPolygon = GeoJson.Geometry.Polygon;
namespace SixLabors.PolygonClipper.Tests;
@@ -16,7 +15,7 @@ public class GenericTestCases
public GenericTestCases(ITestOutputHelper testOutputHelper) => this.testOutputHelper = testOutputHelper;
public static TheoryData GetTestCases()
- => new(TestData.Generic.GetFileNames());
+ => [.. TestData.Generic.GetFileNames()];
[Theory]
[MemberData(nameof(GetTestCases))]
diff --git a/tests/PolygonClipper.Tests/PolygonClipper.Tests.csproj b/tests/PolygonClipper.Tests/PolygonClipper.Tests.csproj
index b32e2d1..236661b 100644
--- a/tests/PolygonClipper.Tests/PolygonClipper.Tests.csproj
+++ b/tests/PolygonClipper.Tests/PolygonClipper.Tests.csproj
@@ -10,12 +10,12 @@
- net8.0;net10.0
+ net10.0;net11.0
- net8.0
+ net10.0
diff --git a/tests/PolygonClipper.Tests/PolygonClipperContourClosureTests.cs b/tests/PolygonClipper.Tests/PolygonClipperContourClosureTests.cs
index 53af215..db9d985 100644
--- a/tests/PolygonClipper.Tests/PolygonClipperContourClosureTests.cs
+++ b/tests/PolygonClipper.Tests/PolygonClipperContourClosureTests.cs
@@ -34,11 +34,13 @@ private static Contour CreateRectangleContour(
double maxY,
bool closed)
{
- Contour contour = [];
- contour.Add(new Vertex(minX, minY));
- contour.Add(new Vertex(maxX, minY));
- contour.Add(new Vertex(maxX, maxY));
- contour.Add(new Vertex(minX, maxY));
+ Contour contour =
+ [
+ new Vertex(minX, minY),
+ new Vertex(maxX, minY),
+ new Vertex(maxX, maxY),
+ new Vertex(minX, maxY)
+ ];
if (closed)
{
contour.Add(contour[0]);
diff --git a/tests/PolygonClipper.Tests/PolygonTests.cs b/tests/PolygonClipper.Tests/PolygonTests.cs
index 5e41605..ccda967 100644
--- a/tests/PolygonClipper.Tests/PolygonTests.cs
+++ b/tests/PolygonClipper.Tests/PolygonTests.cs
@@ -7,18 +7,20 @@ public class PolygonTests
{
private static Contour CreateSquare(double x, double y, double size)
{
- Contour contour = new(4);
- contour.Add(new Vertex(x, y));
- contour.Add(new Vertex(x + size, y));
- contour.Add(new Vertex(x + size, y + size));
- contour.Add(new Vertex(x, y + size));
+ Contour contour =
+ [
+ new Vertex(x, y),
+ new Vertex(x + size, y),
+ new Vertex(x + size, y + size),
+ new Vertex(x, y + size)
+ ];
return contour;
}
[Fact]
public void DefaultConstructor_CreatesEmptyPolygon()
{
- Polygon polygon = new();
+ Polygon polygon = [];
Assert.Equal(0, polygon.Count);
Assert.Equal(0, polygon.VertexCount);
@@ -35,7 +37,7 @@ public void CapacityConstructor_StartsEmpty()
[Fact]
public void Add_AppendsContoursAndIndexerReturnsThem()
{
- Polygon polygon = new();
+ Polygon polygon = [];
Contour a = CreateSquare(0, 0, 10);
Contour b = CreateSquare(20, 20, 5);
@@ -51,14 +53,18 @@ public void Add_AppendsContoursAndIndexerReturnsThem()
[Fact]
public void VertexCount_SumsAcrossAllContours()
{
- Polygon polygon = new();
- polygon.Add(CreateSquare(0, 0, 10));
- polygon.Add(CreateSquare(20, 20, 5));
-
- Contour triangle = new();
- triangle.Add(new Vertex(0, 0));
- triangle.Add(new Vertex(1, 0));
- triangle.Add(new Vertex(0, 1));
+ Polygon polygon =
+ [
+ CreateSquare(0, 0, 10),
+ CreateSquare(20, 20, 5)
+ ];
+
+ Contour triangle =
+ [
+ new Vertex(0, 0),
+ new Vertex(1, 0),
+ new Vertex(0, 1)
+ ];
polygon.Add(triangle);
Assert.Equal(4 + 4 + 3, polygon.VertexCount);
@@ -67,7 +73,7 @@ public void VertexCount_SumsAcrossAllContours()
[Fact]
public void GetBoundingBox_EmptyPolygon_ReturnsDefault()
{
- Polygon polygon = new();
+ Polygon polygon = [];
Assert.Equal(default, polygon.GetBoundingBox());
}
@@ -75,7 +81,7 @@ public void GetBoundingBox_EmptyPolygon_ReturnsDefault()
[Fact]
public void GetBoundingBox_SingleContour_MatchesContourBox()
{
- Polygon polygon = new();
+ Polygon polygon = [];
Contour contour = CreateSquare(2, 3, 10);
polygon.Add(contour);
@@ -85,9 +91,11 @@ public void GetBoundingBox_SingleContour_MatchesContourBox()
[Fact]
public void GetBoundingBox_MultipleContours_ReturnsUnion()
{
- Polygon polygon = new();
- polygon.Add(CreateSquare(0, 0, 10));
- polygon.Add(CreateSquare(20, -5, 4));
+ Polygon polygon =
+ [
+ CreateSquare(0, 0, 10),
+ CreateSquare(20, -5, 4)
+ ];
Box2 box = polygon.GetBoundingBox();
@@ -98,9 +106,11 @@ public void GetBoundingBox_MultipleContours_ReturnsUnion()
[Fact]
public void Translate_OffsetsAllContours()
{
- Polygon polygon = new();
- polygon.Add(CreateSquare(0, 0, 10));
- polygon.Add(CreateSquare(20, 20, 5));
+ Polygon polygon =
+ [
+ CreateSquare(0, 0, 10),
+ CreateSquare(20, 20, 5)
+ ];
polygon.Translate(1, 2);
@@ -112,9 +122,11 @@ public void Translate_OffsetsAllContours()
[Fact]
public void Clear_RemovesAllContours()
{
- Polygon polygon = new();
- polygon.Add(CreateSquare(0, 0, 10));
- polygon.Add(CreateSquare(20, 20, 5));
+ Polygon polygon =
+ [
+ CreateSquare(0, 0, 10),
+ CreateSquare(20, 20, 5)
+ ];
polygon.Clear();
@@ -125,7 +137,7 @@ public void Clear_RemovesAllContours()
[Fact]
public void Enumeration_YieldsContoursInInsertionOrder()
{
- Polygon polygon = new();
+ Polygon polygon = [];
Contour a = CreateSquare(0, 0, 10);
Contour b = CreateSquare(20, 20, 5);
polygon.Add(a);
@@ -141,9 +153,11 @@ public void Enumeration_YieldsContoursInInsertionOrder()
[Fact]
public void DeepClone_ProducesIndependentCopy()
{
- Polygon original = new();
- original.Add(CreateSquare(0, 0, 10));
- original.Add(CreateSquare(20, 20, 5));
+ Polygon original =
+ [
+ CreateSquare(0, 0, 10),
+ CreateSquare(20, 20, 5)
+ ];
Polygon clone = original.DeepClone();
@@ -166,13 +180,17 @@ public void DeepClone_ProducesIndependentCopy()
[Fact]
public void Join_AppendsAllContours()
{
- Polygon a = new();
- a.Add(CreateSquare(0, 0, 10));
- a.Add(CreateSquare(20, 0, 5));
-
- Polygon b = new();
- b.Add(CreateSquare(40, 0, 5));
- b.Add(CreateSquare(60, 0, 5));
+ Polygon a =
+ [
+ CreateSquare(0, 0, 10),
+ CreateSquare(20, 0, 5)
+ ];
+
+ Polygon b =
+ [
+ CreateSquare(40, 0, 5),
+ CreateSquare(60, 0, 5)
+ ];
a.Join(b);
@@ -185,9 +203,8 @@ public void Join_AppendsAllContours()
[Fact]
public void Join_OnEmptyTarget_CopiesContoursFromSource()
{
- Polygon target = new();
- Polygon source = new();
- source.Add(CreateSquare(0, 0, 10));
+ Polygon target = [];
+ Polygon source = [CreateSquare(0, 0, 10)];
target.Join(source);
@@ -198,8 +215,7 @@ public void Join_OnEmptyTarget_CopiesContoursFromSource()
[Fact]
public void ToDebugString_ContainsVertexCoordinates()
{
- Polygon polygon = new();
- polygon.Add(CreateSquare(0, 0, 10));
+ Polygon polygon = [CreateSquare(0, 0, 10)];
string debug = polygon.ToDebugString();
diff --git a/tests/PolygonClipper.Tests/TestEnvironment.cs b/tests/PolygonClipper.Tests/TestEnvironment.cs
index 20fc0d9..a869cb9 100644
--- a/tests/PolygonClipper.Tests/TestEnvironment.cs
+++ b/tests/PolygonClipper.Tests/TestEnvironment.cs
@@ -10,7 +10,7 @@ internal static class TestEnvironment
{
private static readonly FileInfo TestAssemblyFile = new(typeof(TestEnvironment).GetTypeInfo().Assembly.Location);
- private const string SixLaborsSolutionFileName = "PolygonClipper.sln";
+ private const string SixLaborsSolutionFileName = "PolygonClipper.slnx";
private const string GeoJsonTestDataRelativePath = @"tests\TestData\";
diff --git a/tests/PolygonClipper.Tests/TestPolygonUtilities.cs b/tests/PolygonClipper.Tests/TestPolygonUtilities.cs
index c8fe0f2..3a394e6 100644
--- a/tests/PolygonClipper.Tests/TestPolygonUtilities.cs
+++ b/tests/PolygonClipper.Tests/TestPolygonUtilities.cs
@@ -28,7 +28,7 @@ public static Polygon ConvertToPolygon(IGeometryObject geometry)
Polygon polygon = [];
foreach (LineString ring in geoJsonPolygon.Coordinates)
{
- Contour contour = new();
+ Contour contour = [];
foreach (IPosition xy in ring.Coordinates)
{
contour.Add(new Vertex(xy.Longitude, xy.Latitude));
@@ -52,7 +52,7 @@ public static Polygon ConvertToPolygon(IGeometryObject geometry)
{
foreach (LineString ring in geoPolygon.Coordinates)
{
- Contour contour = new();
+ Contour contour = [];
foreach (IPosition xy in ring.Coordinates)
{
contour.Add(new Vertex(xy.Longitude, xy.Latitude));