-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
159 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.mapbox.maps | ||
|
||
import android.opengl.GLES20 | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import androidx.test.filters.LargeTest | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.junit.runners.Parameterized | ||
import java.util.concurrent.CountDownLatch | ||
import java.util.concurrent.TimeUnit | ||
import java.util.concurrent.TimeoutException | ||
|
||
@RunWith(Parameterized::class) | ||
@LargeTest | ||
class RenderTest( | ||
private val useTexture: Boolean, | ||
private val eventNeedRender: Boolean, | ||
) { | ||
|
||
@get:Rule | ||
val rule = ActivityScenarioRule(EmptyActivity::class.java) | ||
|
||
@Test | ||
fun userQueueEventNeedRender() { | ||
val latch = CountDownLatch(1) | ||
var openGlVersionString = "" | ||
rule.scenario.onActivity { | ||
it.runOnUiThread { | ||
val mapView = MapView(it, MapInitOptions(it, textureView = useTexture)) | ||
mapView.queueEvent( | ||
{ | ||
openGlVersionString = GLES20.glGetString(GLES20.GL_VERSION) | ||
// assume anything should already have OpenGL ES 3+... | ||
assert(openGlVersionString.contains("OpenGL ES 3.")) | ||
latch.countDown() | ||
}, | ||
needRender = eventNeedRender | ||
) | ||
it.frameLayout.addView(mapView) | ||
mapView.onStart() | ||
} | ||
} | ||
if (!latch.await(LATCH_TIMEOUT_SEC, TimeUnit.SECONDS)) { | ||
throw TimeoutException() | ||
} | ||
} | ||
|
||
companion object { | ||
private const val LATCH_TIMEOUT_SEC = 5L | ||
@JvmStatic | ||
@Parameterized.Parameters | ||
fun data() = listOf( | ||
arrayOf(/* useTexture */ true, /* eventNeedRender */ true), | ||
arrayOf(/* useTexture */ true, /* eventNeedRender */ false), | ||
arrayOf(/* useTexture */ false, /* eventNeedRender */ true), | ||
arrayOf(/* useTexture */ false, /* eventNeedRender */ false), | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.