diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-22 15:10:24 -0800 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2015-12-23 12:50:42 -0800 |
commit | 16de579d7cfc2960793cbcb5e95741f22ab73768 (patch) | |
tree | b4c3b7651f605e3d3dd61b469f61036bd2c4dcc3 /test/sprite | |
parent | 7bd4745cf10c504a4899a37016e87bce45e51472 (diff) | |
download | qtlocation-mapboxgl-16de579d7cfc2960793cbcb5e95741f22ab73768.tar.gz |
[core] Rationalize error handling for resource loading
* Standardize on std::exception_ptr as the error representation
(fixes #2854).
* Don't format textual strings at the error source; pass on the
constituent data via observer method parameters instead.
* Use the null object pattern to simplify observer notification code.
* Further refactoring for ResourceLoading tests.
Diffstat (limited to 'test/sprite')
-rw-r--r-- | test/sprite/sprite_parser.cpp | 5 | ||||
-rw-r--r-- | test/sprite/sprite_store.cpp | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/test/sprite/sprite_parser.cpp b/test/sprite/sprite_parser.cpp index dfa3a1055b..0eb298b23e 100644 --- a/test/sprite/sprite_parser.cpp +++ b/test/sprite/sprite_parser.cpp @@ -5,6 +5,7 @@ #include <mbgl/sprite/sprite_image.hpp> #include <mbgl/util/image.hpp> #include <mbgl/util/io.hpp> +#include <mbgl/util/string.hpp> #include <algorithm> @@ -211,9 +212,9 @@ TEST(Sprite, SpriteParsingInvalidJSON) { const auto image_1x = util::read_file("test/fixtures/annotations/emerald.png"); const auto json_1x = R"JSON({ "image": " })JSON"; - const auto error = parseSprite(image_1x, json_1x).get<std::string>(); + const auto error = parseSprite(image_1x, json_1x).get<std::exception_ptr>(); - EXPECT_EQ(error, + EXPECT_EQ(util::toString(error), std::string("Failed to parse JSON: Missing a closing quotation mark in string. at offset 13")); } diff --git a/test/sprite/sprite_store.cpp b/test/sprite/sprite_store.cpp index 574af51b81..6209bde2a3 100644 --- a/test/sprite/sprite_store.cpp +++ b/test/sprite/sprite_store.cpp @@ -176,7 +176,7 @@ public: callback_(spriteStore_.get(), nullptr); } - void onSpriteLoadingFailed(std::exception_ptr error) override { + void onSpriteError(std::exception_ptr error) override { callback_(spriteStore_.get(), error); } |