diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/sprite_atlas/basic/expected.png | bin | 694 -> 673 bytes | |||
-rw-r--r-- | test/fixtures/sprite_atlas/size/expected.png | bin | 1118 -> 609 bytes | |||
-rw-r--r-- | test/fixtures/sprite_atlas/updates_after/expected.png | bin | 135 -> 118 bytes | |||
-rw-r--r-- | test/fixtures/sprite_atlas/updates_before/expected.png | bin | 110 -> 96 bytes | |||
-rw-r--r-- | test/sprite/sprite_atlas.test.cpp | 27 | ||||
-rw-r--r-- | test/style/source.test.cpp | 2 | ||||
-rw-r--r-- | test/text/quads.test.cpp | 4 | ||||
-rw-r--r-- | test/tile/annotation_tile.test.cpp | 2 | ||||
-rw-r--r-- | test/tile/geojson_tile.test.cpp | 2 | ||||
-rw-r--r-- | test/tile/raster_tile.test.cpp | 2 | ||||
-rw-r--r-- | test/tile/vector_tile.test.cpp | 2 |
11 files changed, 13 insertions, 28 deletions
diff --git a/test/fixtures/sprite_atlas/basic/expected.png b/test/fixtures/sprite_atlas/basic/expected.png Binary files differindex cd13d16df6..2960891c04 100644 --- a/test/fixtures/sprite_atlas/basic/expected.png +++ b/test/fixtures/sprite_atlas/basic/expected.png diff --git a/test/fixtures/sprite_atlas/size/expected.png b/test/fixtures/sprite_atlas/size/expected.png Binary files differindex d9ae7dab47..5b08197a82 100644 --- a/test/fixtures/sprite_atlas/size/expected.png +++ b/test/fixtures/sprite_atlas/size/expected.png diff --git a/test/fixtures/sprite_atlas/updates_after/expected.png b/test/fixtures/sprite_atlas/updates_after/expected.png Binary files differindex 3c850c0a25..626ceab58b 100644 --- a/test/fixtures/sprite_atlas/updates_after/expected.png +++ b/test/fixtures/sprite_atlas/updates_after/expected.png diff --git a/test/fixtures/sprite_atlas/updates_before/expected.png b/test/fixtures/sprite_atlas/updates_before/expected.png Binary files differindex effcd38f1e..0858c19f05 100644 --- a/test/fixtures/sprite_atlas/updates_before/expected.png +++ b/test/fixtures/sprite_atlas/updates_before/expected.png diff --git a/test/sprite/sprite_atlas.test.cpp b/test/sprite/sprite_atlas.test.cpp index c673c5ca0e..7a638a9ec5 100644 --- a/test/sprite/sprite_atlas.test.cpp +++ b/test/sprite/sprite_atlas.test.cpp @@ -18,7 +18,7 @@ using namespace mbgl; TEST(SpriteAtlas, Basic) { FixtureLog log; - SpriteAtlas atlas({ 63, 112 }, 1); + SpriteAtlas atlas; auto images = parseSprite(util::read_file("test/fixtures/annotations/emerald.png"), util::read_file("test/fixtures/annotations/emerald.json")); @@ -26,9 +26,6 @@ TEST(SpriteAtlas, Basic) { atlas.addImage(image->impl); } - EXPECT_EQ(63u, atlas.getPixelSize().width); - EXPECT_EQ(112u, atlas.getPixelSize().height); - auto metro = *atlas.getIcon("metro"); EXPECT_EQ(1, metro.tl()[0]); EXPECT_EQ(1, metro.tl()[1]); @@ -38,8 +35,7 @@ TEST(SpriteAtlas, Basic) { EXPECT_EQ(18, metro.displaySize()[1]); EXPECT_EQ(1.0f, metro.pixelRatio); - EXPECT_EQ(63u, atlas.getAtlasImage().size.width); - EXPECT_EQ(112u, atlas.getAtlasImage().size.height); + EXPECT_EQ(atlas.getPixelSize(), atlas.getAtlasImage().size); auto missing = atlas.getIcon("doesnotexist"); EXPECT_FALSE(missing); @@ -62,7 +58,7 @@ TEST(SpriteAtlas, Basic) { } TEST(SpriteAtlas, Size) { - SpriteAtlas atlas({ 63, 112 }, 1.4); + SpriteAtlas atlas; auto images = parseSprite(util::read_file("test/fixtures/annotations/emerald.png"), util::read_file("test/fixtures/annotations/emerald.json")); @@ -70,9 +66,6 @@ TEST(SpriteAtlas, Size) { atlas.addImage(image->impl); } - EXPECT_EQ(89u, atlas.getPixelSize().width); - EXPECT_EQ(157u, atlas.getPixelSize().height); - auto metro = *atlas.getIcon("metro"); EXPECT_EQ(1, metro.tl()[0]); EXPECT_EQ(1, metro.tl()[1]); @@ -86,10 +79,7 @@ TEST(SpriteAtlas, Size) { } TEST(SpriteAtlas, Updates) { - SpriteAtlas atlas({ 32, 32 }, 1); - - EXPECT_EQ(32u, atlas.getPixelSize().width); - EXPECT_EQ(32u, atlas.getPixelSize().height); + SpriteAtlas atlas; atlas.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 12 }), 1)); auto one = *atlas.getIcon("one"); @@ -101,10 +91,6 @@ TEST(SpriteAtlas, Updates) { EXPECT_EQ(12, one.displaySize()[1]); EXPECT_EQ(1.0f, one.pixelRatio); - // Now the image was created lazily. - EXPECT_EQ(32u, atlas.getAtlasImage().size.width); - EXPECT_EQ(32u, atlas.getAtlasImage().size.height); - test::checkImage("test/fixtures/sprite_atlas/updates_before", atlas.getAtlasImage()); // Update image @@ -119,7 +105,7 @@ TEST(SpriteAtlas, Updates) { TEST(SpriteAtlas, AddRemove) { FixtureLog log; - SpriteAtlas atlas({ 32, 32 }, 1); + SpriteAtlas atlas; atlas.addImage(makeMutable<style::Image::Impl>("one", PremultipliedImage({ 16, 16 }), 2)); atlas.addImage(makeMutable<style::Image::Impl>("two", PremultipliedImage({ 16, 16 }), 2)); @@ -148,8 +134,7 @@ TEST(SpriteAtlas, AddRemove) { TEST(SpriteAtlas, RemoveReleasesBinPackRect) { FixtureLog log; - - SpriteAtlas atlas({ 36, 36 }, 1); + SpriteAtlas atlas; atlas.addImage(makeMutable<style::Image::Impl>("big", PremultipliedImage({ 32, 32 }), 1)); EXPECT_TRUE(atlas.getIcon("big")); diff --git a/test/style/source.test.cpp b/test/style/source.test.cpp index 0473286c8b..880bcd986c 100644 --- a/test/style/source.test.cpp +++ b/test/style/source.test.cpp @@ -43,7 +43,7 @@ public: Transform transform; TransformState transformState; ThreadPool threadPool { 1 }; - AnnotationManager annotationManager { 1.0 }; + AnnotationManager annotationManager; style::Style style { threadPool, fileSource, 1.0 }; TileParameters tileParameters { diff --git a/test/text/quads.test.cpp b/test/text/quads.test.cpp index 4c40b41a97..0a1dbbd1c9 100644 --- a/test/text/quads.test.cpp +++ b/test/text/quads.test.cpp @@ -13,7 +13,7 @@ TEST(getIconQuads, normal) { SymbolLayoutProperties::Evaluated layout; Anchor anchor(2.0, 3.0, 0.0, 0.5f, 0); SpriteAtlasElement image = { - Rect<uint16_t>( 0, 0, 15, 11 ), + mapbox::Bin(-1, 15, 11, 0, 0), style::Image::Impl("test", PremultipliedImage({1,1}), 1.0) }; @@ -43,7 +43,7 @@ TEST(getIconQuads, normal) { TEST(getIconQuads, style) { Anchor anchor(0.0, 0.0, 0.0, 0.5f, 0); SpriteAtlasElement image = { - Rect<uint16_t>( 0, 0, 20, 20 ), + mapbox::Bin(-1, 20, 20, 0, 0), style::Image::Impl("test", PremultipliedImage({1,1}), 1.0) }; diff --git a/test/tile/annotation_tile.test.cpp b/test/tile/annotation_tile.test.cpp index 607a8cca17..05ce109766 100644 --- a/test/tile/annotation_tile.test.cpp +++ b/test/tile/annotation_tile.test.cpp @@ -23,7 +23,7 @@ public: TransformState transformState; util::RunLoop loop; ThreadPool threadPool { 1 }; - AnnotationManager annotationManager { 1.0 }; + AnnotationManager annotationManager; style::Style style { threadPool, fileSource, 1.0 }; TileParameters tileParameters { diff --git a/test/tile/geojson_tile.test.cpp b/test/tile/geojson_tile.test.cpp index 8669c02dfd..dad4aef2ee 100644 --- a/test/tile/geojson_tile.test.cpp +++ b/test/tile/geojson_tile.test.cpp @@ -23,7 +23,7 @@ public: TransformState transformState; util::RunLoop loop; ThreadPool threadPool { 1 }; - AnnotationManager annotationManager { 1.0 }; + AnnotationManager annotationManager; style::Style style { threadPool, fileSource, 1.0 }; Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" }; diff --git a/test/tile/raster_tile.test.cpp b/test/tile/raster_tile.test.cpp index e363b73609..ee6e31d845 100644 --- a/test/tile/raster_tile.test.cpp +++ b/test/tile/raster_tile.test.cpp @@ -19,7 +19,7 @@ public: TransformState transformState; util::RunLoop loop; ThreadPool threadPool { 1 }; - AnnotationManager annotationManager { 1.0 }; + AnnotationManager annotationManager; style::Style style { threadPool, fileSource, 1.0 }; Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" }; diff --git a/test/tile/vector_tile.test.cpp b/test/tile/vector_tile.test.cpp index 03896199f4..205d001f72 100644 --- a/test/tile/vector_tile.test.cpp +++ b/test/tile/vector_tile.test.cpp @@ -25,7 +25,7 @@ public: TransformState transformState; util::RunLoop loop; ThreadPool threadPool { 1 }; - AnnotationManager annotationManager { 1.0 }; + AnnotationManager annotationManager; style::Style style { threadPool, fileSource, 1.0 }; Tileset tileset { { "https://example.com" }, { 0, 22 }, "none" }; |