summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2016-01-20 00:07:04 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2016-01-20 10:35:44 +0200
commit9cd9065031f7d2af62e437f2b32b44207484baca (patch)
tree7eaa326b4d183fc1d26ae64492588bbeb7a4b615 /test
parentd34f8eb674b9753c47616f37ae88ff7a02f61ba0 (diff)
downloadqtlocation-mapboxgl-9cd9065031f7d2af62e437f2b32b44207484baca.tar.gz
Revert "Revert WebP support due to broken builds"
This reverts commit 6709bdcacd5a45a10b554f3f225206c9494e5e43. There was an issue with the script that removes '-lwebp' from WebP linker flags, since we're statically linking. This is now fixed.
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/image/tile.webpbin0 -> 8916 bytes
-rw-r--r--test/miscellaneous/image.cpp8
-rw-r--r--test/miscellaneous/mapbox.cpp7
3 files changed, 15 insertions, 0 deletions
diff --git a/test/fixtures/image/tile.webp b/test/fixtures/image/tile.webp
new file mode 100644
index 0000000000..5dbad8f88d
--- /dev/null
+++ b/test/fixtures/image/tile.webp
Binary files differ
diff --git a/test/miscellaneous/image.cpp b/test/miscellaneous/image.cpp
index 2db62b96d3..9886eede45 100644
--- a/test/miscellaneous/image.cpp
+++ b/test/miscellaneous/image.cpp
@@ -78,6 +78,14 @@ TEST(Image, JPEGTile) {
EXPECT_EQ(256, image.height);
}
+#if !defined(__ANDROID__) && !defined(__APPLE__)
+TEST(Image, WebPTile) {
+ PremultipliedImage image = decodeImage(util::read_file("test/fixtures/image/tile.webp"));
+ EXPECT_EQ(256, image.width);
+ EXPECT_EQ(256, image.height);
+}
+#endif // !defined(__ANDROID__) && !defined(__APPLE__)
+
TEST(Image, Premultiply) {
UnassociatedImage rgba { 1, 1 };
rgba.data[0] = 255;
diff --git a/test/miscellaneous/mapbox.cpp b/test/miscellaneous/mapbox.cpp
index 02a08db9ee..d6f9948e66 100644
--- a/test/miscellaneous/mapbox.cpp
+++ b/test/miscellaneous/mapbox.cpp
@@ -37,10 +37,17 @@ TEST(Mapbox, SpriteURL) {
TEST(Mapbox, TileURL) {
try {
+#if defined(__ANDROID__) || defined(__APPLE__)
EXPECT_EQ("http://path.png/tile{ratio}.png", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png"));
EXPECT_EQ("http://path.png/tile{ratio}.png32", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png32"));
EXPECT_EQ("http://path.png/tile{ratio}.png70", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png70"));
EXPECT_EQ("http://path.png/tile{ratio}.png?access_token=foo", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png?access_token=foo"));
+#else
+ EXPECT_EQ("http://path.png/tile{ratio}.webp", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png"));
+ EXPECT_EQ("http://path.png/tile{ratio}.webp32", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png32"));
+ EXPECT_EQ("http://path.png/tile{ratio}.webp70", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png70"));
+ EXPECT_EQ("http://path.png/tile{ratio}.webp?access_token=foo", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.png?access_token=foo"));
+#endif // defined(__ANDROID__) || defined(__APPLE__)
EXPECT_EQ("http://path.png/tile{ratio}.pbf", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.pbf"));
EXPECT_EQ("http://path.png/tile{ratio}.pbf?access_token=foo", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.pbf?access_token=foo"));
EXPECT_EQ("http://path.png/tile{ratio}.pbf?access_token=foo.png", mbgl::util::mapbox::normalizeRasterTileURL("http://path.png/tile.pbf?access_token=foo.png"));