图库: 书库点图改按文件名定位(修 P1 截断错位)+ 册间衔接根锁定(M18 评审 r1)
P1-1(会静默开错图):取消「书库从列表推导图片下标」。 - 新增 mr_reader_open_dir_at_name(dir, name):阅读器打开目录册后,在**自己刚枚举出的 全量目录册**(mr_dir_book,与翻页同一份枚举)里按 basename 定位起始页(先精确, 再大小写不敏感兜底;找不到退回续读/首页)。书库点击只传文件名。 - 删除 mr_library_image_index(不再有跨枚举的隐式契约)。 - 截断提示文案改为「仅显示前 2000 项(图片可在阅读器中翻到)」。 - 修复前(cb02722 探针,2100 张 4 位名夹具):rows=2000/truncated=1/ library_images=2000/reader_pages=2100/**mismatched=590**(首行 p1412 → 打开 p1411); 评审夹具为 1995/2000。修复后:2000 个可见图片行按名定位 **0 mismatch**, 2100 页全量可翻;26 次真实 UI 点开(首尾各 3 + 20 个确定性伪随机)逐张命中。 连带处理(评审 r1): 1. 删掉 reader_page_enter 的 c->view 死写(reopen 判定用 activity active/depth); 顺手删掉 library_page_create 里同款死写。 2. 阅读器册间衔接根锁定:新增 mr_path_within_root + mr_book_adjacent_rooted, book_switch 用浏览根(默认 MR_ROOT_DIR,测试可注入)钳制相邻册; 根外的兄弟册按「没有相邻册」处理。test_cont_adjacent A7 验证「明文 _ex 会越根、 rooted 拒绝、根内翻册不受影响」;test_mode_switch_host H6 验证条漫末页不越根。 3. test_reader_perf 不再依赖顶栏 tap 命中时序:模式切换改走测试钩子 mr_reader_test_toggle_mode()(与顶栏动作同一个 mode_set),负载下稳定。 4. page_cache 注释去掉「缩略图缓存/缩略图线程」过时描述(只改文字)。 回归:run_tests.sh(library 81 / nav 74 / lazy 57 / perf 25 / … / open_book 含 2100 用例) 与 run_webtoon_tests.sh(含 A7/H6)全 PASS;交叉构建零警告。
This commit is contained in:
1 parent
64336f95d9
commit
4befbfe14c
17 files changed
+523
-112
No files matched your search
+22
-19
@@ -5,7 +5,7 @@
|
||||
* T2 扩展名过滤:图片 png/jpg/jpeg/bmp 与档案册 cbz/zip 大小写不敏感;gif/txt 不支持;
|
||||
* T3 单层扫描:目录 + 受支持图片 + 档案册混排(目录优先、组内自然序);
|
||||
* 其它普通文件/隐藏项/符号链接不列;副标题扫描期生成一次(无占位/无懒判定);
|
||||
* 图片行下标(mr_library_image_index)与行类型;不可读路径 -> -1;max_depth 忽略;
|
||||
* 行类型;不可读路径 -> -1;max_depth 忽略;浏览根前缀判据 mr_path_within_root;
|
||||
* T4 阅读方向状态(logic/reader.c)。
|
||||
*
|
||||
* 编译(在 tuku/ 下):
|
||||
@@ -80,13 +80,6 @@ static const mr_library_entry *find_entry(const mr_library *lib, const char *nam
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int find_index(const mr_library *lib, const char *name)
|
||||
{
|
||||
for (int i = 0; i < lib->count; i++)
|
||||
if (strcmp(lib->items[i].name, name) == 0) return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void test_natural(void)
|
||||
{
|
||||
CHECK(mr_natural_cmp("page2", "page10") < 0, "page2 < page10");
|
||||
@@ -214,17 +207,27 @@ static void test_scan(void)
|
||||
CHECK(find_entry(&lib, "a.png") == NULL, "no recursion into subdirs");
|
||||
CHECK(find_entry(&lib, "Deeper") == NULL, "no recursion into subdirs (deeper)");
|
||||
|
||||
/* 图片下标 = 本层图片自然序(书库点图 → 阅读器起始页的契约)。 */
|
||||
int i_cover = find_index(&lib, "cover.JPG");
|
||||
int i_root = find_index(&lib, "root.png");
|
||||
CHECK(mr_library_image_index(&lib, i_cover) == 0, "cover.JPG is image #0");
|
||||
CHECK(mr_library_image_index(&lib, i_root) == 1, "root.png is image #1");
|
||||
CHECK(mr_library_image_index(&lib, find_index(&lib, "book.cbz")) == -1,
|
||||
"archive has no image index");
|
||||
CHECK(mr_library_image_index(&lib, find_index(&lib, "Empty")) == -1,
|
||||
"dir has no image index");
|
||||
CHECK(mr_library_image_index(&lib, -1) == -1 && mr_library_image_index(&lib, 99) == -1,
|
||||
"out-of-range image index");
|
||||
/* 浏览根前缀判据(书库导航/阅读器册间衔接的根锁定;纯路径工具)。 */
|
||||
CHECK(mr_path_within_root("/usr/data/mnt/sd_0/a/b", "/usr/data/mnt/sd_0") == 1,
|
||||
"nested path inside root");
|
||||
CHECK(mr_path_within_root("/usr/data/mnt/sd_0", "/usr/data/mnt/sd_0") == 1,
|
||||
"root itself is inside");
|
||||
CHECK(mr_path_within_root("/usr/data/mnt/sd_0/", "/usr/data/mnt/sd_0") == 1,
|
||||
"root with trailing slash is inside");
|
||||
CHECK(mr_path_within_root("/usr/data/mnt/sd_0evil", "/usr/data/mnt/sd_0") == 0,
|
||||
"prefix-lookalike rejected");
|
||||
CHECK(mr_path_within_root("/usr/data/mnt/sd_00", "/usr/data/mnt/sd_0") == 0,
|
||||
"prefix-lookalike with digits rejected");
|
||||
CHECK(mr_path_within_root("/usr/data/mnt", "/usr/data/mnt/sd_0") == 0,
|
||||
"parent of root rejected");
|
||||
CHECK(mr_path_within_root("/usr/data/mnt/sd_0x/a", "/usr/data/mnt/sd_0") == 0,
|
||||
"sibling-prefixed path rejected");
|
||||
CHECK(mr_path_within_root("/a/b", "/a/") == 1, "root trailing slash tolerated");
|
||||
CHECK(mr_path_within_root("/a", "/") == 1, "filesystem root accepts abs path");
|
||||
CHECK(mr_path_within_root("/", "/") == 1, "filesystem root itself");
|
||||
CHECK(mr_path_within_root("rel/path", "/") == 0, "relative path not inside /");
|
||||
CHECK(mr_path_within_root(NULL, "/") == 0 && mr_path_within_root("/a", NULL) == 0 &&
|
||||
mr_path_within_root("/a", "") == 0, "NULL/empty safe");
|
||||
|
||||
/* 行合成:纯内存,返回扫描期生成的字符串。 */
|
||||
mr_library_row row;
|
||||
|
||||
Reference in new issue
Block a user