-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
71b3eb6
commit 3cd1b89
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
Tests/MapboxMapsTests/Foundation/Camera/CameraViewTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import XCTest | ||
@testable import MapboxMaps | ||
|
||
final class CameraViewTests: XCTestCase { | ||
|
||
let cameraOptions = CameraOptions(center: .init(latitude: 10, longitude: 10), | ||
padding: .init(top: 10, left: 10, bottom: 10, right: 10), | ||
anchor: .init(x: 10, y: 10), | ||
zoom: 10, | ||
bearing: 10, | ||
pitch: 10) | ||
|
||
var cameraView: CameraView! | ||
|
||
override func setUp() { | ||
cameraView = CameraView() | ||
cameraView.syncLayer(to: cameraOptions) | ||
} | ||
|
||
func testSyncLayer() { | ||
XCTAssertEqual(cameraView.layer.opacity, Float(cameraOptions.zoom!)) | ||
XCTAssertEqual(cameraView.layer.cornerRadius, CGFloat(cameraOptions.bearing!)) | ||
let padding = cameraOptions.padding! | ||
XCTAssertEqual(cameraView.layer.bounds, CGRect(x: padding.left, | ||
y: padding.right, | ||
width: padding.bottom, | ||
height: padding.top)) | ||
let center = cameraOptions.center! | ||
XCTAssertEqual(cameraView.layer.position, CGPoint(x: center.longitude, | ||
y: center.latitude)) | ||
XCTAssertEqual(cameraView.layer.transform.m11, cameraOptions.pitch!) | ||
XCTAssertEqual(cameraView.layer.anchorPoint, cameraOptions.anchor!) | ||
} | ||
|
||
func testLocalCamera() { | ||
XCTAssertEqual(cameraView.localCamera, cameraOptions) | ||
} | ||
|
||
} |