10
10
11
11
namespace Cloudinary \Test \Unit \Transformation \Image ;
12
12
13
+ use Cloudinary \Asset \Image ;
14
+ use Cloudinary \Test \Unit \Asset \AssetTestCase ;
13
15
use Cloudinary \Transformation \Argument \Text \FontAntialias ;
14
16
use Cloudinary \Transformation \Argument \Text \FontFamily ;
15
17
use Cloudinary \Transformation \Argument \Text \FontWeight ;
16
- use Cloudinary \Transformation \Argument \Text \Stroke ;
17
18
use Cloudinary \Transformation \Argument \Text \TextAlignment ;
18
19
use Cloudinary \Transformation \Argument \Text \TextDecoration ;
20
+ use Cloudinary \Transformation \Expression \Expression ;
21
+ use Cloudinary \Transformation \ImageSource ;
19
22
use Cloudinary \Transformation \TextStyle ;
20
- use PHPUnit \ Framework \ TestCase ;
23
+ use Cloudinary \ Transformation \ Transformation ;
21
24
22
25
/**
23
26
* Class TextStyleTest
24
27
*/
25
- final class TextStyleTest extends TestCase
28
+ final class TextStyleTest extends AssetTestCase
26
29
{
27
30
public function testTextStyle ()
28
31
{
@@ -42,4 +45,35 @@ public function testTextStyle()
42
45
->stroke ()
43
46
);
44
47
}
48
+
49
+ public function testTextLayerStyleIdentifierVariables ()
50
+ {
51
+ $ image = new Image (self ::IMAGE_NAME );
52
+ $ image ->addTransformation (
53
+ (new Transformation ())
54
+ ->addVariable ('$style ' , '!Arial_12! ' )
55
+ ->overlay (
56
+ ImageSource::text ('hello-world ' )->textStyle ('$style ' )
57
+ )
58
+ );
59
+
60
+ self ::assertImageUrl (
61
+ '$style_!Arial_12!/l_text:$style:hello-world/fl_layer_apply/ ' . self ::IMAGE_NAME ,
62
+ $ image ->toUrl ()
63
+ );
64
+
65
+ $ image = new Image (self ::IMAGE_NAME );
66
+ $ image ->addTransformation (
67
+ (new Transformation ())
68
+ ->addVariable ('$style ' , '!Arial_12! ' )
69
+ ->overlay (
70
+ ImageSource::text ('hello-world ' )->textStyle (new Expression ('$style ' ))
71
+ )
72
+ );
73
+
74
+ self ::assertImageUrl (
75
+ '$style_!Arial_12!/l_text:$style:hello-world/fl_layer_apply/ ' . self ::IMAGE_NAME ,
76
+ $ image ->toUrl ()
77
+ );
78
+ }
45
79
}
0 commit comments