summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2016-11-28 13:00:53 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-11-29 06:52:24 -0800
commit3d2d57cd30aae8d2811f679fcb30fd0e8f2ab2e9 (patch)
tree5a2700d943cdb190e7cb73c8683d08e186806263 /test
parent99c2bf2580f57542ce2a473dba2587604d10f6ac (diff)
downloadqtlocation-mapboxgl-3d2d57cd30aae8d2811f679fcb30fd0e8f2ab2e9.tar.gz
[core] Assert valid range for color components
Diffstat (limited to 'test')
-rw-r--r--test/api/annotations.test.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index 31277718da..72a2d62bde 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -59,7 +59,7 @@ TEST(Annotations, LineAnnotation) {
LineString<double> line = {{ { 0, 0 }, { 45, 45 }, { 30, 0 } }};
LineAnnotation annotation { line };
- annotation.color = { { 255, 0, 0, 1 } };
+ annotation.color = Color::red();
annotation.width = { 5 };
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
@@ -75,7 +75,7 @@ TEST(Annotations, FillAnnotation) {
Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }};
FillAnnotation annotation { polygon };
- annotation.color = { { 255, 0, 0, 1 } };
+ annotation.color = Color::red();
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotation(annotation);
@@ -94,13 +94,13 @@ TEST(Annotations, AntimeridianAnnotationSmall) {
LineString<double> line = {{ { antimeridian, 20 }, { antimeridian, -20 } }};
LineAnnotation lineAnnotation { line };
- lineAnnotation.color = { { 255, 0, 0, 1 } };
+ lineAnnotation.color = Color::red();
lineAnnotation.width = { 2 };
test.map.addAnnotation(lineAnnotation);
Polygon<double> polygon = {{ {{ { antimeridian+10, 0 }, { antimeridian - 10, 10 }, { antimeridian-10, -10 } }} }};
FillAnnotation polygonAnnotation { polygon };
- polygonAnnotation.color = { { 0, 0, 255, 1 } };
+ polygonAnnotation.color = Color::blue();
test.map.addAnnotation(polygonAnnotation);
test.checkRendering("antimeridian_annotation_small");
@@ -115,13 +115,13 @@ TEST(Annotations, AntimeridianAnnotationLarge) {
LineString<double> line = {{ { antimeridian, 20 }, { antimeridian, -20 } }};
LineAnnotation lineAnnotation { line };
- lineAnnotation.color = { { 255, 0, 0, 1 } };
+ lineAnnotation.color = Color::red();
lineAnnotation.width = { 2 };
test.map.addAnnotation(lineAnnotation);
Polygon<double> polygon = {{ {{ { antimeridian-10, 0 }, { -antimeridian+10, 10 }, { -antimeridian+10, -10 } }} }};
FillAnnotation polygonAnnotation { polygon };
- polygonAnnotation.color = { { 0, 0, 255, 1 } };
+ polygonAnnotation.color = Color::blue();
test.map.addAnnotation(polygonAnnotation);
test.checkRendering("antimeridian_annotation_large");
@@ -132,9 +132,9 @@ TEST(Annotations, OverlappingFillAnnotation) {
Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }};
FillAnnotation underlaidAnnotation { polygon };
- underlaidAnnotation.color = { { 0, 255, 0, 1 } };
+ underlaidAnnotation.color = Color::green();
FillAnnotation overlaidAnnotation { polygon };
- overlaidAnnotation.color = { { 255, 0, 0, 1 } };
+ overlaidAnnotation.color = Color::red();
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
test.map.addAnnotation(underlaidAnnotation);
@@ -173,7 +173,7 @@ TEST(Annotations, NonImmediateAdd) {
Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }};
FillAnnotation annotation { polygon };
- annotation.color = { { 255, 0, 0, 1 } };
+ annotation.color = Color::red();
test.map.addAnnotation(annotation);
test.checkRendering("non_immediate_add");
@@ -211,7 +211,7 @@ TEST(Annotations, UpdateLineAnnotationGeometry) {
AnnotationTest test;
LineAnnotation annotation { LineString<double> {{ { 0, 0 }, { 45, 45 }, { 30, 0 } }} };
- annotation.color = { { 255, 0, 0, 1 } };
+ annotation.color = Color::red();
annotation.width = { 5 };
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
@@ -228,7 +228,7 @@ TEST(Annotations, UpdateLineAnnotationStyle) {
AnnotationTest test;
LineAnnotation annotation { LineString<double> {{ { 0, 0 }, { 45, 45 }, { 30, 0 } }} };
- annotation.color = { { 255, 0, 0, 1 } };
+ annotation.color = Color::red();
annotation.width = { 5 };
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
@@ -236,7 +236,7 @@ TEST(Annotations, UpdateLineAnnotationStyle) {
test::render(test.map, test.view);
- annotation.color = { { 0, 255, 0, 1 } };
+ annotation.color = Color::green();
annotation.width = { 2 };
test.map.updateAnnotation(line, annotation);
test.checkRendering("update_line_style");
@@ -246,7 +246,7 @@ TEST(Annotations, UpdateFillAnnotationGeometry) {
AnnotationTest test;
FillAnnotation annotation { Polygon<double> {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }} };
- annotation.color = { { 255, 0, 0, 1 } };
+ annotation.color = Color::red();
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
AnnotationID fill = test.map.addAnnotation(annotation);
@@ -263,14 +263,14 @@ TEST(Annotations, UpdateFillAnnotationStyle) {
Polygon<double> polygon = {{ {{ { 0, 0 }, { 0, 45 }, { 45, 45 }, { 45, 0 } }} }};
FillAnnotation annotation { polygon };
- annotation.color = { { 255, 0, 0, 1 } };
+ annotation.color = Color::red();
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));
AnnotationID fill = test.map.addAnnotation(annotation);
test::render(test.map, test.view);
- annotation.color = { { 0, 255, 0, 1 } };
+ annotation.color = Color::green();
test.map.updateAnnotation(fill, annotation);
test.checkRendering("update_fill_style");
}
@@ -293,7 +293,7 @@ TEST(Annotations, RemoveShape) {
LineString<double> line = {{ { 0, 0 }, { 45, 45 } }};
LineAnnotation annotation { line };
- annotation.color = { { 255, 0, 0, 1 } };
+ annotation.color = Color::red();
annotation.width = { 5 };
test.map.setStyleJSON(util::read_file("test/fixtures/api/empty.json"));