test(app): Arabic shell, toasts, chrome names and paddings; RTL captures are drawn mirrored
- Smoke tests: the main window opens mirrored when Arabic is applied before it exists, directional icons follow while other glyphs, the logo, the preview surface and the charts do not; the shell behind the first-run dialog is disabled; toasts draw, are named and close after their action; caption buttons, the job bar and the pause button have names; text boxes pad once. - --capture draws right-to-left windows through the window's mirror, as the Uploader and Setup do. - DESIGN §5 states the directional icon rule and the left-to-right islands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
3 files changed
+148
-5
No files matched your search
@@ -321,11 +321,25 @@ public static class ScreenCapture
|
||||
return false;
|
||||
}
|
||||
var bitmap = new RenderTargetBitmap(width, height, dpi.PixelsPerInchX, dpi.PixelsPerInchY, PixelFormats.Pbgra32);
|
||||
bitmap.Render(root);
|
||||
bitmap.Render(window.FlowDirection == FlowDirection.RightToLeft ? Mirrored(root) : root);
|
||||
var encoder = new PngBitmapEncoder();
|
||||
encoder.Frames.Add(BitmapFrame.Create(bitmap));
|
||||
using var stream = File.Create(path);
|
||||
encoder.Save(stream);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A right-to-left window is mirrored by a transform on the window itself, which rendering its content alone
|
||||
/// would leave out (mirrored glyphs, left-to-right layout): draw the content through that mirror.
|
||||
/// </summary>
|
||||
private static DrawingVisual Mirrored(FrameworkElement root)
|
||||
{
|
||||
var size = new Rect(0, 0, root.ActualWidth, root.ActualHeight);
|
||||
var visual = new DrawingVisual();
|
||||
using var dc = visual.RenderOpen();
|
||||
dc.PushTransform(new MatrixTransform(-1, 0, 0, 1, size.Width, 0));
|
||||
dc.DrawRectangle(new VisualBrush(root) { Stretch = Stretch.Fill, ViewboxUnits = BrushMappingMode.Absolute, Viewbox = size }, null, size);
|
||||
return visual;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user