summaryrefslogtreecommitdiff
path: root/platform/darwin/test/MGLStyleLayerTests.mm.ejs
diff options
context:
space:
mode:
authorFabian Guerra Soto <fabian.guerra@mapbox.com>2017-03-10 11:33:31 -0800
committerGitHub <noreply@github.com>2017-03-10 11:33:31 -0800
commit20712b7c84bd91bcf658d74bf25f3460354b5fd6 (patch)
treec12fd8cf71d293ddfc123f9e1d0af1dafa887750 /platform/darwin/test/MGLStyleLayerTests.mm.ejs
parent4a0ce1365f469c5da30aa7136ec5d31dfd621ff1 (diff)
downloadqtlocation-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/MGLStyleLayerTests.mm.ejs')
-rw-r--r--platform/darwin/test/MGLStyleLayerTests.mm.ejs16
1 files changed, 16 insertions, 0 deletions
diff --git a/platform/darwin/test/MGLStyleLayerTests.mm.ejs b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
index 810d7fbd3b..a405ae58c4 100644
--- a/platform/darwin/test/MGLStyleLayerTests.mm.ejs
+++ b/platform/darwin/test/MGLStyleLayerTests.mm.ejs
@@ -7,10 +7,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/<%- type %>_layer.hpp>
+#include <mbgl/style/transition_options.hpp>
@interface MGL<%- camelize(type) %>LayerTests : MGLStyleLayerTests
@end
@@ -53,6 +55,9 @@
XCTAssertNotEqual(layer.rawLayer, nullptr);
XCTAssertTrue(layer.rawLayer->is<mbgl::style::<%- camelize(type) %>Layer>());
auto rawLayer = layer.rawLayer->as<mbgl::style::<%- camelize(type) %>Layer>();
+
+ MGLTransition transitionTest = MGLTransitionMake(5, 4);
+
<% for (const property of properties) { -%>
// <%- originalPropertyName(property) %>
@@ -124,6 +129,17 @@
functionStyleValue = [MGLStyleValue<<%- propertyType(property) %>> valueWithInterpolationMode:MGLInterpolationModeInterval compositeStops:@{@18: constantStyleValue} attributeName:@"" options:nil];
XCTAssertThrowsSpecificNamed(layer.<%- objCName(property) %> = functionStyleValue, NSException, NSInvalidArgumentException, @"MGLStyleValue should raise an exception if it is applied to a property that cannot support it");
<% } -%>
+<% if (property["transition"] && !property.original) { -%>
+ // Transition property test
+ layer.<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition = transitionTest;
+ auto toptions = rawLayer->get<%- camelize(originalPropertyName(property)) %>Transition();
+ XCTAssert(toptions.delay && MGLTimeIntervalFromDuration(*toptions.delay) == transitionTest.delay);
+ XCTAssert(toptions.duration && MGLTimeIntervalFromDuration(*toptions.duration) == transitionTest.duration);
+
+ MGLTransition <%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition = layer.<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition;
+ XCTAssertEqual(<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition.delay, transitionTest.delay);
+ XCTAssertEqual(<%- camelizeWithLeadingLowercase(originalPropertyName(property)) %>Transition.duration, transitionTest.duration);
+<% } -%>
}
<% } -%>
}