summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLExpressionTests.mm
Commit message (Collapse)AuthorAgeFilesLines
* [ios, macos] Support expressions in formatting parameters. (#14198)Fabian Guerra Soto2019-03-221-24/+28
| | | | | Modified MGLAttributedExpression object to support NSExpressions as formatting attributes only. This aligns with GL and Android implementation and specification. Modified the documentation accordingly, and changed MGLFontSizeAttribute to MGLFontScaleAttribute to clarify the true function of the formatting parameter.
* [ios, macos] Fix conditional expression parsing error. (#14181) (#14191)Fabian Guerra Soto2019-03-211-4/+1
| | | Fixed an error that caused conditional expressions to crash when a conditional parameter was also a conditional expression.
* [ios, macos] Fix format expression parsing. (#14168) (#14178)Fabian Guerra Soto2019-03-211-0/+20
| | | CP [ios, macos] Fix format expression parsing. (#14168)
* [ios, macos] Add text-color support to format expressions. (#14146)Fabian Guerra Soto2019-03-191-0/+37
| | | | | | | | Added the possibility of overriding paint properties inside the format expression. Added an example of how to create an MGLAttributedExpression object and documented the attributes keys and value types. Fixed a bug that ignored the font names.
* [ios, macos] Add format expression convenience methods support. (#14094)Fabian Guerra Soto2019-03-151-17/+82
| | | | | | | | | | | Added the ios/macos format expression bindings. The equivalent is mgl_attributed: or mgl_attributed({}) when making an expression using the expressionForFormat selector. A new constructor called mgl_expressionForAttributedExpressions:(NSArray<NSExpression*>*)attributedExpressions was added to NSExpression+MGLAdditions category. Updated the symbol style layer text test to use the bindings. Updated the Predicates and Expressions.md and For Style Authors.md.ejs template with the bindings.
* [ios, macos] Fix a bug with multiple format expressions. (#14064)Fabian Guerra Soto2019-03-071-0/+17
| | | | Fixed a bug where `format` expressions using the generic `MGL_FUNCTION` binding ignored multiple formatting parameters.
* [ios, macos] Update for streets-v8 data and coalesced name fields in v11 stylesJason Wray2018-12-071-2/+11
|
* [darwin] Rename variables to avoid shadow declarationsJason Wray2018-11-201-2/+2
| | | | Per GCC_WARN_SHADOW.
* [ios, macos] Added $lineProgress expression variableMinh Nguyễn2018-10-301-0/+8
|
* [ios, macos] Fixed crash on nullary vararg expression functionMinh Nguyễn2018-10-271-1/+37
| | | | Equate the nullary and unary forms of vararg-style aftermarket expression functions when converting to JSON objects.
* [iOS] Add fallbacks for name fields (#12387)Lloyd Sheng2018-07-261-4/+5
| | | | | | | | * Add fallbacks for name fields * Add a fallback for `name_zh-Hant` * Update changelog
* [ios, macos] Convert token strings to expressions on inputJohn Firebaugh2018-07-201-41/+0
| | | | Removes mgl_expressionByReplacingTokensWithKeyPaths and associated code. Converting on output is no longer necessary: from the prior commit, core converts token strings to expressions at parse time; all that's necessary is to ensure that the runtime styling API does so as well.
* [ios, macos] Allow unwrapped arguments in match expressionsMinh Nguyễn2018-07-091-0/+7
|
* [ios, macos] Fix keypath expressions, json object is parsed incorrectly for ↵Fabian Guerra Soto2018-05-231-0/+12
| | | | | | | | nested keypaths. (#11959) * [ios, macos] Fix keypath expressions, a json object is parsed incorrectly for nested keypaths. * [ios, macos] Update changelogs.
* [ios, macos] Support array values in match expressions. (#11866)android-v6.2.0-alpha.1Fabian Guerra Soto2018-05-171-0/+6
| | | | | | | | | | * [ios, macos] Support array values in match expressions. * [ios, macos] Update mgl_match documentation. * [ios, macos] Update changelogs. * [ios, macos] Clarify match expressions documentation.
* Merge branch 'release-boba' into masterupstream/fabian-merge-release-4.0.1-masterFabian Guerra2018-05-171-0/+69
|\ | | | | | | | | | | | | | | | | | | | | | | # Conflicts: # mapbox-gl-js # platform/android/CHANGELOG.md # platform/android/MapboxGLAndroidSDK/gradle.properties # platform/android/gradle/dependencies.gradle # platform/darwin/src/MGLVectorTileSource.mm # platform/darwin/src/MGLVectorTileSource_Private.h # platform/ios/CHANGELOG.md # src/mbgl/style/expression/compound_expression.cpp
| * [ios, macos] Add to-rgba expression operator. (#11725)Fabian Guerra Soto2018-05-071-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios, macos] Add expression support to to-rgba operator. * [ios, macos] Update style docs. * [ios, macos] Refactored to-rgba to to-color. * [ios, macos] Add support for to-rgba expression operator. * [ios, macos] Add multiple parameters support to to-color operand. * [ios, macos] Enable to-rgba operator for MGLColor or key path expressions. * [ios, macos] Update predicates and expressions guide to reflect cast changes. * [ios, macos] Update changelogs. * [ios, macos] Clarify color casting usage.
| * [ios, macos] Add support for subscripting in expressions. (#11770)Fabian Guerra Soto2018-05-041-0/+27
| | | | | | | | | | | | | | | | * [ios, macos] Add support for subscripting in expressions. * [ios, macos] Update changelogs. * [ios, macos] Refactor LAST subscripting expression.
| * [ios, macos] Raise exceptions for empty expression stops dictionaries (#9539)Julian Rex2018-04-261-0/+10
| |
* | [ios, macos] Update minimum deployment versions to iOS 9, macOS 10.11 (#11776)Jason Wray2018-04-271-40/+23
|/ | | | | | | | | | | | | | | | | | | * [ios] Remove iOS 8 conditionals * [ios, macos] Bump pod deployment targets * [ios, macos] Add changelog entries * [ios, macos] Update docs * Remove unnecessary selector-based version checks * Update SQLite note * [ios, macos] Replace lightweight generics macros with direct use Lightweight generics for Foundation collections are available everywhere with the bump to iOS 9 and macOS 10.11. * Update deprecated macOS method
* [ios, macos] Rename featureProperties to featureAttributes. (#11748)Fabian Guerra Soto2018-04-231-3/+3
| | | | | | | | | | * [ios, macos] Rename featureProperties to featureAttributes. * [ios, macos] Update style documentation. * [ios, macos] Remove featureProperties variable tests. * [ios, macos] Update the changelogs.
* [ios, macos] Add trigonometric support to NSExpression. (#11716)Fabian Guerra Soto2018-04-171-0/+50
| | | | | | | | | | | | | | | | | | * [ios, macos] Add acos NSExpresssion operator. * [ios, macos] Add asin NSExpresssion operator. * [ios, macos] Add atan NSExpresssion operator. * [ios, macos] Add cosine NSExpresssion operator. * [ios, macos] Add sine NSExpresssion operator. * [ios, macos] Add tangent NSExpresssion operator. * [ios, macos] Add log2 NSExpresssion operator. * [ios, macos] Update style authors documentation.
* [ios, macos] Add NSExpression convenience constructors and helper methods. ↵Fabian Guerra Soto2018-04-161-0/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (#11278) * [ios, macos] Refactor convinience expression initializers. # Conflicts: # platform/darwin/src/NSExpression+MGLAdditions.h # platform/darwin/src/NSExpression+MGLAdditions.mm # platform/ios/app/MBXViewController.m * [ios, macos] Add MGL_MATCH convenience method. # Conflicts: # platform/darwin/src/NSExpression+MGLAdditions.h # platform/darwin/src/NSExpression+MGLAdditions.mm # platform/darwin/test/MGLExpressionTests.mm * [ios, macos] Add Swift friendly convenience methods name syntax.. # Conflicts: # platform/darwin/src/NSExpression+MGLAdditions.h * [ios, macos] Update runtime styling examples. # Conflicts: # platform/ios/app/MBXViewController.m * [ios, macos] Add NSExpression variable expressions properties. * [ios, macos] Clarify convenience initializer names. * [ios, macos] Update Style Authors guides. * [ios, macos] Fix cherry-pick merge. * [ios, macos] Update convenience initializers documentation.
* Localize expressions more thoroughly (#11651)Minh Nguyễn2018-04-161-0/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios] Removed changelog entry for Terrarium The broader feature is new to v4.0.0 as well. * [ios, macos] Localize expressions more thoroughly Replaced the MGLStyle.localizesLabels property with a -localizeLabelsIntoLocale: method that allows the caller to specify the locale to localize into. Also exposed a per-expression localization method for developers who want to vary behavior from layer to layer. * [macos] Offer English labels if preferred language is unsupported * [ios, macos] Removed dead code * [ios] Use new localization method in iosapp * [ios, macos] Fixed local name labels * [ios, macos] Convert tokens to key path expressions in stop dictionaries * [ios, macos] Streamlined token upgrading Separated token upgrading into a separate process that only happens as part of the MGLSymbolStyleLayer.text and MGLSymbolStyleLayer.iconImageName properties’ getters, so that it’s easy to remove later when mbgl changes obviate this workaround. Removed the replacesTokens parameter to the expression localization methods. * [ios, macos] Preserve whitespace between tokens * [ios, macos] Moved token replacement to a consistent category Fixed a build warning. * [ios, macos] Replace tokens in all string-typed getters For consistency, replace tokens with key paths in all string-typed style paint and layout properties. * [ios, macos] Test token replacement Added tests for replacement of tokens with key paths in expressions. Fixed token replacement for raw strings in stop dictionaries. Avoid sticking a single string inside an mgl_join: call. * [ios, macos] Test token replacement, localization Added unit tests of token replacement and localization of expressions. Only NSExpression is responsible for resolving the preferred language now, since NSLocale tends to tack a region code onto the locale identifier and the NSExpression method can be called independently anyways. Added a private variation of +[MGLVectorTileSource preferredMapboxStreetsLanguage] that takes an array of preferred languages. Fixed localization of non-expressions in stop dictionaries. * [ios, macos] Dictionary keys aren’t necessarily zoom levels
* [ios, macos] Remove mgl_ prefix from built-in expressions variables. (#11689)Fabian Guerra Soto2018-04-161-7/+7
|
* [ios, macos] Renamed expression initializer to be more SwiftianMinh Nguyễn2018-04-111-62/+62
|
* Add abs, round, floor, ceil operators (#11653)Anand Thakker2018-04-111-18/+34
| | | | | | | | | | | | | | | | | | | | * Add abs, round, floor, ceil operators Port of https://github.com/mapbox/mapbox-gl-js/pull/6496 * [ios, macos] Simplified abs, ceiling, floor expressions * [ios, macos] Added rounding expression function * [android] - binding integration for round, ceil, floor and abs expressions * Update mapbox-gl-js to include non-integer rounding test * Drop extra braces * mapbox-gl-js -> master * Update style-spec docs -> PropertyFactory.java
* [ios, macos] Distinguish between conditionals and expressions in case expressionMinh Nguyễn2018-04-061-1/+15
|
* Eviscerate mbgl expression to Foundation JSON object conversion (#11389)Minh Nguyễn2018-03-301-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios, macos] Eviscerate mbgl expression to Foundation JSON object conversion * [ios, macos] Remove literal special case MGLJSONObjectFromMBGLValue() is just a literal translation from C++ types to Foundation types; no need for expression-specific literal wrapping. * [ios, macos] Implemented RGB(A) operators * [ios, macos] More robust color conversion * [macos] Create calibrated RGB from expression on Sierra * [macos] Calibrate colors in expressions at runtime * [ios, macos] Special-case number conversion without fallbacks * [ios, macos] Test mgl_number expressions * [ios, macos] Updated tests for aftermarket expressions * [ios, macos] Relax roundtripping requirement for serialize() * [ios, macos] Fixed interpolation expression tests * [ios, macos] Removed dead code * [ios, macos] Fixed color conversion on Sierra
* Install aftermarket expression functions (#11472)Minh Nguyễn2018-03-291-31/+161
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios, macos] Introduced more ergonomic expression concatenation syntax * [ios, macos] Fixed mgl_join: * [ios, macos] Simplified expression document headings * [ios, macos] Documented mgl_join: * [ios, macos] Convert length operator to length: for strings Only works for literal strings. * [ios, macos] Implemented type conversion using CAST() * [ios, macos] Aftermarket let expressions * [ios, macos] Refactored aftermarket expression functions Refactored the installation of aftermarket expression functions to use macros. It is no longer necessary to handwrite the type encoding of a function. Also added aftermarket functions for interpolating and stepping. * [ios, macos] Updated documentation, tests, demo apps * [ios, macos] Added generic expression function * [ios, macos] Add MGL_MATCH function placeholder. * [ios, macos] Add MGL_SWITCH expression operator. * [ios, macos] Add mgl_coalesce: as expression function. * [ios, macos] Update style documentation. * [ios, macos] Add conventional custom function support. * [ios, macos] Updated example code * [ios, macos] Add mgl_coalesce conventional custom function support. * [ios, macos] Add aftermarket function to 'has' operator. * [ios, macos] Add documentation for lookup and feature operators. * [ios, macos] Documented simple lookup * [ios, macos] Renamed, reversed has expression Renamed mgl_hasProperty:properties: to mgl_does:have: for better readability and consistency with the conventional mgl_has: function. Documented both forms of mgl_has:. * [ios, macos] Restored OEM conditionals where available This is the preferred syntax for simple conditionals on iOS 9 and above, because you can inline the predicate instead of wrapping it in a constant value expression, which means you can write a conditional in a single format string. * [ios, macos] Update style docs. Co-authored-by: Fabian Guerra <fabian.guerra@mapbox.com>
* [ios, macos] Add lookup and feature operators. (#11528)Fabian Guerra Soto2018-03-281-0/+57
| | | | | | | | | | | | | | * [ios, macos] Add Expressions 'at' operator. * [ios, macos] Implement 'has' operator. * [ios, macos] Implement expressions feature operators. * [ios, macos] Refactor expressions variable name and 'mgl_has' implementation. * [ios, macos] Refactor expresssion variable names. * [ios, macos] Update 'mgl_has' to support non-self operands.
* [ios, macos] Add match expressions support. (#11464)Fabian Guerra Soto2018-03-261-0/+31
| | | | | | | | | | | | | | * [ios, macos] Add match expressions support. * [ios, macos] Add coalesce operator support. * [ios, macos] Add coalesce operator test. * [ios, macos] Match operator implementation is moved to NSPredicate. * [ios, macos] Match operator function implementation refactor. * [ios, macos] Address merge conflicts.
* [ios, macos] Change the format for case expressions to a flat structure. ↵Fabian Guerra Soto2018-03-261-21/+22
| | | | | | | | | | | | (#11450) * [ios, macos] Change the format for case expressions to a flat structure. * [ios, macos] Add support for multiple branches case expression. * [ios, macos] Add multiple branch tests to case expressions. * [ios, macos] Case operator now has iOS 8 support.
* [ios] Disable -[MGLExpressionTests testConditionalExpressionObject] on iOS 8Jason Wray2018-02-201-17/+21
| | | | Temporarily disable this test until iOS 8 compatibility is added.
* Reimplement style values atop NSExpression (#10726)Minh Nguyễn2018-01-241-3/+456
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios, macos] Import headers, not implementation files * [core] Added accessors for various expression parameters Added missing parameter accessors to various expression operator classes, as well as a method on InterpolatorBase and Step that enumerates the stops and their values. * [ios, macos] Silenced warning in test of error condition * [ios, macos] Made MGLSphericalPosition boxable * [ios, macos] Implemented array enumeration during conversion * [ios, macos] Temporarily ignore heatmap layer type * [ios, macos] Migrated MGLSymbolStyleLayer.text to NSExpression MGLSymbolStyleLayer.text is now of type NSExpression instead of MGLStyleValue, as a first step toward migrating the entire layer API from style values to expressions. Implemented conversions from NSExpression to JSON arrays and vice versa. The most common NSExpression functions are now converted into style expressions, but not all of the most common style expression operators are supported yet. * [ios, macos] Implemented string coercion * [ios, macos] Color literals * [ios, macos] Null constant expressions * [ios, macos] Convert dictionary literals * [ios, macos] Interpolation expressions * [ios, macos] to-boolean, to-number, get from object * [ios, macos] Variable expressions Implemented custom expression functions for assigning and referring to variables within the context of an expression. Variables are assigned via a “context dictionary” and applied to an subexpression that is given as another argument to the same expression. Also implemented built-in variable expressions for zoom level and heatmap density. * [ios, macos] Convert colors, offsets, padding in expressions to JSON objects * [ios, macos] Expression-based style property getters Implemented a conversion from mbgl::style::PropertyValues to Objective-C JSON objects, which are then converted to NSExpressions. * [ios, macos] Consolidated property value–expression conversion in MGLStyleValueTransformer * [ios, macos] Predicate and expression guide Extracted documentation about predicates from a documentation comment in MGLVectorStyleLayer.h to a new jazzy guide. Added details about NSExpression support as well. Began updating the “For Style Authors” guide to reflect the transition from style values to expressions. * [ios, macos] Updated style authoring guide Updated the Information for Style Authors guide to discuss expressions instead of style functions. Included a table mapping style specification expression operators to NSExpression syntaxes. * [ios, macos] Migrated codegen templates to expressions * [ios, macos] Applied expression changes via codegen Ran make darwin-style-code. * [macos] Migrated macosapp to expressions * [ios, macos] Updated style function guide This guide needs to be thoroughly rewritten, but for now the example code has been migrated to expressions. * [ios, macos] Eviscerated style function tests * [ios, macos] Updated changelogs * [ios] Migrated iosapp to expressions * [ios, macos] Exposed JSON conversion methods publicly * [ios, macos] Removed MGLStyleValue, MGLStyleFunction
* [ios, macos] Convert NSColor/UIColor expressions to CSS color string valuesMinh Nguyễn2017-02-181-169/+78
| | | | When converting a constant NSExpression to an mbgl::Value, turn an NSColor or UIColor into an std::string containing a CSS color string. This allows developers to set an attribute of an MGLFeature to an NSColor or UIColor (rather than a CSS color string, which would be foreign), then use it in an MGLStyleFunction with identity interpolation.
* [core] Introduce dedicated filter types for $type and $id special cases (#7971)John Firebaugh2017-02-091-0/+19
| | | | | | | | * [core] Introduce dedicated filter types for $type and $id special cases * [ios, macos] Special-case $id, $type in predicates Also support $id ≟ nil.
* [ios, macos] Cleaned up expression conversionMinh Nguyễn2017-01-041-24/+30
|
* [ios, macos] Fixed null expression crashMinh Nguyễn2016-12-231-0/+9
| | | | Convert NSNull into an mbgl null value.
* [ios] fixes #6248: properly handle all NSNumber types in filters (#6290)Justin R. Miller2016-09-161-0/+200