This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[iOS] TextDecoration Strikethrough not working on iOS together with LineHeight #11928
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c73a4f8
Avoid override wrong text decoration
jsuarezruiz 482f4ce
Updated the sample to allow to modify the LineHeight dynamically
jsuarezruiz a6c9b34
Fixed issue updating the LineHeight
jsuarezruiz b76e2c7
Fix build error
jsuarezruiz bee9041
Update Xamarin.Forms.Controls.Issues.Shared.projitems
jfversluis e779da2
Fix build & improve repro
jfversluis File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
114 changes: 114 additions & 0 deletions
114
Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Issue11829.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,114 @@ | ||
using Xamarin.Forms.Internals; | ||
using Xamarin.Forms.CustomAttributes; | ||
|
||
#if UITEST | ||
using Xamarin.UITest; | ||
using NUnit.Framework; | ||
using Xamarin.Forms.Core.UITests; | ||
#endif | ||
|
||
namespace Xamarin.Forms.Controls.Issues | ||
{ | ||
#if UITEST | ||
[Category(UITestCategories.Label)] | ||
#endif | ||
[Preserve(AllMembers = true)] | ||
[Issue(IssueTracker.Github, 11829, | ||
"[Bug] TextDecoration Strikethrough not working on iOS together with LineHeight", | ||
PlatformAffected.All)] | ||
public class Issue11829 : TestContentPage | ||
{ | ||
public Issue11829() | ||
{ | ||
|
||
} | ||
|
||
protected override void Init() | ||
{ | ||
Title = "Issue 11829"; | ||
|
||
var layout = new StackLayout(); | ||
|
||
var instructions = new Label | ||
{ | ||
Padding = 12, | ||
BackgroundColor = Color.Black, | ||
TextColor = Color.White, | ||
Text = "If the text below is underline & strike through, the test has passed." | ||
}; | ||
|
||
var label = new Label | ||
{ | ||
TextDecorations = TextDecorations.Underline | TextDecorations.Strikethrough, | ||
LineHeight = 2, | ||
Text = "Underline using LineHeight", | ||
Margin = new Thickness(0, 12) | ||
}; | ||
|
||
var textDecorationsLayout = new StackLayout | ||
{ | ||
Orientation = StackOrientation.Horizontal | ||
}; | ||
|
||
var textDecorationsCheckBox = new CheckBox | ||
{ | ||
IsChecked = true, | ||
VerticalOptions = LayoutOptions.Center | ||
}; | ||
|
||
var textDecorationsText = new Label | ||
{ | ||
Text = "Underline", | ||
WidthRequest = 100, | ||
VerticalOptions = LayoutOptions.Center | ||
}; | ||
|
||
textDecorationsLayout.Children.Add(textDecorationsText); | ||
textDecorationsLayout.Children.Add(textDecorationsCheckBox); | ||
|
||
var lineHeightLayout = new StackLayout | ||
{ | ||
Orientation = StackOrientation.Horizontal | ||
}; | ||
|
||
var lineHeightSlider = new Slider | ||
{ | ||
Maximum = 4, | ||
Minimum = 2, | ||
Value = 2, | ||
WidthRequest = 150, | ||
VerticalOptions = LayoutOptions.Center | ||
}; | ||
|
||
var lineHeightText = new Label | ||
{ | ||
Text = "LineHeight", | ||
WidthRequest = 100, | ||
VerticalOptions = LayoutOptions.Center | ||
}; | ||
|
||
lineHeightLayout.Children.Add(lineHeightText); | ||
lineHeightLayout.Children.Add(lineHeightSlider); | ||
|
||
layout.Children.Add(instructions); | ||
layout.Children.Add(label); | ||
layout.Children.Add(textDecorationsLayout); | ||
layout.Children.Add(lineHeightLayout); | ||
|
||
Content = layout; | ||
|
||
textDecorationsCheckBox.CheckedChanged += (sender, args) => | ||
{ | ||
if (args.Value) | ||
label.TextDecorations = TextDecorations.Strikethrough | TextDecorations.Underline; | ||
else | ||
label.TextDecorations = TextDecorations.None; | ||
}; | ||
|
||
lineHeightSlider.ValueChanged += (sender, args) => | ||
{ | ||
label.LineHeight = args.NewValue; | ||
}; | ||
} | ||
} | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be automated with a platform test on iOS - we can verify that the Control's AttributedText has the strikethrough attribute after the Label has LineHeight and TextDecoration set.