summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLStyleTests.mm
Commit message (Collapse)AuthorAgeFilesLines
* [core, darwin] Object identity for MGLSource*, MGLStyleLayer*John Firebaugh2017-04-131-0/+2
| | | | All `MGLSource` pointers referencing the same logical source will now be object identical; similarly for `MGLStyleLayer`.
* [ios, macos] Make source removal consistent with layer removalJesse Bounds2017-02-231-4/+38
| | | | | | | | | | | | | | | This refactors the source removal methods to make them consistent with the way layers are removed. This makes removal of nonexistent sources and removal of sources of a different type but same identifier as a previously added source a no-ops. As with layers, the check at the top of the method to ensure that the raw pointer is the same as the one in mbgl for the same identifier string should make it impossible to attempt to remove a source of a different type than the one in mbgl for the same identifier. However, for consistency with the layer implementation, the reinterpret_cast has been replaced with a dynamic_cast and check for nullptr.
* [ios, macos] Simplify implementation of layer removal from map viewJesse Bounds2017-02-231-1/+16
| | | | | | | | | | | This reverts a previous change that recreated the pending and raw layer pointers if an identifier match caused a layer to be removed but the removed layer was of a different type than the layer triggering the removal This refactors the pointer replacement to use a simpler solution that returns early if the layer does not have a raw pointer loaded in the mbgl map instance.
* [core, ios, macos] Return null when removing nonexistent sourceJesse Bounds2017-02-231-0/+17
|
* [ios, macos] Recreate pending and raw layer ref when layer is removedJesse Bounds2017-02-231-0/+38
|
* [ios, macos] Fixed runtime styling deprecation warningsMinh Nguyễn2017-02-081-0/+3
|
* [core] remove trailing whitespace, add trailing newlines, add space after //Konstantin Käfer2017-01-271-21/+21
|
* [ios, macos] Rewrote style layer testsMinh Nguyễn2017-01-131-1/+38
| | | | | | | | 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.
* [ios, macos] Made style-related tests more robustMinh Nguyễn2017-01-121-22/+19
| | | | Removed UIViewController from MGLStyleLayerTests on iOS, because we aren’t really testing integration at that level. Switched to delegate-based expectation fulfillment for both MGLStyleLayerTests and MGLStyleTests, conditionalized on whether the style has already loaded, to avoid race conditions that bleed into other tests.
* [ios, macos] Make MGLMapView.style property nullable (#7664)Minh Nguyễn2017-01-111-6/+16
| | | | | | | | | | | | * [ios, macos] Made MGLMapView.style property nullable MGLMapView’s style property is now nullable (optional in Swift). The property is set to nil while the style loads and in the event that the style has failed to load. * [ios, macos] Switch to delegate method * [macos] Create MGLMapView programmatically for layer tests When MGLMapView is created via a nib, -initWithCoder: is called, causing styleURL to be set to nil, in turn causing the default Streets style to be loaded, fooling MGLStyleLayerTests into thinking one-line has been loaded. Instead, create MGLMapView programmatically, passing the intended style URL into the initializer, preventing Streets from being loaded.
* [ios, macos] Insert example code in original headers (#7569)Minh Nguyễn2017-01-041-20/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios, macos] Removed extraneous code fences * [ios] Streamlined example delimiters Use test method names as names of example blocks and test method documentation comments as front matter for examples. Set off example blocks using a syntax similar to playground markup syntax. Avoid hard-coding indentation levels. Trigger Xcode build error when an error occurs in the script. * [ios] Removed platform-specific code from examples * [ios] Fixed logic error The comment said 200 while the code said 1,500. * [ios] Formalize build phase input * [ios] Insert examples into original source documentation Rewrote the example code insertion script to work on the original source files and overwrite any existing code examples on the same symbols. The script uses SourceKitten to find the documentation comment for the symbol named by the test method. Replaced the Run Script build phase that runs the example code insertion script with a make rule that runs the same script. Inlined skeleton examples minus the contents of the code blocks. * [ios] Fixed syntax error * [ios] Ran ios-add-examples-to-docs * [ios] Avoid touching unchanged headers * [ios] Refactored example insertion script * [ios] Point jazzy at original sources * [ios] Invoke SourceKitten only once * [ios] Look for methods as well as properties * [ios] Thoroughly search for code blocks in doc comments Refactored the example code insertion script to index test methods by their names, then recursively search the SourceKitten output for documentation comments that contain Swift code blocks, replacing each code block with the associated test method body. * [ios, macos] Enabled example insertion for macOS The example code insertion script is now platform-agnostic. * [ios, macos] Fixed documentation example tests Set the map view’s style to a minimal local JSON file. Wait for the style to finish loading before running each test. Corrected CGVector type. * [ios, macos] Dry run mode The output of this mode isn’t a good indicator of whether any files would’ve needed to be changed, because the presence of a conditional compilation block in one of the test methods means this script would always change and revert the corresponding comment. * [ios] Fixed test failure The iOS implementation of MGLMapView tries to show the Streets style by default even if no access token has been set. Avoid a race condition and frequent test failure by specifying the minimal style on initialization. * [ios, macos] Ensure SourceKitten is installed before inserting example code * [ios, macos] Tear down map view after each test Keep map views from previous tests from hanging around, potentially obscuring the result of a subsequent test. Set the access token to a bogus token upfront for all style layer tests. Unified MGLStyle usage within MGLStyleTests. * [ios, macos] Reinsert examples after generating runtime styling headers
* [ios, macos] reversed MGLStyle.layersFredrik Karlsson2016-12-221-0/+32
|
* [ios, macos] Simplify MGLSource and subclasses (#7377)Minh Nguyễn2016-12-131-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [ios, macos] Audited source headers for nullability * [macos] Made MGLTileSet public * [ios, macos] Replaced MGLTileSet with MGLTileSource MGLRasterSource and MGLVectorSource now share a common abstract superclass, MGLTileSource. MGLTileSet has been removed. MGLTileSource is modeled after mbgl::style::RasterSource and mbgl::style::VectorSource. It has initializers that incorporate the parameters of MGLTileSet’s initializers, but it lacks getters for everything but the attribution string. MGLTileSet’s properties have been converted into options that can be passed into MGLTileSource’s initializers in a dictionary. Properly implement rawSource as a covariant property so that it doesn’t end up getting autosynthesized as a shadow ivar. This prevents concrete subclasses of MGLSource from setting _rawSource directly but getting a different value out of self.rawSource. Marked -[MGLSource init] as unavailable and ensured that concrete subclasses of MGLSource have the right set of initializers marked as designated initializers. Documentation comments for each concrete source class identify the corresponding source type in the style specification. Clarified the purpose of MGLTileSetScheme, now known as MGLTileCoordinateSystem. * [ios, macos] Clarified tile size interpretation Sticking to a default value of 256 for mapbox: URLs, but other URLs get the standard 512 value. * [ios, macos] rawSource is always set * [ios, macos] Cleaned up MGLShapeSource initialization rawSource is never nil, so there’s no need for a -commonInit method. Extracted -geoJSONOptions from MGLShapeSource into a standalone function for easier testing. * [ios, macos] Synchronized headers in project Realphabetized headers in groups. Added headers missing from one project or the other. * [ios, macos] Added MGLShape methods to (de)serialize GeoJSON data Added a class initializer and instance method to MGLShape that deserialize and serialize the shape as GeoJSON data, respectively. The new initializer handles parsing errors gracefully. Removed methods specific to GeoJSON data from MGLShapeSource, in an effort to reduce parallel state. Developers are now expected to go through the new MGLShape initializer to get an MGLShape representation. Alternatively, a local file URL can be passed into the other MGLShapeSource initializer. * [ios, macos] Typo in assertion message * [ios, macos] Simplified GeoJSON serialization Every MGLShape now knows its most specific mbgl::GeoJSON representation. * [ios, macos] Reremoved MGLFeaturePrivate mbgl::GeoJSON, which is a variant, allows a single GeoJSON representation method to traffic in whatever type is needed for a particular shape class. This change removes some hidden private protocols, which are a bug waiting to happen. * [ios, macos] Fixed covariant rawLayer property Properly implement rawLayer as a covariant property so that it doesn’t end up getting autosynthesized as a shadow ivar. This prevents concrete subclasses of MGLStyleLayer from setting _rawLayer directly but getting a different value out of self.rawLayer. * [ios, macos] Use MGLAttributionInfo for source attribution Made MGLAttributionInfo public. Replaced MGLTileSource’s attribution property with an attributionInfos property set to an array of MGLAttributionInfo objects. Added an MGLTileSourceOption for specifying an array of MGLAttributionInfo objects instead of an HTML string (either is acceptable when creating an MGLTileSource). * [ios, macos] Corrected method references in documentation
* [ios, macos] handle duplicate layer errorIvo van Dongen2016-12-131-0/+18
|
* [ios, macos] Expanded source documentationMinh Nguyễn2016-12-101-2/+2
| | | | Also fixed a few stray references to GeoJSON sources.
* [ios, macos] Rename MGLGeoJSONSource to MGLShapeSource (#7334)Jesse Bounds2016-12-091-5/+5
|
* [ios, macos] Fix typo in exception name for style source identifier (#7315)Jesse Bounds2016-12-071-1/+1
|
* [ios, macos] MGLGeoJSONSource can now be initialized with any shapeFredrik Karlsson2016-12-061-2/+2
|
* [core, ios, macos] Add image accessor to MGLStyle (#7096)Roman Blum2016-12-051-0/+24
| | | | | | | | | | | | * [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.
* Merge branch 'release-ios-v3.2.2' into 1ec5-release-ios-v3.2.2-masterMinh Nguyễn2016-05-101-0/+6
|
* [ios, osx] Reformatted documentation commentsMinh Nguyễn2016-05-101-1/+1
| | | | Reformatted documentation comments in public headers in the OS X SDK and public headers shared between the iOS and OS X SDKs to wrap at column 80 and avoid excessive indentation that causes SourceKitten to detect code blocks.
* [ios, osx] Renamed version constant, linked to more infoMinh Nguyễn2016-05-061-13/+31
| | | | | | Renamed MGLStyleCurrentVersion to MGLStyleDefaultVersion to emphasize the constant’s role as an indicator of the default version used by SDK classes, which may be behind depending on release schedules. In the documentation for each style URL method, include the actual version number instead of the constant. In unit tests, verify that this documentation is in sync with the constant. Link each style URL method’s documentation to a forthcoming webpage on mapbox.com that describes the style in rich detail.
* [ios, osx] Renamed Hybrid to Satellite StreetsMinh Nguyễn2016-05-061-1/+1
| | | | The style ID has also changed, but the unversioned method will continue to point to the old v8 style ID.
* [ios, osx] Pin unversioned style URL APIs to v8 stylesMinh Nguyễn2016-05-061-5/+5
|
* [core, ios, osx] Version default style URL APIs; deprecated EmeraldMinh Nguyễn2016-05-061-4/+59
| | | | | | | | | | Updated default styles from v8 to v9. Deprecated the MGLMapView class methods in favor of new methods that take a version parameter. Deprecated Emerald outright in favor of Outdoors. Replaced usage of the unversioned MGLStyle methods with the corresponding versioned methods and MGLStyleCurrentVersion to ensure consistency. Expanded MGLStyle unit tests to also assert that MGLStyle has the right number of style URL methods and that they’re all public. Linked the OS X SDK unit test bundle to libmbgl-core.a. Removed an unnecessary dependency on osxapp. Replaced Emerald with Outdoors in iosapp and osxapp. Fixes the iOS and OS X side of #4577 and #4702.
* [ios, osx] Took advantage of C99Minh Nguyễn2016-04-161-3/+0
| | | | Now that #4641 has removed the prohibition against C99 extensions, this change removes many pragma statements that suppress warnings about variadic macros and designated initializers. Designated initializers and Elvis operators have been introduced wherever appropriate.
* [ios, osx] Shared test bundleMinh Nguyễn2016-04-161-0/+29
The iOS and OS X SDKs now share a non-UI test bundle. Moved the iOS UI test bundle into a uitest/ subdirectory and moved the OS X SDK tests into the darwin/ subdirectory. Upgraded KIF to v3.4.2.