summaryrefslogtreecommitdiff
path: root/platform/darwin/src
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2017-01-12 16:48:17 -0800
committerMinh Nguyễn <mxn@1ec5.org>2017-01-13 10:26:43 -0800
commit4d5036616f85ff87ffe9042739872b1a080015b2 (patch)
tree586bc460e60c638c7ab83c074ba15a473e18a889 /platform/darwin/src
parent85fc75db8ddb5e045d5612fb38925535a8bb1804 (diff)
downloadqtlocation-mapboxgl-4d5036616f85ff87ffe9042739872b1a080015b2.tar.gz
[ios, macos] Rewrote style layer tests
Replaced the style layer integration tests with unit tests. Test conversion of style values to property values and vice versa, not just round-tripping. Test the initial state and null-resetting of each null-resettable property. Test NSValue additions for style attribute enumerations. Test properties common to all style layer classes. Test MGLStyle’s source and layer collections. Eviscerated implementations of unavailable style layer properties corresponding to style specification properties that were renamed. Implemented corresponding getters to prevent ivars from being autosynthesized for these unavailable properties. Added a missing bridging header to the iOS test project.
Diffstat (limited to 'platform/darwin/src')
-rw-r--r--platform/darwin/src/MGLCircleStyleLayer.mm18
-rw-r--r--platform/darwin/src/MGLFillStyleLayer.mm18
-rw-r--r--platform/darwin/src/MGLLineStyleLayer.mm18
-rw-r--r--platform/darwin/src/MGLRasterStyleLayer.mm18
-rw-r--r--platform/darwin/src/MGLStyleLayer.mm.ejs18
-rw-r--r--platform/darwin/src/MGLSymbolStyleLayer.mm58
6 files changed, 74 insertions, 74 deletions
diff --git a/platform/darwin/src/MGLCircleStyleLayer.mm b/platform/darwin/src/MGLCircleStyleLayer.mm
index 7ef1e0892a..0aff74ffa6 100644
--- a/platform/darwin/src/MGLCircleStyleLayer.mm
+++ b/platform/darwin/src/MGLCircleStyleLayer.mm
@@ -201,9 +201,11 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::CirclePitchScaleType, NSValue *, mbgl::style::CirclePitchScaleType, MGLCircleScaleAlignment>().toEnumStyleValue(propertyValue);
}
-
- (void)setCirclePitchScale:(MGLStyleValue<NSValue *> *)circlePitchScale {
- NSAssert(NO, @"Use -setCircleScaleAlignment: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)circlePitchScale {
+ return self.circleScaleAlignment;
}
- (void)setCircleTranslation:(MGLStyleValue<NSValue *> *)circleTranslation {
@@ -220,9 +222,11 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-
- (void)setCircleTranslate:(MGLStyleValue<NSValue *> *)circleTranslate {
- NSAssert(NO, @"Use -setCircleTranslation: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)circleTranslate {
+ return self.circleTranslation;
}
- (void)setCircleTranslationAnchor:(MGLStyleValue<NSValue *> *)circleTranslationAnchor {
@@ -239,9 +243,11 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLCircleTranslationAnchor>().toEnumStyleValue(propertyValue);
}
-
- (void)setCircleTranslateAnchor:(MGLStyleValue<NSValue *> *)circleTranslateAnchor {
- NSAssert(NO, @"Use -setCircleTranslationAnchor: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)circleTranslateAnchor {
+ return self.circleTranslationAnchor;
}
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm
index 560a1cab18..ec736d8825 100644
--- a/platform/darwin/src/MGLFillStyleLayer.mm
+++ b/platform/darwin/src/MGLFillStyleLayer.mm
@@ -140,9 +140,11 @@ namespace mbgl {
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setFillAntialias:(MGLStyleValue<NSNumber *> *)fillAntialias {
- NSAssert(NO, @"Use -setFillAntialiased: instead.");
+}
+
+- (MGLStyleValue<NSNumber *> *)fillAntialias {
+ return self.isFillAntialiased;
}
- (void)setFillColor:(MGLStyleValue<MGLColor *> *)fillColor {
@@ -215,9 +217,11 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-
- (void)setFillTranslate:(MGLStyleValue<NSValue *> *)fillTranslate {
- NSAssert(NO, @"Use -setFillTranslation: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)fillTranslate {
+ return self.fillTranslation;
}
- (void)setFillTranslationAnchor:(MGLStyleValue<NSValue *> *)fillTranslationAnchor {
@@ -234,9 +238,11 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLFillTranslationAnchor>().toEnumStyleValue(propertyValue);
}
-
- (void)setFillTranslateAnchor:(MGLStyleValue<NSValue *> *)fillTranslateAnchor {
- NSAssert(NO, @"Use -setFillTranslationAnchor: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)fillTranslateAnchor {
+ return self.fillTranslationAnchor;
}
diff --git a/platform/darwin/src/MGLLineStyleLayer.mm b/platform/darwin/src/MGLLineStyleLayer.mm
index f3b9f22df9..f6884fad15 100644
--- a/platform/darwin/src/MGLLineStyleLayer.mm
+++ b/platform/darwin/src/MGLLineStyleLayer.mm
@@ -238,9 +238,11 @@ namespace mbgl {
return MGLStyleValueTransformer<std::vector<float>, NSArray<NSNumber *> *, float>().toStyleValue(propertyValue);
}
-
- (void)setLineDasharray:(MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
- NSAssert(NO, @"Use -setLineDashPattern: instead.");
+}
+
+- (MGLStyleValue<NSArray<NSNumber *> *> *)lineDasharray {
+ return self.lineDashPattern;
}
- (void)setLineGapWidth:(MGLStyleValue<NSNumber *> *)lineGapWidth {
@@ -313,9 +315,11 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-
- (void)setLineTranslate:(MGLStyleValue<NSValue *> *)lineTranslate {
- NSAssert(NO, @"Use -setLineTranslation: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)lineTranslate {
+ return self.lineTranslation;
}
- (void)setLineTranslationAnchor:(MGLStyleValue<NSValue *> *)lineTranslationAnchor {
@@ -332,9 +336,11 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLLineTranslationAnchor>().toEnumStyleValue(propertyValue);
}
-
- (void)setLineTranslateAnchor:(MGLStyleValue<NSValue *> *)lineTranslateAnchor {
- NSAssert(NO, @"Use -setLineTranslationAnchor: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)lineTranslateAnchor {
+ return self.lineTranslationAnchor;
}
- (void)setLineWidth:(MGLStyleValue<NSNumber *> *)lineWidth {
diff --git a/platform/darwin/src/MGLRasterStyleLayer.mm b/platform/darwin/src/MGLRasterStyleLayer.mm
index ebe9e5f8f0..22e182df61 100644
--- a/platform/darwin/src/MGLRasterStyleLayer.mm
+++ b/platform/darwin/src/MGLRasterStyleLayer.mm
@@ -103,9 +103,11 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setRasterBrightnessMax:(MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
- NSAssert(NO, @"Use -setMaximumRasterBrightness: instead.");
+}
+
+- (MGLStyleValue<NSNumber *> *)rasterBrightnessMax {
+ return self.maximumRasterBrightness;
}
- (void)setMinimumRasterBrightness:(MGLStyleValue<NSNumber *> *)minimumRasterBrightness {
@@ -122,9 +124,11 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setRasterBrightnessMin:(MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
- NSAssert(NO, @"Use -setMinimumRasterBrightness: instead.");
+}
+
+- (MGLStyleValue<NSNumber *> *)rasterBrightnessMin {
+ return self.minimumRasterBrightness;
}
- (void)setRasterContrast:(MGLStyleValue<NSNumber *> *)rasterContrast {
@@ -169,9 +173,11 @@
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setRasterHueRotate:(MGLStyleValue<NSNumber *> *)rasterHueRotate {
- NSAssert(NO, @"Use -setRasterHueRotation: instead.");
+}
+
+- (MGLStyleValue<NSNumber *> *)rasterHueRotate {
+ return self.rasterHueRotation;
}
- (void)setRasterOpacity:(MGLStyleValue<NSNumber *> *)rasterOpacity {
diff --git a/platform/darwin/src/MGLStyleLayer.mm.ejs b/platform/darwin/src/MGLStyleLayer.mm.ejs
index c3b9e92243..ec8f8599b3 100644
--- a/platform/darwin/src/MGLStyleLayer.mm.ejs
+++ b/platform/darwin/src/MGLStyleLayer.mm.ejs
@@ -175,7 +175,7 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
<% if (property.type == "enum") { -%>
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::<%- mbglType(property) %>, NSValue *, mbgl::style::<%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumPropertyValue(<%- objCName(property) %>);
+ auto mbglValue = MGLStyleValueTransformer<<%- mbglType(property) %>, NSValue *, <%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumPropertyValue(<%- objCName(property) %>);
self.rawLayer->set<%- camelize(originalPropertyName(property)) %>(mbglValue);
<% } else { -%>
auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue(<%- objCName(property) %>);
@@ -188,15 +188,14 @@ namespace mbgl {
auto propertyValue = self.rawLayer->get<%- camelize(originalPropertyName(property)) %>() ?: self.rawLayer->getDefault<%- camelize(originalPropertyName(property)) %>();
<% if (property.type == "enum") { -%>
- return MGLStyleValueTransformer<mbgl::style::<%- mbglType(property) %>, NSValue *, mbgl::style::<%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumStyleValue(propertyValue);
+ return MGLStyleValueTransformer<<%- mbglType(property) %>, NSValue *, <%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumStyleValue(propertyValue);
<% } else { -%>
return MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toStyleValue(propertyValue);
<% } -%>
}
-<% if (property.original) { %>
+<% if (property.original) { -%>
- (void)set<%- camelize(originalPropertyName(property)) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
- self.<%- camelizeWithLeadingLowercase(property.name) %> = <%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>;
}
- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
@@ -214,7 +213,7 @@ namespace mbgl {
MGLAssertStyleLayerIsValid();
<% if (property.type == "enum") { -%>
- auto mbglValue = MGLStyleValueTransformer<mbgl::style::<%- mbglType(property) %>, NSValue *, mbgl::style::<%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumPropertyValue(<%- objCName(property) %>);
+ auto mbglValue = MGLStyleValueTransformer<<%- mbglType(property) %>, NSValue *, <%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumPropertyValue(<%- objCName(property) %>);
self.rawLayer->set<%- camelize(originalPropertyName(property)) %>(mbglValue);
<% } else { -%>
auto mbglValue = MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toPropertyValue(<%- objCName(property) %>);
@@ -227,15 +226,18 @@ namespace mbgl {
auto propertyValue = self.rawLayer->get<%- camelize(originalPropertyName(property)) %>() ?: self.rawLayer->getDefault<%- camelize(originalPropertyName(property)) %>();
<% if (property.type == "enum") { -%>
- return MGLStyleValueTransformer<mbgl::style::<%- mbglType(property) %>, NSValue *, mbgl::style::<%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumStyleValue(propertyValue);
+ return MGLStyleValueTransformer<<%- mbglType(property) %>, NSValue *, <%- mbglType(property) %>, MGL<%- camelize(property.name) %>>().toEnumStyleValue(propertyValue);
<% } else { -%>
return MGLStyleValueTransformer<<%- valueTransformerArguments(property).join(', ') %>>().toStyleValue(propertyValue);
<% } -%>
}
-<% if (property.original) { %>
+<% if (property.original) { -%>
- (void)set<%- camelize(originalPropertyName(property)) %>:(MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
- NSAssert(NO, @"Use -set<%- camelize(property.name) %>: instead.");
+}
+
+- (MGLStyleValue<<%- propertyType(property, true) %>> *)<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %> {
+ return self.<%- objCGetter(property) %>;
}
<% } -%>
diff --git a/platform/darwin/src/MGLSymbolStyleLayer.mm b/platform/darwin/src/MGLSymbolStyleLayer.mm
index c84f218cac..c7ba9d7dc5 100644
--- a/platform/darwin/src/MGLSymbolStyleLayer.mm
+++ b/platform/darwin/src/MGLSymbolStyleLayer.mm
@@ -199,9 +199,7 @@ namespace mbgl {
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setIconAllowOverlap:(MGLStyleValue<NSNumber *> *)iconAllowOverlap {
- self.iconAllowsOverlap = iconAllowOverlap;
}
- (MGLStyleValue<NSNumber *> *)iconAllowOverlap {
@@ -222,9 +220,7 @@ namespace mbgl {
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setIconIgnorePlacement:(MGLStyleValue<NSNumber *> *)iconIgnorePlacement {
- self.iconIgnoresPlacement = iconIgnorePlacement;
}
- (MGLStyleValue<NSNumber *> *)iconIgnorePlacement {
@@ -245,9 +241,7 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
-
- (void)setIconImage:(MGLStyleValue<NSString *> *)iconImage {
- self.iconImageName = iconImage;
}
- (MGLStyleValue<NSString *> *)iconImage {
@@ -310,9 +304,7 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setIconRotate:(MGLStyleValue<NSNumber *> *)iconRotate {
- self.iconRotation = iconRotate;
}
- (MGLStyleValue<NSNumber *> *)iconRotate {
@@ -347,9 +339,7 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setIconSize:(MGLStyleValue<NSNumber *> *)iconSize {
- self.iconScale = iconSize;
}
- (MGLStyleValue<NSNumber *> *)iconSize {
@@ -398,9 +388,7 @@ namespace mbgl {
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setIconKeepUpright:(MGLStyleValue<NSNumber *> *)iconKeepUpright {
- self.keepsIconUpright = iconKeepUpright;
}
- (MGLStyleValue<NSNumber *> *)iconKeepUpright {
@@ -421,9 +409,7 @@ namespace mbgl {
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setTextKeepUpright:(MGLStyleValue<NSNumber *> *)textKeepUpright {
- self.keepsTextUpright = textKeepUpright;
}
- (MGLStyleValue<NSNumber *> *)textKeepUpright {
@@ -444,9 +430,7 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setTextMaxAngle:(MGLStyleValue<NSNumber *> *)textMaxAngle {
- self.maximumTextAngle = textMaxAngle;
}
- (MGLStyleValue<NSNumber *> *)textMaxAngle {
@@ -467,9 +451,7 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setTextMaxWidth:(MGLStyleValue<NSNumber *> *)textMaxWidth {
- self.maximumTextWidth = textMaxWidth;
}
- (MGLStyleValue<NSNumber *> *)textMaxWidth {
@@ -490,9 +472,7 @@ namespace mbgl {
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setSymbolAvoidEdges:(MGLStyleValue<NSNumber *> *)symbolAvoidEdges {
- self.symbolAvoidsEdges = symbolAvoidEdges;
}
- (MGLStyleValue<NSNumber *> *)symbolAvoidEdges {
@@ -541,9 +521,7 @@ namespace mbgl {
return MGLStyleValueTransformer<std::string, NSString *>().toStyleValue(propertyValue);
}
-
- (void)setTextField:(MGLStyleValue<NSString *> *)textField {
- self.text = textField;
}
- (MGLStyleValue<NSString *> *)textField {
@@ -564,9 +542,7 @@ namespace mbgl {
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setTextAllowOverlap:(MGLStyleValue<NSNumber *> *)textAllowOverlap {
- self.textAllowsOverlap = textAllowOverlap;
}
- (MGLStyleValue<NSNumber *> *)textAllowOverlap {
@@ -601,9 +577,7 @@ namespace mbgl {
return MGLStyleValueTransformer<std::vector<std::string>, NSArray<NSString *> *, std::string>().toStyleValue(propertyValue);
}
-
- (void)setTextFont:(MGLStyleValue<NSArray<NSString *> *> *)textFont {
- self.textFontNames = textFont;
}
- (MGLStyleValue<NSArray<NSString *> *> *)textFont {
@@ -624,9 +598,7 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setTextSize:(MGLStyleValue<NSNumber *> *)textSize {
- self.textFontSize = textSize;
}
- (MGLStyleValue<NSNumber *> *)textSize {
@@ -647,9 +619,7 @@ namespace mbgl {
return MGLStyleValueTransformer<bool, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setTextIgnorePlacement:(MGLStyleValue<NSNumber *> *)textIgnorePlacement {
- self.textIgnoresPlacement = textIgnorePlacement;
}
- (MGLStyleValue<NSNumber *> *)textIgnorePlacement {
@@ -670,9 +640,7 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::TextJustifyType, NSValue *, mbgl::style::TextJustifyType, MGLTextJustification>().toEnumStyleValue(propertyValue);
}
-
- (void)setTextJustify:(MGLStyleValue<NSValue *> *)textJustify {
- self.textJustification = textJustify;
}
- (MGLStyleValue<NSValue *> *)textJustify {
@@ -777,9 +745,7 @@ namespace mbgl {
return MGLStyleValueTransformer<float, NSNumber *>().toStyleValue(propertyValue);
}
-
- (void)setTextRotate:(MGLStyleValue<NSNumber *> *)textRotate {
- self.textRotation = textRotate;
}
- (MGLStyleValue<NSNumber *> *)textRotate {
@@ -900,9 +866,11 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-
- (void)setIconTranslate:(MGLStyleValue<NSValue *> *)iconTranslate {
- NSAssert(NO, @"Use -setIconTranslation: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)iconTranslate {
+ return self.iconTranslation;
}
- (void)setIconTranslationAnchor:(MGLStyleValue<NSValue *> *)iconTranslationAnchor {
@@ -919,9 +887,11 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLIconTranslationAnchor>().toEnumStyleValue(propertyValue);
}
-
- (void)setIconTranslateAnchor:(MGLStyleValue<NSValue *> *)iconTranslateAnchor {
- NSAssert(NO, @"Use -setIconTranslationAnchor: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)iconTranslateAnchor {
+ return self.iconTranslationAnchor;
}
- (void)setTextColor:(MGLStyleValue<MGLColor *> *)textColor {
@@ -1008,9 +978,11 @@ namespace mbgl {
return MGLStyleValueTransformer<std::array<float, 2>, NSValue *>().toStyleValue(propertyValue);
}
-
- (void)setTextTranslate:(MGLStyleValue<NSValue *> *)textTranslate {
- NSAssert(NO, @"Use -setTextTranslation: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)textTranslate {
+ return self.textTranslation;
}
- (void)setTextTranslationAnchor:(MGLStyleValue<NSValue *> *)textTranslationAnchor {
@@ -1027,9 +999,11 @@ namespace mbgl {
return MGLStyleValueTransformer<mbgl::style::TranslateAnchorType, NSValue *, mbgl::style::TranslateAnchorType, MGLTextTranslationAnchor>().toEnumStyleValue(propertyValue);
}
-
- (void)setTextTranslateAnchor:(MGLStyleValue<NSValue *> *)textTranslateAnchor {
- NSAssert(NO, @"Use -setTextTranslationAnchor: instead.");
+}
+
+- (MGLStyleValue<NSValue *> *)textTranslateAnchor {
+ return self.textTranslationAnchor;
}