-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Windows] Fix pointer released event not being handled on ImageButton #21766
Merged
+138
−3
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c4c64dd
Fix pointer released event not being handled on ImageButton
0851b82
Revert bad file include
45a4b28
Actually implement the scripts needed for right click
a904f8d
Resolve conflict
2d071ee
Fix merge
fb81777
Merge branch 'main' into foda/ImgButtonPointerState
Foda 0afcce4
Remove dupe release event
f6ee95a
Merge branch 'foda/ImgButtonPointerState' of https://github.com/dotne…
2dbf759
Update ref image
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/Controls/samples/Controls.Sample.UITests/Issues/Issue21706.xaml
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,40 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
x:Class="Maui.Controls.Sample.Issues.Issue21706" | ||
xmlns:ns="clr-namespace:Maui.Controls.Sample.Issues"> | ||
<VerticalStackLayout> | ||
<ImageButton | ||
Source="groceries.png" | ||
WidthRequest="200" | ||
HeightRequest="200" | ||
AutomationId="WaitForElement" | ||
x:Name="PointerImageButton"> | ||
<VisualStateManager.VisualStateGroups> | ||
<VisualStateGroup | ||
x:Name="CommonStates"> | ||
<VisualState | ||
x:Name="Normal"> | ||
<VisualState.Setters> | ||
<Setter | ||
Property="BackgroundColor" Value="Blue" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
<VisualState | ||
x:Name="PointerOver"> | ||
<VisualState.Setters> | ||
<Setter | ||
Property="BackgroundColor" Value="Red" /> | ||
</VisualState.Setters> | ||
</VisualState> | ||
</VisualStateGroup> | ||
</VisualStateManager.VisualStateGroups> | ||
</ImageButton> | ||
|
||
<Button | ||
AutomationId="OtherButton" | ||
WidthRequest="200" | ||
HeightRequest="200" | ||
Text="Other"/> | ||
</VerticalStackLayout> | ||
</ContentPage> |
18 changes: 18 additions & 0 deletions
18
src/Controls/samples/Controls.Sample.UITests/Issues/Issue21706.xaml.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,18 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using Microsoft.Maui.Controls; | ||
using Microsoft.Maui.Controls.Xaml; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[XamlCompilation(XamlCompilationOptions.Compile)] | ||
[Issue(IssueTracker.Github, 21706, "ImageButton stuck in PointerOver state", PlatformAffected.UWP)] | ||
public partial class Issue21706 : ContentPage | ||
{ | ||
public Issue21706() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.AppiumTests.Issues | ||
{ | ||
public class Issue21706 : _IssuesUITest | ||
{ | ||
public override string Issue => "ImageButton stuck in PointerOver state"; | ||
|
||
public Issue21706(TestDevice device) : base(device) { } | ||
|
||
[Test] | ||
public async Task ImageButtonStuckAfterRightClick() | ||
{ | ||
this.IgnoreIfPlatforms(new TestDevice[] { TestDevice.Android, TestDevice.Mac, TestDevice.iOS }); | ||
App.WaitForElement("WaitForElement"); | ||
App.RightClick("WaitForElement"); | ||
await Task.Delay(200); | ||
App.Click("OtherButton"); | ||
await Task.Delay(200); | ||
VerifyScreenshot(); | ||
} | ||
} | ||
} |
Binary file added
BIN
+13.6 KB
src/Controls/tests/UITests/snapshots/windows/ImageButtonStuckAfterRightClick.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Any specific reason we want to not test this on the other platforms?
I get that this is about clicks/hovers so it might not work on some platforms, but if it reasonably can work, why not let them run there as well?
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.
Ah, the ticket mentioned that it already worked fine in macOS, so I wrote the test to only check on Win. The Appium test does specifically use the pointer right click, so we could enable it for macOS as well.