summaryrefslogtreecommitdiff
path: root/test/headless.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-08-27 14:28:56 +0200
committerKonstantin Käfer <mail@kkaefer.com>2014-08-27 14:28:56 +0200
commit953e5524a99325ffb049f466b85ce13a62dc327a (patch)
tree36e1db7f68c94f1ad0135eed0dd1b3292c4a4ca3 /test/headless.cpp
parenta55be0217bdc2b4e15500f9a5cd4aba207d33fc7 (diff)
downloadqtlocation-mapboxgl-953e5524a99325ffb049f466b85ce13a62dc327a.tar.gz
fix basepath for headless stylesheets
Diffstat (limited to 'test/headless.cpp')
-rw-r--r--test/headless.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/test/headless.cpp b/test/headless.cpp
index a2f58e98d9..2453f1bb37 100644
--- a/test/headless.cpp
+++ b/test/headless.cpp
@@ -18,17 +18,12 @@
const std::string base_directory = []{
std::string fn = __FILE__;
fn.erase(fn.find_last_of("/"));
- return fn + "/../node_modules/mapbox-gl-test-suite/";
+ fn.erase(fn.find_last_of("/"));
+ return fn + "/node_modules/mapbox-gl-test-suite/";
}();
class HeadlessTest : public ::testing::TestWithParam<std::string> {};
-void ResolveLocalURL(rapidjson::Value& value, rapidjson::Document& doc) {
- std::string str { value.GetString(), value.GetStringLength() };
- str.replace(0, 8, base_directory); // local://
- value.SetString(str.c_str(), str.length(), doc.GetAllocator());
-}
-
TEST_P(HeadlessTest, render) {
using namespace mbgl;
@@ -43,12 +38,6 @@ TEST_P(HeadlessTest, render) {
ASSERT_EQ(false, styleDoc.HasParseError());
ASSERT_EQ(true, styleDoc.IsObject());
- if (styleDoc.HasMember("sprite")) {
- ResolveLocalURL(styleDoc["sprite"], styleDoc);
- }
-
- ResolveLocalURL(styleDoc["sources"]["mapbox"]["tiles"][rapidjson::SizeType(0)], styleDoc);
-
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
styleDoc.Accept(writer);
@@ -91,7 +80,7 @@ TEST_P(HeadlessTest, render) {
}
}
- map.setStyleJSON(style);
+ map.setStyleJSON(style, base_directory);
map.setAppliedClasses(classes);
view.resize(width, height);