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
Binary file not shown.
17 changes: 16 additions & 1 deletion src/Controls/tests/TestCases.HostApp/Issues/Issue19109.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,29 @@ public Issue19109()
HorizontalOptions = LayoutOptions.Center
};

var rangeLabel = new Label
{
AutomationId = "RangeLabel",
Text = "Range not set yet",
HorizontalOptions = LayoutOptions.Center
};

button.Clicked += (sender, e) =>
{
entry.Focus();

#if IOS
if (entry.Handler?.PlatformView is UIKit.UITextField textField && textField.SelectedTextRange != null)
{
rangeLabel.Text = $"Start={textField.GetOffsetFromPosition(textField.BeginningOfDocument, textField.SelectedTextRange.Start)}, " +
$"End={textField.GetOffsetFromPosition(textField.BeginningOfDocument, textField.SelectedTextRange.End)}";
}
#endif
};

Content = new StackLayout
{
Children = { entry, button, label },
Children = { entry, button, label, rangeLabel },
Padding = new Thickness(20),
Spacing = 10
};
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if IOS
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;
Expand All @@ -17,7 +18,9 @@ public void EntryShouldApplyCursorPositionCorrectly()
App.WaitForElement("EntryControl");
App.WaitForElement("FocusButton");
App.Tap("FocusButton");
VerifyScreenshot();
var rangeText = App.WaitForElement("RangeLabel").GetText();
Assert.That(rangeText, Is.EqualTo("Start=5, End=5"), "Cursor position not applied correctly");
}
}
}
#endif
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.