Tests - Add Artemis.Core and profile editor test suites (#907)

This commit is contained in:
RobertBeekman authored and GitHub committed 2026-10-20 09:22:10 +02:00
1 parent 6e7fae16d2
commit 504845c7d2
168 files changed
+22914 -7

No files matched your search

+4
View File
@@ -19,6 +19,10 @@
<AssemblyMetadata Include="PluginApiVersion" Value="$(PluginApiVersion)" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Artemis.Core.Tests" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Artemis.Storage\Artemis.Storage.csproj" />
<ProjectReference Condition="'$(BuildingNuget)' == 'True'" Update="..\Artemis.Storage\Artemis.Storage.csproj" PrivateAssets="All" />
+5 -4
View File
@@ -28,17 +28,18 @@ public sealed class SKTexture : ITexture, IDisposable
foreach (ArtemisDevice artemisDevice in devices)
{
// Sample the same render-grid-aligned rectangle that layers use to clip and draw the LED
foreach (ArtemisLed artemisLed in artemisDevice.Leds)
_ledRects[artemisLed.RgbLed] = CreateSampleRect(artemisLed.RgbLed.AbsoluteBoundary, scale, width, height);
_ledRects[artemisLed.RgbLed] = CreateSampleRect(artemisLed.AbsoluteRectangle, scale, width, height);
}
}
#endregion
private static SKRectI CreateSampleRect(Rectangle boundary, float scale, int width, int height)
private static SKRectI CreateSampleRect(SKRect boundary, float scale, int width, int height)
{
(int left, int right) = ScaleSpan(boundary.Location.X, boundary.Size.Width, scale, width);
(int top, int bottom) = ScaleSpan(boundary.Location.Y, boundary.Size.Height, scale, height);
(int left, int right) = ScaleSpan(boundary.Left, boundary.Width, scale, width);
(int top, int bottom) = ScaleSpan(boundary.Top, boundary.Height, scale, height);
return new SKRectI(left, top, right, bottom);
}
+9 -2
View File
@@ -28,8 +28,15 @@ internal static class RenderScale
return SKRectI.Create(
roundX - roundX % RenderScaleMultiplier,
roundY - roundY % RenderScaleMultiplier,
roundWidth - roundWidth % RenderScaleMultiplier,
roundHeight - roundHeight % RenderScaleMultiplier
SnapSize(roundWidth),
SnapSize(roundHeight)
);
}
private static int SnapSize(int size)
{
// Keep at least one render pixel so LEDs smaller than a pixel don't collapse and remain addressable
int snapped = size - size % RenderScaleMultiplier;
return snapped == 0 && size > 0 ? RenderScaleMultiplier : snapped;
}
}