summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLDocumentationExampleTests.swift
diff options
context:
space:
mode:
authorFabian Guerra Soto <fabian.guerra@mapbox.com>2019-03-19 14:53:35 -0700
committerAlf Watt <alf.watt@mapbox.com>2019-03-21 12:25:10 -0700
commit4ada14cfde5d32076855a777605d9a090e041ad0 (patch)
treec6989d6dc31340dc0e5954d3caeafa9661b45415 /platform/darwin/test/MGLDocumentationExampleTests.swift
parent42aeaf4f40f4281197ff4a3580617306c140d355 (diff)
downloadqtlocation-mapboxgl-4ada14cfde5d32076855a777605d9a090e041ad0.tar.gz
[ios, macos] Add text-color support to format expressions. (#14146)
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.
Diffstat (limited to 'platform/darwin/test/MGLDocumentationExampleTests.swift')
-rw-r--r--platform/darwin/test/MGLDocumentationExampleTests.swift18
1 files changed, 18 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift
index 91fb02dfd2..45efe4c591 100644
--- a/platform/darwin/test/MGLDocumentationExampleTests.swift
+++ b/platform/darwin/test/MGLDocumentationExampleTests.swift
@@ -542,6 +542,24 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate {
}
}
+ func testMGLAttributedExpression() {
+ //#-example-code
+ #if os(macOS)
+ let redColor = NSColor.red
+ #else
+ let redColor = UIColor.red
+ #endif
+ let expression = NSExpression(forConstantValue: "Foo")
+ let attributes: Dictionary<MGLAttributedExpressionKey, Any> = [.fontNamesAttribute : ["DIN Offc Pro Italic",
+ "Arial Unicode MS Regular"],
+ .fontSizeAttribute: 1.2,
+ .fontColorAttribute: redColor]
+ let attributedExpression = MGLAttributedExpression(expression, attributes:attributes)
+ //#-end-example-code
+
+ XCTAssertNotNil(attributedExpression)
+ }
+
// For testMGLMapView().
func myCustomFunction() {}
}