summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-08-24 17:38:06 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-08-24 20:02:31 +0300
commitc98f4f476bd590bdfd78409d428459e40347302a (patch)
tree6c4bc14970ba0bf199e36156e3bc529a6d054a61 /test
parent646528bc53c37950b556be825de1ba9fa5303be3 (diff)
downloadqtlocation-mapboxgl-c98f4f476bd590bdfd78409d428459e40347302a.tar.gz
[core] Emit MapChangeDidFailLoadingMap when the style cannot be loaded or parsed
Currently this signal is never emitted, which can cause the Still mode to starve in case of an invalid style or failed request.
Diffstat (limited to 'test')
-rw-r--r--test/fixtures/style_parser/non-object.info.json4
-rw-r--r--test/map/map.cpp2
-rw-r--r--test/style/style_parser.cpp7
3 files changed, 9 insertions, 4 deletions
diff --git a/test/fixtures/style_parser/non-object.info.json b/test/fixtures/style_parser/non-object.info.json
index d1b67e2ea6..ac6ea00d97 100644
--- a/test/fixtures/style_parser/non-object.info.json
+++ b/test/fixtures/style_parser/non-object.info.json
@@ -1,7 +1,7 @@
{
"default": {
"log": [
- [1, "ERROR", "ParseStyle", "Style JSON must be an object"]
+ [1, "ERROR", "ParseStyle", "Failed to parse style: style must be an object"]
]
}
-} \ No newline at end of file
+}
diff --git a/test/map/map.cpp b/test/map/map.cpp
index 2dc8aad927..7e0bbd0234 100644
--- a/test/map/map.cpp
+++ b/test/map/map.cpp
@@ -68,7 +68,7 @@ TEST(Map, SetStyleInvalidJSON) {
auto observer = Log::removeObserver();
auto flo = dynamic_cast<FixtureLogObserver*>(observer.get());
EXPECT_EQ(1u, flo->count({ EventSeverity::Error, Event::ParseStyle, -1,
- "Error parsing style JSON at 0: Invalid value." }));
+ "Failed to parse style: 0 - Invalid value." }));
auto unchecked = flo->unchecked();
EXPECT_TRUE(unchecked.empty()) << unchecked;
}
diff --git a/test/style/style_parser.cpp b/test/style/style_parser.cpp
index b7806c11cc..3e1149c997 100644
--- a/test/style/style_parser.cpp
+++ b/test/style/style_parser.cpp
@@ -4,6 +4,7 @@
#include <mbgl/style/parser.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/enum.hpp>
+#include <mbgl/util/string.hpp>
#include <mbgl/util/tileset.hpp>
#include <rapidjson/document.h>
@@ -32,7 +33,11 @@ TEST_P(StyleParserTest, ParseStyle) {
Log::setObserver(std::unique_ptr<Log::Observer>(observer));
style::Parser parser;
- parser.parse(util::read_file(base + ".style.json"));
+ auto error = parser.parse(util::read_file(base + ".style.json"));
+
+ if (error) {
+ Log::Error(Event::ParseStyle, "Failed to parse style: %s", util::toString(error).c_str());
+ }
for (auto it = infoDoc.MemberBegin(), end = infoDoc.MemberEnd(); it != end; it++) {
const std::string name { it->name.GetString(), it->name.GetStringLength() };