summaryrefslogtreecommitdiff
path: root/test/style
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-02-05 16:52:07 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-02-10 15:40:20 -0800
commite9302c797f68c7e48b908b87b126045c8c5e5209 (patch)
tree044441cdb82ed8752401c43ead9e84018b067fbd /test/style
parent7eb1a91c4e5134ecfbfb91b61a6622be40478af5 (diff)
downloadqtlocation-mapboxgl-e9302c797f68c7e48b908b87b126045c8c5e5209.tar.gz
[all] Don't interpret 404s on non-tile resources as "no content"
Diffstat (limited to 'test/style')
-rw-r--r--test/style/source.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/test/style/source.cpp b/test/style/source.cpp
index 528059ae9f..f5b46292ab 100644
--- a/test/style/source.cpp
+++ b/test/style/source.cpp
@@ -116,6 +116,64 @@ TEST(Source, LoadingCorrupt) {
test.run();
}
+TEST(Source, RasterTileEmpty) {
+ SourceTest test;
+
+ test.fileSource.tileResponse = [&] (const Resource&) {
+ Response response;
+ response.noContent = true;
+ return response;
+ };
+
+ test.observer.tileLoaded = [&] (Source& source, const TileID&, bool) {
+ EXPECT_EQ("source", source.id);
+ test.end();
+ };
+
+ test.observer.tileError = [&] (Source&, const TileID&, std::exception_ptr) {
+ FAIL() << "Should never be called";
+ };
+
+ auto info = std::make_unique<SourceInfo>();
+ info->tiles = { "tiles" };
+
+ Source source(SourceType::Raster, "source", "", 512, std::move(info), nullptr);
+ source.setObserver(&test.observer);
+ source.load();
+ source.update(test.updateParameters);
+
+ test.run();
+}
+
+TEST(Source, VectorTileEmpty) {
+ SourceTest test;
+
+ test.fileSource.tileResponse = [&] (const Resource&) {
+ Response response;
+ response.noContent = true;
+ return response;
+ };
+
+ test.observer.tileLoaded = [&] (Source& source, const TileID&, bool) {
+ EXPECT_EQ("source", source.id);
+ test.end();
+ };
+
+ test.observer.tileError = [&] (Source&, const TileID&, std::exception_ptr) {
+ FAIL() << "Should never be called";
+ };
+
+ auto info = std::make_unique<SourceInfo>();
+ info->tiles = { "tiles" };
+
+ Source source(SourceType::Vector, "source", "", 512, std::move(info), nullptr);
+ source.setObserver(&test.observer);
+ source.load();
+ source.update(test.updateParameters);
+
+ test.run();
+}
+
TEST(Source, RasterTileFail) {
SourceTest test;