Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the cross platform tests on all platforms #2623

Merged
merged 11 commits into from May 18, 2024

Conversation

pauldendulk
Copy link
Member

No description provided.

@pauldendulk pauldendulk changed the title Enable cross platform tests on all platforms Enable the cross platform tests on all platforms May 9, 2024
@@ -230,17 +236,13 @@ jobs:
run: dotnet build --no-restore --configuration Debug Tests/Mapsui.Tests/Mapsui.Tests.csproj
- name: Mapsui.UI.Maui.Tests
run: dotnet build --no-restore --configuration Debug Tests/Mapsui.UI.Maui.Tests/Mapsui.UI.Maui.Tests.csproj
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intend to remove the Maui test and add a Mapsui.Dispose.Test project instead (or perhaps better to put it in Mapsui.Tests). We don't have platform specific tests for any other platform, and I don't want add them all. Also we should move as much code as possible to core so that we do not have to test a lot in the platforms.

public readonly double LabelSize = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? 39.6 : 42.6;
const double labelSizeOnMac = 42.642578125d;
const double labelSizeOnWindows = 39.642578125d;
const double labelSizeOnLinux = 40.181640625d;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had some trouble getting this to work on linux, had to figure out the linux label size through the build server test log.

@@ -116,6 +125,6 @@ public void DefaultSizeFeatureSize_Offset_x_y()
using var renderService = new RenderService();
var size = LabelStyleRenderer.FeatureSize(feature, labelStyle, skPaint, renderService.LabelCache);

ClassicAssert.AreEqual(Math.Round(size, 0), Math.Round(LabelSize + Math.Sqrt(2 * 2 + 2 * 2) * 2, 0));
Assert.That(size, Is.EqualTo(LabelSize + Math.Sqrt(2 * 2 + 2 * 2) * 2).Within(Constants.Epsilon));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Linux label size rounded the wrong way for this test. Instead of rounding I now use a margin. Such a margin is part of all test frameworks. In the v4 nunit you can use Within for that. In general this is a more common solution than rounding.

@pauldendulk pauldendulk merged commit 2ad4eca into main May 18, 2024
5 checks passed
@pauldendulk pauldendulk deleted the feature/run-tests-on-all-platforms branch May 18, 2024 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant