Skip to content

Commit

Permalink
Merge pull request #52 from ssssota/dependabot/cargo/resvg-0.22.0
Browse files Browse the repository at this point in the history
Update resvg requirement from 0.20.0 to 0.22.0
  • Loading branch information
ssssota committed Apr 23, 2022
2 parents e51ef8d + a0b2e30 commit de7ca5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ crate-type = ["cdylib", "rlib"]
default = ["console_error_panic_hook"]

[dependencies]
resvg = { version = "0.20.0", default-features = false, features = ["filter"] }
usvg = { version = "0.20.0", default-features = false, features = [ "filter", "text"] }
resvg = { version = "0.22.0", default-features = false, features = ["filter"] }
usvg = { version = "0.22.0", default-features = false, features = [ "filter", "text"] }
svgtypes = "0.8.0"

tiny-skia = "0.6.1"
Expand Down
1 change: 1 addition & 0 deletions src/converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ impl Converter {
)
.ok_or_else(|| JsValue::from_str("Invalid width or height"))?,
fontdb: &fontdb,
image_href_resolver: &usvg::ImageHrefResolver::default(),
};
let scale = scale.unwrap_or(1.0);
let tree =
Expand Down
12 changes: 8 additions & 4 deletions test/node/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ describe('svg2png', () => {
);
});

it('should throw because invalid svg (missing width and height)', async () => {
await expect(
svg2png('<svg xmlns="http://www.w3.org/2000/svg"></svg>'),
).rejects.toThrow('Invalid width or height');
it('should convert with default sizes', async () => {
const actual = await svg2png(
'<svg xmlns="http://www.w3.org/2000/svg"></svg>',
);
const expected = await svg2png(
'<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"></svg>',
);
expect(actual).toStrictEqual(expected);
});

it('should convert because specify width and height', async () => {
Expand Down

0 comments on commit de7ca5b

Please sign in to comment.