This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue creating Paths with segments without points on iOS (#13161)
Co-authored-by: Gerald Versluis <gerald.versluis@microsoft.com>
- Loading branch information
1 parent
430754b
commit dad72d3
Showing
3 changed files
with
130 additions
and
3 deletions.
There are no files selected for viewing
126 changes: 126 additions & 0 deletions
126
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue13159.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
using Xamarin.Forms.CustomAttributes; | ||
using Xamarin.Forms.Internals; | ||
using Xamarin.Forms.Shapes; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 13159, "[Bug] +Fix. Path.Data crashing when geometry has a PolyLineSegment with 0 point", | ||
PlatformAffected.iOS)] | ||
#if UITEST | ||
[Category(UITestCategories.Shape)] | ||
#endif | ||
public class Issue13159 : TestContentPage | ||
{ | ||
const string TestReady = "TestReadyId"; | ||
|
||
public Issue13159() | ||
{ | ||
|
||
} | ||
|
||
protected override void Init() | ||
{ | ||
var layout = new StackLayout(); | ||
|
||
var instructions = new Label | ||
{ | ||
AutomationId = TestReady, | ||
Padding = 12, | ||
BackgroundColor = Color.Black, | ||
TextColor = Color.White, | ||
Text = "Without exceptions, the test has passed." | ||
}; | ||
|
||
layout.Children.Add(instructions); | ||
layout.Children.Add(CreateNoPointsPolyLineSegmentPath()); | ||
layout.Children.Add(CreateNoPointsPolyBezierSegmentPath()); | ||
layout.Children.Add(CreateNoPointsPolyQuadraticBezierSegmentPath()); | ||
layout.Children.Add(CreateNoPointsArcSegmentPath()); | ||
|
||
Content = layout; | ||
} | ||
|
||
Path CreateNoPointsPolyLineSegmentPath() | ||
{ | ||
var path = new Path(); | ||
|
||
PathFigure pathFigure = new PathFigure(); | ||
|
||
pathFigure.Segments.Add(new PolyLineSegment()); | ||
|
||
PathGeometry geometry = new PathGeometry(); | ||
|
||
geometry.Figures.Add(pathFigure); | ||
|
||
path.Data = geometry; | ||
|
||
return path; | ||
} | ||
|
||
Path CreateNoPointsPolyBezierSegmentPath() | ||
{ | ||
var path = new Path(); | ||
|
||
PathFigure pathFigure = new PathFigure(); | ||
|
||
pathFigure.Segments.Add(new PolyBezierSegment()); | ||
|
||
PathGeometry geometry = new PathGeometry(); | ||
|
||
geometry.Figures.Add(pathFigure); | ||
|
||
path.Data = geometry; | ||
|
||
return path; | ||
} | ||
|
||
Path CreateNoPointsPolyQuadraticBezierSegmentPath() | ||
{ | ||
var path = new Path(); | ||
|
||
PathFigure pathFigure = new PathFigure(); | ||
|
||
pathFigure.Segments.Add(new PolyQuadraticBezierSegment()); | ||
|
||
PathGeometry geometry = new PathGeometry(); | ||
|
||
geometry.Figures.Add(pathFigure); | ||
|
||
path.Data = geometry; | ||
|
||
return path; | ||
} | ||
|
||
Path CreateNoPointsArcSegmentPath() | ||
{ | ||
var path = new Path(); | ||
|
||
PathFigure pathFigure = new PathFigure(); | ||
|
||
pathFigure.Segments.Add(new ArcSegment()); | ||
|
||
PathGeometry geometry = new PathGeometry(); | ||
|
||
geometry.Figures.Add(pathFigure); | ||
|
||
path.Data = geometry; | ||
|
||
return path; | ||
} | ||
|
||
#if UITEST && __IOS__ | ||
[Test] | ||
public void Issue13159NoPointsPathTest() | ||
{ | ||
RunningApp.WaitForElement(TestReady); | ||
} | ||
#endif | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters