Skip to content

Commit 4f91d2a

Browse files
committed
Run instrumentation tests on the main thread
1 parent 847133c commit 4f91d2a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
hs_err_pid*
2525
replay_pid*
2626

27+
# JVM dumps
28+
*.hprof
29+
2730
# Kotlin Gradle plugin data, see https://kotlinlang.org/docs/whatsnew20.html#new-directory-for-kotlin-data-in-gradle-projects
2831
.kotlin/
2932

openmapview/src/androidTest/kotlin/de/afarber/openmapview/UiSettingsInstrumentationTest.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,12 @@ class UiSettingsInstrumentationTest {
2424
@Before
2525
fun setUp() {
2626
val context = InstrumentationRegistry.getInstrumentation().targetContext
27-
openMapView = OpenMapView(context)
28-
openMapView.layout(0, 0, 1080, 1920)
27+
28+
// Create and setup view on main thread to avoid Handler creation issues
29+
InstrumentationRegistry.getInstrumentation().runOnMainSync {
30+
openMapView = OpenMapView(context)
31+
openMapView.layout(0, 0, 1080, 1920)
32+
}
2933

3034
controller = openMapView.getMapControllerForTesting()
3135
controller.setCenter(LatLng(51.4661, 7.2491))

0 commit comments

Comments
 (0)