Skip to content

Commit 7935165

Browse files
authored
Fixed the Label not sized correctly on Android (dotnet#28215)
* Fixed the Label Width issue on Android * Added the test case and sample * Removed the wrong screenshots * Committed the correct image * Added windows snap * Committed the mac snapshots * Fixed the Label Width issue on Android * Added the test case and sample * Removed the wrong screenshots * Committed the correct image * Added windows snap * Committed the mac snapshots * Modified the test sample and images * Committed the pending snaps
1 parent d8d2a2b commit 7935165

17 files changed

+126
-1
lines changed
84.1 KB
Loading
84.1 KB
Loading
84.1 KB
Loading
24 Bytes
Loading
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
namespace Maui.Controls.Sample.Issues
2+
{
3+
[Issue(IssueTracker.Github, 27614, "Label not sized correctly on Android", PlatformAffected.Android)]
4+
public class Issue27614 : ContentPage
5+
{
6+
public Issue27614()
7+
{
8+
9+
var singleLineLabel = new Label
10+
{
11+
HorizontalOptions = LayoutOptions.Start,
12+
AutomationId = "Label",
13+
Margin = new Thickness(5, 5),
14+
Text = "Hello World",
15+
BackgroundColor = Colors.Blue,
16+
TextColor = Colors.Black,
17+
FontSize = 20
18+
};
19+
20+
var multiLineLabel = new Label
21+
{
22+
HorizontalOptions = LayoutOptions.Start,
23+
Margin = new Thickness(5, 5),
24+
Text = "NET MAUI is a framework used to build native, cross-platform desktop and mobile apps from a single C# codebase for Android, iOS, Mac, and Windows",
25+
BackgroundColor = Colors.Orchid,
26+
TextColor = Colors.Black,
27+
FontSize = 20
28+
};
29+
30+
var button = new Button
31+
{
32+
Text = "Change Label HorizontalOptions to Center",
33+
AutomationId = "CenterButton",
34+
Margin = new Thickness(5, 5)
35+
36+
};
37+
button.Clicked += (s, e) =>
38+
{
39+
singleLineLabel.HorizontalOptions = LayoutOptions.Center;
40+
multiLineLabel.HorizontalOptions = LayoutOptions.Center;
41+
};
42+
var button1 = new Button
43+
{
44+
Text = "Change Label HorizontalOptions to End",
45+
AutomationId = "EndButton",
46+
Margin = new Thickness(5, 5)
47+
};
48+
button1.Clicked += (s, e) =>
49+
{
50+
singleLineLabel.HorizontalOptions = LayoutOptions.End;
51+
multiLineLabel.HorizontalOptions = LayoutOptions.End;
52+
};
53+
var layout = new VerticalStackLayout
54+
{
55+
Children = { singleLineLabel, multiLineLabel, button, button1 }
56+
};
57+
58+
Content = layout;
59+
}
60+
}
61+
}
43.7 KB
Loading
41.5 KB
Loading
41.7 KB
Loading
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using NUnit.Framework;
2+
using UITest.Appium;
3+
using UITest.Core;
4+
5+
namespace Microsoft.Maui.TestCases.Tests.Issues
6+
{
7+
public class Issue27614 : _IssuesUITest
8+
{
9+
public Issue27614(TestDevice testDevice) : base(testDevice)
10+
{
11+
}
12+
13+
public override string Issue => "Label not sized correctly on Android";
14+
15+
[Test, Order(1)]
16+
[Category(UITestCategories.Label)]
17+
public void LabelShouldSizeCorrectlyOnHorizontalStartLayoutOptions()
18+
{
19+
App.WaitForElement("Label");
20+
VerifyScreenshot();
21+
}
22+
23+
[Test, Order(2)]
24+
[Category(UITestCategories.Label)]
25+
public void LabelShouldSizeCorrectlyOnHorizontalCenterLayoutOptions()
26+
{
27+
App.WaitForElement("CenterButton");
28+
App.Tap("CenterButton");
29+
VerifyScreenshot();
30+
}
31+
32+
[Test, Order(3)]
33+
[Category(UITestCategories.Label)]
34+
public void LabelShouldSizeCorrectlyOnHorizontalEndLayoutOptions()
35+
{
36+
App.WaitForElement("EndButton");
37+
App.Tap("EndButton");
38+
VerifyScreenshot();
39+
}
40+
}
41+
}
22.3 KB
Loading

0 commit comments

Comments
 (0)