[FeedBack]反馈代码提交

[feedback]优化ui
This commit is contained in:
renwj
2022-03-17 14:58:59 +08:00
parent 11c6f2cf2b
commit 639950ccc5
50 changed files with 1334 additions and 149 deletions

View File

@@ -3,8 +3,8 @@ package com.mogo.functions.test
import androidx.test.core.app.ActivityScenario
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import com.mogo.eagle.core.data.autopilot.AutoPilotRecordResult
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
import com.mogo.eagle.core.function.hmi.ui.MoGoHmiFragment
import com.mogo.eagle.core.function.main.MainLauncherActivity
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.*
@@ -14,6 +14,7 @@ import org.junit.runner.RunWith
import record_cache.RecordPanelOuterClass
import java.text.SimpleDateFormat
import java.util.*
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import kotlin.random.Random
@@ -31,7 +32,7 @@ class AutoPilotBadCaseTest {
@ExperimentalCoroutinesApi
@Test
fun showBadCaseEntrance1(): Unit = runBlocking(Dispatchers.Main) {
delay(5000)
ensureMoGoHmiFragmentShow()
var index = 0
(1 until 50)
.map { it }
@@ -61,7 +62,7 @@ class AutoPilotBadCaseTest {
@ExperimentalCoroutinesApi
@Test
fun showBadCaseEntrance2(): Unit = runBlocking(Dispatchers.Main) {
delay(5000)
ensureMoGoHmiFragmentShow()
var index = 0
(1 until 50)
.map { it }
@@ -118,4 +119,29 @@ class AutoPilotBadCaseTest {
.collect()
delay(TimeUnit.HOURS.toMillis(2))
}
private suspend fun ensureMoGoHmiFragmentShow(): MoGoHmiFragment = suspendCancellableCoroutine {
launch.onActivity { itx ->
val executor = Executors.newSingleThreadScheduledExecutor()
executor.scheduleAtFixedRate({
var find =
itx.supportFragmentManager.fragments.find { it is MoGoHmiFragment } as? MoGoHmiFragment
while (find == null) {
find =
itx.supportFragmentManager.fragments.find { it is MoGoHmiFragment } as? MoGoHmiFragment
}
while (!find.isResumed) {
Thread.sleep(500)
}
it.resumeWith(Result.success(find))
try {
Thread.sleep(500)
executor.shutdownNow()
} catch (e: Throwable) {
e.printStackTrace()
}
}, 50, 500, TimeUnit.MILLISECONDS)
}
}
}