From cc831f85cc1252fe35c33b7e285e83e661b0973e Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 23 Jul 2026 16:04:02 +0800 Subject: [PATCH] =?UTF-8?q?feat(macrobenchmark):=20=E6=9B=B4=E6=96=B0=20Ba?= =?UTF-8?q?seline=20Profile=20=E8=84=9A=E6=9C=AC=E8=A6=86=E7=9B=96?= =?UTF-8?q?=E5=B9=B4=E6=9C=88=E8=A7=86=E5=9B=BE=E7=A9=BF=E6=A2=AD=E4=B8=8E?= =?UTF-8?q?=E6=97=A5=E6=9C=9F=E8=AE=B0=E5=BD=95=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../baseline/BaselineProfileGenerator.kt | 70 ++++++++++++++++++- 1 file changed, 67 insertions(+), 3 deletions(-) diff --git a/macrobenchmark/src/main/java/plus/rua/project/baseline/BaselineProfileGenerator.kt b/macrobenchmark/src/main/java/plus/rua/project/baseline/BaselineProfileGenerator.kt index 11440a2..78765f4 100644 --- a/macrobenchmark/src/main/java/plus/rua/project/baseline/BaselineProfileGenerator.kt +++ b/macrobenchmark/src/main/java/plus/rua/project/baseline/BaselineProfileGenerator.kt @@ -51,9 +51,8 @@ import org.junit.runner.RunWith * 10. 拖拽 BottomCard 展开回月视图 * 11. 切换"显示调休"OFF * 12. CalendarPager 左右翻页 - * - * 注:年视图、关于/开源许可、工具/日期检查器等路径在部分模拟器上不稳定, - * 暂时从生成流程中移除以保证 Profile 可稳定生成。后续可在真机上扩展覆盖。 + * 13. 进入年视图(覆盖 SharedTransitionLayout 缩放与年视图网格 Pager) + * 14. 进入"工具" -> "日期记录器"界面(覆盖新增的工具页与日期记录器功能) */ @RunWith(AndroidJUnit4::class) class BaselineProfileGenerator { @@ -198,6 +197,71 @@ class BaselineProfileGenerator { device.waitForIdle() } + // ── 13. 进入年视图与 SharedTransition 穿梭 ─────────────── + val fabYear = safeFindFab() + if (fabYear != null) { + fabYear.click() + device.waitForIdle() + val yearViewMenu = device.wait(Until.findObject(By.text("年视图")), 3000) + if (yearViewMenu != null) { + yearViewMenu.click() + device.waitForIdle() + + val yearGrid = device.wait(Until.findObject(By.res("year_grid")), 5000) + if (yearGrid != null) { + // 年视图左右翻页 + yearGrid.swipe(Direction.LEFT, 0.5f) + device.waitForIdle() + yearGrid.swipe(Direction.RIGHT, 0.5f) + device.waitForIdle() + + // 点击月份小网格切回月视图 + val bounds = yearGrid.visibleBounds + device.click(bounds.centerX(), bounds.centerY()) + device.waitForIdle() + } else { + // 备用:若未找到 year_grid,通过菜单切回月视图 + fabYear.click() + device.waitForIdle() + device.wait(Until.findObject(By.text("月视图")), 3000)?.click() + device.waitForIdle() + } + } + } + + // ── 14. 进入"工具" -> "日期记录器"界面 ───────────────────── + val fabTools = safeFindFab() + if (fabTools != null) { + fabTools.click() + device.waitForIdle() + val toolsMenu = device.wait(Until.findObject(By.text("工具")), 3000) + if (toolsMenu != null) { + toolsMenu.click() + device.waitForIdle() + + val dateRecorderItem = device.wait( + Until.findObject(By.res("tool_date_recorder")), 5000 + ) ?: device.wait(Until.findObject(By.text("日期记录器")), 3000) + + if (dateRecorderItem != null) { + dateRecorderItem.click() + device.waitForIdle() + + // 等待日期记录器页面加载 + device.wait(Until.findObject(By.res("date_recorder_fab")), 5000) + device.waitForIdle() + + // 按返回键返回工具页 + device.pressBack() + device.waitForIdle() + } + + // 按返回键返回主日历 + device.pressBack() + device.waitForIdle() + } + } + Log.d(TAG, "Baseline Profile / Startup Profile 生成完成,所有路径已覆盖") } }