Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue25502.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
namespace Maui.Controls.Sample.Issues
{

[Issue(IssueTracker.Github, 25502, "Gray Line Appears on the Right Side of GraphicsView with Decimal WidthRequest on iOS Platform", PlatformAffected.iOS)]
public class Issue25502 : ContentPage
{
public Issue25502()
{
GraphicsView graphicsView = new GraphicsView
{
AutomationId = "GraphicsView",
HeightRequest = 200.25,
WidthRequest = 248.25,
BackgroundColor = Colors.White,
Margin = new Thickness(20),
};
graphicsView.Drawable = new GraphicsDrawable(graphicsView);

Button changeColorButton = new Button
{
Text = "Click to change Color",
AutomationId = "ChangeColorButton"
};

changeColorButton.Clicked += ChangeColorButton_Clicked;

Content = new StackLayout
{
Spacing = 10,
Children =
{
graphicsView,
changeColorButton
}
};

void ChangeColorButton_Clicked(object sender, EventArgs e)
{
graphicsView.BackgroundColor = Colors.Yellow;
}
}

public class GraphicsDrawable : IDrawable
{
GraphicsView _graphicsView;
public GraphicsDrawable(GraphicsView graphicsView)
{
_graphicsView = graphicsView;
}

public void Draw(ICanvas canvas, RectF dirtyRect)
{
canvas.FillColor = _graphicsView.BackgroundColor;
canvas.FillRectangle(new RectF(dirtyRect.X, dirtyRect.Y + 40, dirtyRect.Width - 40, dirtyRect.Height - 40));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue25502 : _IssuesUITest
{
public Issue25502(TestDevice testDevice) : base(testDevice)
{
}

public override string Issue => "Gray Line Appears on the Right Side of GraphicsView with Decimal WidthRequest on iOS Platform";

[Test]
[Category(UITestCategories.GraphicsView)]
public void VerifyGraphicsViewWithoutGrayLine()
{
App.WaitForElement("ChangeColorButton");
App.Click("ChangeColorButton");
VerifyScreenshot();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ public partial class GraphicsViewHandler : ViewHandler<IGraphicsView, PlatformTo
{
protected override PlatformTouchGraphicsView CreatePlatformView() => new(Context);

// TODO : The modifier needs to be changed to public in the future.
internal static void MapBackground(IGraphicsViewHandler handler, IGraphicsView graphicsView)
{
if (graphicsView.Background is not null)
{
handler.PlatformView?.Invalidate();
}
}

public static void MapDrawable(IGraphicsViewHandler handler, IGraphicsView graphicsView)
{
handler.PlatformView?.UpdateDrawable(graphicsView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ private protected override void OnDisconnectHandler(FrameworkElement platformVie
platformView.Loaded -= OnLoaded;
}

// TODO : The modifier needs to be changed to public in the future.
internal static void MapBackground(IGraphicsViewHandler handler, IGraphicsView graphicsView)
{
if (graphicsView.Background is not null)
{
handler.PlatformView?.Invalidate();
}
}

public static void MapDrawable(IGraphicsViewHandler handler, IGraphicsView graphicsView)
{
handler.PlatformView?.UpdateDrawable(graphicsView);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public partial class GraphicsViewHandler : IGraphicsViewHandler
{
public static IPropertyMapper<IGraphicsView, IGraphicsViewHandler> Mapper = new PropertyMapper<IGraphicsView, IGraphicsViewHandler>(ViewHandler.ViewMapper)
{
[nameof(IView.Background)] = MapBackground,
[nameof(IGraphicsView.Drawable)] = MapDrawable,
[nameof(IView.FlowDirection)] = MapFlowDirection
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ protected override PlatformTouchGraphicsView CreatePlatformView()
return new PlatformTouchGraphicsView();
}

// TODO : The modifier needs to be changed to public in the future.
internal static void MapBackground(IGraphicsViewHandler handler, IGraphicsView graphicsView)
{
if (graphicsView.Background is not null)
{
handler.PlatformView?.InvalidateDrawable();
}
}

public static void MapDrawable(IGraphicsViewHandler handler, IGraphicsView graphicsView)
{
handler.PlatformView?.UpdateDrawable(graphicsView);
Expand Down
Loading