Skip to content

Commit 10d5ed1

Browse files
authored
[web] Fix path to svg for drrect (flutter#13779)
1 parent b6e25aa commit 10d5ed1

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

lib/web_ui/dev/goldens_lock.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
repository: https://github.com/flutter/goldens.git
2-
revision: 009fbdd595aeec364eaff6b8f337f8ceb3c44ab9
2+
revision: 75729099b6f4d4e78ceb110b9305fc9905b91519

lib/web_ui/lib/src/engine/path_to_svg.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ void pathToSvg(ui.Path path, StringBuffer sb,
9696
final double blRadiusY = rrect.blRadiusY.abs();
9797
final double brRadiusY = rrect.brRadiusY.abs();
9898

99-
sb.write('L ${left + trRadiusX} $top ');
99+
sb.write('M ${left + trRadiusX} $top ');
100100
// Top side and top-right corner
101-
sb.write('M ${right - trRadiusX} $top ');
101+
sb.write('L ${right - trRadiusX} $top ');
102102
_writeEllipse(sb, right - trRadiusX, top + trRadiusY, trRadiusX,
103103
trRadiusY, 0, 1.5 * math.pi, 2.0 * math.pi, false);
104104
// Right side and bottom-right corner

lib/web_ui/test/golden_tests/engine/canvas_draw_image_golden_test.dart

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void main() async {
3131
try {
3232
sceneElement.append(engineCanvas.rootElement);
3333
html.document.body.append(sceneElement);
34-
await matchGoldenFile('$fileName.png', region: region, maxDiffRate: 0.02);
34+
await matchGoldenFile('$fileName.png', region: region, maxDiffRate: 0.2);
3535
} finally {
3636
// The page is reused across tests, so remove the element after taking the
3737
// Scuba screenshot.
@@ -100,6 +100,19 @@ void main() async {
100100
await _checkScreenshot(rc, 'draw_image_rect_with_source');
101101
});
102102

103+
test('Paints image with source and destination and round clip', () async {
104+
final RecordingCanvas rc =
105+
RecordingCanvas(const Rect.fromLTRB(0, 0, 400, 300));
106+
Image testImage = createTestImage();
107+
double testWidth = testImage.width.toDouble();
108+
double testHeight = testImage.height.toDouble();
109+
rc.save();
110+
rc.clipRRect(RRect.fromLTRBR(100, 30, 2 * testWidth, 2 * testHeight, Radius.circular(16)));
111+
rc.drawImageRect(testImage, Rect.fromLTRB(testWidth / 2, 0, testWidth, testHeight),
112+
Rect.fromLTRB(100, 30, 2 * testWidth, 2 * testHeight), new Paint());
113+
await _checkScreenshot(rc, 'draw_image_rect_with_source_and_clip');
114+
});
115+
103116
test('Paints image with transform using source and destination', () async {
104117
final RecordingCanvas rc =
105118
RecordingCanvas(const Rect.fromLTRB(0, 0, 400, 300));

0 commit comments

Comments
 (0)