fix(ncm): SDK圆角矩形列表项加外边距 — 实为ncm_app应用层自绘(row_bg圆角卡),调用处加NCM_ROW_GAP=8px卡间可见外距(卡高48/行距56上下对称+擦SDK行分隔线);三屏playlist/home/queue;宿主test_meow_row_gap PASS,0warning,不涉meow_ui.a无需重链

This commit is contained in:
AskaEth committed 2026-09-03 23:29:45 +08:00
1 parent a82f3f9dfa
commit e8218b8ae9
5 files changed
+107 -15

No files matched your search

@@ -0,0 +1,59 @@
/* app/test/test_meow_row_gap.c — 宿主验证:圆角卡列表项外边距(item margin/gap)几何。
*
* 只测 app/ui 卡片几何辅助(ncm_row_card_y / ncm_row_card_h + NCM_ROW_GAP / APP_ROW_H),
* 纯整数运算,不链 SDK / 不开设备:
* gcc -I. -I../sdk -I../meow_launcherd -Icore \
* -I"$ROOT/patch_v2/sdk" -I"$ROOT/patch_v2/meow_launcherd" \
* -Ivendor/mbedtls/include -Ivendor/jsmn -Ivendor/qrcodegen/c \
* -Ivendor/minimp3 -Ivendor/dr_flac \
* test_meow_row_gap.c -o test_meow_row_gap && ./test_meow_row_gap
*
* 断言集(对应「相邻 item 顶之间 = item 高 + gap」的可见形式):
* ① 相邻卡顶间距 = APP_ROW_H(= 卡高 + gap;SDK 行距不变);
* ② 卡片间可见外距 = NCM_ROW_GAP;
* ③ 卡在其行高内上下对称内缩 → SDK 文本(按 APP_ROW_H 垂直居中)落卡中心;
* ④ 滚动偏移只整体平移,不改变上述间距/对称。
*/
#include "../ncm_app_internal.h" /* APP_ROW_H / NCM_ROW_GAP / ncm_row_card_y / ncm_row_card_h */
#include <stdio.h>
#include <assert.h>
int main(void)
{
const int item = APP_ROW_H; /* 行距(SDK listview item_h,不变) */
const int gap = NCM_ROW_GAP;
const int list_y = 100;
/* 卡顶 = 行顶 + 上下对称内缩 gap/2;卡高 = item - gap。 */
int y0 = ncm_row_card_y(item, 0, 0, list_y);
int y1 = ncm_row_card_y(item, 1, 0, list_y);
int h = ncm_row_card_h(item);
/* ① 行顶(索引0)=list_y;卡相对行顶对称内缩 gap/2;卡高=item-gap */
assert(y0 == list_y + gap / 2);
assert(h == item - gap);
assert(h + gap == item);
/* ① 相邻卡顶间距 = item(顶到顶 = 卡高 + gap) */
assert(y1 - y0 == item);
/* ② 卡片间可见外距 = gap(卡 i 底 到 卡 i+1 顶) */
assert(y1 - (y0 + h) == gap);
/* ③ 卡中心 == 行中心(SDK 文本按行高居中 → 落卡中心) */
assert(y0 - gap / 2 + item / 2 == y0 + h / 2);
/* ④ 滚动偏移只平移,不改变间距/对称 */
for (int off = 0; off <= 2 * item; off += item / 2) {
int a2 = ncm_row_card_y(item, 2, off, list_y);
int a3 = ncm_row_card_y(item, 3, off, list_y);
assert(a3 - a2 == item);
assert(a3 - (a2 + h) == gap);
/* 顶到顶 = 卡高 + gap,且卡在行内对称(对任意 off 一致) */
assert(a2 - (list_y + (2 * item - off)) == gap / 2); /* 行顶 = list_y + idx*item - off */
}
printf("PASS row_gap=%d card_h=%d top2top=%d visible_gap=%d symmetric=1\n",
gap, h, item, gap);
return 0;
}