|
2 | 2 | // Use of this source code is governed by a BSD-style license that can be
|
3 | 3 | // found in the LICENSE file.
|
4 | 4 |
|
| 5 | +#include <array> |
5 | 6 | #include "flutter/testing/testing.h"
|
6 | 7 | #include "impeller/aiks/aiks_playground.h"
|
7 | 8 | #include "impeller/aiks/canvas.h"
|
@@ -122,6 +123,26 @@ TEST_F(AiksTest, CanRenderNestedClips) {
|
122 | 123 | ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
123 | 124 | }
|
124 | 125 |
|
| 126 | +TEST_F(AiksTest, ClipsUseCurrentTransform) { |
| 127 | + std::array<Color, 5> colors = {Color::White(), Color::Black(), |
| 128 | + Color::SkyBlue(), Color::Red(), |
| 129 | + Color::Yellow()}; |
| 130 | + Canvas canvas; |
| 131 | + Paint paint; |
| 132 | + |
| 133 | + canvas.Translate(Vector3(300, 300)); |
| 134 | + for (int i = 0; i < 15; i++) { |
| 135 | + canvas.Translate(-Vector3(300, 300)); |
| 136 | + canvas.Scale(Vector3(0.8, 0.8)); |
| 137 | + canvas.Translate(Vector3(300, 300)); |
| 138 | + |
| 139 | + paint.color = colors[i % colors.size()]; |
| 140 | + canvas.ClipPath(PathBuilder{}.AddCircle({0, 0}, 300).TakePath()); |
| 141 | + canvas.DrawRect(Rect(-300, -300, 600, 600), paint); |
| 142 | + } |
| 143 | + ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); |
| 144 | +} |
| 145 | + |
125 | 146 | TEST_F(AiksTest, CanSaveLayerStandalone) {
|
126 | 147 | Canvas canvas;
|
127 | 148 |
|
|
0 commit comments