@@ -224,7 +224,7 @@ mod passing {
224
224
)
225
225
) ;
226
226
227
- // STDOUT should contain HTML with date URL for background-image in it
227
+ // STDOUT should contain HTML with one symbol extracted from SVG file
228
228
assert_eq ! (
229
229
String :: from_utf8_lossy( & out. stdout) ,
230
230
"<html><head></head><body>\n <button class=\" tm-votes-lever__button\" data-test-id=\" votes-lever-upvote-button\" title=\" Like\" type=\" button\" >\n <svg class=\" tm-svg-img tm-votes-lever__icon\" height=\" 24\" width=\" 24\" >\n <title>Like</title>\n <use xlink:href=\" #icon-1\" ><symbol id=\" icon-1\" >\n <path fill-rule=\" evenodd\" clip-rule=\" evenodd\" d=\" M10 20h4V10h3l-5-6.5L7 10h3v10Z\" ></path>\n </symbol></use>\n </svg>\n </button>\n \n \n </body></html>\n "
@@ -234,6 +234,37 @@ mod passing {
234
234
out. assert ( ) . code ( 0 ) ;
235
235
}
236
236
237
+ #[ test]
238
+ fn embed_svg_local_asset_via_image ( ) {
239
+ let mut cmd = Command :: cargo_bin ( env ! ( "CARGO_PKG_NAME" ) ) . unwrap ( ) ;
240
+ let path_html: & Path = Path :: new ( "tests/_data_/svg/image.html" ) ;
241
+ let path_svg: & Path = Path :: new ( "tests/_data_/svg/image.svg" ) ;
242
+
243
+ let out = cmd. arg ( "-M" ) . arg ( path_html. as_os_str ( ) ) . output ( ) . unwrap ( ) ;
244
+
245
+ // STDERR should list files that got retrieved
246
+ assert_eq ! (
247
+ String :: from_utf8_lossy( & out. stderr) ,
248
+ format!(
249
+ "\
250
+ {file_url_html}\n \
251
+ {file_url_svg}\n \
252
+ ",
253
+ file_url_html = Url :: from_file_path( fs:: canonicalize( path_html) . unwrap( ) ) . unwrap( ) ,
254
+ file_url_svg = Url :: from_file_path( fs:: canonicalize( path_svg) . unwrap( ) ) . unwrap( ) ,
255
+ )
256
+ ) ;
257
+
258
+ // STDOUT should contain HTML with data URL of SVG file
259
+ assert_eq ! (
260
+ String :: from_utf8_lossy( & out. stdout) ,
261
+ "<html><head></head><body>\n <svg height=\" 24\" width=\" 24\" >\n <image href=\" data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGJhc2VQcm9maWxlPSJmdWxsIiB3aWR0aD0iMzAwIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbGw9InJlZCIgLz4KICAgIDxjaXJjbGUgY3g9IjE1MCIgY3k9IjEwMCIgcj0iODAiIGZpbGw9ImdyZWVuIiAvPgogICAgPHRleHQgeD0iMTUwIiB5PSIxMjUiIGZvbnQtc2l6ZT0iNjAiIHRleHQtYW5jaG9yPSJtaWRkbGUiIGZpbGw9IndoaXRlIj5TVkc8L3RleHQ+Cjwvc3ZnPgo=\" width=\" 24\" height=\" 24\" >\n </image></svg>\n \n \n </body></html>\n "
262
+ ) ;
263
+
264
+ // Exit code should be 0
265
+ out. assert ( ) . code ( 0 ) ;
266
+ }
267
+
237
268
#[ test]
238
269
fn discard_integrity_for_local_files ( ) {
239
270
let mut cmd = Command :: cargo_bin ( env ! ( "CARGO_PKG_NAME" ) ) . unwrap ( ) ;
0 commit comments