Engine (form.rs MỚI): - list_form_fields: duyệt cây /AcroForm/Fields (đệ quy /Kids), tên đầy đủ, phân loại theo /FT + cờ /Ff (text/checkbox/radio/combo/list/button/sig), đọc /V + options + on-state + trang + rect; kế thừa /FT từ cha - fill_form_fields: text/combo đặt /V (UTF-16BE cho tiếng Việt), checkbox/radio đặt /V + /AS về on-state, bật NeedAppearances (portable mọi viewer) - create_form_fields: tạo widget + field text/checkbox/combo, gắn vào /Annots + /AcroForm/Fields (tạo AcroForm nếu chưa có) - flatten_form: PDFium page.flatten() in field vào nội dung, bỏ tương tác - export_fdf/parse_fdf/import_fdf (literal ASCII + hex UTF-16BE round-trip tiếng Việt), export_csv Tauri + UI (thanh 📝 Form): - Commands: form_list, form_fill, form_flatten, form_create, form_export (FDF/CSV theo đuôi), form_import_fdf; pick_save_data/pick_fdf; tự chuẩn hoá qua qpdf khi lopdf không đọc thẳng trailer phi chuẩn (thêm dep lopdf cho app) - 📋 Điền form (modal liệt kê field theo loại: text→ô nhập, checkbox→tick, combo→select), ➕ Thêm field (dialog loại/tên/trang/vị trí/cỡ/options), 🧷 Flatten, ⬆ Xuất FDF/CSV, ⬇ Nhập FDF — không prompt/alert Test (5 mới → engine 67/67 xanh ngoài 2 fixture qpdf Linux): - create_and_list_fields; fill_text_checkbox_combo_round_trips (tiếng Việt); fdf_export_import_round_trip; export_csv_has_rows; flatten_removes_interactive_fields Docs: 17-phase6-summary (+ giới hạn), 18-phase6-user-tests (F1–F10), README, roadmap (Phase 6 HOÀN TẤT lõi), 14 (kế tiếp: Phase 7 OCR/Convert). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HgnbPwSoRGNH7LHsDUmRpk
2.2 KiB
2.2 KiB
18 — Checklist test thủ công Phase 6 (Form)
Quan trọng nhất: điền form lưu giữ dữ liệu (F3) và file mở đúng ở Foxit/Adobe (F4, F8), vì đây là dữ liệu người dùng nhập.
Chạy
cd c:\Project\FoFreeXit\app\src-tauri
cargo run
Bảng test
| # | Thao tác | Kỳ vọng | KQ |
|---|---|---|---|
| F1 | Mở 1 PDF, bấm 📝 Form | Hiện thanh Form; nút “Điền form (n)” cho biết số field | |
| F2 | Bấm ➕ Thêm field → tạo 1 Text “hoTen” trang 1 → lưu | File mới mở lên, thanh Form đếm tăng | |
| F3 | Bấm 📋 Điền form → nhập “Nguyễn Văn A” vào hoTen → Lưu | File mới; mở lại thấy giá trị đã điền | |
| F4 | Mở file F3 ở Foxit/Adobe | Field hoTen hiển thị đúng “Nguyễn Văn A” (tiếng Việt đúng dấu) | |
| F5 | Thêm 1 Checkbox và 1 Combo (Nam/Nữ/Khác) → Điền form: tick checkbox, chọn combo → Lưu | Mở lại: checkbox đang tick, combo đúng lựa chọn | |
| F6 | ⬆ Xuất FDF → mở file .fdf bằng Notepad | Có tên field + giá trị (tiếng Việt dạng <FEFF...>) |
|
| F7 | Trên 1 file form rỗng: ⬇ Nhập FDF (chọn file F6) → Lưu | Các field được điền lại từ FDF | |
| F8 | 🧷 Flatten file đã điền → mở ở Foxit | Giá trị vẫn hiển thị nhưng KHÔNG còn là field bấm/sửa được | |
| F9 | ⬆ Xuất CSV → mở bằng Excel | 2 cột name,value đúng dữ liệu | |
| F10 | Mở form PDF THẬT (mẫu Acrobat) → 📋 Điền form | Liệt kê đúng các field có sẵn, điền & lưu giữ được |
Mẫu phản hồi
[Mã] (vd F4) — Phần mềm mở: <Foxit/Adobe/Chrome> — Hiện tượng: <mô tả> —
Kỳ vọng: <...> — Ưu tiên: cao/vừa/thấp
Giới hạn đã biết: tạo field mới hỗ trợ text/checkbox/combo (radio-group/ list/pushbutton chưa tạo — đọc/điền thì được); dựa vào NeedAppearances để viewer dựng hình field (Flatten cho bản “cứng”); mới FDF+CSV, chưa XFDF — xem
docs/17-phase6-summary.mdmục 6.