-
-
Notifications
You must be signed in to change notification settings - Fork 310
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
Conversation
…i/Mapsui into feature/run-tests-on-all-platforms
@@ -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 |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)); |
There was a problem hiding this comment.
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.
No description provided.