Resolved Text Jump Issue in Entry Control with HorizontalTextAlignment Set to End (#24485)
* fix-24405-Fixed-Entry-Text-Alignment-Issue * Fix-24405-Removed local variable and added old comment. * fix-24405-Testcase sample updated. * Fix-24405-Test case changes committed. * fix-24405-Updated new logic. * fix-24405-Test script changes committed. * fix-24405-Modified script and sample files. * fix-24405-Modified test sample code. * Fix-24405-Snapshots added for windows, iOS and Android. * Fix-24405-Updated Testscript method name.
This commit is contained in:
Родитель
bc5b90b257
Коммит
948632193f
Двоичные данные
src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyEntryHorizontalEndTextAlignmentPosition.png
Normal file
Двоичные данные
src/Controls/tests/TestCases.Android.Tests/snapshots/android/VerifyEntryHorizontalEndTextAlignmentPosition.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 16 KiB |
|
@ -0,0 +1,10 @@
|
|||
<?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"
|
||||
xmlns:local="clr-namespace:Maui.Controls.Sample.Issues"
|
||||
x:Class="Maui.Controls.Sample.Issues.Issue24405">
|
||||
<VerticalStackLayout>
|
||||
<Entry AutomationId="entry" x:Name="entry" Placeholder="Enter text here" HorizontalTextAlignment="End"/>
|
||||
<Button AutomationId="button" Text="Click" Clicked="OnButtonClicked"/>
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Microsoft.Maui.Controls;
|
||||
using Microsoft.Maui.Controls.CustomAttributes;
|
||||
using Microsoft.Maui.Controls.Internals;
|
||||
|
||||
namespace Maui.Controls.Sample.Issues
|
||||
{
|
||||
[XamlCompilation(XamlCompilationOptions.Compile)]
|
||||
[Preserve(AllMembers = true)]
|
||||
[Issue(IssueTracker.Github, 24405, "Entry with right aligned text keeps text jumping to the left during editing", PlatformAffected.UWP)]
|
||||
public partial class Issue24405 : ContentPage
|
||||
{
|
||||
public Issue24405()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OnButtonClicked(object sender, EventArgs e)
|
||||
{
|
||||
entry.Text = "Hello";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
using NUnit.Framework;
|
||||
using UITest.Appium;
|
||||
using UITest.Core;
|
||||
|
||||
namespace Microsoft.Maui.TestCases.Tests.Issues
|
||||
{
|
||||
public class Issue24405 : _IssuesUITest
|
||||
{
|
||||
public Issue24405(TestDevice testDevice) : base(testDevice)
|
||||
{
|
||||
}
|
||||
|
||||
public override string Issue => "Entry with right aligned text keeps text jumping to the left during editing";
|
||||
|
||||
[Test]
|
||||
[Category(UITestCategories.Entry)]
|
||||
[FailsOnMac]
|
||||
public void VerifyEntryHorizontalEndTextAlignmentPosition()
|
||||
{
|
||||
App.WaitForElement("button");
|
||||
App.Tap("button");
|
||||
VerifyScreenshot();
|
||||
}
|
||||
}
|
||||
}
|
Двоичные данные
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyEntryHorizontalEndTextAlignmentPosition.png
Normal file
Двоичные данные
src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/VerifyEntryHorizontalEndTextAlignmentPosition.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 6.0 KiB |
Двоичные данные
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/VerifyEntryHorizontalEndTextAlignmentPosition.png
Normal file
Двоичные данные
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/VerifyEntryHorizontalEndTextAlignmentPosition.png
Normal file
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 18 KiB |
|
@ -67,16 +67,16 @@ namespace Microsoft.Maui.Platform
|
|||
|
||||
Button? deleteButton = element.GetDescendantByName<Button>(DeleteButtonElementName);
|
||||
|
||||
if (deleteButton is not null)
|
||||
// Adjust the second column's width to 'Auto' when the delete button is enabled, and set it to zero when disabled.
|
||||
if (deleteButton?.Parent is Grid rootGrid && rootGrid.ColumnDefinitions.Count > 1)
|
||||
{
|
||||
if (GetIsDeleteButtonEnabled(element))
|
||||
{
|
||||
deleteButton.RenderTransform = null;
|
||||
rootGrid.ColumnDefinitions[1].Width = new UI.Xaml.GridLength(1, UI.Xaml.GridUnitType.Auto);
|
||||
}
|
||||
else
|
||||
{
|
||||
// This is a workaround to move the button to be effectively invisible. It is not perfect.
|
||||
deleteButton.RenderTransform = new TranslateTransform() { X = -int.MaxValue, Y = -int.MaxValue };
|
||||
rootGrid.ColumnDefinitions[1].Width = new UI.Xaml.GridLength(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче