[MAP] 高精地图Marker绘制逻辑重构

This commit is contained in:
renwj
2023-05-08 14:46:29 +08:00
parent eecea49493
commit 22cf999031
97 changed files with 3615 additions and 6757 deletions

View File

@@ -1,62 +1,62 @@
package com.mogo.functions.test
import androidx.annotation.VisibleForTesting
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
import com.mogo.eagle.core.function.hmi.ui.MoGoHmiProvider
import com.mogo.eagle.core.function.main.MainLauncherActivity
import kotlinx.coroutines.delay
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.suspendCancellableCoroutine
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import java.util.concurrent.TimeUnit.MILLISECONDS
@RunWith(AndroidJUnit4::class)
@LargeTest
class MapDataCollectTest {
lateinit var launch: ActivityScenario<MainLauncherActivity>
@Before
fun before() {
launch = ActivityScenario.launch(MainLauncherActivity::class.java)
}
@Test
fun testTaskSent() = runBlocking {
ensureMoGoHmiFragmentShow()
delay(TimeUnit.SECONDS.toMillis(3))
CallerMapDataCollectorManager.setIsInit()
delay(TimeUnit.HOURS.toMillis(1))
}
private suspend fun ensureMoGoHmiFragmentShow(): MoGoHmiProvider = suspendCancellableCoroutine {
launch.onActivity { itx ->
val executor = Executors.newSingleThreadScheduledExecutor()
executor.scheduleAtFixedRate({
var find =
itx.supportFragmentManager.fragments.find { it is MoGoHmiProvider } as? MoGoHmiProvider
while (find == null) {
find =
itx.supportFragmentManager.fragments.find { it is MoGoHmiProvider } as? MoGoHmiProvider
}
while (!find.isResumed) {
Thread.sleep(500)
}
it.resumeWith(Result.success(find))
try {
Thread.sleep(500)
executor.shutdownNow()
} catch (e: Throwable) {
e.printStackTrace()
}
}, 50, 500, MILLISECONDS)
}
}
}
//package com.mogo.functions.test
//
//import androidx.annotation.VisibleForTesting
//import androidx.test.core.app.ActivityScenario
//import androidx.test.ext.junit.runners.AndroidJUnit4
//import androidx.test.filters.LargeTest
//import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
//import com.mogo.eagle.core.function.hmi.ui.MoGoHmiProvider
//import com.mogo.eagle.core.function.main.MainLauncherActivity
//import kotlinx.coroutines.delay
//import kotlinx.coroutines.runBlocking
//import kotlinx.coroutines.suspendCancellableCoroutine
//import org.junit.Before
//import org.junit.Test
//import org.junit.runner.RunWith
//import java.util.concurrent.Executors
//import java.util.concurrent.TimeUnit
//import java.util.concurrent.TimeUnit.MILLISECONDS
//
//@RunWith(AndroidJUnit4::class)
//@LargeTest
//class MapDataCollectTest {
//
// lateinit var launch: ActivityScenario<MainLauncherActivity>
//
// @Before
// fun before() {
// launch = ActivityScenario.launch(MainLauncherActivity::class.java)
// }
//
// @Test
// fun testTaskSent() = runBlocking {
// ensureMoGoHmiFragmentShow()
// delay(TimeUnit.SECONDS.toMillis(3))
// CallerMapDataCollectorManager.setIsInit()
// delay(TimeUnit.HOURS.toMillis(1))
// }
// private suspend fun ensureMoGoHmiFragmentShow(): MoGoHmiProvider = suspendCancellableCoroutine {
// launch.onActivity { itx ->
// val executor = Executors.newSingleThreadScheduledExecutor()
// executor.scheduleAtFixedRate({
// var find =
// itx.supportFragmentManager.fragments.find { it is MoGoHmiProvider } as? MoGoHmiProvider
// while (find == null) {
// find =
// itx.supportFragmentManager.fragments.find { it is MoGoHmiProvider } as? MoGoHmiProvider
//
// }
// while (!find.isResumed) {
// Thread.sleep(500)
// }
// it.resumeWith(Result.success(find))
// try {
// Thread.sleep(500)
// executor.shutdownNow()
// } catch (e: Throwable) {
// e.printStackTrace()
// }
// }, 50, 500, MILLISECONDS)
// }
// }
//}