summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2014-07-10 17:19:53 -0700
committerKonstantin Käfer <mail@kkaefer.com>2014-07-10 17:19:53 -0700
commit8fc4d61025397180374ccc99e6798659470afb69 (patch)
tree3847d6ac7e20ea48559ae3e303a92cd626cfc0ed
parent0719ca73bef13d65a579f8b02b73c2e157f54cc1 (diff)
downloadqtlocation-mapboxgl-8fc4d61025397180374ccc99e6798659470afb69.tar.gz
allow setting classes in the test case
-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
5 files changed, 57 insertions, 0 deletions
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);