|
| 1 | +<UserControl x:Class="UITests.Windows_UI_Xaml_Shapes.PathTestsControl.Path_GeometryTransform" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 4 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 5 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 6 | + mc:Ignorable="d" |
| 7 | + d:DesignHeight="600" |
| 8 | + d:DesignWidth="400"> |
| 9 | + |
| 10 | + <!-- Manual test for Geometry.Transform (issue #3238) |
| 11 | + Expected result: each Path row shows the geometry shape transformed as described in the label. |
| 12 | + The transform is applied to the Geometry itself, not to the Path element. |
| 13 | + A yellow background makes it easy to see the shape's original bounds vs the transformed shape. --> |
| 14 | + |
| 15 | + <ScrollViewer> |
| 16 | + <StackPanel Spacing="16" Margin="16"> |
| 17 | + |
| 18 | + <TextBlock Style="{ThemeResource TitleTextBlockStyle}" Text="Geometry.Transform" /> |
| 19 | + <TextBlock TextWrapping="Wrap" |
| 20 | + Text="Verifies that Transform applied to a Geometry object is rendered correctly. Each row shows the same 40x20 RectangleGeometry with a different transform. The yellow border marks the Path element bounds." /> |
| 21 | + |
| 22 | + <!-- Baseline: no transform --> |
| 23 | + <StackPanel> |
| 24 | + <TextBlock FontWeight="SemiBold" Text="Baseline — no transform" /> |
| 25 | + <TextBlock Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" |
| 26 | + Text="Expected: blue rectangle at origin (0,0) of the yellow container." /> |
| 27 | + <Border Background="Yellow" Width="200" Height="80" HorizontalAlignment="Left"> |
| 28 | + <Path Fill="Blue"> |
| 29 | + <Path.Data> |
| 30 | + <RectangleGeometry Rect="10,10 40,20" /> |
| 31 | + </Path.Data> |
| 32 | + </Path> |
| 33 | + </Border> |
| 34 | + </StackPanel> |
| 35 | + |
| 36 | + <!-- TranslateTransform --> |
| 37 | + <StackPanel> |
| 38 | + <TextBlock FontWeight="SemiBold" Text="TranslateTransform (X=30, Y=20)" /> |
| 39 | + <TextBlock TextWrapping="Wrap" |
| 40 | + Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" |
| 41 | + Text="Expected: blue rectangle shifted 30px right and 20px down relative to the baseline." /> |
| 42 | + <Border Background="Yellow" Width="200" Height="80" HorizontalAlignment="Left"> |
| 43 | + <Path Fill="Blue"> |
| 44 | + <Path.Data> |
| 45 | + <RectangleGeometry Rect="10,10 40,20"> |
| 46 | + <RectangleGeometry.Transform> |
| 47 | + <TranslateTransform X="30" Y="20" /> |
| 48 | + </RectangleGeometry.Transform> |
| 49 | + </RectangleGeometry> |
| 50 | + </Path.Data> |
| 51 | + </Path> |
| 52 | + </Border> |
| 53 | + </StackPanel> |
| 54 | + |
| 55 | + <!-- RotateTransform --> |
| 56 | + <StackPanel> |
| 57 | + <TextBlock FontWeight="SemiBold" Text="RotateTransform (Angle=45)" /> |
| 58 | + <TextBlock TextWrapping="Wrap" |
| 59 | + Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" |
| 60 | + Text="Expected: blue rectangle rotated 45° around the origin of the geometry." /> |
| 61 | + <Border Background="Yellow" Width="200" Height="120" HorizontalAlignment="Left"> |
| 62 | + <Path Fill="Blue"> |
| 63 | + <Path.Data> |
| 64 | + <RectangleGeometry Rect="50,50 40,20"> |
| 65 | + <RectangleGeometry.Transform> |
| 66 | + <RotateTransform Angle="45" CenterX="50" CenterY="50" /> |
| 67 | + </RectangleGeometry.Transform> |
| 68 | + </RectangleGeometry> |
| 69 | + </Path.Data> |
| 70 | + </Path> |
| 71 | + </Border> |
| 72 | + </StackPanel> |
| 73 | + |
| 74 | + <!-- ScaleTransform --> |
| 75 | + <StackPanel> |
| 76 | + <TextBlock FontWeight="SemiBold" Text="ScaleTransform (ScaleX=2, ScaleY=2)" /> |
| 77 | + <TextBlock TextWrapping="Wrap" |
| 78 | + Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" |
| 79 | + Text="Expected: blue rectangle scaled to 2× in both dimensions (80x40 instead of 40x20)." /> |
| 80 | + <Border Background="Yellow" Width="200" Height="120" HorizontalAlignment="Left"> |
| 81 | + <Path Fill="Blue"> |
| 82 | + <Path.Data> |
| 83 | + <RectangleGeometry Rect="10,10 40,20"> |
| 84 | + <RectangleGeometry.Transform> |
| 85 | + <ScaleTransform ScaleX="2" ScaleY="2" /> |
| 86 | + </RectangleGeometry.Transform> |
| 87 | + </RectangleGeometry> |
| 88 | + </Path.Data> |
| 89 | + </Path> |
| 90 | + </Border> |
| 91 | + </StackPanel> |
| 92 | + |
| 93 | + <!-- CompositeTransform (translate + rotate) --> |
| 94 | + <StackPanel> |
| 95 | + <TextBlock FontWeight="SemiBold" Text="CompositeTransform (TranslateX=20, Rotation=30)" /> |
| 96 | + <TextBlock TextWrapping="Wrap" |
| 97 | + Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" |
| 98 | + Text="Expected: blue rectangle translated 20px right then rotated 30°." /> |
| 99 | + <Border Background="Yellow" Width="200" Height="120" HorizontalAlignment="Left"> |
| 100 | + <Path Fill="Blue"> |
| 101 | + <Path.Data> |
| 102 | + <RectangleGeometry Rect="20,40 40,20"> |
| 103 | + <RectangleGeometry.Transform> |
| 104 | + <CompositeTransform TranslateX="20" Rotation="30" /> |
| 105 | + </RectangleGeometry.Transform> |
| 106 | + </RectangleGeometry> |
| 107 | + </Path.Data> |
| 108 | + </Path> |
| 109 | + </Border> |
| 110 | + </StackPanel> |
| 111 | + |
| 112 | + <!-- Dynamic: TranslateTransform driven by sliders --> |
| 113 | + <StackPanel> |
| 114 | + <TextBlock FontWeight="SemiBold" Text="Dynamic TranslateTransform (use sliders)" /> |
| 115 | + <TextBlock TextWrapping="Wrap" |
| 116 | + Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" |
| 117 | + Text="Expected: blue rectangle moves as sliders change, validating that geometry transform changes cause the Path to re-render." /> |
| 118 | + <Border Background="Yellow" Width="200" Height="120" HorizontalAlignment="Left"> |
| 119 | + <Path Fill="Blue"> |
| 120 | + <Path.Data> |
| 121 | + <RectangleGeometry Rect="10,10 40,20"> |
| 122 | + <RectangleGeometry.Transform> |
| 123 | + <TranslateTransform X="{Binding Value, ElementName=SliderX}" |
| 124 | + Y="{Binding Value, ElementName=SliderY}" /> |
| 125 | + </RectangleGeometry.Transform> |
| 126 | + </RectangleGeometry> |
| 127 | + </Path.Data> |
| 128 | + </Path> |
| 129 | + </Border> |
| 130 | + <Slider x:Name="SliderX" Header="TranslateX" Minimum="0" Maximum="120" Value="0" /> |
| 131 | + <Slider x:Name="SliderY" Header="TranslateY" Minimum="0" Maximum="80" Value="0" /> |
| 132 | + </StackPanel> |
| 133 | + |
| 134 | + <!-- GeometryGroup with Transform on child geometry --> |
| 135 | + <StackPanel> |
| 136 | + <TextBlock FontWeight="SemiBold" Text="GeometryGroup with child TranslateTransform" /> |
| 137 | + <TextBlock TextWrapping="Wrap" |
| 138 | + Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}" |
| 139 | + Text="Expected: two rectangles — the second (green) shifted 60px right from the first (blue)." /> |
| 140 | + <Border Background="Yellow" Width="200" Height="80" HorizontalAlignment="Left"> |
| 141 | + <Path> |
| 142 | + <Path.Data> |
| 143 | + <GeometryGroup> |
| 144 | + <RectangleGeometry Rect="10,10 40,20" /> |
| 145 | + <RectangleGeometry Rect="10,10 40,20"> |
| 146 | + <RectangleGeometry.Transform> |
| 147 | + <TranslateTransform X="60" /> |
| 148 | + </RectangleGeometry.Transform> |
| 149 | + </RectangleGeometry> |
| 150 | + </GeometryGroup> |
| 151 | + </Path.Data> |
| 152 | + <Path.Fill> |
| 153 | + <LinearGradientBrush> |
| 154 | + <GradientStop Color="Blue" Offset="0" /> |
| 155 | + <GradientStop Color="Green" Offset="1" /> |
| 156 | + </LinearGradientBrush> |
| 157 | + </Path.Fill> |
| 158 | + </Path> |
| 159 | + </Border> |
| 160 | + </StackPanel> |
| 161 | + |
| 162 | + </StackPanel> |
| 163 | + </ScrollViewer> |
| 164 | +</UserControl> |
0 commit comments