|
16 | 16 | using Windows.System; |
17 | 17 | using Windows.UI.Input.Preview.Injection; |
18 | 18 | using FluentAssertions; |
19 | | -using static Private.Infrastructure.TestServices; |
20 | 19 | using System.Collections.Generic; |
21 | 20 | using System.Drawing; |
22 | 21 | using SamplesApp.UITests; |
23 | 22 | using Uno.Disposables; |
24 | 23 | using Uno.Extensions; |
25 | 24 | using Uno.UI.Extensions; |
26 | | -using Point = Windows.Foundation.Point; |
27 | | -using Size = Windows.Foundation.Size; |
28 | 25 | using Combinatorial.MSTest; |
29 | | - |
| 26 | +using Uno.UI.Helpers; |
| 27 | +using Microsoft.UI.Xaml.Markup; |
30 | 28 |
|
31 | 29 | #if __SKIA__ |
32 | 30 | using SkiaSharp; |
33 | 31 | using Microsoft.UI.Xaml.Documents.TextFormatting; |
34 | 32 | #endif |
35 | 33 |
|
| 34 | +using Point = Windows.Foundation.Point; |
| 35 | +using Size = Windows.Foundation.Size; |
| 36 | +using static Private.Infrastructure.TestServices; |
| 37 | + |
36 | 38 | namespace Uno.UI.RuntimeTests.Tests.Windows_UI_Xaml_Controls |
37 | 39 | { |
38 | 40 | [TestClass] |
@@ -986,6 +988,29 @@ public async Task When_Padding() |
986 | 988 | ImageAssert.DoesNotHaveColorInRectangle(screenshot, new Rectangle(0, 0, 50, 50), Colors.Red); |
987 | 989 | } |
988 | 990 |
|
| 991 | +#if __SKIA__ |
| 992 | + [TestMethod] |
| 993 | + public async Task When_RenderTransform_Rearrange() |
| 994 | + { |
| 995 | + var sut = new TextBlock() |
| 996 | + { |
| 997 | + Text = "AsdAsd", |
| 998 | + RenderTransform = new CompositeTransform { ScaleX = 2, ScaleY = 2 }, |
| 999 | + }; |
| 1000 | + |
| 1001 | + await UITestHelper.Load(sut); |
| 1002 | + |
| 1003 | + var a = sut.Visual.TransformMatrix; |
| 1004 | + |
| 1005 | + sut.InvalidateArrange(); |
| 1006 | + await UITestHelper.WaitForIdle(); |
| 1007 | + |
| 1008 | + var b = sut.Visual.TransformMatrix; |
| 1009 | + |
| 1010 | + Assert.AreEqual(a, b, "Visual.TransformMatrix should remain unchanged after re-arrange."); |
| 1011 | + } |
| 1012 | +#endif |
| 1013 | + |
989 | 1014 | #if HAS_UNO // GetMouse is not available on WinUI |
990 | 1015 | #region IsTextSelectionEnabled |
991 | 1016 |
|
@@ -1601,5 +1626,53 @@ public async Task When_IsTextSelectionEnabled_TouchScroll_Then_DoesNotAlterSelec |
1601 | 1626 | } |
1602 | 1627 | #endregion |
1603 | 1628 | #endif |
| 1629 | + |
| 1630 | +#if __SKIA__ |
| 1631 | + [TestMethod] |
| 1632 | + [GitHubWorkItem("https://github.com/unoplatform/uno/issues/21264")] |
| 1633 | + [DataRow("L")] |
| 1634 | + [DataRow("R")] |
| 1635 | + [DataRow("LL")] |
| 1636 | + [DataRow("LR")] |
| 1637 | + [DataRow("RL")] |
| 1638 | + [DataRow("RR")] |
| 1639 | + [DataRow("LLL")] |
| 1640 | + [DataRow("LLR")] |
| 1641 | + [DataRow("LRL")] |
| 1642 | + [DataRow("LRR")] |
| 1643 | + [DataRow("RLL")] |
| 1644 | + [DataRow("RLR")] |
| 1645 | + [DataRow("RRL")] |
| 1646 | + [DataRow("RRR")] |
| 1647 | + public async Task When_Layered_FlowDirection(string setup) |
| 1648 | + { |
| 1649 | + if (string.IsNullOrEmpty(setup) || setup.Any(c => c is not ('L' or 'R'))) |
| 1650 | + { |
| 1651 | + throw new ArgumentException("setup must be a non-empty string containing only 'L' and 'R' characters"); |
| 1652 | + } |
| 1653 | + |
| 1654 | + FrameworkElement root = null; |
| 1655 | + var textblock = new TextBlock { Text = "Asd" }; |
| 1656 | + |
| 1657 | + // assign FlowDirection from in-most, and box each layer with border |
| 1658 | + // LLR: Border R > Border L > TextBlock L |
| 1659 | + foreach (var c in setup) |
| 1660 | + { |
| 1661 | + root = root is null ? textblock : new Border { Child = root }; |
| 1662 | + root.FlowDirection = Parse(c); |
| 1663 | + } |
| 1664 | + |
| 1665 | + await UITestHelper.Load(root); |
| 1666 | + |
| 1667 | + Assert.AreEqual(1, textblock.Visual.TotalMatrix.M11); |
| 1668 | + |
| 1669 | + FlowDirection Parse(char c) => c switch |
| 1670 | + { |
| 1671 | + 'L' => FlowDirection.LeftToRight, |
| 1672 | + 'R' => FlowDirection.RightToLeft, |
| 1673 | + _ => throw new InvalidOperationException() |
| 1674 | + }; |
| 1675 | + } |
| 1676 | +#endif |
1604 | 1677 | } |
1605 | 1678 | } |
0 commit comments