diff --git a/test/fixtures/resources/versatiles-sprite/sprite.json b/test/fixtures/resources/versatiles-sprite/sprite.json new file mode 100644 index 00000000000..031001d5657 --- /dev/null +++ b/test/fixtures/resources/versatiles-sprite/sprite.json @@ -0,0 +1,114 @@ +{ + "icon-airfield": {"width":32,"height":32,"x":0,"y":0,"pixelRatio":1,"sdf":true}, + "icon-airport": {"width":32,"height":32,"x":32,"y":0,"pixelRatio":1,"sdf":true}, + "icon-alcohol_shop": {"width":32,"height":32,"x":0,"y":32,"pixelRatio":1,"sdf":true}, + "icon-art_gallery": {"width":32,"height":32,"x":32,"y":32,"pixelRatio":1,"sdf":true}, + "icon-artwork": {"width":32,"height":32,"x":64,"y":0,"pixelRatio":1,"sdf":true}, + "icon-atm": {"width":32,"height":32,"x":64,"y":32,"pixelRatio":1,"sdf":true}, + "icon-bakery": {"width":32,"height":32,"x":0,"y":64,"pixelRatio":1,"sdf":true}, + "icon-bank": {"width":32,"height":32,"x":32,"y":64,"pixelRatio":1,"sdf":true}, + "icon-bar": {"width":32,"height":32,"x":64,"y":64,"pixelRatio":1,"sdf":true}, + "icon-beauty": {"width":32,"height":32,"x":96,"y":0,"pixelRatio":1,"sdf":true}, + "icon-beer": {"width":32,"height":32,"x":96,"y":32,"pixelRatio":1,"sdf":true}, + "icon-beergarden": {"width":32,"height":32,"x":96,"y":64,"pixelRatio":1,"sdf":true}, + "icon-bench": {"width":32,"height":32,"x":0,"y":96,"pixelRatio":1,"sdf":true}, + "icon-beverages": {"width":32,"height":32,"x":32,"y":96,"pixelRatio":1,"sdf":true}, + "icon-bicycle_share": {"width":32,"height":32,"x":64,"y":96,"pixelRatio":1,"sdf":true}, + "icon-books": {"width":32,"height":32,"x":96,"y":96,"pixelRatio":1,"sdf":true}, + "icon-bus": {"width":32,"height":32,"x":128,"y":0,"pixelRatio":1,"sdf":true}, + "icon-butcher": {"width":32,"height":32,"x":128,"y":32,"pixelRatio":1,"sdf":true}, + "icon-cafe": {"width":32,"height":32,"x":128,"y":64,"pixelRatio":1,"sdf":true}, + "icon-car_rental": {"width":32,"height":32,"x":128,"y":96,"pixelRatio":1,"sdf":true}, + "icon-car_wash": {"width":32,"height":32,"x":0,"y":128,"pixelRatio":1,"sdf":true}, + "icon-castle": {"width":32,"height":32,"x":32,"y":128,"pixelRatio":1,"sdf":true}, + "icon-cemetery": {"width":32,"height":32,"x":64,"y":128,"pixelRatio":1,"sdf":true}, + "icon-chalet": {"width":32,"height":32,"x":96,"y":128,"pixelRatio":1,"sdf":true}, + "icon-chemist": {"width":32,"height":32,"x":128,"y":128,"pixelRatio":1,"sdf":true}, + "icon-cinema": {"width":32,"height":32,"x":160,"y":0,"pixelRatio":1,"sdf":true}, + "icon-clothes": {"width":32,"height":32,"x":160,"y":32,"pixelRatio":1,"sdf":true}, + "icon-college": {"width":32,"height":32,"x":160,"y":64,"pixelRatio":1,"sdf":true}, + "icon-community": {"width":32,"height":32,"x":160,"y":96,"pixelRatio":1,"sdf":true}, + "icon-defibrillator": {"width":32,"height":32,"x":160,"y":128,"pixelRatio":1,"sdf":true}, + "icon-dentist": {"width":32,"height":32,"x":0,"y":160,"pixelRatio":1,"sdf":true}, + "icon-doctor": {"width":32,"height":32,"x":32,"y":160,"pixelRatio":1,"sdf":true}, + "icon-dog_park": {"width":32,"height":32,"x":64,"y":160,"pixelRatio":1,"sdf":true}, + "icon-doityourself": {"width":32,"height":32,"x":96,"y":160,"pixelRatio":1,"sdf":true}, + "icon-drinking_water": {"width":32,"height":32,"x":128,"y":160,"pixelRatio":1,"sdf":true}, + "icon-drycleaning": {"width":32,"height":32,"x":160,"y":160,"pixelRatio":1,"sdf":true}, + "icon-embassy": {"width":32,"height":32,"x":192,"y":0,"pixelRatio":1,"sdf":true}, + "icon-emergency_phone": {"width":32,"height":32,"x":192,"y":32,"pixelRatio":1,"sdf":true}, + "icon-fast_food": {"width":32,"height":32,"x":192,"y":64,"pixelRatio":1,"sdf":true}, + "icon-fire_station": {"width":32,"height":32,"x":192,"y":96,"pixelRatio":1,"sdf":true}, + "icon-florist": {"width":32,"height":32,"x":192,"y":128,"pixelRatio":1,"sdf":true}, + "icon-fountain": {"width":32,"height":32,"x":192,"y":160,"pixelRatio":1,"sdf":true}, + "icon-furniture": {"width":32,"height":32,"x":0,"y":192,"pixelRatio":1,"sdf":true}, + "icon-garden_centre": {"width":32,"height":32,"x":32,"y":192,"pixelRatio":1,"sdf":true}, + "icon-gift": {"width":32,"height":32,"x":64,"y":192,"pixelRatio":1,"sdf":true}, + "icon-golf": {"width":32,"height":32,"x":96,"y":192,"pixelRatio":1,"sdf":true}, + "icon-greengrocer": {"width":32,"height":32,"x":128,"y":192,"pixelRatio":1,"sdf":true}, + "icon-hairdresser": {"width":32,"height":32,"x":160,"y":192,"pixelRatio":1,"sdf":true}, + "icon-hardware": {"width":32,"height":32,"x":192,"y":192,"pixelRatio":1,"sdf":true}, + "icon-historic": {"width":32,"height":32,"x":224,"y":0,"pixelRatio":1,"sdf":true}, + "icon-hospital": {"width":32,"height":32,"x":224,"y":32,"pixelRatio":1,"sdf":true}, + "icon-huntingstand": {"width":32,"height":32,"x":224,"y":64,"pixelRatio":1,"sdf":true}, + "icon-hydrant": {"width":32,"height":32,"x":224,"y":96,"pixelRatio":1,"sdf":true}, + "icon-icerink": {"width":32,"height":32,"x":224,"y":128,"pixelRatio":1,"sdf":true}, + "icon-jewelry_store": {"width":32,"height":32,"x":224,"y":160,"pixelRatio":1,"sdf":true}, + "icon-kiosk": {"width":32,"height":32,"x":224,"y":192,"pixelRatio":1,"sdf":true}, + "icon-laundry": {"width":32,"height":32,"x":0,"y":224,"pixelRatio":1,"sdf":true}, + "icon-library": {"width":32,"height":32,"x":32,"y":224,"pixelRatio":1,"sdf":true}, + "icon-lighthouse": {"width":32,"height":32,"x":64,"y":224,"pixelRatio":1,"sdf":true}, + "icon-marketplace": {"width":32,"height":32,"x":96,"y":224,"pixelRatio":1,"sdf":true}, + "icon-monument": {"width":32,"height":32,"x":128,"y":224,"pixelRatio":1,"sdf":true}, + "icon-newsagent": {"width":32,"height":32,"x":160,"y":224,"pixelRatio":1,"sdf":true}, + "icon-nightclub": {"width":32,"height":32,"x":192,"y":224,"pixelRatio":1,"sdf":true}, + "icon-nursinghome": {"width":32,"height":32,"x":224,"y":224,"pixelRatio":1,"sdf":true}, + "icon-observation_tower": {"width":32,"height":32,"x":256,"y":0,"pixelRatio":1,"sdf":true}, + "icon-optician": {"width":32,"height":32,"x":256,"y":32,"pixelRatio":1,"sdf":true}, + "icon-outdoor": {"width":32,"height":32,"x":256,"y":64,"pixelRatio":1,"sdf":true}, + "icon-pharmacy": {"width":32,"height":32,"x":256,"y":96,"pixelRatio":1,"sdf":true}, + "icon-picnic_site": {"width":32,"height":32,"x":256,"y":128,"pixelRatio":1,"sdf":true}, + "icon-pitch": {"width":32,"height":32,"x":256,"y":160,"pixelRatio":1,"sdf":true}, + "icon-place_of_worship": {"width":32,"height":32,"x":256,"y":192,"pixelRatio":1,"sdf":true}, + "icon-playground": {"width":32,"height":32,"x":256,"y":224,"pixelRatio":1,"sdf":true}, + "icon-police": {"width":32,"height":32,"x":0,"y":256,"pixelRatio":1,"sdf":true}, + "icon-postbox": {"width":32,"height":32,"x":32,"y":256,"pixelRatio":1,"sdf":true}, + "icon-post": {"width":32,"height":32,"x":64,"y":256,"pixelRatio":1,"sdf":true}, + "icon-prison": {"width":32,"height":32,"x":96,"y":256,"pixelRatio":1,"sdf":true}, + "icon-rail_light": {"width":32,"height":32,"x":128,"y":256,"pixelRatio":1,"sdf":true}, + "icon-rail_metro": {"width":32,"height":32,"x":160,"y":256,"pixelRatio":1,"sdf":true}, + "icon-rail": {"width":32,"height":32,"x":192,"y":256,"pixelRatio":1,"sdf":true}, + "icon-recycling": {"width":32,"height":32,"x":224,"y":256,"pixelRatio":1,"sdf":true}, + "icon-restaurant": {"width":32,"height":32,"x":256,"y":256,"pixelRatio":1,"sdf":true}, + "icon-school": {"width":32,"height":32,"x":288,"y":0,"pixelRatio":1,"sdf":true}, + "icon-shelter": {"width":32,"height":32,"x":288,"y":32,"pixelRatio":1,"sdf":true}, + "icon-shoes": {"width":32,"height":32,"x":288,"y":64,"pixelRatio":1,"sdf":true}, + "icon-shop": {"width":32,"height":32,"x":288,"y":96,"pixelRatio":1,"sdf":true}, + "icon-shrine": {"width":32,"height":32,"x":288,"y":128,"pixelRatio":1,"sdf":true}, + "icon-sports": {"width":32,"height":32,"x":288,"y":160,"pixelRatio":1,"sdf":true}, + "icon-stadium": {"width":32,"height":32,"x":288,"y":192,"pixelRatio":1,"sdf":true}, + "icon-stationery": {"width":32,"height":32,"x":288,"y":224,"pixelRatio":1,"sdf":true}, + "icon-surveillance": {"width":32,"height":32,"x":288,"y":256,"pixelRatio":1,"sdf":true}, + "icon-swimming": {"width":32,"height":32,"x":0,"y":288,"pixelRatio":1,"sdf":true}, + "icon-telephone": {"width":32,"height":32,"x":32,"y":288,"pixelRatio":1,"sdf":true}, + "icon-theatre": {"width":32,"height":32,"x":64,"y":288,"pixelRatio":1,"sdf":true}, + "icon-toilet": {"width":32,"height":32,"x":96,"y":288,"pixelRatio":1,"sdf":true}, + "icon-town_hall": {"width":32,"height":32,"x":128,"y":288,"pixelRatio":1,"sdf":true}, + "icon-toys": {"width":32,"height":32,"x":160,"y":288,"pixelRatio":1,"sdf":true}, + "icon-travel_agent": {"width":32,"height":32,"x":192,"y":288,"pixelRatio":1,"sdf":true}, + "icon-vendingmachine": {"width":32,"height":32,"x":224,"y":288,"pixelRatio":1,"sdf":true}, + "icon-veterinary": {"width":32,"height":32,"x":256,"y":288,"pixelRatio":1,"sdf":true}, + "icon-video": {"width":32,"height":32,"x":288,"y":288,"pixelRatio":1,"sdf":true}, + "icon-viewpoint": {"width":32,"height":32,"x":320,"y":0,"pixelRatio":1,"sdf":true}, + "icon-waste_basket": {"width":32,"height":32,"x":320,"y":32,"pixelRatio":1,"sdf":true}, + "icon-watermill": {"width":32,"height":32,"x":320,"y":64,"pixelRatio":1,"sdf":true}, + "icon-waterpark": {"width":32,"height":32,"x":320,"y":96,"pixelRatio":1,"sdf":true}, + "icon-windmill": {"width":32,"height":32,"x":320,"y":128,"pixelRatio":1,"sdf":true}, + "icon-zoo": {"width":32,"height":32,"x":320,"y":160,"pixelRatio":1,"sdf":true}, + "marking-arrow": {"width":14,"height":25,"x":352,"y":0,"pixelRatio":1,"sdf":true}, + "pattern-hatched_thin": {"width":22,"height":22,"x":320,"y":256,"pixelRatio":1,"sdf":true}, + "pattern-striped": {"width":22,"height":22,"x":320,"y":278,"pixelRatio":1,"sdf":true}, + "pattern-warning": {"width":22,"height":22,"x":0,"y":320,"pixelRatio":1,"sdf":true}, + "transport-tram": {"width":32,"height":32,"x":320,"y":192,"pixelRatio":1,"sdf":true}, + "transport-information": {"width":32,"height":32,"x":320,"y":224,"pixelRatio":1,"sdf":true} +} \ No newline at end of file diff --git a/test/fixtures/resources/versatiles-sprite/sprite.png b/test/fixtures/resources/versatiles-sprite/sprite.png new file mode 100644 index 00000000000..c1f7aca816e Binary files /dev/null and b/test/fixtures/resources/versatiles-sprite/sprite.png differ diff --git a/test/fixtures/resources/versatiles-sprite/sprite@2x.json b/test/fixtures/resources/versatiles-sprite/sprite@2x.json new file mode 100644 index 00000000000..b3f3e0373a3 --- /dev/null +++ b/test/fixtures/resources/versatiles-sprite/sprite@2x.json @@ -0,0 +1,114 @@ +{ + "icon-airfield": {"width":64,"height":64,"x":0,"y":0,"pixelRatio":2,"sdf":true}, + "icon-airport": {"width":64,"height":64,"x":64,"y":0,"pixelRatio":2,"sdf":true}, + "icon-alcohol_shop": {"width":64,"height":64,"x":0,"y":64,"pixelRatio":2,"sdf":true}, + "icon-art_gallery": {"width":64,"height":64,"x":64,"y":64,"pixelRatio":2,"sdf":true}, + "icon-artwork": {"width":64,"height":64,"x":128,"y":0,"pixelRatio":2,"sdf":true}, + "icon-atm": {"width":64,"height":64,"x":128,"y":64,"pixelRatio":2,"sdf":true}, + "icon-bakery": {"width":64,"height":64,"x":0,"y":128,"pixelRatio":2,"sdf":true}, + "icon-bank": {"width":64,"height":64,"x":64,"y":128,"pixelRatio":2,"sdf":true}, + "icon-bar": {"width":64,"height":64,"x":128,"y":128,"pixelRatio":2,"sdf":true}, + "icon-beauty": {"width":64,"height":64,"x":192,"y":0,"pixelRatio":2,"sdf":true}, + "icon-beer": {"width":64,"height":64,"x":192,"y":64,"pixelRatio":2,"sdf":true}, + "icon-beergarden": {"width":64,"height":64,"x":192,"y":128,"pixelRatio":2,"sdf":true}, + "icon-bench": {"width":64,"height":64,"x":0,"y":192,"pixelRatio":2,"sdf":true}, + "icon-beverages": {"width":64,"height":64,"x":64,"y":192,"pixelRatio":2,"sdf":true}, + "icon-bicycle_share": {"width":64,"height":64,"x":128,"y":192,"pixelRatio":2,"sdf":true}, + "icon-books": {"width":64,"height":64,"x":192,"y":192,"pixelRatio":2,"sdf":true}, + "icon-bus": {"width":64,"height":64,"x":256,"y":0,"pixelRatio":2,"sdf":true}, + "icon-butcher": {"width":64,"height":64,"x":256,"y":64,"pixelRatio":2,"sdf":true}, + "icon-cafe": {"width":64,"height":64,"x":256,"y":128,"pixelRatio":2,"sdf":true}, + "icon-car_rental": {"width":64,"height":64,"x":256,"y":192,"pixelRatio":2,"sdf":true}, + "icon-car_wash": {"width":64,"height":64,"x":0,"y":256,"pixelRatio":2,"sdf":true}, + "icon-castle": {"width":64,"height":64,"x":64,"y":256,"pixelRatio":2,"sdf":true}, + "icon-cemetery": {"width":64,"height":64,"x":128,"y":256,"pixelRatio":2,"sdf":true}, + "icon-chalet": {"width":64,"height":64,"x":192,"y":256,"pixelRatio":2,"sdf":true}, + "icon-chemist": {"width":64,"height":64,"x":256,"y":256,"pixelRatio":2,"sdf":true}, + "icon-cinema": {"width":64,"height":64,"x":320,"y":0,"pixelRatio":2,"sdf":true}, + "icon-clothes": {"width":64,"height":64,"x":320,"y":64,"pixelRatio":2,"sdf":true}, + "icon-college": {"width":64,"height":64,"x":320,"y":128,"pixelRatio":2,"sdf":true}, + "icon-community": {"width":64,"height":64,"x":320,"y":192,"pixelRatio":2,"sdf":true}, + "icon-defibrillator": {"width":64,"height":64,"x":320,"y":256,"pixelRatio":2,"sdf":true}, + "icon-dentist": {"width":64,"height":64,"x":0,"y":320,"pixelRatio":2,"sdf":true}, + "icon-doctor": {"width":64,"height":64,"x":64,"y":320,"pixelRatio":2,"sdf":true}, + "icon-dog_park": {"width":64,"height":64,"x":128,"y":320,"pixelRatio":2,"sdf":true}, + "icon-doityourself": {"width":64,"height":64,"x":192,"y":320,"pixelRatio":2,"sdf":true}, + "icon-drinking_water": {"width":64,"height":64,"x":256,"y":320,"pixelRatio":2,"sdf":true}, + "icon-drycleaning": {"width":64,"height":64,"x":320,"y":320,"pixelRatio":2,"sdf":true}, + "icon-embassy": {"width":64,"height":64,"x":384,"y":0,"pixelRatio":2,"sdf":true}, + "icon-emergency_phone": {"width":64,"height":64,"x":384,"y":64,"pixelRatio":2,"sdf":true}, + "icon-fast_food": {"width":64,"height":64,"x":384,"y":128,"pixelRatio":2,"sdf":true}, + "icon-fire_station": {"width":64,"height":64,"x":384,"y":192,"pixelRatio":2,"sdf":true}, + "icon-florist": {"width":64,"height":64,"x":384,"y":256,"pixelRatio":2,"sdf":true}, + "icon-fountain": {"width":64,"height":64,"x":384,"y":320,"pixelRatio":2,"sdf":true}, + "icon-furniture": {"width":64,"height":64,"x":0,"y":384,"pixelRatio":2,"sdf":true}, + "icon-garden_centre": {"width":64,"height":64,"x":64,"y":384,"pixelRatio":2,"sdf":true}, + "icon-gift": {"width":64,"height":64,"x":128,"y":384,"pixelRatio":2,"sdf":true}, + "icon-golf": {"width":64,"height":64,"x":192,"y":384,"pixelRatio":2,"sdf":true}, + "icon-greengrocer": {"width":64,"height":64,"x":256,"y":384,"pixelRatio":2,"sdf":true}, + "icon-hairdresser": {"width":64,"height":64,"x":320,"y":384,"pixelRatio":2,"sdf":true}, + "icon-hardware": {"width":64,"height":64,"x":384,"y":384,"pixelRatio":2,"sdf":true}, + "icon-historic": {"width":64,"height":64,"x":448,"y":0,"pixelRatio":2,"sdf":true}, + "icon-hospital": {"width":64,"height":64,"x":448,"y":64,"pixelRatio":2,"sdf":true}, + "icon-huntingstand": {"width":64,"height":64,"x":448,"y":128,"pixelRatio":2,"sdf":true}, + "icon-hydrant": {"width":64,"height":64,"x":448,"y":192,"pixelRatio":2,"sdf":true}, + "icon-icerink": {"width":64,"height":64,"x":448,"y":256,"pixelRatio":2,"sdf":true}, + "icon-jewelry_store": {"width":64,"height":64,"x":448,"y":320,"pixelRatio":2,"sdf":true}, + "icon-kiosk": {"width":64,"height":64,"x":448,"y":384,"pixelRatio":2,"sdf":true}, + "icon-laundry": {"width":64,"height":64,"x":0,"y":448,"pixelRatio":2,"sdf":true}, + "icon-library": {"width":64,"height":64,"x":64,"y":448,"pixelRatio":2,"sdf":true}, + "icon-lighthouse": {"width":64,"height":64,"x":128,"y":448,"pixelRatio":2,"sdf":true}, + "icon-marketplace": {"width":64,"height":64,"x":192,"y":448,"pixelRatio":2,"sdf":true}, + "icon-monument": {"width":64,"height":64,"x":256,"y":448,"pixelRatio":2,"sdf":true}, + "icon-newsagent": {"width":64,"height":64,"x":320,"y":448,"pixelRatio":2,"sdf":true}, + "icon-nightclub": {"width":64,"height":64,"x":384,"y":448,"pixelRatio":2,"sdf":true}, + "icon-nursinghome": {"width":64,"height":64,"x":448,"y":448,"pixelRatio":2,"sdf":true}, + "icon-observation_tower": {"width":64,"height":64,"x":512,"y":0,"pixelRatio":2,"sdf":true}, + "icon-optician": {"width":64,"height":64,"x":512,"y":64,"pixelRatio":2,"sdf":true}, + "icon-outdoor": {"width":64,"height":64,"x":512,"y":128,"pixelRatio":2,"sdf":true}, + "icon-pharmacy": {"width":64,"height":64,"x":512,"y":192,"pixelRatio":2,"sdf":true}, + "icon-picnic_site": {"width":64,"height":64,"x":512,"y":256,"pixelRatio":2,"sdf":true}, + "icon-pitch": {"width":64,"height":64,"x":512,"y":320,"pixelRatio":2,"sdf":true}, + "icon-place_of_worship": {"width":64,"height":64,"x":512,"y":384,"pixelRatio":2,"sdf":true}, + "icon-playground": {"width":64,"height":64,"x":512,"y":448,"pixelRatio":2,"sdf":true}, + "icon-police": {"width":64,"height":64,"x":0,"y":512,"pixelRatio":2,"sdf":true}, + "icon-postbox": {"width":64,"height":64,"x":64,"y":512,"pixelRatio":2,"sdf":true}, + "icon-post": {"width":64,"height":64,"x":128,"y":512,"pixelRatio":2,"sdf":true}, + "icon-prison": {"width":64,"height":64,"x":192,"y":512,"pixelRatio":2,"sdf":true}, + "icon-rail_light": {"width":64,"height":64,"x":256,"y":512,"pixelRatio":2,"sdf":true}, + "icon-rail_metro": {"width":64,"height":64,"x":320,"y":512,"pixelRatio":2,"sdf":true}, + "icon-rail": {"width":64,"height":64,"x":384,"y":512,"pixelRatio":2,"sdf":true}, + "icon-recycling": {"width":64,"height":64,"x":448,"y":512,"pixelRatio":2,"sdf":true}, + "icon-restaurant": {"width":64,"height":64,"x":512,"y":512,"pixelRatio":2,"sdf":true}, + "icon-school": {"width":64,"height":64,"x":576,"y":0,"pixelRatio":2,"sdf":true}, + "icon-shelter": {"width":64,"height":64,"x":576,"y":64,"pixelRatio":2,"sdf":true}, + "icon-shoes": {"width":64,"height":64,"x":576,"y":128,"pixelRatio":2,"sdf":true}, + "icon-shop": {"width":64,"height":64,"x":576,"y":192,"pixelRatio":2,"sdf":true}, + "icon-shrine": {"width":64,"height":64,"x":576,"y":256,"pixelRatio":2,"sdf":true}, + "icon-sports": {"width":64,"height":64,"x":576,"y":320,"pixelRatio":2,"sdf":true}, + "icon-stadium": {"width":64,"height":64,"x":576,"y":384,"pixelRatio":2,"sdf":true}, + "icon-stationery": {"width":64,"height":64,"x":576,"y":448,"pixelRatio":2,"sdf":true}, + "icon-surveillance": {"width":64,"height":64,"x":576,"y":512,"pixelRatio":2,"sdf":true}, + "icon-swimming": {"width":64,"height":64,"x":0,"y":576,"pixelRatio":2,"sdf":true}, + "icon-telephone": {"width":64,"height":64,"x":64,"y":576,"pixelRatio":2,"sdf":true}, + "icon-theatre": {"width":64,"height":64,"x":128,"y":576,"pixelRatio":2,"sdf":true}, + "icon-toilet": {"width":64,"height":64,"x":192,"y":576,"pixelRatio":2,"sdf":true}, + "icon-town_hall": {"width":64,"height":64,"x":256,"y":576,"pixelRatio":2,"sdf":true}, + "icon-toys": {"width":64,"height":64,"x":320,"y":576,"pixelRatio":2,"sdf":true}, + "icon-travel_agent": {"width":64,"height":64,"x":384,"y":576,"pixelRatio":2,"sdf":true}, + "icon-vendingmachine": {"width":64,"height":64,"x":448,"y":576,"pixelRatio":2,"sdf":true}, + "icon-veterinary": {"width":64,"height":64,"x":512,"y":576,"pixelRatio":2,"sdf":true}, + "icon-video": {"width":64,"height":64,"x":576,"y":576,"pixelRatio":2,"sdf":true}, + "icon-viewpoint": {"width":64,"height":64,"x":640,"y":0,"pixelRatio":2,"sdf":true}, + "icon-waste_basket": {"width":64,"height":64,"x":640,"y":64,"pixelRatio":2,"sdf":true}, + "icon-watermill": {"width":64,"height":64,"x":640,"y":128,"pixelRatio":2,"sdf":true}, + "icon-waterpark": {"width":64,"height":64,"x":640,"y":192,"pixelRatio":2,"sdf":true}, + "icon-windmill": {"width":64,"height":64,"x":640,"y":256,"pixelRatio":2,"sdf":true}, + "icon-zoo": {"width":64,"height":64,"x":640,"y":320,"pixelRatio":2,"sdf":true}, + "marking-arrow": {"width":28,"height":50,"x":704,"y":0,"pixelRatio":2,"sdf":true}, + "pattern-hatched_thin": {"width":44,"height":44,"x":640,"y":512,"pixelRatio":2,"sdf":true}, + "pattern-striped": {"width":44,"height":44,"x":640,"y":556,"pixelRatio":2,"sdf":true}, + "pattern-warning": {"width":44,"height":44,"x":0,"y":640,"pixelRatio":2,"sdf":true}, + "transport-tram": {"width":64,"height":64,"x":640,"y":384,"pixelRatio":2,"sdf":true}, + "transport-information": {"width":64,"height":64,"x":640,"y":448,"pixelRatio":2,"sdf":true} +} \ No newline at end of file diff --git a/test/fixtures/resources/versatiles-sprite/sprite@2x.png b/test/fixtures/resources/versatiles-sprite/sprite@2x.png new file mode 100644 index 00000000000..e7d449a05ec Binary files /dev/null and b/test/fixtures/resources/versatiles-sprite/sprite@2x.png differ diff --git a/test/sprite/sprite_loader.test.cpp b/test/sprite/sprite_loader.test.cpp index 0da618bb7ea..f0b4a9a227a 100644 --- a/test/sprite/sprite_loader.test.cpp +++ b/test/sprite/sprite_loader.test.cpp @@ -29,11 +29,13 @@ class StubSpriteLoaderObserver : public SpriteLoaderObserver { std::function spriteError; }; +std::string defaultSpritePath = "test/fixtures/resources/sprite"; + class SpriteLoaderTest { public: - SpriteLoaderTest() + SpriteLoaderTest(float pixelRatio = 1) : threadPool(Scheduler::GetBackground(), uniqueID), - spriteLoader(1, threadPool) {} + spriteLoader(pixelRatio, threadPool) {} ~SpriteLoaderTest() { threadPool.waitForEmpty(); @@ -46,6 +48,7 @@ class SpriteLoaderTest { StubSpriteLoaderObserver observer; TaggedScheduler threadPool; SpriteLoader spriteLoader; + std::string spritePath = defaultSpritePath; // default void run() { // Squelch logging. @@ -53,7 +56,7 @@ class SpriteLoaderTest { spriteLoader.setObserver(&observer); - Sprite sprite = Sprite("default", "test/fixtures/resources/sprite"); + Sprite sprite = Sprite("default", spritePath); spriteLoader.load(sprite, fileSource); loop.run(); @@ -62,18 +65,22 @@ class SpriteLoaderTest { void end() { loop.stop(); } }; -Response successfulSpriteImageResponse(const Resource& resource) { - EXPECT_EQ("test/fixtures/resources/sprite.png", resource.url); - Response response; - response.data = std::make_unique(util::read_file(resource.url)); - return response; +auto successfulSpriteImageResponse(const std::string& spritePath = defaultSpritePath, float pixelRatio = 1.0f) { + return [spritePath, pixelRatio](const Resource& resource) { + EXPECT_EQ(spritePath + (pixelRatio == 2.0 ? "@2x" : "") + ".png", resource.url); + Response response; + response.data = std::make_unique(util::read_file(resource.url)); + return response; + }; } -Response successfulSpriteJSONResponse(const Resource& resource) { - EXPECT_EQ("test/fixtures/resources/sprite.json", resource.url); - Response response; - response.data = std::make_unique(util::read_file(resource.url)); - return response; +auto successfulSpriteJSONResponse(const std::string& spritePath = defaultSpritePath, float pixelRatio = 1.0f) { + return [spritePath, pixelRatio](const Resource& resource) { + EXPECT_EQ(spritePath + (pixelRatio == 2.0 ? "@2x" : "") + ".json", resource.url); + Response response; + response.data = std::make_unique(util::read_file(resource.url)); + return response; + }; } Response failedSpriteResponse(const Resource&) { @@ -88,29 +95,43 @@ Response corruptSpriteResponse(const Resource&) { return response; } -TEST(SpriteLoader, LoadingSuccess) { - SpriteLoaderTest test; +class SpriteLoaderParametrized : public testing::TestWithParam> {}; + +TEST_P(SpriteLoaderParametrized, LoadingSuccess) { + const auto [spritePath, expectedImages_, pixelRatio_] = GetParam(); + const auto expectedImages = expectedImages_; // lambda cannot capture structured binding yet + const auto pixelRatio = pixelRatio_; - test.fileSource.spriteImageResponse = successfulSpriteImageResponse; - test.fileSource.spriteJSONResponse = successfulSpriteJSONResponse; + SpriteLoaderTest test{pixelRatio}; + test.spritePath = spritePath; + + test.fileSource.spriteImageResponse = successfulSpriteImageResponse(spritePath, pixelRatio); + test.fileSource.spriteJSONResponse = successfulSpriteJSONResponse(spritePath, pixelRatio); test.observer.spriteError = [&](std::exception_ptr error) { FAIL() << util::toString(error); test.end(); }; - test.observer.spriteLoaded = [&](std::vector> images) { - EXPECT_EQ(images.size(), 418u); + test.observer.spriteLoaded = [&, expectedImages](std::vector> images) { + EXPECT_EQ(images.size(), expectedImages); test.end(); }; test.run(); } +INSTANTIATE_TEST_SUITE_P( + SpriteLoaderSprites, + SpriteLoaderParametrized, + ::testing::Values(std::make_tuple("test/fixtures/resources/sprite", 418, 1.0f), + std::make_tuple("test/fixtures/resources/versatiles-sprite/sprite", 112, 1.0f), + std::make_tuple("test/fixtures/resources/versatiles-sprite/sprite", 112, 2.0f))); + TEST(SpriteLoader, JSONLoadingFail) { SpriteLoaderTest test; - test.fileSource.spriteImageResponse = successfulSpriteImageResponse; + test.fileSource.spriteImageResponse = successfulSpriteImageResponse(); test.fileSource.spriteJSONResponse = failedSpriteResponse; test.observer.spriteError = [&](std::exception_ptr error) { @@ -126,7 +147,7 @@ TEST(SpriteLoader, ImageLoadingFail) { SpriteLoaderTest test; test.fileSource.spriteImageResponse = failedSpriteResponse; - test.fileSource.spriteJSONResponse = successfulSpriteJSONResponse; + test.fileSource.spriteJSONResponse = successfulSpriteJSONResponse(); test.observer.spriteError = [&](std::exception_ptr error) { EXPECT_TRUE(error != nullptr); @@ -140,7 +161,7 @@ TEST(SpriteLoader, ImageLoadingFail) { TEST(SpriteLoader, JSONLoadingCorrupted) { SpriteLoaderTest test; - test.fileSource.spriteImageResponse = successfulSpriteImageResponse; + test.fileSource.spriteImageResponse = successfulSpriteImageResponse(); test.fileSource.spriteJSONResponse = corruptSpriteResponse; test.observer.spriteError = [&](std::exception_ptr error) { @@ -156,7 +177,7 @@ TEST(SpriteLoader, ImageLoadingCorrupted) { SpriteLoaderTest test; test.fileSource.spriteImageResponse = corruptSpriteResponse; - test.fileSource.spriteJSONResponse = successfulSpriteJSONResponse; + test.fileSource.spriteJSONResponse = successfulSpriteJSONResponse(); test.observer.spriteError = [&](std::exception_ptr error) { EXPECT_TRUE(error != nullptr);