feat(reader): 增强阅读器功能与 UI 测试支持

- 新增字体选择(系统/宋体/圆体/等宽)与暗色图片柔化配置
- 文本选择改为自定义手势+操作栏(拷贝/高亮/批注)
- 添加 accessibilityIdentifier 支持自动化 UI 测试
- 新增 UITests 覆盖阅读器打开/关闭、工具栏、设置面板、批注等
- 添加 Demo 测试用 EPUB 书源(宝山辽墓材料与释读)
- 新增文档:UI 自动化测试、功能开发计划、阅读器规划
This commit is contained in:
shen
2026-05-31 23:56:54 +08:00
parent 44202357c0
commit 1efb9d172f
268 changed files with 4991 additions and 44 deletions
@@ -48,6 +48,7 @@ class RDReaderContentCell: UICollectionViewCell {
override init(frame: CGRect) {
super.init(frame: frame)
accessibilityIdentifier = "epub.reader.content.cell"
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
@@ -6,7 +6,6 @@ extension RDReaderView {
/// /
func tapCenter() {
refreshToolViewsFromProviderIfNeeded()
print("[Debug] tapCenter called, isShowToolView was: \(isShowToolView), topToolView: \(String(describing: topToolView)), onBack: \(String(describing: (topToolView as? RDEPUBReaderTopToolView)?.onBack))")
isShowToolView = !isShowToolView
if isShowToolView {
if let topToolView = topToolView {
@@ -74,6 +74,7 @@ public class RDReaderView: UIView {
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
collectionView.backgroundColor = UIColor.clear
collectionView.accessibilityIdentifier = "epub.reader.paging"
return collectionView
}()
private let spreadResolver = RDReaderSpreadResolver()
@@ -327,6 +328,8 @@ public class RDReaderView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
accessibilityIdentifier = "epub.reader.content"
isAccessibilityElement = false
}
///
@@ -610,7 +613,6 @@ public class RDReaderView: UIView {
let point = tap.location(in: tap.view)
if isShowToolView {
let hitView = hitTest(point, with: nil)
print("[Debug] tapAction: isShowToolView=true, point=\(point), hitView=\(String(describing: hitView)), top=\(String(describing: topToolView))")
if let top = topToolView, isHitView(hitView, inside: top, point: point) { return }
if let bottom = bottomToolView, isHitView(hitView, inside: bottom, point: point) { return }
}