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
64 changes: 64 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue29740.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 29740, "[Windows] Stepper control fails to reach maximum value when increment exceeds remaining threshold",
PlatformAffected.UWP)]
public class Issue29740 : ContentPage
{
Label stepperValueLabel;
Stepper myStepper;

public Issue29740()
{
// Initialize the label
stepperValueLabel = new Label
{
AutomationId = "29740StepperValueLabel",
Text = "Stepper Value: 0",
FontSize = 18,
HorizontalOptions = LayoutOptions.Center
};

// Initialize the stepper
myStepper = new Stepper
{
AutomationId = "29740Stepper",
Minimum = 0,
Maximum = 10,
Increment = 3,
HorizontalOptions = LayoutOptions.Center
};
myStepper.ValueChanged += OnStepperValueChanged;

// Create the layout
var verticalStack = new VerticalStackLayout
{
Padding = new Thickness(30, 0),
Spacing = 25,
Children =
{
stepperValueLabel,
myStepper
}
};

// Embed in a ScrollView
Content = new ScrollView
{
Content = verticalStack
};

// Optionally update initial value display
UpdateLabel(myStepper.Value);
}

private void OnStepperValueChanged(object sender, ValueChangedEventArgs e)
{
UpdateLabel(e.NewValue);
}

private void UpdateLabel(double value)
{
stepperValueLabel.Text = $"Stepper Value: {value}";
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue29740 : _IssuesUITest
{
public Issue29740(TestDevice device) : base(device)
{
}

public override string Issue => "[Windows] Stepper control fails to reach maximum value when increment exceeds remaining threshold";

[Test]
[Category(UITestCategories.Stepper)]
public void GestureRecognizersOnLabelSpanShouldWork()
{
var initialvalue = App.WaitForElement("29740StepperValueLabel").GetText();
Assert.That(initialvalue, Is.EqualTo("Stepper Value: 0"));
for (int i = 0; i < 4; i++)
{
App.IncreaseStepper("29740Stepper");
}
var finalvalue = App.WaitForElement("29740StepperValueLabel").GetText();
Assert.That(finalvalue, Is.EqualTo("Stepper Value: 10"));
}
}
3 changes: 0 additions & 3 deletions src/Core/src/Platform/Windows/MauiStepper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@ void UpdateEnabled(double value)
void UpdateValue(double delta)
{
double newValue = Value + delta;
if (newValue > Maximum || newValue < Minimum)
return;

Value = newValue;
}

Expand Down
Loading