公开 SDK 落后主仓的一批 bugfix(主仓是固件构建源,这些修复已在设备上跑过)。 本次只做「主仓 → 公开仓」单向同步,图像栈方向由主仓侧另一单处理。 时钟 ABI(M16 第二弹,原文件自认「残余未修」): - meow_ui_time.c 147→345 行:futex 相对超时接管(__timedwait/_cp)、 timerfd_create/settime/gettime 的 itimerspec 64↔32 双向转换、 __clock_settime64 越界返 ENOTSUP,另有 4 个纯换算函数 - meow_ui_internal.h:struct meow_time32 / meow_itimerspec32 契约移入内部头 - CLOCK_ABI.md:补接管机制、验证配方与 objdump 证据 - 新增 test_meow_time64.c IME bug3(成对才有意义): - meow_ui_ime.c:IME_TAP_COOLDOWN_MS 200 冷却窗 + 打开时二次 drain - meow_ui_input.c:meow_input_touch_reset() 并在 drain 内调用(复位触摸状态机) - test_ime_fix.c:新增用例④ stray-tap 列表行高(M15,修用户可见 bug): - meow_ui_widget.c:listv_item_h() 由主题字体行高派生,不再写死 56 (两行列表 62 > 56 会让首行标题被裁剪守卫整条跳过) - include/meow_ui_widgets.h:新增 meow_listview_item_h() - 新增 test_meow_ui_listview_rowh.c 其余:meow_select.c / meow_ui_dialog.c 统一 MD3 形状 token; include/meow_ipc.h 补 MSG_KEY_PAGEUP/PAGEDOWN 枚举; meow_ui_sys.c / meow_cachegov.c 取时统一走 meow_ui_time_ms()。 测试辅助函数标定:tuku/test/test_settings_lock_host.c 的注入前等待 150ms→350ms。 该等待按修复前 IME 标定,新冷却窗下首键 dt_open≈114ms 会被当迟到抬起吞掉, 只录到 "68" 两位。仅改等待时长,断言原样保留。 验证:tuku 四套脚本全绿(run_tests 644 PASS / zip 106 / cbz 296 / webtoon PASS); 12 个源文件与主仓逐字节一致;sdk/build_sdk.sh 34 成员; tuku/build_tuku.sh 产出静态 MIPS32r2 ELF。
123 lines
6.4 KiB
C
123 lines
6.4 KiB
C
/* test_meow_ui_theme_export.c — M7.0a 主题收口前置(缺口#6 SDK 半)宿主验证:
|
||
* §8.1.5 色板导出/注入——meow_theme_export 拷当前权威主题;meow_theme_inject 覆写当前生效主题。
|
||
*
|
||
* 覆盖:
|
||
* T1 导出一致性:export 后关键字段 == meow_theme_get()(当前 style×mode 权威板);
|
||
* T2 注入:inject 一份自定义板 → meow_theme_get()/export 都返回注入板(单一权威反映);
|
||
* 注入恢复内建:inject(NULL) 后回到目标 style×mode 的内建板;
|
||
* T3 launcher 薄壳映射契约:导出板能映射出 meow_ui_theme_t 的 9 个角色字段(surface/
|
||
* surface_variant/surface_container/primary/on_surface/on_surface_variant/outline/error/
|
||
* surface_tint),值与 SDK meow_theme 对应字段一致。
|
||
*
|
||
* 编译(宿主 gcc,链真实 gfx/sys/theme/vol/log/widget/input/activity/dialog/ime + 打桩 font/global):
|
||
* gcc -Wall -Wextra -o test_meow_ui_theme_export test_meow_ui_theme_export.c test_host_stub.c \
|
||
* meow_ui_gfx.c meow_ui_time.c meow_ui_sys.c meow_ui_theme.c meow_ui_vol.c meow_ui_log.c \
|
||
* meow_ui_widget.c meow_ui_input.c meow_ui_activity.c meow_ui_dialog.c meow_ui_ime.c meow_ui_str.c \
|
||
* meow_pinyin.c meow_ui_draw.c meow_ui_view.c meow_ui_box.c meow_ui_anim.c meow_ui_scroll.c \
|
||
* meow_ui_img.c meow_ui_media.c meow_notify_ipc.c stb_image.c meow_ui_nav.c \
|
||
* -I. -Iinclude -DMEOW_UI_HOST_TEST -pthread -lm
|
||
* 运行:./test_meow_ui_theme_export
|
||
*/
|
||
#include "meow_ui.h"
|
||
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include <string.h>
|
||
#include <assert.h>
|
||
|
||
static int g_fail = 0;
|
||
#define CHECK(cond, name) do { \
|
||
if (cond) printf(" PASS %s\n", name); \
|
||
else { printf(" FAIL %s\n", name); g_fail++; } } while (0)
|
||
|
||
/* launcher meow_ui_theme_t 的 9 字段形状(测试内复刻字段名,不依赖 launcher 内部头)。 */
|
||
typedef struct {
|
||
uint32_t surface, surface_variant, surface_container;
|
||
uint32_t primary, on_surface, on_surface_variant;
|
||
uint32_t outline, error, surface_tint;
|
||
} shell_theme;
|
||
|
||
static shell_theme export_shell(const meow_theme *t)
|
||
{
|
||
shell_theme s;
|
||
s.surface = t->surface;
|
||
s.surface_variant = t->surfaceVariant;
|
||
s.surface_container = t->surfaceContainer;
|
||
s.primary = t->primary;
|
||
s.on_surface = t->onSurface;
|
||
s.on_surface_variant= t->onSurfaceVariant;
|
||
s.outline = t->outline;
|
||
s.error = t->error;
|
||
s.surface_tint = t->surfaceTint;
|
||
return s;
|
||
}
|
||
|
||
int main(void)
|
||
{
|
||
setenv("MEOW_UI_DUMP", "/tmp/theme_export.ppm", 1);
|
||
meow_ui_opts o = { 480, 720 };
|
||
assert(meow_ui_init(&o) == 0);
|
||
|
||
/* ---- T1 导出一致性(MD3 dark) ---- */
|
||
printf("T1 export consistency\n");
|
||
meow_theme_set_mode(MEOW_THEME_DARK);
|
||
meow_ui_set_style(MEOW_STYLE_MD3);
|
||
const meow_theme *t0 = meow_theme_get();
|
||
meow_theme e0; meow_theme_export(&e0);
|
||
CHECK(e0.surface == t0->surface, "export.surface == get.surface");
|
||
CHECK(e0.primary == t0->primary, "export.primary == get.primary");
|
||
CHECK(e0.surfaceVariant== t0->surfaceVariant,"export.surfaceVariant == get.surfaceVariant");
|
||
CHECK(e0.onSurface == t0->onSurface, "export.onSurface == get.onSurface");
|
||
CHECK(e0.radius == t0->radius, "export.radius == get.radius");
|
||
CHECK(e0.bg == t0->bg, "export.bg == get.bg (background override applied)");
|
||
|
||
/* MIUIx light:确认导出随 style×mode 切换(不是固定板) */
|
||
meow_ui_set_style(MEOW_STYLE_MIUIX);
|
||
meow_theme_set_mode(MEOW_THEME_LIGHT);
|
||
const meow_theme *t1 = meow_theme_get();
|
||
meow_theme e1; meow_theme_export(&e1);
|
||
CHECK(e1.primary == 0xF57200 && t1->primary == 0xF57200, "MIUIx light primary exported");
|
||
CHECK(e1.bg == t1->bg && e1.surface == t1->surface, "MIUIx light bg/surface exported");
|
||
CHECK(e1.surface == (uint32_t)0xF7F3EE, "MIUIx light surface == warm default");
|
||
|
||
/* ---- T2 注入覆写 + 恢复内建 ---- */
|
||
printf("T2 inject override + restore\n");
|
||
meow_theme custom; memset(&custom, 0, sizeof custom);
|
||
custom.surface = 0x112233; custom.primary = 0xABCDEF; custom.onSurface = 0x0F0F0F;
|
||
custom.radius = 99; custom.radius_card = 100;
|
||
meow_theme_inject(&custom);
|
||
const meow_theme *ti = meow_theme_get();
|
||
meow_theme ei; meow_theme_export(&ei);
|
||
CHECK(ti->primary == 0xABCDEF && ti->surface == 0x112233 && ti->radius == 99,
|
||
"inject -> get() reads injected palette");
|
||
CHECK(ei.primary == 0xABCDEF && ei.surface == 0x112233, "inject -> export reads injected palette");
|
||
/* meow_theme_export == meow_theme_get even when injected(单一权威) */
|
||
CHECK(ei.onSurface == ti->onSurface && ei.radius_card == ti->radius_card,
|
||
"export == get while injected");
|
||
/* 注入恢复内建 */
|
||
meow_theme_inject(NULL);
|
||
const meow_theme *tr = meow_theme_get();
|
||
CHECK(tr->primary == 0xF57200 && tr->surface == 0xF7F3EE,
|
||
"inject(NULL) restores builtin (MIUIx light)");
|
||
|
||
/* ---- T3 launcher 薄壳映射契约(9 角色字段) ---- */
|
||
printf("T3 shell mapping contract\n");
|
||
meow_theme_export(&e1);
|
||
shell_theme sh = export_shell(&e1);
|
||
CHECK(sh.surface == e1.surface, "shell.surface == surface");
|
||
CHECK(sh.surface_variant == e1.surfaceVariant, "shell.surface_variant == surfaceVariant");
|
||
CHECK(sh.surface_container == e1.surfaceContainer, "shell.surface_container == surfaceContainer");
|
||
CHECK(sh.primary == e1.primary, "shell.primary == primary");
|
||
CHECK(sh.on_surface == e1.onSurface, "shell.on_surface == onSurface");
|
||
CHECK(sh.on_surface_variant == e1.onSurfaceVariant, "shell.on_surface_variant == onSurfaceVariant");
|
||
CHECK(sh.outline == e1.outline, "shell.outline == outline");
|
||
CHECK(sh.error == e1.error, "shell.error == error");
|
||
CHECK(sh.surface_tint == e1.surfaceTint, "shell.surface_tint == surfaceTint");
|
||
/* 关键角色字段值与 MIUIx light 内建一致(证明读的是 SDK 单一权威,而非 launcher 自持 4 套) */
|
||
CHECK(sh.surface == 0xF7F3EE && sh.primary == 0xF57200 && sh.error == 0xB3261E,
|
||
"shell roles match SDK builtin (single authority)");
|
||
|
||
meow_ui_shutdown();
|
||
printf(g_fail ? "\nRESULT: %d FAIL(S)\n" : "\nRESULT: ALL PASS\n", g_fail);
|
||
return g_fail;
|
||
}
|