通知中心 ⑥⑦: 电源菜单chip + 勿扰面板内开关 + 单条左滑删除(agent-132)
- ⑥ 快捷行 5chip: WiFi/蓝牙/亮度/主题/电源菜单; 电源菜单chip点击=唤起 show_power_menu(真弹) + after_modal 还原 - 勿扰=面板内开关(notify.dnd bool, 零旁路), ncp_draw_list 按 urgency>=2 过滤; NCP_LIST_TOP 308 - ⑦ 单条通知行左滑删除: 跟手(mnp_swipe_clamp)+半程可回(未过阈值回弹), 过阈值滑出删除(mnp_swipe_delete/step) - 手势区分: 行内左滑=删该条, 竖向=滚动, meow_edge_back(左缘<24) 优先; 局部刷该行带 - meow_ui.a 零改动(d249c6e6); launcher=115e2b1d; 宿主147断言PASS; 新增0warn - SYSTEM_SETTINGS §1 加 notify.dnd; NOTIFICATION_SYSTEM §9 增 ⑥/⑦ 定案
This commit is contained in:
1 parent
a8ec8377ed
commit
82b77d64b4
7 files changed
+452
-46
No files matched your search
@@ -238,6 +238,79 @@ static void test_anim_pure(void)
|
||||
CHECK(mnp_anim_step(0, 0, FIX, 10, 180) == 0, "at p==0 with target 0 stays put (would break)");
|
||||
}
|
||||
|
||||
/* P5 ⑥ 勿扰过滤 + ⑦ 行左滑删除(纯逻辑,header-only):
|
||||
* - mnp_dnd_should_show:dnd=0 全显示;dnd=1 只 urgency>=2(HIGH/CRITICAL)。
|
||||
* - mnp_swipe_clamp:跟手 clamp 到 [-row_w,0]。
|
||||
* - mnp_swipe_delete:松手阈值(行宽百分比 / 绝对像素,取大者)。
|
||||
* - mnp_swipe_step:落位动画线性步进(回弹/滑出,正反向,到底停,半程取消)。
|
||||
* 另加一段 mini 状态机:手指拖 → 松手过阈值=滑出删除 / 未过=回弹复原(跟手、半程可回)。 */
|
||||
static void test_dnd_swipe_pure(void)
|
||||
{
|
||||
fprintf(stderr, "--- P5 DND filter + row left-swipe ---\n");
|
||||
/* mnp_dnd_should_show */
|
||||
CHECK(mnp_dnd_should_show(0, 0) == 1, "dnd off -> LOW(0) shows");
|
||||
CHECK(mnp_dnd_should_show(1, 0) == 1, "dnd off -> NORMAL(1) shows");
|
||||
CHECK(mnp_dnd_should_show(2, 0) == 1, "dnd off -> HIGH(2) shows");
|
||||
CHECK(mnp_dnd_should_show(3, 0) == 1, "dnd off -> CRITICAL(3) shows");
|
||||
CHECK(mnp_dnd_should_show(0, 1) == 0, "dnd on -> LOW(0) hidden");
|
||||
CHECK(mnp_dnd_should_show(1, 1) == 0, "dnd on -> NORMAL(1) hidden");
|
||||
CHECK(mnp_dnd_should_show(2, 1) == 1, "dnd on -> HIGH(2) shows");
|
||||
CHECK(mnp_dnd_should_show(3, 1) == 1, "dnd on -> CRITICAL(3) shows");
|
||||
|
||||
/* mnp_swipe_clamp(跟手 offset clamp:off∈[-row_w,0]) */
|
||||
CHECK(mnp_swipe_clamp(-200, 456) == -200, "swipe_clamp in-range kept");
|
||||
CHECK(mnp_swipe_clamp(30, 456) == 0, "swipe_clamp rightward -> 0");
|
||||
CHECK(mnp_swipe_clamp(-500, 456) == -456, "swipe_clamp past left -> -row_w");
|
||||
CHECK(mnp_swipe_clamp(-456, 456) == -456, "swipe_clamp exactly -row_w kept");
|
||||
CHECK(mnp_swipe_clamp(0, 456) == 0, "swipe_clamp 0 kept");
|
||||
|
||||
/* mnp_swipe_delete(row_w=456, frac_pct=40 → 40%=182.4;min_px=110;OR 语义 → 有效阈值=110px) */
|
||||
CHECK(mnp_swipe_delete(-80, 456, 40, 110) == 0, "delete -80 (<110 & <182.4) -> cancel");
|
||||
CHECK(mnp_swipe_delete(-110, 456, 40, 110) == 1, "delete -110 (>=min_px) -> delete");
|
||||
CHECK(mnp_swipe_delete(-150, 456, 40, 110) == 1, "delete -150 (>=min_px, <40%) -> delete");
|
||||
CHECK(mnp_swipe_delete(-183, 456, 40, 110) == 1, "delete -183 (>=40%) -> delete");
|
||||
CHECK(mnp_swipe_delete(-456, 456, 40, 110) == 1, "delete full slide -> delete");
|
||||
CHECK(mnp_swipe_delete(0, 456, 40, 110) == 0, "delete 0 -> cancel");
|
||||
/* 窄行:40%=24px(row_w=60),min_px=110 不起作用 → 阈值=24px */
|
||||
CHECK(mnp_swipe_delete(-25, 60, 40, 110) == 1, "delete narrow row -25 (>=40%) -> delete");
|
||||
CHECK(mnp_swipe_delete(-20, 60, 40, 110) == 0, "delete narrow row -20 (<40%) -> cancel");
|
||||
|
||||
/* mnp_swipe_step(线性步进:off 向 target 走 dt*rate,可正/反向,到底停) */
|
||||
CHECK(mnp_swipe_step(-100, 0, 10, 3) == -70, "step springback +30px/tick");
|
||||
CHECK(mnp_swipe_step(-100, 0, 0, 3) == -100, "step dt=0 -> unchanged");
|
||||
CHECK(mnp_swipe_step(-100, 0, 1000, 3) == 0, "step huge dt -> clamp at 0 (springback done)");
|
||||
CHECK(mnp_swipe_step(-50, -456, 10, 3) == -80, "step slide-out leftward");
|
||||
CHECK(mnp_swipe_step(-50, -456, 1000, 3) == -456, "step huge dt -> clamp at -row_w (deleted)");
|
||||
CHECK(mnp_swipe_step(-30, -30, 10, 3) == -30, "step at target -> stays");
|
||||
CHECK(mnp_swipe_step(0, 0, 10, 3) == 0, "step 0 target 0 -> stays");
|
||||
CHECK(mnp_swipe_step(-1000, 0, 5, 3) == -985, "step linear rate not exponential (small dt)");
|
||||
|
||||
/* mini 状态机:跟手拖 → 松手判定 → 动画到目标(半程取消 vs 删除)。 */
|
||||
int row_w = 456, off = 0;
|
||||
/* 拖 80px 左(低于阈值 110)→ 松手回弹复原 */
|
||||
off = mnp_swipe_clamp(-80, row_w);
|
||||
CHECK(mnp_swipe_delete(off, row_w, 40, 110) == 0, "mini: drag -80 -> cancel (springback)");
|
||||
int target = mnp_swipe_delete(off, row_w, 40, 110) ? -row_w : 0;
|
||||
off = mnp_swipe_step(off, target, 1000, 3);
|
||||
CHECK(off == 0, "mini: springback reaches 0 (row restored)");
|
||||
/* 拖 150px 左(>=110)→ 松手滑出删除 */
|
||||
off = mnp_swipe_clamp(-150, row_w);
|
||||
CHECK(mnp_swipe_delete(off, row_w, 40, 110) == 1, "mini: drag -150 -> delete");
|
||||
target = mnp_swipe_delete(off, row_w, 40, 110) ? -row_w : 0;
|
||||
off = mnp_swipe_step(off, target, 1000, 3);
|
||||
CHECK(off == -row_w, "mini: slide-out reaches -row_w (dismiss)");
|
||||
/* 半程可反向:拖 200 左再反向回摄(dx 变 +30)→ off 回 0(跟手可回、松手在途取消) */
|
||||
off = mnp_swipe_clamp(-200, row_w);
|
||||
CHECK(off == -200, "mini: drag -200 follows finger");
|
||||
off = mnp_swipe_clamp(30, row_w); /* 反向拖回原点左侧以右 → clamp 0 */
|
||||
CHECK(off == 0, "mini: reverse drag -> row slides back to 0 (halfway cancel)");
|
||||
/* 半程取消:拖 150 左(未达 182.4 的 40% 但达 110px 阈值)→ 松手删;若再拖回 <110 → 回弹 */
|
||||
off = mnp_swipe_clamp(-150, row_w);
|
||||
CHECK(mnp_swipe_delete(off, row_w, 40, 110) == 1, "mini: -150 passed threshold -> delete");
|
||||
off = mnp_swipe_clamp(-100, row_w); /* 又拖回 100 <110 */
|
||||
CHECK(mnp_swipe_delete(off, row_w, 40, 110) == 0, "mini: -100 back under threshold -> cancel");
|
||||
}
|
||||
|
||||
static void test_storage_contract(void)
|
||||
{
|
||||
fprintf(stderr, "--- P0 storage contract (panel reads) ---\n");
|
||||
@@ -341,6 +414,7 @@ int main(void)
|
||||
test_pure_logic();
|
||||
test_scroll_pure();
|
||||
test_anim_pure();
|
||||
test_dnd_swipe_pure();
|
||||
test_storage_contract();
|
||||
|
||||
unlink(g_tflog); rmdir(dir);
|
||||
|
||||
Reference in new issue
Block a user