mapbox-maps-android icon indicating copy to clipboard operation
mapbox-maps-android copied to clipboard

OnMapIdle event not triggered reliably in instrument tests

Open kiryldz opened this issue 4 years ago • 8 comments

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.

kiryldz avatar Feb 21 '22 14:02 kiryldz

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

akinsetesunday avatar Mar 29 '22 21:03 akinsetesunday

Same here, OnMapIdleListener is not being triggered

Michae1Wan avatar Apr 27 '22 06:04 Michae1Wan

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

kiryldz avatar Apr 27 '22 15:04 kiryldz

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 avatar Apr 28 '22 06:04 Michae1Wan

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

Michae1Wan avatar May 11 '22 03:05 Michae1Wan

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?

kiryldz avatar May 11 '22 10:05 kiryldz

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())

Michae1Wan avatar May 16 '22 07:05 Michae1Wan

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

kiryldz avatar May 17 '22 07:05 kiryldz

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.

Haoming-Wu92 avatar Nov 09 '22 19:11 Haoming-Wu92