-
Notifications
You must be signed in to change notification settings - Fork 853
fix(textbox): subpixel gaps between adjacent selected characters #22962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
fe91429
e33a514
02b39e8
4168cab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5100,6 +5100,36 @@ public async Task When_PasswordBox_ContextFlyout_Commands_Available() | |||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| #endif | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| [TestMethod] | ||||||||||||||||||||||||
| public async Task When_Selection_Background_Has_No_Gaps_Between_Characters() | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| using var _ = new TextBoxFeatureConfigDisposable(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| // Text with spaces that can produce cluster boundaries at exact | ||||||||||||||||||||||||
| // integer coordinates, which previously caused 1-pixel gaps in | ||||||||||||||||||||||||
| // the selection background due to rounding/antialiasing issues. | ||||||||||||||||||||||||
| var SUT = new TextBox | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| Text = "____", | ||||||||||||||||||||||||
| FontSize = 14, | ||||||||||||||||||||||||
|
Comment on lines
+5112
to
+5118
|
||||||||||||||||||||||||
| Width = 300, | ||||||||||||||||||||||||
| SelectionHighlightColor = new SolidColorBrush(Colors.Red), | ||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| await UITestHelper.Load(SUT); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| SUT.Focus(FocusState.Programmatic); | ||||||||||||||||||||||||
| SUT.SelectAll(); | ||||||||||||||||||||||||
| await UITestHelper.WaitForIdle(); | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| var tb = SUT.FindVisualChildByType<TextBlock>(); | ||||||||||||||||||||||||
| var screenshot = await UITestHelper.ScreenShot(tb); | ||||||||||||||||||||||||
| for (int i = 0; i < 20; i++) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| screenshot.GetPixel(i, screenshot.Height / 2).Should().Be(Colors.Red, $"Selection background should have no gaps at x={i}"); | ||||||||||||||||||||||||
|
Comment on lines
+5131
to
+5133
|
||||||||||||||||||||||||
| for (int i = 0; i < 20; i++) | |
| { | |
| screenshot.GetPixel(i, screenshot.Height / 2).Should().Be(Colors.Red, $"Selection background should have no gaps at x={i}"); | |
| const byte colorTolerance = 8; | |
| for (int i = 0; i < 20; i++) | |
| { | |
| var pixel = screenshot.GetPixel(i, screenshot.Height / 2); | |
| pixel.A.Should().BeInRange((byte)Math.Max(0, Colors.Red.A - colorTolerance), (byte)Math.Min(255, Colors.Red.A + colorTolerance), $"Selection background alpha should have no gaps at x={i}"); | |
| pixel.R.Should().BeInRange((byte)Math.Max(0, Colors.Red.R - colorTolerance), (byte)Math.Min(255, Colors.Red.R + colorTolerance), $"Selection background red channel should have no gaps at x={i}"); | |
| pixel.G.Should().BeInRange((byte)Math.Max(0, Colors.Red.G - colorTolerance), (byte)Math.Min(255, Colors.Red.G + colorTolerance), $"Selection background green channel should have no gaps at x={i}"); | |
| pixel.B.Should().BeInRange((byte)Math.Max(0, Colors.Red.B - colorTolerance), (byte)Math.Min(255, Colors.Red.B + colorTolerance), $"Selection background blue channel should have no gaps at x={i}"); |
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.
The PR description currently includes
closes #without an issue number/link. Please update it to use a fully-qualified issue URL (e.g.,Closes https://github.com/unoplatform/uno/issues/<id>) or note explicitly that there is no related issue and who approved it, per the repo PR requirements.