@@ -541,6 +541,151 @@ class MapboxRouteLineViewTest {
541541 unmockkStatic(" com.mapbox.maps.extension.style.layers.LayerUtils" )
542542 }
543543
544+ @Test
545+ fun renderTraveledRouteLineUpdate_whenIgnorePrimaryRouteLineData () =
546+ coroutineRule.runBlockingTest {
547+ mockkStatic(" com.mapbox.maps.extension.style.layers.LayerUtils" )
548+ mockkObject(MapboxRouteLineUtils )
549+ val options = MapboxRouteLineOptions .Builder (ctx).build()
550+ val trafficLineExp = mockk<Expression >()
551+ val routeLineExp = mockk<Expression >()
552+ val casingLineEx = mockk<Expression >()
553+ val restrictedRoadExp = mockk<Expression >()
554+ val trailExpression = mockk<Expression >()
555+ val trailCasingExpression = mockk<Expression >()
556+ val state: Expected <RouteLineError , RouteLineUpdateValue > =
557+ ExpectedFactory .createValue(
558+ RouteLineUpdateValue (
559+ primaryRouteLineDynamicData = RouteLineDynamicData (
560+ { routeLineExp },
561+ { casingLineEx },
562+ { trafficLineExp },
563+ { restrictedRoadExp },
564+ trailExpressionProvider = { trailExpression },
565+ trailCasingExpressionProvider = { trailCasingExpression }
566+ ),
567+ alternativeRouteLinesDynamicData = listOf (
568+ RouteLineDynamicData (
569+ { throw UnsupportedOperationException () },
570+ { throw UnsupportedOperationException () },
571+ { throw UnsupportedOperationException () },
572+ { throw UnsupportedOperationException () }
573+ ),
574+ RouteLineDynamicData (
575+ { throw UnsupportedOperationException () },
576+ { throw UnsupportedOperationException () },
577+ { throw UnsupportedOperationException () },
578+ { throw UnsupportedOperationException () }
579+ )
580+ ),
581+ routeLineMaskingLayerDynamicData = RouteLineDynamicData (
582+ { routeLineExp },
583+ { casingLineEx },
584+ { trafficLineExp },
585+ { restrictedRoadExp },
586+ trailExpressionProvider = { trailExpression },
587+ trailCasingExpressionProvider = { trailCasingExpression }
588+ )
589+ ).also {
590+ it.ignorePrimaryRouteLineData = true
591+ }
592+ )
593+ val style = mockk<Style > {
594+ every {
595+ setStyleLayerProperty(any(), any(), any())
596+ } returns ExpectedFactory .createNone()
597+ }.also {
598+ mockCheckForLayerInitialization(it)
599+ }
600+
601+ pauseDispatcher {
602+ val view = MapboxRouteLineView (options)
603+ view.initPrimaryRouteLineLayerGroup(MapboxRouteLineUtils .layerGroup1SourceLayerIds)
604+ view.renderRouteLineUpdate(style, state)
605+ }
606+
607+ verify(exactly = 0 ) {
608+ style.setStyleLayerProperty(
609+ LAYER_GROUP_1_TRAFFIC ,
610+ " line-gradient" ,
611+ trafficLineExp
612+ )
613+ }
614+ verify(exactly = 0 ) {
615+ style.setStyleLayerProperty(
616+ LAYER_GROUP_1_MAIN ,
617+ " line-gradient" ,
618+ routeLineExp
619+ )
620+ }
621+ verify(exactly = 0 ) {
622+ style.setStyleLayerProperty(
623+ LAYER_GROUP_1_CASING ,
624+ " line-gradient" ,
625+ casingLineEx
626+ )
627+ }
628+ verify(exactly = 0 ) {
629+ style.setStyleLayerProperty(
630+ LAYER_GROUP_1_RESTRICTED ,
631+ " line-gradient" ,
632+ restrictedRoadExp
633+ )
634+ }
635+ verify(exactly = 0 ) {
636+ style.setStyleLayerProperty(
637+ LAYER_GROUP_1_TRAIL ,
638+ " line-gradient" ,
639+ trailExpression
640+ )
641+ }
642+ verify(exactly = 0 ) {
643+ style.setStyleLayerProperty(
644+ LAYER_GROUP_1_TRAIL_CASING ,
645+ " line-gradient" ,
646+ trailCasingExpression
647+ )
648+ }
649+ verify {
650+ style.setStyleLayerProperty(
651+ MASKING_LAYER_TRAFFIC ,
652+ " line-gradient" ,
653+ trafficLineExp
654+ )
655+ }
656+ verify {
657+ style.setStyleLayerProperty(
658+ MASKING_LAYER_MAIN ,
659+ " line-gradient" ,
660+ routeLineExp
661+ )
662+ }
663+ verify {
664+ style.setStyleLayerProperty(
665+ MASKING_LAYER_CASING ,
666+ " line-gradient" ,
667+ casingLineEx
668+ )
669+ }
670+ verify {
671+ style.setStyleLayerProperty(
672+ MASKING_LAYER_TRAIL ,
673+ " line-gradient" ,
674+ trailExpression
675+ )
676+ }
677+ verify {
678+ style.setStyleLayerProperty(
679+ MASKING_LAYER_TRAIL_CASING ,
680+ " line-gradient" ,
681+ trailCasingExpression
682+ )
683+ }
684+
685+ unmockkObject(MapboxRouteLineUtils )
686+ unmockkStatic(" com.mapbox.maps.extension.style.layers.LayerUtils" )
687+ }
688+
544689 @Test
545690 fun renderTraveledRouteLineTrimUpdate () = coroutineRule.runBlockingTest {
546691 mockkStatic(" com.mapbox.maps.extension.style.layers.LayerUtils" )
0 commit comments