blob: 90069bc4d26719c566b8b6e4933bdc977cfadfa8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
package com.mapbox.mapboxsdk.snapshotter
import android.support.test.rule.ActivityTestRule
import android.support.test.runner.AndroidJUnit4
import com.mapbox.mapboxsdk.maps.Style
import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
@RunWith(AndroidJUnit4::class)
class MapSnapshotterDefault {
@JvmField
@Rule
var rule = ActivityTestRule(FeatureOverviewActivity::class.java)
private val latch: CountDownLatch = CountDownLatch(1)
@Test
fun snapshotterOverDenseArea() {
rule.runOnUiThread {
val options = MapSnapshotter.Options(1024, 1024)
.withStyle(Style.MAPBOX_STREETS)
val mapSnapshotter = MapSnapshotter(rule.activity, options)
mapSnapshotter.start {
resumeTestExecution()
}
}
holdTestExecution()
}
fun holdTestExecution() {
val timeout = !latch.await(15, TimeUnit.SECONDS)
if (timeout) {
throw IllegalStateException()
}
}
fun resumeTestExecution() {
latch.countDown()
}
}
|