Skip to content

Commit

Permalink
RUM-3793: fixing GesturesDetectorWrapperTest
Browse files Browse the repository at this point in the history
  • Loading branch information
satween committed Dec 31, 2024
1 parent 917649d commit 75129d6
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

package com.datadog.android.rum.internal.instrumentation.gestures

import android.view.GestureDetector
import android.view.MotionEvent
import androidx.core.view.GestureDetectorCompat
import com.datadog.android.rum.utils.forge.Configurator
import fr.xgouchet.elmyr.Forge
import fr.xgouchet.elmyr.junit5.ForgeConfiguration
Expand Down Expand Up @@ -42,21 +42,21 @@ internal class GesturesDetectorWrapperTest {
lateinit var mockGesturesDetectorListener: GesturesListener

@Mock
lateinit var mockGesturesDetectorCompat: GestureDetectorCompat
lateinit var mockGesturesDetector: GestureDetector

@BeforeEach
fun `set up`() {
testedWrapper = GesturesDetectorWrapper(
mockGesturesDetectorListener,
mockGesturesDetectorCompat
mockGesturesDetector
)
}

@Test
fun `it will delegate the events to the bundled compat detector`() {
val event: MotionEvent = mock()
testedWrapper.onTouchEvent(event)
verify(mockGesturesDetectorCompat).onTouchEvent(event)
verify(mockGesturesDetector).onTouchEvent(event)
}

@Test
Expand All @@ -65,8 +65,8 @@ internal class GesturesDetectorWrapperTest {
whenever(it.actionMasked).thenReturn(MotionEvent.ACTION_UP)
}
testedWrapper.onTouchEvent(event)
inOrder(mockGesturesDetectorCompat, mockGesturesDetectorListener) {
verify(mockGesturesDetectorCompat).onTouchEvent(event)
inOrder(mockGesturesDetector, mockGesturesDetectorListener) {
verify(mockGesturesDetector).onTouchEvent(event)
verify(mockGesturesDetectorListener).onUp(event)
}
}
Expand Down

0 comments on commit 75129d6

Please sign in to comment.