From 17b3ec1edd217b8b14d64b74cbf58b0e4ae4f241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Thu, 5 Jan 2017 03:22:04 -0800 Subject: [ios, macos] Renamed text-field, text-font, text-font-size, circle-pitch-scale Reduced the likelihood that the developer might attempt to set textField to an NSTextField or UITextField, or textFont to an NSFont or UIFont, or textSize to a CGSize or NSSize, or circlePitchScale to a number (given iconScale). --- platform/darwin/test/MGLCircleStyleLayerTests.m | 12 ++++----- .../darwin/test/MGLDocumentationExampleTests.swift | 2 +- platform/darwin/test/MGLStyleValueTests.swift | 4 +-- platform/darwin/test/MGLSymbolStyleLayerTests.m | 30 +++++++++++----------- 4 files changed, 24 insertions(+), 24 deletions(-) (limited to 'platform/darwin/test') diff --git a/platform/darwin/test/MGLCircleStyleLayerTests.m b/platform/darwin/test/MGLCircleStyleLayerTests.m index 66c05f15c9..0fca470f04 100644 --- a/platform/darwin/test/MGLCircleStyleLayerTests.m +++ b/platform/darwin/test/MGLCircleStyleLayerTests.m @@ -23,8 +23,8 @@ layer.circleBlur = [MGLRuntimeStylingHelper testNumber]; layer.circleColor = [MGLRuntimeStylingHelper testColor]; layer.circleOpacity = [MGLRuntimeStylingHelper testNumber]; - layer.circlePitchScale = [MGLRuntimeStylingHelper testEnum:MGLCirclePitchScaleViewport type:@encode(MGLCirclePitchScale)]; layer.circleRadius = [MGLRuntimeStylingHelper testNumber]; + layer.circleScaleAlignment = [MGLRuntimeStylingHelper testEnum:MGLCircleScaleAlignmentViewport type:@encode(MGLCircleScaleAlignment)]; layer.circleTranslate = [MGLRuntimeStylingHelper testOffset]; layer.circleTranslateAnchor = [MGLRuntimeStylingHelper testEnum:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]; @@ -33,9 +33,9 @@ XCTAssertEqualObjects(gLayer.circleBlur, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.circleColor, [MGLRuntimeStylingHelper testColor]); XCTAssertEqualObjects(gLayer.circleOpacity, [MGLRuntimeStylingHelper testNumber]); - XCTAssert([gLayer.circlePitchScale isKindOfClass:[MGLStyleConstantValue class]]); - XCTAssertEqualObjects(gLayer.circlePitchScale, [MGLRuntimeStylingHelper testEnum:MGLCirclePitchScaleViewport type:@encode(MGLCirclePitchScale)]); XCTAssertEqualObjects(gLayer.circleRadius, [MGLRuntimeStylingHelper testNumber]); + XCTAssert([gLayer.circleScaleAlignment isKindOfClass:[MGLStyleConstantValue class]]); + XCTAssertEqualObjects(gLayer.circleScaleAlignment, [MGLRuntimeStylingHelper testEnum:MGLCircleScaleAlignmentViewport type:@encode(MGLCircleScaleAlignment)]); XCTAssertEqualObjects(gLayer.circleTranslate, [MGLRuntimeStylingHelper testOffset]); XCTAssert([gLayer.circleTranslateAnchor isKindOfClass:[MGLStyleConstantValue class]]); XCTAssertEqualObjects(gLayer.circleTranslateAnchor, [MGLRuntimeStylingHelper testEnum:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]); @@ -43,16 +43,16 @@ layer.circleBlur = [MGLRuntimeStylingHelper testNumberFunction]; layer.circleColor = [MGLRuntimeStylingHelper testColorFunction]; layer.circleOpacity = [MGLRuntimeStylingHelper testNumberFunction]; - layer.circlePitchScale = [MGLRuntimeStylingHelper testEnumFunction:MGLCirclePitchScaleViewport type:@encode(MGLCirclePitchScale)]; layer.circleRadius = [MGLRuntimeStylingHelper testNumberFunction]; + layer.circleScaleAlignment = [MGLRuntimeStylingHelper testEnumFunction:MGLCircleScaleAlignmentViewport type:@encode(MGLCircleScaleAlignment)]; layer.circleTranslate = [MGLRuntimeStylingHelper testOffsetFunction]; layer.circleTranslateAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]; XCTAssertEqualObjects(gLayer.circleBlur, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.circleColor, [MGLRuntimeStylingHelper testColorFunction]); XCTAssertEqualObjects(gLayer.circleOpacity, [MGLRuntimeStylingHelper testNumberFunction]); - XCTAssertEqualObjects(gLayer.circlePitchScale, [MGLRuntimeStylingHelper testEnumFunction:MGLCirclePitchScaleViewport type:@encode(MGLCirclePitchScale)]); XCTAssertEqualObjects(gLayer.circleRadius, [MGLRuntimeStylingHelper testNumberFunction]); + XCTAssertEqualObjects(gLayer.circleScaleAlignment, [MGLRuntimeStylingHelper testEnumFunction:MGLCircleScaleAlignmentViewport type:@encode(MGLCircleScaleAlignment)]); XCTAssertEqualObjects(gLayer.circleTranslate, [MGLRuntimeStylingHelper testOffsetFunction]); XCTAssertEqualObjects(gLayer.circleTranslateAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLCircleTranslateAnchorViewport type:@encode(MGLCircleTranslateAnchor)]); } @@ -61,8 +61,8 @@ [self testPropertyName:@"circle-blur" isBoolean:NO]; [self testPropertyName:@"circle-color" isBoolean:NO]; [self testPropertyName:@"circle-opacity" isBoolean:NO]; - [self testPropertyName:@"circle-pitch-scale" isBoolean:NO]; [self testPropertyName:@"circle-radius" isBoolean:NO]; + [self testPropertyName:@"circle-scale-alignment" isBoolean:NO]; [self testPropertyName:@"circle-translate" isBoolean:NO]; [self testPropertyName:@"circle-translate-anchor" isBoolean:NO]; } diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index 9243924328..418aa98d76 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -157,7 +157,7 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { layer.sourceLayerIdentifier = "pois" layer.iconImageName = MGLStyleValue(rawValue: "coffee") layer.iconScale = MGLStyleValue(rawValue: 0.5) - layer.textField = MGLStyleValue(rawValue: "{name}") + layer.text = MGLStyleValue(rawValue: "{name}") #if os(macOS) var vector = CGVector(dx: 10, dy: 0) layer.textTranslate = MGLStyleValue(rawValue: NSValue(bytes: &vector, objCType: "{CGVector=dd}")) diff --git a/platform/darwin/test/MGLStyleValueTests.swift b/platform/darwin/test/MGLStyleValueTests.swift index a787804410..18b6a901de 100644 --- a/platform/darwin/test/MGLStyleValueTests.swift +++ b/platform/darwin/test/MGLStyleValueTests.swift @@ -17,8 +17,8 @@ extension MGLStyleValueTests { XCTAssertEqual((symbolStyleLayer.iconHaloWidth as! MGLStyleConstantValue).rawValue, 3) // String - symbolStyleLayer.textField = MGLStyleConstantValue(rawValue: "{name}") - XCTAssertEqual((symbolStyleLayer.textField as! MGLStyleConstantValue).rawValue, "{name}") + symbolStyleLayer.text = MGLStyleConstantValue(rawValue: "{name}") + XCTAssertEqual((symbolStyleLayer.text as! MGLStyleConstantValue).rawValue, "{name}") } func testFunctions() { diff --git a/platform/darwin/test/MGLSymbolStyleLayerTests.m b/platform/darwin/test/MGLSymbolStyleLayerTests.m index 40250a8c72..e8d9c775ba 100644 --- a/platform/darwin/test/MGLSymbolStyleLayerTests.m +++ b/platform/darwin/test/MGLSymbolStyleLayerTests.m @@ -38,10 +38,11 @@ layer.symbolAvoidsEdges = [MGLRuntimeStylingHelper testBool]; layer.symbolPlacement = [MGLRuntimeStylingHelper testEnum:MGLSymbolPlacementLine type:@encode(MGLSymbolPlacement)]; layer.symbolSpacing = [MGLRuntimeStylingHelper testNumber]; + layer.text = [MGLRuntimeStylingHelper testString]; layer.textAllowsOverlap = [MGLRuntimeStylingHelper testBool]; layer.textAnchor = [MGLRuntimeStylingHelper testEnum:MGLTextAnchorBottomRight type:@encode(MGLTextAnchor)]; - layer.textField = [MGLRuntimeStylingHelper testString]; - layer.textFont = [MGLRuntimeStylingHelper testFont]; + layer.textFontNames = [MGLRuntimeStylingHelper testFont]; + layer.textFontSize = [MGLRuntimeStylingHelper testNumber]; layer.textIgnoresPlacement = [MGLRuntimeStylingHelper testBool]; layer.textJustification = [MGLRuntimeStylingHelper testEnum:MGLTextJustificationRight type:@encode(MGLTextJustification)]; layer.textLetterSpacing = [MGLRuntimeStylingHelper testNumber]; @@ -52,7 +53,6 @@ layer.textPitchAlignment = [MGLRuntimeStylingHelper testEnum:MGLTextPitchAlignmentAuto type:@encode(MGLTextPitchAlignment)]; layer.textRotation = [MGLRuntimeStylingHelper testNumber]; layer.textRotationAlignment = [MGLRuntimeStylingHelper testEnum:MGLTextRotationAlignmentAuto type:@encode(MGLTextRotationAlignment)]; - layer.textSize = [MGLRuntimeStylingHelper testNumber]; layer.textTransform = [MGLRuntimeStylingHelper testEnum:MGLTextTransformLowercase type:@encode(MGLTextTransform)]; layer.iconColor = [MGLRuntimeStylingHelper testColor]; layer.iconHaloBlur = [MGLRuntimeStylingHelper testNumber]; @@ -92,11 +92,12 @@ XCTAssert([gLayer.symbolPlacement isKindOfClass:[MGLStyleConstantValue class]]); XCTAssertEqualObjects(gLayer.symbolPlacement, [MGLRuntimeStylingHelper testEnum:MGLSymbolPlacementLine type:@encode(MGLSymbolPlacement)]); XCTAssertEqualObjects(gLayer.symbolSpacing, [MGLRuntimeStylingHelper testNumber]); + XCTAssertEqualObjects(gLayer.text, [MGLRuntimeStylingHelper testString]); XCTAssertEqualObjects(gLayer.textAllowsOverlap, [MGLRuntimeStylingHelper testBool]); XCTAssert([gLayer.textAnchor isKindOfClass:[MGLStyleConstantValue class]]); XCTAssertEqualObjects(gLayer.textAnchor, [MGLRuntimeStylingHelper testEnum:MGLTextAnchorBottomRight type:@encode(MGLTextAnchor)]); - XCTAssertEqualObjects(gLayer.textField, [MGLRuntimeStylingHelper testString]); - XCTAssertEqualObjects(gLayer.textFont, [MGLRuntimeStylingHelper testFont]); + XCTAssertEqualObjects(gLayer.textFontNames, [MGLRuntimeStylingHelper testFont]); + XCTAssertEqualObjects(gLayer.textFontSize, [MGLRuntimeStylingHelper testNumber]); XCTAssertEqualObjects(gLayer.textIgnoresPlacement, [MGLRuntimeStylingHelper testBool]); XCTAssert([gLayer.textJustification isKindOfClass:[MGLStyleConstantValue class]]); XCTAssertEqualObjects(gLayer.textJustification, [MGLRuntimeStylingHelper testEnum:MGLTextJustificationRight type:@encode(MGLTextJustification)]); @@ -110,7 +111,6 @@ XCTAssertEqualObjects(gLayer.textRotation, [MGLRuntimeStylingHelper testNumber]); XCTAssert([gLayer.textRotationAlignment isKindOfClass:[MGLStyleConstantValue class]]); XCTAssertEqualObjects(gLayer.textRotationAlignment, [MGLRuntimeStylingHelper testEnum:MGLTextRotationAlignmentAuto type:@encode(MGLTextRotationAlignment)]); - XCTAssertEqualObjects(gLayer.textSize, [MGLRuntimeStylingHelper testNumber]); XCTAssert([gLayer.textTransform isKindOfClass:[MGLStyleConstantValue class]]); XCTAssertEqualObjects(gLayer.textTransform, [MGLRuntimeStylingHelper testEnum:MGLTextTransformLowercase type:@encode(MGLTextTransform)]); XCTAssertEqualObjects(gLayer.iconColor, [MGLRuntimeStylingHelper testColor]); @@ -148,10 +148,11 @@ layer.symbolAvoidsEdges = [MGLRuntimeStylingHelper testBoolFunction]; layer.symbolPlacement = [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolPlacementLine type:@encode(MGLSymbolPlacement)]; layer.symbolSpacing = [MGLRuntimeStylingHelper testNumberFunction]; + layer.text = [MGLRuntimeStylingHelper testStringFunction]; layer.textAllowsOverlap = [MGLRuntimeStylingHelper testBoolFunction]; layer.textAnchor = [MGLRuntimeStylingHelper testEnumFunction:MGLTextAnchorBottomRight type:@encode(MGLTextAnchor)]; - layer.textField = [MGLRuntimeStylingHelper testStringFunction]; - layer.textFont = [MGLRuntimeStylingHelper testFontFunction]; + layer.textFontNames = [MGLRuntimeStylingHelper testFontFunction]; + layer.textFontSize = [MGLRuntimeStylingHelper testNumberFunction]; layer.textIgnoresPlacement = [MGLRuntimeStylingHelper testBoolFunction]; layer.textJustification = [MGLRuntimeStylingHelper testEnumFunction:MGLTextJustificationRight type:@encode(MGLTextJustification)]; layer.textLetterSpacing = [MGLRuntimeStylingHelper testNumberFunction]; @@ -162,7 +163,6 @@ layer.textPitchAlignment = [MGLRuntimeStylingHelper testEnumFunction:MGLTextPitchAlignmentAuto type:@encode(MGLTextPitchAlignment)]; layer.textRotation = [MGLRuntimeStylingHelper testNumberFunction]; layer.textRotationAlignment = [MGLRuntimeStylingHelper testEnumFunction:MGLTextRotationAlignmentAuto type:@encode(MGLTextRotationAlignment)]; - layer.textSize = [MGLRuntimeStylingHelper testNumberFunction]; layer.textTransform = [MGLRuntimeStylingHelper testEnumFunction:MGLTextTransformLowercase type:@encode(MGLTextTransform)]; layer.iconColor = [MGLRuntimeStylingHelper testColorFunction]; layer.iconHaloBlur = [MGLRuntimeStylingHelper testNumberFunction]; @@ -197,10 +197,11 @@ XCTAssertEqualObjects(gLayer.symbolAvoidsEdges, [MGLRuntimeStylingHelper testBoolFunction]); XCTAssertEqualObjects(gLayer.symbolPlacement, [MGLRuntimeStylingHelper testEnumFunction:MGLSymbolPlacementLine type:@encode(MGLSymbolPlacement)]); XCTAssertEqualObjects(gLayer.symbolSpacing, [MGLRuntimeStylingHelper testNumberFunction]); + XCTAssertEqualObjects(gLayer.text, [MGLRuntimeStylingHelper testStringFunction]); XCTAssertEqualObjects(gLayer.textAllowsOverlap, [MGLRuntimeStylingHelper testBoolFunction]); XCTAssertEqualObjects(gLayer.textAnchor, [MGLRuntimeStylingHelper testEnumFunction:MGLTextAnchorBottomRight type:@encode(MGLTextAnchor)]); - XCTAssertEqualObjects(gLayer.textField, [MGLRuntimeStylingHelper testStringFunction]); - XCTAssertEqualObjects(gLayer.textFont, [MGLRuntimeStylingHelper testFontFunction]); + XCTAssertEqualObjects(gLayer.textFontNames, [MGLRuntimeStylingHelper testFontFunction]); + XCTAssertEqualObjects(gLayer.textFontSize, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.textIgnoresPlacement, [MGLRuntimeStylingHelper testBoolFunction]); XCTAssertEqualObjects(gLayer.textJustification, [MGLRuntimeStylingHelper testEnumFunction:MGLTextJustificationRight type:@encode(MGLTextJustification)]); XCTAssertEqualObjects(gLayer.textLetterSpacing, [MGLRuntimeStylingHelper testNumberFunction]); @@ -211,7 +212,6 @@ XCTAssertEqualObjects(gLayer.textPitchAlignment, [MGLRuntimeStylingHelper testEnumFunction:MGLTextPitchAlignmentAuto type:@encode(MGLTextPitchAlignment)]); XCTAssertEqualObjects(gLayer.textRotation, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.textRotationAlignment, [MGLRuntimeStylingHelper testEnumFunction:MGLTextRotationAlignmentAuto type:@encode(MGLTextRotationAlignment)]); - XCTAssertEqualObjects(gLayer.textSize, [MGLRuntimeStylingHelper testNumberFunction]); XCTAssertEqualObjects(gLayer.textTransform, [MGLRuntimeStylingHelper testEnumFunction:MGLTextTransformLowercase type:@encode(MGLTextTransform)]); XCTAssertEqualObjects(gLayer.iconColor, [MGLRuntimeStylingHelper testColorFunction]); XCTAssertEqualObjects(gLayer.iconHaloBlur, [MGLRuntimeStylingHelper testNumberFunction]); @@ -248,10 +248,11 @@ [self testPropertyName:@"symbol-avoids-edges" isBoolean:YES]; [self testPropertyName:@"symbol-placement" isBoolean:NO]; [self testPropertyName:@"symbol-spacing" isBoolean:NO]; + [self testPropertyName:@"text" isBoolean:NO]; [self testPropertyName:@"text-allows-overlap" isBoolean:YES]; [self testPropertyName:@"text-anchor" isBoolean:NO]; - [self testPropertyName:@"text-field" isBoolean:NO]; - [self testPropertyName:@"text-font" isBoolean:NO]; + [self testPropertyName:@"text-font-names" isBoolean:NO]; + [self testPropertyName:@"text-font-size" isBoolean:NO]; [self testPropertyName:@"text-ignores-placement" isBoolean:YES]; [self testPropertyName:@"text-justification" isBoolean:NO]; [self testPropertyName:@"text-letter-spacing" isBoolean:NO]; @@ -262,7 +263,6 @@ [self testPropertyName:@"text-pitch-alignment" isBoolean:NO]; [self testPropertyName:@"text-rotation" isBoolean:NO]; [self testPropertyName:@"text-rotation-alignment" isBoolean:NO]; - [self testPropertyName:@"text-size" isBoolean:NO]; [self testPropertyName:@"text-transform" isBoolean:NO]; [self testPropertyName:@"icon-color" isBoolean:NO]; [self testPropertyName:@"icon-halo-blur" isBoolean:NO]; -- cgit v1.2.1