@@ -132,9 +132,7 @@ TEST_F(AiksTest, ClipsUseCurrentTransform) {
132
132
133
133
canvas.Translate (Vector3 (300 , 300 ));
134
134
for (int i = 0 ; i < 15 ; i++) {
135
- canvas.Translate (-Vector3 (300 , 300 ));
136
135
canvas.Scale (Vector3 (0.8 , 0.8 ));
137
- canvas.Translate (Vector3 (300 , 300 ));
138
136
139
137
paint.color = colors[i % colors.size ()];
140
138
canvas.ClipPath (PathBuilder{}.AddCircle ({0 , 0 }, 300 ).TakePath ());
@@ -202,7 +200,7 @@ TEST_F(AiksTest, CanPerformSkew) {
202
200
Paint red;
203
201
red.color = Color::Red ();
204
202
205
- canvas.Skew (10 , 125 );
203
+ canvas.Skew (2 , 5 );
206
204
canvas.DrawRect (Rect::MakeXYWH (0 , 0 , 100 , 100 ), red);
207
205
208
206
ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
@@ -417,5 +415,43 @@ TEST_F(AiksTest, PaintBlendModeIsRespected) {
417
415
ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
418
416
}
419
417
418
+ TEST_F (AiksTest, TransformMultipliesCorrectly) {
419
+ Canvas canvas;
420
+ ASSERT_MATRIX_NEAR (canvas.GetCurrentTransformation (), Matrix ());
421
+
422
+ // clang-format off
423
+ canvas.Translate (Vector3 (100 , 200 ));
424
+ ASSERT_MATRIX_NEAR (
425
+ canvas.GetCurrentTransformation (),
426
+ Matrix ( 1 , 0 , 0 , 0 ,
427
+ 0 , 1 , 0 , 0 ,
428
+ 0 , 0 , 1 , 0 ,
429
+ 100 , 200 , 0 , 1 ));
430
+
431
+ canvas.Rotate (Radians (kPiOver2 ));
432
+ ASSERT_MATRIX_NEAR (
433
+ canvas.GetCurrentTransformation (),
434
+ Matrix ( 0 , 1 , 0 , 0 ,
435
+ -1 , 0 , 0 , 0 ,
436
+ 0 , 0 , 1 , 0 ,
437
+ 100 , 200 , 0 , 1 ));
438
+
439
+ canvas.Scale (Vector3 (2 , 3 ));
440
+ ASSERT_MATRIX_NEAR (
441
+ canvas.GetCurrentTransformation (),
442
+ Matrix ( 0 , 2 , 0 , 0 ,
443
+ -3 , 0 , 0 , 0 ,
444
+ 0 , 0 , 0 , 0 ,
445
+ 100 , 200 , 0 , 1 ));
446
+
447
+ canvas.Translate (Vector3 (100 , 200 ));
448
+ ASSERT_MATRIX_NEAR (
449
+ canvas.GetCurrentTransformation (),
450
+ Matrix ( 0 , 2 , 0 , 0 ,
451
+ -3 , 0 , 0 , 0 ,
452
+ 0 , 0 , 0 , 0 ,
453
+ -500 , 400 , 0 , 1 ));
454
+ }
455
+
420
456
} // namespace testing
421
457
} // namespace impeller
0 commit comments