mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
476 stars 133 forks source link

OnMapIdle event not triggered reliably in instrument tests #1170

Closed kiryldz closed 2 weeks ago

kiryldz commented 2 years ago

When running a bunch of instrument tests one after one (see https://github.com/mapbox/mapbox-maps-android/blob/main/sdk/src/androidTest/java/com/mapbox/maps/ViewAnnotationTest.kt) it seems that in some cases IDLE events are not triggered.

That actually leads to flaky tests as we hit timeout due to https://github.com/mapbox/mapbox-maps-android/blob/913649e2f72d516c504901c0482450ca324957f6/sdk/src/androidTest/java/com/mapbox/maps/ViewAnnotationTest.kt#L68-L70 not being called.

That requires some investigation and first step would be to think of a reliable way to reproduce it.

akinsetesunday commented 2 years ago

I am getting this issue as well, Any luck on a fix. addOnMapIdleListener is not getting triggered.

Michae1Wan commented 2 years ago

Same here, OnMapIdleListener is not being triggered

kiryldz commented 2 years ago

@akinsetesunday @Michae1Wan could you give it a try with v10.4.3 version and let us know if it will help?

Michae1Wan commented 2 years ago

Unfortunately v10.4.3 didn't help...

I used OnMoveListener and call onMapIdle manually when movement ended as a work around, but this doesn't help if I set the camera location directly.

Michae1Wan commented 2 years ago

So.... any idea to resolve the issue or a plan for a fix?

kiryldz commented 2 years ago

Unfortunately v10.4.3 didn't help...

I used OnMoveListener and call onMapIdle manually when movement ended as a work around, but this doesn't help if I set the camera location directly.

Can you share how are you setting camera?

Michae1Wan commented 2 years ago

Unfortunately v10.4.3 didn't help... I used OnMoveListener and call onMapIdle manually when movement ended as a work around, but this doesn't help if I set the camera location directly.

Can you share how are you setting camera?

val position = CameraOptions.Builder()
            .center(mapBoxMap.coordinateForPixel(center))
            .padding(
                EdgeInsets(
                    DEFAULT_MAP_PADDING,
                    DEFAULT_MAP_PADDING,
                    DEFAULT_MAP_PADDING,
                    DEFAULT_MAP_PADDING
                )
            )
mapBoxView.camera.easeTo(position.build())
kiryldz commented 2 years ago

@Michae1Wan can you actually share full reproducible code when IDLE is not triggered so that I could test it?

Haoming-Wu92 commented 2 years ago

Stilling having this issue in 10.9.0

I'm testing with

mapbox.subscribeMapIdle(Observer {
    Log.d("mapbox_idle", "map idle")
})

also tried

mapboxMap.addOnMapIdleListener(OnMapIdleListener {
    Log.d("mapbox_idle", "map idle")
})

It doesn't matter what I do, pan camera, rotate, zoom, load source, add features into source nothing triggers this idle event

all my other listeners, and subscribeSourceDataLoaded works fine.

kiryldz commented 2 weeks ago

Closing as stale.