1
+ import CoreLocation
1
2
import MapLibreSwiftDSL
2
3
import SnapshotTesting
3
4
import XCTest
4
5
@testable import MapLibreSwiftUI
5
6
6
7
final class MapControlsTests : XCTestCase {
8
+ // NOTE: The map views in this test intentionally have a non-north orientation
9
+ // so that the compass will be rendered if present.
10
+
7
11
@MainActor
8
12
func testEmptyControls( ) {
9
13
assertView {
10
- MapView ( styleURL: demoTilesURL)
14
+ MapView ( styleURL: demoTilesURL, camera : . constant ( . center ( CLLocationCoordinate2D ( ) , zoom : 4 , direction : 45 ) ) )
11
15
. mapControls {
12
16
// No controls
13
17
}
@@ -17,7 +21,7 @@ final class MapControlsTests: XCTestCase {
17
21
@MainActor
18
22
func testLogoOnly( ) {
19
23
assertView {
20
- MapView ( styleURL: demoTilesURL)
24
+ MapView ( styleURL: demoTilesURL, camera : . constant ( . center ( CLLocationCoordinate2D ( ) , zoom : 4 , direction : 45 ) ) )
21
25
. mapControls {
22
26
LogoView ( )
23
27
}
@@ -27,7 +31,7 @@ final class MapControlsTests: XCTestCase {
27
31
@MainActor
28
32
func testLogoChangePosition( ) {
29
33
assertView {
30
- MapView ( styleURL: demoTilesURL)
34
+ MapView ( styleURL: demoTilesURL, camera : . constant ( . center ( CLLocationCoordinate2D ( ) , zoom : 4 , direction : 45 ) ) )
31
35
. mapControls {
32
36
LogoView ( )
33
37
. position ( . topLeft)
@@ -38,7 +42,7 @@ final class MapControlsTests: XCTestCase {
38
42
@MainActor
39
43
func testCompassOnly( ) {
40
44
assertView {
41
- MapView ( styleURL: demoTilesURL)
45
+ MapView ( styleURL: demoTilesURL, camera : . constant ( . center ( CLLocationCoordinate2D ( ) , zoom : 4 , direction : 45 ) ) )
42
46
. mapControls {
43
47
CompassView ( )
44
48
}
@@ -48,7 +52,7 @@ final class MapControlsTests: XCTestCase {
48
52
@MainActor
49
53
func testCompassChangePosition( ) {
50
54
assertView {
51
- MapView ( styleURL: demoTilesURL)
55
+ MapView ( styleURL: demoTilesURL, camera : . constant ( . center ( CLLocationCoordinate2D ( ) , zoom : 4 , direction : 45 ) ) )
52
56
. mapControls {
53
57
CompassView ( )
54
58
. position ( . topLeft)
@@ -59,7 +63,7 @@ final class MapControlsTests: XCTestCase {
59
63
@MainActor
60
64
func testAttributionOnly( ) {
61
65
assertView {
62
- MapView ( styleURL: demoTilesURL)
66
+ MapView ( styleURL: demoTilesURL, camera : . constant ( . center ( CLLocationCoordinate2D ( ) , zoom : 4 , direction : 45 ) ) )
63
67
. mapControls {
64
68
AttributionButton ( )
65
69
}
@@ -69,7 +73,7 @@ final class MapControlsTests: XCTestCase {
69
73
@MainActor
70
74
func testAttributionChangePosition( ) {
71
75
assertView {
72
- MapView ( styleURL: demoTilesURL)
76
+ MapView ( styleURL: demoTilesURL, camera : . constant ( . center ( CLLocationCoordinate2D ( ) , zoom : 4 , direction : 45 ) ) )
73
77
. mapControls {
74
78
AttributionButton ( )
75
79
. position ( . topLeft)
0 commit comments