summaryrefslogtreecommitdiff
path: root/platform/darwin/test
Commit message (Collapse)AuthorAgeFilesLines
* [ios, macos] handle duplicate layer errorIvo van Dongen2016-12-131-0/+18
|
* [ios, macos] Load features into shape source if possible (#7339)Jesse Bounds2016-12-121-7/+14
| | | | | | | | | | | | | | | | | | | | This checks the kind of MGLShape passed into the source and, if it is a feature, it mbgl feature objects to pass to core. This keeps the feature id and attributes data intact. If the shape is a `MGLShapeCollectionFeature` it creates an `mbgl::FeatureCollection` object (also to keep feature properties). If the shape is not any sort of feature, it passes along just the geometry. This also uses the MGLFeatureFromMBGLFeature converter for the case where GeoJSON data passed in to a source contains a single feature. The converter has logic to keep the id and attributes properties intact. Before, these properties were lost because only geometry conversion was done. Finally, logic to handle (and associated tests) of nested shape collection features is removed since that is not supported by the GeoJSON spec or the core implementation. [ios] Add test of drawing plain shape to iosapp
* [ios, macos] Expanded source documentationMinh Nguyễn2016-12-102-4/+4
| | | | Also fixed a few stray references to GeoJSON sources.
* [ios, macos] Rename MGLGeoJSONSource to MGLShapeSource (#7334)Jesse Bounds2016-12-099-49/+49
|
* [ios, macos] Source-driven attribution (#5999)Minh Nguyễn2016-12-081-0/+115
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios, macos] Source-driven attribution Refactored MGLSource initialization. Implemented a new private class, MGLAttributionInfo, that parses an HTML attribution string from TileJSON and stores the resulting structured data. Added methods to MGLTileSet and MGLStyle to aggregate MGLAttributionInfos. On macOS, update the attribution view as soon as the source attribution changes. On iOS, fetch the current attribution information when displaying the action sheet. Removed hard-coded attribution strings. * [macos] Respect inline formatting in attribution HTML Apply a default font and color to attribution HTML as it is imported into an attributed string. Pass the attributed string into MGLAttributionButton as is, without stripping formatting. Avoid overriding the font and color after importing the HTML, in case these attributes are explicitly specified rather than intrinsic to a hyperlink. Constrain the top of the attribution view to all the attribution buttons, in case one of them needs additional headspace. * [ios, macos] Display unlinked attribution strings Unlinked attribution strings are represented on macOS as buttons that have the default cursor and do nothing when clicked. On iOS, they are action sheet buttons that do nothing but dismiss the action sheet. * [macos] Fixed random Auto Layout exception Auto Layout randomly finds itself unable to satisfy constraints when updating attribution, due to some spurious constraints between attribution buttons. Regenerate the entire attribution view every time the source attribution changes. * [ios, macos] Thoroughly dedupe attribution infos Also added a test to verify parity with the GL JS implementation. This implementation avoids sorting. * [ios, macos] Trim whitespace from attribution strings Also added parsing tests. * [ios, macos] Added attribution parsing tests for styles Included an emoji test to ensure that attribution strings are interpreted as UTF-8, to avoid mojibake. Included a test of removing the underline from a leading copyright symbol. * [ios, macos] Derive feedback link from source MGLAttributionInfo now detects feedback links in the attribution HTML code, and it is responsible for tailoring the feedback URL to the current viewport. Removed the hard-coded feedback action from the attribution sheet on iOS in favor of a source-derived feedback title and URL. Moved the feedback action from macosapp to MGLMapView; applications are now expected to hook an Improve This Map menu item to an MGLMapView action.
* [ios, macos] renamed raster-hue-rotateFredrik Karlsson2016-12-081-4/+4
|
* [ios, macos] Fix typo in exception name for style source identifier (#7315)Jesse Bounds2016-12-071-1/+1
|
* Prevent stopless functions (#7309)Fredrik Karlsson2016-12-074-2/+22
| | | | | | * [ios, macos] prevent stopless functions * [ios, macos] removed unused bridging header and fixed naming
* [ios, macos] fixed compiler warningsFredrik Karlsson2016-12-071-2/+2
|
* [ios, macos] renamed dasharray and icon sizeFredrik Karlsson2016-12-062-8/+8
|
* [ios, macos] MGLGeoJSONSource can now be initialized with any shapeFredrik Karlsson2016-12-063-39/+51
|
* [core, ios, macos] Add image accessor to MGLStyle (#7096)Roman Blum2016-12-056-0/+56
| | | | | | | | | | | | * [core] Add interface to get image from sprite atlas * [tests] Add tests for Map::getImage * [ios, macos] WIP: get MGLImage for name from style * [ios, macos] Fixed -imageForName: Convert from sprite images to platform images using the existing encodePNG() function, which is also used for printing. Allow -imageForName: to return nil without an assertion failure. Added a basic test.
* [ios, macos] Consolidate tests of MGLStyle addSource in MGLStyleTestsJesse Bounds2016-12-021-23/+37
| | | | | | | | | This replaces the integration test of `addSource` when duplicate identifiers are used in `MGLSourceTests` with a more direct unit test in the style class's unit test file `MGLStyleTests`. Although tests of the case where the same instance are actually integration tests where the source instance itself throws, it is easier to test all of this functionality in one place using the public facing MGLStyle API.
* [ios, macos] Raise NSException if layer or source added more than onceJesse Bounds2016-12-021-1/+60
| | | | | | | | | | | | | | When MGLSource and MGLLayer instances are added to the style, they lose ownership of their std::unique_ptr<T> after it is moved to the mbgl level. Subsequent attempts to add such instances result in a C++ exception. This adds logic in the Darwin platform to raise a NSException if the source and layer addToMapView methods are called more than once and the pointer is invalid. In addition, the documentation in MGLStyle for addSource: and addLayer: has been update to warn developers to avoid adding the same instance twice and, for that matter, instances with the same identifier.
* [ios, macos] Rename MGLMapViewTests back to MGLStyleLayerTestsJesse Bounds2016-12-0210-18/+18
|
* [ios, macos] renamed MGLStyleLayerTests to MGLMapViewTestsIvo van Dongen2016-12-0210-20/+20
|
* [ios, macos] Add back support for CONTAINS operatorJesse Bounds2016-12-011-0/+12
| | | | This reverts commit 6877e3efe73fb6e103c2635f1e4b1c1866b17d5c.
* [ios, macos] rename style spec propertiesFredrik Karlsson2016-11-306-173/+173
|
* [ios, macos] Fixed spurious offline storage test failureMinh Nguyễn2016-11-291-0/+1
| | | | Even if the expectation is immediately fulfilled, we still have to wait for it to be fulfilled, because the expectation only gets unregistered after waiting. The zombie expectation was fulfilling a stricter expectation in a test method.
* [macos] Enabled runtime styling testsMinh Nguyễn2016-11-021-0/+1
| | | | | | Added the style layer tests to the test bundle target. Set the access token to a bogus access token before running any tests. The macOS implementation of MGLMapView doesn’t even attempt to set a default style if the access token is missing, because in macosapp, the access token may be set asynchronously by the user when the preferences window appears.
* [ios, macos] Share more testsMinh Nguyễn2016-11-022-0/+324
| | | | Moved MGLGeoJSONSourceTests and MGLTileSetTests into platform/darwin/test/ and added them to the macOS project. Also added a private header needed to compile the tests to the macOS project.
* [ios, macos] Rationalized string enum namesMinh Nguyễn2016-11-021-2/+2
| | | | Renamed MGLGeoJSONSourceOption and MGLOfflinePackUserInfoKey constants for clarity and to remove redundancy in the Swift-bridged names. Left the old MGLOfflinePackUserInfoKey constants in place as deprecated aliases.
* [ios, macos] Added Swift MGLStyleValue testsMinh Nguyễn2016-10-262-0/+39
| | | | Added tests of MGLStyleValue written in Swift, along with bridging headers just in case they become needed in the future.
* Add MGLPointCollection for GeoJSON multipoints (#6742)Jesse Bounds2016-10-201-18/+19
| | | | | | | | | | | | | | | | * [ios, macos] Introduce MGLPointCollection This makes MGLMultiPoint abstract again so that it is only a place for shared functionality of polygons and polylines. The multipoint feature replaces the point collection feature and can be used to initialize a MGLGeoJSONSource. The previously added swift_names for polyline and polygon are removed, for now. This also updates the iOS and macOS annotation adding logic so that unwanted shapes really are avoided. Previously the combined OR conditions meant that an annotation had to logically be NOT a kind of all three types so the check always let the annotation slip through. This also expands the guard to deflect the new MGLPointCollection.
* [ios, macos] Expand changes to entire APIMinh Nguyễn2016-10-176-107/+99
|
* [ios, macos] Teach features and shapes about GeoJSON and mbgl typesJesse Bounds2016-10-141-0/+165
| | | | | | MGLShape subclasses can now return NSDictionaries that represent the shapes' GeoJSON geometries. MGLFeature classes can now return NSDictionaries that represent the features as GeoJSON features. This makes it trivial to serialize iOS and macOS shapes and features into GeoJSON. MGLFeature instances can also return a representation of themselves as an mbgl::Feature. This capability is used in a refactoring of the implementations of MGLGeoJSONSource to more efficiently transform MGLFeatures into mbgl::Features so they can be fed directly into mbgl::GeoJSONSource without having to round trip through NSJSONSerialization. The MGLFeature identifier is converted into the mbgl::identifier type based on the type of the identifier. The MGLFeature attributes are recursively converted into an mbgl::PropertyMap and each value is converted into one of the types that the PropertyMap's Value variant supports.
* [ios, macos] Simplified style property enum namesMinh Nguyễn2016-10-114-64/+64
| | | | The name of each enumeration type no longer refers to the layer type that uses it.
* [ios, macos] Revamped MGLStyleLayer, MGLSource inheritanceMinh Nguyễn2016-10-067-23/+25
| | | | | | | | | | Removed the MGLStyleLayer protocol, because almost none of its members was actually implemented in every class that adopted the protocol. Removed the unused mapView backpointer property with no replacement. Renamed MGLBaseStyleLayer to MGLStyleLayer. Created the intermediate abstract classes MGLForegroundStyleLayer and MGLVectorStyleLayer to cover subsets of style layer classes with like functionality. Moved each MGLBaseStyleLayer initializer and the corresponding properties down to an abstract subclass such that the initializer makes sense for all concrete subclasses. Moved more initializers and the predicate property up to MGLVectorStyleLayer to eliminate duplication among the concrete subclasses. Marked these initializers as designated initializers. Removed “source” or “layer” before identifier wherever the type of identifier is apparent. Removed extra MGLGeoJSONSource initializer variants in favor of nullable parameters. Added copious documentation comments for source and style layer classes, including several previously undocumented methods and properties. In particular, some preconditions and postconditions have been documented. Added pragma marks to break up the jazzy documentation pages into sections. Reformatted exceptions for consistency.
* [ios, macos] Remove support for CONTAINS operator (#6590)Minh Nguyễn2016-10-051-12/+0
| | | | | | * [ios, macos] Removed support for CONTAINS operator * [ios, macos] Removed CONTAINS test
* update style generation code for new style spec enum values docs (#6508)Justin R. Miller2016-09-301-4/+4
| | | | | | Documentation for enum values landed in mapbox/mapbox-gl-style-spec#510. This updates Android, iOS, and macOS documentation code gen scripts to capitalize on them.
* [ios, macos] increase timeout to 2 secondsFredrik Karlsson2016-09-211-2/+2
|
* [ios, macos] Short-circuit packs testMinh Nguyễn2016-09-211-3/+6
| | | | If the packs property is already populated, there’s no need to wait for a change notification.
* Better handling for undefined icon|text-rotation-alignment (#6253)Young Hahn2016-09-211-12/+12
| | | | | | * [core, ios, android] Use `auto` value for properties with calculated defaults * Fix render tests
* [ios, macos] Add more predicate operator to mbgl filter translationsJesse Bounds2016-09-211-3/+54
| | | Adds several new translations to prevent data loss.
* [ios] fixes #6248: properly handle all NSNumber types in filters (#6290)Justin R. Miller2016-09-161-0/+200
|
* [ios, macos] Put MGLStyleLayer inits in respective classesJesse Bounds2016-09-087-7/+7
| | | | | | | | | | | | | | | | | | | | | | | Previously, we declared MGLStyleLayer initializers in the MGLStyleLayer protocol as optional methods. This made it easy to opt in and out of initializers that did or or did not make sense for the subclass. However, this approach was dangerous since it was easy for an application developer to initialize an MGLStyleLayer subclass with an init method that was actually not implemented in that class causing an exception at runtime. This commit moves the init methods that each subclass supports to each subclass so xcode (and the compiler) help the developer avoid the previously possible runtime exception. In addition, a new init method is added that takes the source layer and passes that on to `mbgl::style:Layer` (but only on classes where this is possible in core). This allows an application developer to style a specific source layer (i.e. the contour lines of the mapbox terrain vector source). Finally, this refactors MGLStyleLayer classes to use an MGLSource instead of a string identifier for the source when initializing the style.
* [ios] Check for bool value with charJesse Bounds2016-09-021-1/+3
| | | | | | | | | | | | | | We convert NSNumbers (and NSStrings) to the appropriate mbgl value so that we can use NSPredicates to describe mbgl filters we want to apply to style layers at runtime. This change fixes an issue where the conversion from an NSNumber that represented a bool was not recognized as such. encode(bool) returns a 'c' or 'b' on 32 bit and 64 bit systems respectively and objCType of an NSNumber representing a bool always returns 'c'. Now the implementation checks for 'c' always and NSNumbers representing bool don't fall through and trigger the exception.
* [ios] Added support for filters (NSPredicate)Fredrik Karlsson2016-09-023-2/+178
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ios, macos] cleaned up filters [ios] added a filter example [ios] utest filters [ios, macos] nested predicates [ios] refactored [ios] filter -> NSPredicate [ios] fixed mbgl::Any/AllFilter -> NSPredicate [ios] translate nested mbgl::NotIn filters [ios] cleanup and added more utests [ios] fixed a bug in the None filter conversion and improved utests [ios, macos] doc [macos] added missing category [ios, macos] additional utests [ios, macos] updated documentation
* [ios, macos] Test roundtripping property functionsMinh Nguyễn2016-08-268-16/+291
|
* [ios, macos] Test enum values, not just typesMinh Nguyễn2016-08-264-16/+16
|
* [ios, macos] Simplified test code generationMinh Nguyễn2016-08-266-140/+140
|
* [ios, macos] Offsets as vectors, padding as edge insetsMinh Nguyễn2016-08-191-6/+15
| | | | | | An offset style attribute is now exposed publicly as an NSValue representing a CGVector instead of an NSArray of NSNumbers. A padding style attribute is now exposed publicly as an NSValue representing an NSEdgeInsets or UIEdgeInsets instead of an NSArray of NSNumbers. This change also fixes round-tripping of padding values due to a difference between the style specification and Foundation regarding the order of edges around a box. Used a designated initializer on NSEdgeInsets/UIEdgeInsets to ensure correct order when converting from C++ to Objective-C. Fixes #5947, fixes #6065.
* [ios, macos] Fixes #5975 Add source getter to MGLStyleFredrik Karlsson2016-08-181-0/+2283
|
* [ios, macos] Fixed incorrect assignment in style layer testsMinh Nguyễn2016-08-181-1/+1
| | | | Fixes #5992.
* [ios, macos] Replaced testAAALoadPacks with a setUp method (#6007)Minh Nguyễn2016-08-151-12/+16
| | | XCTest apparently no longer executes tests in alphabetical order, so naming the test testAAALoadPacks doesn’t ensure it gets run first. Instead, put the pack loading test inside -setUp, but also put it inside a dispatch_once() block to ensure that it only gets run before the first offline storage test that gets run in the current process.
* Runtime styling API for iOS/macOS (#5727)Fredrik Karlsson2016-08-1110-0/+422
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios] wip runtime styling * [ios, macos] Outlined header templates * [ios, macos] cleanup and use appropiate data types * [ios, macos] removed refs to mbgl and added convenient color methods on UIColor and NSColor * [ios, macos] updated header template, included doc string * [ios, macos] outlined template for layer implementation files * [ios, macos] moved script to platform/darwin and updated comments * [ios, macos] Cleaned up the implementation template * [ios, macos] removed unused function and added support for more datatypes * [ios, macos] overhauling the type protocols * [ios, macos] removed unnecessary style classes * [ios, macos] added support for more types * [ios, macos] fixed string and number prop values * [ios, macos] enum getters * [ios, macos] added removeLayer() and removed unused layer ref * [ios, macos] fixed remaining layer types and converted style layer into a protocol * [ios, macos] fixed addLayer() and added example for line layer * [ios] GeoJSON source now works * [ios] fixed raster layer and raster source * [ios] fixed attr prop number and outlined prop function * [ios] wip functions * [ios] bool and float function fix * [ios] cleanup * [macos] fixed support for macos * [ios] fixed string functions * [ios] extended array functions * [ios] added tests and fixed a few bugs * [ios] less verbose functions and improved tests * [ios, macos] Removed unnecessary use of default arguments Default arguments aren’t supported in Node v4, and they aren’t needed here anyways, because we’re only testing for truthiness. * [ios, macos] Enum setters Rely on a macro instead of category methods to specialize the setter implementation for enum attributes, since generic types are disallowed in Objective-C method signatures and mbgl::style::PropertyType must be type-qualified. * [ios, macos] Got macOS closer to parity w/ iOS Added various classes and test classes to the macOS workspace. Also fixed lots of compiler errors and updated macosapp runtime styling example to use the new dictionary syntax for function stops. Updated all conversions from Objective-C stops to C++ stops to enumerate over the dictionary. Fixed compiler errors in enum setter implementations. Also corrected path to script in generated file comments. * [ios, macos] Added EJS templates to project * [ios, macos] Code formatting Made code format more consistent. * [ios, macos] Spelled out ID Cocoa convention is to always spell out “ID” as “identifier”, in part to avoid confusion with the id keyword. Also, URL is capitalized in most contexts, including property names. * [ios, macos] Grouped related headers together * [ios, macos] Cleaned up layer transformation Also added support for converting background layers into Objective-C. * [ios, macos] Cleaned up tests Also made the tests work on macOS by introducing a new window to host the map. * [ios, macos] Replaced TODOs with #warnings * [ios] convert array based property values * [ios, macos] color function/undefined getter * [ios, macos] fixed function/undefined getters for bool and float properties * [ios, macos] more function/undefined property getters * [ios, macos] more type conversion and cleanup * [ios, macos] disable macos runtime styling tests for now * [ios, macos] cleaned up style code script * [ios, macos] more type conversion * [ios] added a base layer to handle visibility min/max zoom * [macos] fixed base layer * [ios, macos] use accessor methods * [ios, macos] cleanup * [ios, macos] add geojson to ios and macos * [macos] rebase fix * [ios, macos] fixed enum getters and added tests for enums * [ios, macos] added an update method to base layer * [ios, macos] added some documentation * [ios, macos] docs * [ios, macos] removed refs to filters for now * [ios, macos] various tail work * [ios, macos] missing import and incorrect type
* [ios, macos] Offline storage size APIMinh Nguyễn2016-07-181-0/+4
| | | | | | Added a property to MGLOfflineStorage that indicates the disk space occupied by all cached and offline resources. Fixes #5580.
* [core] Add support for $id key to filtersJohn Firebaugh2016-07-181-8/+9
| | | | https://github.com/mapbox/mapbox-gl-style-spec/issues/391
* Merge branch 'release-ios-v3.3.0' into masterJesse Bounds2016-07-071-5/+6
|\
| * [ios] Move cache.db to a subdirectory (#5601)Jason Wray2016-07-071-5/+6
| | | | | | | | | | | | | | | | | | | | | | We cannot guarantee that the offline/ambient tile cache (cache.db) will be created in a timely manner, so it's safer to set the backup exclusion key on its containing directory. But, because we placed cache.db in the base of the app's Application Support directory (where backups are expected to be allowed), we need to move cache.db into a directory that we control and can exclude from backups with impunity. This is an amalgam of https://github.com/mapbox/mapbox-gl-native/pull/5578 (directory exclusion) and https://github.com/mapbox/mapbox-gl-native/pull/5585 (refactored URL methods, but without the new database size method). Also: * Prefix mapbox subdirectory with dot, for extra safety * Update changelog entry with new ticket, less speculation