diff --git a/martin/src/sprites/mod.rs b/martin/src/sprites/mod.rs index e78fb0902..5d96f13b7 100644 --- a/martin/src/sprites/mod.rs +++ b/martin/src/sprites/mod.rs @@ -255,7 +255,7 @@ mod tests { //.sdf => generate sdf from png, add sdf == true //- => does not generate sdf, omits sdf == true - for extension in [".sdf", ""] { + for extension in ["_sdf", ""] { test_src(sprites.values(), 1, "all_1", extension).await; test_src(sprites.values(), 2, "all_2", extension).await; @@ -276,7 +276,7 @@ mod tests { let path = PathBuf::from(format!( "../tests/fixtures/sprites/expected/{filename}{extension}" )); - let sprites = get_spritesheet(sources, pixel_ratio, extension == ".sdf") + let sprites = get_spritesheet(sources, pixel_ratio, extension == "_sdf") .await .unwrap(); let mut json = serde_json::to_string_pretty(sprites.get_index()).unwrap(); diff --git a/tests/fixtures/sprites/expected/all_1_sdf.json b/tests/fixtures/sprites/expected/all_1_sdf.json new file mode 100644 index 000000000..1ca1cd595 --- /dev/null +++ b/tests/fixtures/sprites/expected/all_1_sdf.json @@ -0,0 +1,34 @@ +{ + "another_bicycle": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 20, + "y": 16, + "sdf": true + }, + "bear": { + "height": 16, + "pixelRatio": 1, + "width": 16, + "x": 20, + "y": 0, + "sdf": true + }, + "bicycle": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 35, + "y": 16, + "sdf": true + }, + "sub/circle": { + "height": 20, + "pixelRatio": 1, + "width": 20, + "x": 0, + "y": 0, + "sdf": true + } +} diff --git a/tests/fixtures/sprites/expected/all_1_sdf.png b/tests/fixtures/sprites/expected/all_1_sdf.png new file mode 100644 index 000000000..ffb354692 Binary files /dev/null and b/tests/fixtures/sprites/expected/all_1_sdf.png differ diff --git a/tests/fixtures/sprites/expected/all_2_sdf.json b/tests/fixtures/sprites/expected/all_2_sdf.json new file mode 100644 index 000000000..5d1fb2e53 --- /dev/null +++ b/tests/fixtures/sprites/expected/all_2_sdf.json @@ -0,0 +1,34 @@ +{ + "another_bicycle": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 40, + "y": 32, + "sdf": true + }, + "bear": { + "height": 32, + "pixelRatio": 2, + "width": 32, + "x": 40, + "y": 0, + "sdf": true + }, + "bicycle": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 70, + "y": 32, + "sdf": true + }, + "sub/circle": { + "height": 40, + "pixelRatio": 2, + "width": 40, + "x": 0, + "y": 0, + "sdf": true + } +} diff --git a/tests/fixtures/sprites/expected/all_2_sdf.png b/tests/fixtures/sprites/expected/all_2_sdf.png new file mode 100644 index 000000000..e1ce6514b Binary files /dev/null and b/tests/fixtures/sprites/expected/all_2_sdf.png differ diff --git a/tests/fixtures/sprites/expected/src1_1_sdf.json b/tests/fixtures/sprites/expected/src1_1_sdf.json new file mode 100644 index 000000000..05675714b --- /dev/null +++ b/tests/fixtures/sprites/expected/src1_1_sdf.json @@ -0,0 +1,26 @@ +{ + "another_bicycle": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 20, + "y": 16, + "sdf": true + }, + "bear": { + "height": 16, + "pixelRatio": 1, + "width": 16, + "x": 20, + "y": 0, + "sdf": true + }, + "sub/circle": { + "height": 20, + "pixelRatio": 1, + "width": 20, + "x": 0, + "y": 0, + "sdf": true + } +} diff --git a/tests/fixtures/sprites/expected/src1_1_sdf.png b/tests/fixtures/sprites/expected/src1_1_sdf.png new file mode 100644 index 000000000..b3c301e82 Binary files /dev/null and b/tests/fixtures/sprites/expected/src1_1_sdf.png differ diff --git a/tests/fixtures/sprites/expected/src1_2_sdf.json b/tests/fixtures/sprites/expected/src1_2_sdf.json new file mode 100644 index 000000000..1430954ff --- /dev/null +++ b/tests/fixtures/sprites/expected/src1_2_sdf.json @@ -0,0 +1,26 @@ +{ + "another_bicycle": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 40, + "y": 32, + "sdf": true + }, + "bear": { + "height": 32, + "pixelRatio": 2, + "width": 32, + "x": 40, + "y": 0, + "sdf": true + }, + "sub/circle": { + "height": 40, + "pixelRatio": 2, + "width": 40, + "x": 0, + "y": 0, + "sdf": true + } +} diff --git a/tests/fixtures/sprites/expected/src1_2_sdf.png b/tests/fixtures/sprites/expected/src1_2_sdf.png new file mode 100644 index 000000000..c291da958 Binary files /dev/null and b/tests/fixtures/sprites/expected/src1_2_sdf.png differ diff --git a/tests/fixtures/sprites/expected/src2_1_sdf.json b/tests/fixtures/sprites/expected/src2_1_sdf.json new file mode 100644 index 000000000..a7f71e2be --- /dev/null +++ b/tests/fixtures/sprites/expected/src2_1_sdf.json @@ -0,0 +1,10 @@ +{ + "bicycle": { + "height": 15, + "pixelRatio": 1, + "width": 15, + "x": 0, + "y": 0, + "sdf": true + } +} diff --git a/tests/fixtures/sprites/expected/src2_1_sdf.png b/tests/fixtures/sprites/expected/src2_1_sdf.png new file mode 100644 index 000000000..db2640780 Binary files /dev/null and b/tests/fixtures/sprites/expected/src2_1_sdf.png differ diff --git a/tests/fixtures/sprites/expected/src2_2_sdf.json b/tests/fixtures/sprites/expected/src2_2_sdf.json new file mode 100644 index 000000000..8cd9eaa1a --- /dev/null +++ b/tests/fixtures/sprites/expected/src2_2_sdf.json @@ -0,0 +1,10 @@ +{ + "bicycle": { + "height": 30, + "pixelRatio": 2, + "width": 30, + "x": 0, + "y": 0, + "sdf": true + } +} diff --git a/tests/fixtures/sprites/expected/src2_2_sdf.png b/tests/fixtures/sprites/expected/src2_2_sdf.png new file mode 100644 index 000000000..7c947fd36 Binary files /dev/null and b/tests/fixtures/sprites/expected/src2_2_sdf.png differ