@@ -308,6 +308,50 @@ public function it_can_generate_svg_with_custom_font_family()
308
308
$ this ->assertEquals ($ expected , $ svg );
309
309
}
310
310
311
+ /**
312
+ * @test
313
+ */
314
+ public function it_can_use_the_foreground_color_for_the_svg_border ()
315
+ {
316
+ $ expected = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"> ' ;
317
+ $ expected .= '<circle cx="50" cy="50" r="45" stroke="green" stroke-width="10" fill="red" /> ' ;
318
+ $ expected .= '<text x="50" y="50" font-size="24" fill="green" alignment-baseline="middle" text-anchor="middle" dominant-baseline="central">AB</text> ' ;
319
+ $ expected .= '</svg> ' ;
320
+
321
+ $ avatar = new \Laravolt \Avatar \Avatar (['border ' => ['size ' => 10 , 'color ' => 'foreground ' ]]);
322
+ $ svg = $ avatar ->create ('Andi Budiman ' )
323
+ ->setShape ('circle ' )
324
+ ->setFontSize (24 )
325
+ ->setDimension (100 , 100 )
326
+ ->setForeground ('green ' )
327
+ ->setBackground ('red ' )
328
+ ->toSvg ();
329
+
330
+ $ this ->assertEquals ($ expected , $ svg );
331
+ }
332
+
333
+ /**
334
+ * @test
335
+ */
336
+ public function it_can_use_the_background_color_for_the_svg_border ()
337
+ {
338
+ $ expected = '<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"> ' ;
339
+ $ expected .= '<circle cx="50" cy="50" r="45" stroke="red" stroke-width="10" fill="red" /> ' ;
340
+ $ expected .= '<text x="50" y="50" font-size="24" fill="green" alignment-baseline="middle" text-anchor="middle" dominant-baseline="central">AB</text> ' ;
341
+ $ expected .= '</svg> ' ;
342
+
343
+ $ avatar = new \Laravolt \Avatar \Avatar (['border ' => ['size ' => 10 , 'color ' => 'background ' ]]);
344
+ $ svg = $ avatar ->create ('Andi Budiman ' )
345
+ ->setShape ('circle ' )
346
+ ->setFontSize (24 )
347
+ ->setDimension (100 , 100 )
348
+ ->setForeground ('green ' )
349
+ ->setBackground ('red ' )
350
+ ->toSvg ();
351
+
352
+ $ this ->assertEquals ($ expected , $ svg );
353
+ }
354
+
311
355
/**
312
356
* @test
313
357
*/
0 commit comments