[6.7.0][地图sdk] 更改自车模型添加nt3d字节数组支持

This commit is contained in:
renwj
2024-10-25 17:29:45 +08:00
parent bf2659d6e2
commit 39088b7ed8
4 changed files with 114 additions and 1 deletions

View File

@@ -0,0 +1,81 @@
package com.mogo.functions.test
import androidx.test.core.app.ActivityScenario
import androidx.test.platform.app.InstrumentationRegistry
import com.mogo.eagle.core.data.enums.Carmodel
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
import com.mogo.eagle.core.function.main.MainLauncherActivity
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
import com.zhidaoauto.map.sdk.open.renders.marker.BitmapDescriptorFactory
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import okio.use
import org.junit.Before
import org.junit.Test
import java.util.concurrent.TimeUnit
class Nt3dByteArrayTest {
companion object {
private const val TAG = "NT3D_TEST"
}
lateinit var launch: ActivityScenario<MainLauncherActivity>
@Before fun before() {
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
}
@Test fun testAllNt3d(): Unit = runBlocking {
val arguments = InstrumentationRegistry.getArguments()
val millis = arguments.getString("delay", "0").toLong()
Logger.d(TAG, "-- testAllNt3d --- 0 ---")
if (millis > 0) {
delay(millis)
}
Logger.d(TAG, "-- testAllNt3d --- 1 ---")
val interval = arguments.getString("interval", "0").toLong()
Carmodel.values().iterator().forEach {
Logger.d(TAG, "-- testAllNt3d --- 2 ---")
delay(interval)
Logger.d(TAG, "-- testAllNt3d --- 3 ---")
BitmapDescriptorFactory.from3DResource(InstrumentationRegistry.getInstrumentation().targetContext, it.rawValue)?.also { data ->
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(data, true)
}
}
delay(TimeUnit.MINUTES.toMillis(10))
}
@Test fun testAllNt3d2(): Unit = runBlocking {
val arguments = InstrumentationRegistry.getArguments()
val millis = arguments.getString("delay", "0").toLong()
Logger.d(TAG, "-- testAllNt3d2 --- 0 ---")
if (millis > 0) {
delay(millis)
}
Logger.d(TAG, "-- testAllNt3d2 --- 1 ---")
val interval = arguments.getString("interval", "0").toLong()
val step = arguments.getString("step", "0").toInt()
var index = 0
Carmodel.values().iterator().forEach {
Logger.d(TAG, "-- testAllNt3d2 --- 2 ---")
var useByteArray = false
if ((index % step) == 0) {
useByteArray = true
}
delay(interval)
Logger.d(TAG, "-- testAllNt3d2 --- 3 ---:useByteArray -> $useByteArray")
if (useByteArray) {
BitmapDescriptorFactory.from3DResource(InstrumentationRegistry.getInstrumentation().targetContext, it.rawValue)?.also { data ->
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(data, true)
}
} else {
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(it.rawValue)
}
index ++
}
delay(TimeUnit.MINUTES.toMillis(10))
}
}