@@ -39,115 +39,6 @@ namespace testing {
3939
4040INSTANTIATE_PLAYGROUND_SUITE (AiksTest);
4141
42- TEST_P (AiksTest, CanvasCTMCanBeUpdated) {
43- Canvas canvas;
44- Matrix identity;
45- ASSERT_MATRIX_NEAR (canvas.GetCurrentTransform (), identity);
46- canvas.Translate (Size{100 , 100 });
47- ASSERT_MATRIX_NEAR (canvas.GetCurrentTransform (),
48- Matrix::MakeTranslation ({100.0 , 100.0 , 0.0 }));
49- }
50-
51- TEST_P (AiksTest, CanvasCanPushPopCTM) {
52- Canvas canvas;
53- ASSERT_EQ (canvas.GetSaveCount (), 1u );
54- ASSERT_EQ (canvas.Restore (), false );
55-
56- canvas.Translate (Size{100 , 100 });
57- canvas.Save ();
58- ASSERT_EQ (canvas.GetSaveCount (), 2u );
59- ASSERT_MATRIX_NEAR (canvas.GetCurrentTransform (),
60- Matrix::MakeTranslation ({100.0 , 100.0 , 0.0 }));
61- ASSERT_TRUE (canvas.Restore ());
62- ASSERT_EQ (canvas.GetSaveCount (), 1u );
63- ASSERT_MATRIX_NEAR (canvas.GetCurrentTransform (),
64- Matrix::MakeTranslation ({100.0 , 100.0 , 0.0 }));
65- }
66-
67- TEST_P (AiksTest, CanPictureConvertToImage) {
68- Canvas recorder_canvas;
69- Paint paint;
70- paint.color = Color{0.9568 , 0.2627 , 0.2118 , 1.0 };
71- recorder_canvas.DrawRect (Rect::MakeXYWH (100.0 , 100.0 , 600 , 600 ), paint);
72- paint.color = Color{0.1294 , 0.5882 , 0.9529 , 1.0 };
73- recorder_canvas.DrawRect (Rect::MakeXYWH (200.0 , 200.0 , 600 , 600 ), paint);
74-
75- Canvas canvas;
76- AiksContext renderer (GetContext (), nullptr );
77- paint.color = Color::BlackTransparent ();
78- canvas.DrawPaint (paint);
79- Picture picture = recorder_canvas.EndRecordingAsPicture ();
80- auto image = picture.ToImage (renderer, ISize{1000 , 1000 });
81- if (image) {
82- canvas.DrawImage (image, Point (), Paint ());
83- paint.color = Color{0.1 , 0.1 , 0.1 , 0.2 };
84- canvas.DrawRect (Rect::MakeSize (ISize{1000 , 1000 }), paint);
85- }
86-
87- ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
88- }
89-
90- // Regression test for https://github.com/flutter/flutter/issues/142358 .
91- // Without a change to force render pass construction the image is left in an
92- // undefined layout and triggers a validation error.
93- TEST_P (AiksTest, CanEmptyPictureConvertToImage) {
94- Canvas recorder_canvas;
95-
96- Canvas canvas;
97- AiksContext renderer (GetContext (), nullptr );
98- Paint paint;
99- paint.color = Color::BlackTransparent ();
100- canvas.DrawPaint (paint);
101- Picture picture = recorder_canvas.EndRecordingAsPicture ();
102- auto image = picture.ToImage (renderer, ISize{1000 , 1000 });
103- if (image) {
104- canvas.DrawImage (image, Point (), Paint ());
105- paint.color = Color{0.1 , 0.1 , 0.1 , 0.2 };
106- canvas.DrawRect (Rect::MakeSize (ISize{1000 , 1000 }), paint);
107- }
108-
109- ASSERT_TRUE (OpenPlaygroundHere (canvas.EndRecordingAsPicture ()));
110- }
111-
112- TEST_P (AiksTest, TransformMultipliesCorrectly) {
113- Canvas canvas;
114- ASSERT_MATRIX_NEAR (canvas.GetCurrentTransform (), Matrix ());
115-
116- // clang-format off
117- canvas.Translate (Vector3 (100 , 200 ));
118- ASSERT_MATRIX_NEAR (
119- canvas.GetCurrentTransform (),
120- Matrix ( 1 , 0 , 0 , 0 ,
121- 0 , 1 , 0 , 0 ,
122- 0 , 0 , 1 , 0 ,
123- 100 , 200 , 0 , 1 ));
124-
125- canvas.Rotate (Radians (kPiOver2 ));
126- ASSERT_MATRIX_NEAR (
127- canvas.GetCurrentTransform (),
128- Matrix ( 0 , 1 , 0 , 0 ,
129- -1 , 0 , 0 , 0 ,
130- 0 , 0 , 1 , 0 ,
131- 100 , 200 , 0 , 1 ));
132-
133- canvas.Scale (Vector3 (2 , 3 ));
134- ASSERT_MATRIX_NEAR (
135- canvas.GetCurrentTransform (),
136- Matrix ( 0 , 2 , 0 , 0 ,
137- -3 , 0 , 0 , 0 ,
138- 0 , 0 , 0 , 0 ,
139- 100 , 200 , 0 , 1 ));
140-
141- canvas.Translate (Vector3 (100 , 200 ));
142- ASSERT_MATRIX_NEAR (
143- canvas.GetCurrentTransform (),
144- Matrix ( 0 , 2 , 0 , 0 ,
145- -3 , 0 , 0 , 0 ,
146- 0 , 0 , 0 , 0 ,
147- -500 , 400 , 0 , 1 ));
148- // clang-format on
149- }
150-
15142#if IMPELLER_ENABLE_3D
15243TEST_P (AiksTest, SceneColorSource) {
15344 // Load up the scene.
@@ -495,6 +386,5 @@ TEST_P(AiksTest, CorrectClipDepthAssignedToEntities) {
495386// █
496387// █ Subdivisions:
497388// █ - aiks_blend_unittests.cc
498- // █ - aiks_blur_unittests.cc
499389// █ - aiks_gradient_unittests.cc
500390// █████████████████████████████████████████████████████████████████████████████
0 commit comments