@@ -20,6 +20,7 @@ import type {
2020 NavigationController ,
2121 NavigationInitErrorCode ,
2222} from '@googlemaps/react-native-navigation-sdk' ;
23+ import { Platform } from 'react-native' ;
2324
2425interface TestTools {
2526 navigationController : NavigationController ;
@@ -76,21 +77,41 @@ const expectFalseMessage = (expectation: string) => {
7677} ;
7778
7879export const testMapInitialization = async ( testTools : TestTools ) => {
79- const { mapViewController, passTest, failTest, expectFalseError } = testTools ;
80+ const {
81+ mapViewController,
82+ passTest,
83+ failTest,
84+ expectFalseError,
85+ expectTrueError,
86+ } = testTools ;
8087 if ( ! mapViewController ) {
8188 return failTest ( 'mapViewController was expected to exist' ) ;
8289 }
83- if ( ( await mapViewController . getUiSettings ( ) ) . isCompassEnabled ) {
84- return expectFalseError (
85- 'mapViewController.getUiSettings()).isCompassEnabled'
86- ) ;
90+ if ( Platform . OS === 'ios' ) {
91+ if ( ( await mapViewController . getUiSettings ( ) ) . isCompassEnabled ) {
92+ return expectFalseError (
93+ 'mapViewController.getUiSettings()).isCompassEnabled'
94+ ) ;
95+ }
96+ } else {
97+ if ( ! ( await mapViewController . getUiSettings ( ) ) . isCompassEnabled ) {
98+ return expectTrueError (
99+ 'mapViewController.getUiSettings()).isCompassEnabled'
100+ ) ;
101+ }
87102 }
88- if ( ( await mapViewController . getUiSettings ( ) ) . isMapToolbarEnabled ) {
89- return failTest (
90- expectFalseMessage (
103+ if ( Platform . OS === 'ios' ) {
104+ if ( ( await mapViewController . getUiSettings ( ) ) . isMapToolbarEnabled ) {
105+ return expectFalseError (
91106 'mapViewController.getUiSettings()).isMapToolbarEnabled'
92- )
93- ) ;
107+ ) ;
108+ }
109+ } else {
110+ if ( ! ( await mapViewController . getUiSettings ( ) ) . isMapToolbarEnabled ) {
111+ return expectTrueError (
112+ 'mapViewController.getUiSettings()).isMapToolbarEnabled'
113+ ) ;
114+ }
94115 }
95116 if ( ! ( await mapViewController . getUiSettings ( ) ) . isIndoorLevelPickerEnabled ) {
96117 return failTest (
@@ -99,11 +120,6 @@ export const testMapInitialization = async (testTools: TestTools) => {
99120 )
100121 ) ;
101122 }
102- if ( ( await mapViewController . getUiSettings ( ) ) . isMapToolbarEnabled ) {
103- return expectFalseError (
104- 'mapViewController.getUiSettings()).isMapToolbarEnabled'
105- ) ;
106- }
107123 if ( ! ( await mapViewController . getUiSettings ( ) ) . isRotateGesturesEnabled ) {
108124 return expectFalseError (
109125 'mapViewController.getUiSettings()).isRotateGesturesEnabled'
@@ -137,6 +153,15 @@ export const testMapInitialization = async (testTools: TestTools) => {
137153 'mapViewController.getUiSettings()).isZoomGesturesEnabled'
138154 ) ;
139155 }
156+ if ( Platform . OS === 'ios' ) {
157+ if ( ! ( await mapViewController . isMyLocationEnabled ( ) ) ) {
158+ return expectFalseError ( 'await mapViewController.isMyLocationEnabled()' ) ;
159+ }
160+ } else {
161+ if ( await mapViewController . isMyLocationEnabled ( ) ) {
162+ return expectTrueError ( 'await mapViewController.isMyLocationEnabled()' ) ;
163+ }
164+ }
140165
141166 passTest ( ) ;
142167} ;
0 commit comments