summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llmr/map/map.hpp1
-rw-r--r--src/map/map.cpp4
-rw-r--r--test/fixtures/styles/line-color.info.json13
-rw-r--r--test/fixtures/styles/line-color.style.json33
-rw-r--r--test/fixtures/styles/line-color/colored.expected.pngbin0 -> 64163 bytes
-rw-r--r--test/fixtures/styles/line-color/default.expected.pngbin0 -> 80000 bytes
-rw-r--r--test/headless.cpp11
7 files changed, 57 insertions, 5 deletions
diff --git a/include/llmr/map/map.hpp b/include/llmr/map/map.hpp
index a1c9842fbb..649acfa693 100644
--- a/include/llmr/map/map.hpp
+++ b/include/llmr/map/map.hpp
@@ -56,7 +56,6 @@ public:
void setAppliedClasses(const std::vector<std::string> &classes);
void toggleClass(const std::string &name);
const std::vector<std::string> &getAppliedClasses() const;
- void setAppliedClasses(std::vector<std::string> &class_names);
void setDefaultTransitionDuration(uint64_t duration_milliseconds = 0);
void setStyleJSON(std::string newStyleJSON);
std::string getStyleJSON() const;
diff --git a/src/map/map.cpp b/src/map/map.cpp
index 08b14bcf38..db81700c47 100644
--- a/src/map/map.cpp
+++ b/src/map/map.cpp
@@ -405,10 +405,6 @@ const std::vector<std::string> &Map::getAppliedClasses() const {
return style->getAppliedClasses();
}
-void Map::setAppliedClasses(std::vector<std::string> &class_names) {
- style->setAppliedClasses(class_names);
-}
-
void Map::setDefaultTransitionDuration(uint64_t duration_milliseconds) {
style->setDefaultTransitionDuration(duration_milliseconds);
}
diff --git a/test/fixtures/styles/line-color.info.json b/test/fixtures/styles/line-color.info.json
new file mode 100644
index 0000000000..03e33581dc
--- /dev/null
+++ b/test/fixtures/styles/line-color.info.json
@@ -0,0 +1,13 @@
+{
+ "default": {
+ "zoom": 14,
+ "center": [52.499167, 13.418056],
+ "height": 256
+ },
+ "colored": {
+ "zoom": 14,
+ "center": [52.499167, 13.418056],
+ "height": 256,
+ "classes": ["colored"]
+ }
+}
diff --git a/test/fixtures/styles/line-color.style.json b/test/fixtures/styles/line-color.style.json
new file mode 100644
index 0000000000..10f5fb9cb7
--- /dev/null
+++ b/test/fixtures/styles/line-color.style.json
@@ -0,0 +1,33 @@
+{
+ "version": 3,
+ "sources": {
+ "mapbox": {
+ "type": "vector",
+ "url": "tiles/{z}-{x}-{y}.vector.pbf",
+ "tileSize": 512,
+ "maxZoom": 14
+ }
+ },
+ "layers": [
+ {
+ "id": "background",
+ "type": "background",
+ "style": {
+ "background-color": "white"
+ }
+ },
+ {
+ "id": "road",
+ "source": "mapbox",
+ "source-layer": "road",
+ "type": "line",
+ "style": {
+ "line-width": 2,
+ "line-color": "#3590db"
+ },
+ "style.colored": {
+ "line-color": "#222222"
+ }
+ }
+ ]
+}
diff --git a/test/fixtures/styles/line-color/colored.expected.png b/test/fixtures/styles/line-color/colored.expected.png
new file mode 100644
index 0000000000..ffd1ac3fb5
--- /dev/null
+++ b/test/fixtures/styles/line-color/colored.expected.png
Binary files differ
diff --git a/test/fixtures/styles/line-color/default.expected.png b/test/fixtures/styles/line-color/default.expected.png
new file mode 100644
index 0000000000..6369f5620b
--- /dev/null
+++ b/test/fixtures/styles/line-color/default.expected.png
Binary files differ
diff --git a/test/headless.cpp b/test/headless.cpp
index a93c03ce9e..97a5e581a3 100644
--- a/test/headless.cpp
+++ b/test/headless.cpp
@@ -49,8 +49,19 @@ TEST_P(HeadlessTest, render) {
const double longitude = value.HasMember("center") ? value["center"][rapidjson::SizeType(1)].GetDouble() : 0;
const unsigned int width = value.HasMember("width") ? value["width"].GetUint() : 512;
const unsigned int height = value.HasMember("height") ? value["height"].GetUint() : 512;
+ std::vector<std::string> classes;
+ if (value.HasMember("classes")) {
+ const rapidjson::Value &js_classes = value["classes"];
+ ASSERT_EQ(true, js_classes.IsArray());
+ for (rapidjson::SizeType i = 0; i < js_classes.Size(); i++) {
+ const rapidjson::Value &js_class = js_classes[i];
+ ASSERT_EQ(true, js_class.IsString());
+ classes.push_back({ js_class.GetString(), js_class.GetStringLength() });
+ }
+ }
map.setStyleJSON(style);
+ map.setAppliedClasses(classes);
view.resize(width, height);
map.resize(width, height);