-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[net7.0] Reconcile PointerOver, Pressed, and Focused states (#12431)
* Potential fix for #9753 on desktop * Fix test for release disabled button * Fix test for release disabled button * Add more tests; fix issues with "stuck" PointerOver states * Clean up extraneous debug stuff * D'oh Co-authored-by: E.Z. Hart <[email protected]>
- Loading branch information
1 parent
e64dab3
commit cb7c44c
Showing
10 changed files
with
172 additions
and
59 deletions.
There are no files selected for viewing
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
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
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
49 changes: 49 additions & 0 deletions
49
src/Controls/tests/Core.UnitTests/VisualStateTestHelpers.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,49 @@ | ||
namespace Microsoft.Maui.Controls.Core.UnitTests | ||
{ | ||
public class VisualStateTestHelpers | ||
{ | ||
public const string NormalStateName = "Normal"; | ||
public const string PressedStateName = "Pressed"; | ||
public const string InvalidStateName = "Invalid"; | ||
public const string UnfocusedStateName = "Unfocused"; | ||
public const string FocusedStateName = "Focused"; | ||
public const string DisabledStateName = "Disabled"; | ||
public const string CommonStatesGroupName = "CommonStates"; | ||
public const string FocusStatesGroupName = "FocusStates"; | ||
|
||
public static VisualStateGroupList CreateTestStateGroups() | ||
{ | ||
var stateGroups = new VisualStateGroupList(); | ||
var commonStatesGroup = new VisualStateGroup { Name = CommonStatesGroupName }; | ||
var normalState = new VisualState { Name = NormalStateName }; | ||
var focusState = new VisualState { Name = FocusedStateName }; | ||
var pressedState = new VisualState { Name = PressedStateName }; | ||
var invalidState = new VisualState { Name = InvalidStateName }; | ||
|
||
var disabledState = new VisualState { Name = DisabledStateName }; | ||
|
||
commonStatesGroup.States.Add(normalState); | ||
commonStatesGroup.States.Add(pressedState); | ||
commonStatesGroup.States.Add(invalidState); | ||
commonStatesGroup.States.Add(focusState); | ||
commonStatesGroup.States.Add(disabledState); | ||
|
||
stateGroups.Add(commonStatesGroup); | ||
|
||
return stateGroups; | ||
} | ||
|
||
public static VisualStateGroupList CreateStateGroupsWithoutNormalState() | ||
{ | ||
var stateGroups = new VisualStateGroupList(); | ||
var visualStateGroup = new VisualStateGroup { Name = CommonStatesGroupName }; | ||
var invalidState = new VisualState { Name = InvalidStateName }; | ||
|
||
visualStateGroup.States.Add(invalidState); | ||
|
||
stateGroups.Add(visualStateGroup); | ||
|
||
return stateGroups; | ||
} | ||
} | ||
} |