#import "MGLRuntimeStylingHelper.h" #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR #import #define MGLEdgeInsets UIEdgeInsets #else #import #define MGLEdgeInsets NSEdgeInsets #endif @implementation MGLRuntimeStylingHelper + (MGLStyleConstantValue *)testPadding { MGLEdgeInsets insets = { .top = 1, .left = 1, .bottom = 1, .right = 1, }; return [MGLStyleConstantValue valueWithRawValue:[NSValue value:&insets withObjCType:@encode(MGLEdgeInsets)]]; } + (MGLStyleFunction *)testPaddingFunction { return [MGLStyleFunction functionWithStops:@{@(18): self.testPadding}]; } + (MGLStyleConstantValue *)testOffset { CGVector vector = CGVectorMake(1, 1); return [MGLStyleConstantValue valueWithRawValue:[NSValue value:&vector withObjCType:@encode(CGVector)]]; } + (MGLStyleFunction *)testOffsetFunction { return [MGLStyleFunction valueWithStops:@{ @(18): self.testOffset }]; } + (MGLStyleConstantValue *> *)testFont { return [MGLStyleConstantValue *> valueWithRawValue:@[@"Open Sans Regular", @"Arial Unicode MS Regular"]]; } + (MGLStyleFunction *> *)testFontFunction { return [MGLStyleFunction *> valueWithStops:@{ @18: self.testFont }]; } + (MGLStyleConstantValue *> *)testDashArray { return [MGLStyleConstantValue *> valueWithRawValue:@[@1, @2]]; } + (MGLStyleFunction *> *)testDashArrayFunction { return [MGLStyleFunction *> valueWithStops:@{ @18: self.testDashArray, }]; } + (MGLStyleConstantValue *)testNumber { return [MGLStyleConstantValue valueWithRawValue:@1]; } + (MGLStyleFunction *)testNumberFunction { return [MGLStyleFunction valueWithStops:@{ @18: self.testNumber, }]; } + (MGLStyleConstantValue *)testBool { return [MGLStyleConstantValue valueWithRawValue:@YES]; } + (MGLStyleFunction *)testBoolFunction { return [MGLStyleFunction valueWithStops:@{ @18: self.testBool, }]; } + (MGLStyleConstantValue *)testString { return [MGLStyleConstantValue valueWithRawValue:@"test"]; } + (MGLStyleFunction *)testStringFunction { return [MGLStyleFunction valueWithStops:@{ @18: self.testString, }]; } + (MGLStyleConstantValue *)testColor { return [MGLStyleConstantValue valueWithRawValue:[MGLColor redColor]]; } + (MGLStyleFunction *)testColorFunction { return [MGLStyleFunction valueWithStops:@{ @18: self.testColor, }]; } + (MGLStyleConstantValue *)testEnum:(NSUInteger)value type:(const char *)type { return [MGLStyleConstantValue valueWithRawValue:[NSValue value:&value withObjCType:type]]; } + (MGLStyleFunction *)testEnumFunction:(NSUInteger)value type:(const char *)type { return [MGLStyleFunction valueWithStops:@{ @18: [self testEnum:value type:type], }]; } @end