diff options
author | Fabian Guerra Soto <fabian.guerra@mapbox.com> | 2017-03-10 11:33:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-10 11:33:31 -0800 |
commit | 20712b7c84bd91bcf658d74bf25f3460354b5fd6 (patch) | |
tree | c12fd8cf71d293ddfc123f9e1d0af1dafa887750 /platform/darwin/test/MGLFillStyleLayerTests.mm | |
parent | 4a0ce1365f469c5da30aa7136ec5d31dfd621ff1 (diff) | |
download | qtlocation-mapboxgl-20712b7c84bd91bcf658d74bf25f3460354b5fd6.tar.gz |
Per-attribute transition properties on MGLStyleLayer (#8225)
* [ios, macos] new struct MGLTransition
* [ios] MGLTransition struct moved to MGLTypes.h
* [ios] MGLTransition implemented for style layer properties
* [ios, macos] added support for getting property transitions
* [ios, macos] updated to MGLDurationFromTimeInterval and MGLTimeIntervalFromDuration
* [ios, macos] added transition properties test
* [ios, macos] modified key strings imp
* [ios, macos] The impl for transition properties were changed to public methods
* [ios, macos] Changelog update
* [ios] Fixed layer space formatting
* [core] The name space was fixed for getters that returned TransitionOptions
* [ios, macos] Added rawLayer transition property tests
* [ios] Added a factory method for MGLTransition and transition-related methods to NSValue(MGLAdditions)
* [ios, macos] Copyedited changelog blurbs about transition properties
Diffstat (limited to 'platform/darwin/test/MGLFillStyleLayerTests.mm')
-rw-r--r-- | platform/darwin/test/MGLFillStyleLayerTests.mm | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLFillStyleLayerTests.mm b/platform/darwin/test/MGLFillStyleLayerTests.mm index c03b22c399..85f0b24fa7 100644 --- a/platform/darwin/test/MGLFillStyleLayerTests.mm +++ b/platform/darwin/test/MGLFillStyleLayerTests.mm @@ -2,10 +2,12 @@ // Edit platform/darwin/scripts/generate-style-code.js, then run `make darwin-style-code`. #import "MGLStyleLayerTests.h" +#import "../../darwin/src/NSDate+MGLAdditions.h" #import "MGLStyleLayer_Private.h" #include <mbgl/style/layers/fill_layer.hpp> +#include <mbgl/style/transition_options.hpp> @interface MGLFillLayerTests : MGLStyleLayerTests @end @@ -43,6 +45,9 @@ XCTAssertTrue(layer.rawLayer->is<mbgl::style::FillLayer>()); auto rawLayer = layer.rawLayer->as<mbgl::style::FillLayer>(); + MGLTransition transitionTest = MGLTransitionMake(5, 4); + + // fill-antialias { XCTAssertTrue(rawLayer->getFillAntialias().isUndefined(), @@ -137,6 +142,15 @@ @"Unsetting fillColor should return fill-color to the default value."); XCTAssertEqualObjects(layer.fillColor, defaultStyleValue, @"fillColor should return the default value after being unset."); + // Transition property test + layer.fillColorTransition = transitionTest; + auto toptions = rawLayer->getFillColorTransition(); + XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay); + XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration); + + MGLTransition fillColorTransition = layer.fillColorTransition; + XCTAssertEqual(fillColorTransition.delay, transitionTest.delay); + XCTAssertEqual(fillColorTransition.duration, transitionTest.duration); } // fill-opacity @@ -194,6 +208,15 @@ @"Unsetting fillOpacity should return fill-opacity to the default value."); XCTAssertEqualObjects(layer.fillOpacity, defaultStyleValue, @"fillOpacity should return the default value after being unset."); + // Transition property test + layer.fillOpacityTransition = transitionTest; + auto toptions = rawLayer->getFillOpacityTransition(); + XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay); + XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration); + + MGLTransition fillOpacityTransition = layer.fillOpacityTransition; + XCTAssertEqual(fillOpacityTransition.delay, transitionTest.delay); + XCTAssertEqual(fillOpacityTransition.duration, transitionTest.duration); } // fill-outline-color @@ -251,6 +274,15 @@ @"Unsetting fillOutlineColor should return fill-outline-color to the default value."); XCTAssertEqualObjects(layer.fillOutlineColor, defaultStyleValue, @"fillOutlineColor should return the default value after being unset."); + // Transition property test + layer.fillOutlineColorTransition = transitionTest; + auto toptions = rawLayer->getFillOutlineColorTransition(); + XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay); + XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration); + + MGLTransition fillOutlineColorTransition = layer.fillOutlineColorTransition; + XCTAssertEqual(fillOutlineColorTransition.delay, transitionTest.delay); + XCTAssertEqual(fillOutlineColorTransition.duration, transitionTest.duration); } // fill-pattern @@ -290,6 +322,15 @@ XCTAssertThrowsSpecificNamed(layer.fillPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it"); functionStyleValue = [MGLStyleValue<NSString *> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil]; XCTAssertThrowsSpecificNamed(layer.fillPattern = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it"); + // Transition property test + layer.fillPatternTransition = transitionTest; + auto toptions = rawLayer->getFillPatternTransition(); + XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay); + XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration); + + MGLTransition fillPatternTransition = layer.fillPatternTransition; + XCTAssertEqual(fillPatternTransition.delay, transitionTest.delay); + XCTAssertEqual(fillPatternTransition.duration, transitionTest.duration); } // fill-translate |