Files
legado-ios/scripts/fixtures/SourceImportFixture.swift
T
Aminark 0915a144a7 fix: 修复书源导入、阅读外观和书签状态
- 修复书源文件选择、访问权限与导入预览流程,支持查看分组内的书源
- 修复背景图片、字体选择与主题切换,限制背景图片解码尺寸
- 根据已保存书签恢复当前位置状态,避免重复添加
- 补充模型、阅读器和文件选择回归测试及测试样本
- 更新应用版本为 0.1.10(build 16)

Fixes #1
2026-10-20 23:30:42 +08:00

34 lines
1.5 KiB
Swift

import UIKit
// Standalone simulator-only file provider; never bundled with Legado.
@main
@MainActor
final class FixtureAppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
let documents = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0]
let fixtures = [
("JSON-Source.json", "https://file-import.test/json", "文件导入 JSON 测试"),
("JSON-Uppercase.JSON", "https://file-import.test/uppercase", "文件导入大写扩展名测试"),
("JSON-Text.txt", "https://file-import.test/text", "文件导入文本扩展名测试")
]
for (name, url, title) in fixtures {
let source = [["bookSourceUrl": url, "bookSourceName": title]]
if let data = try? JSONSerialization.data(withJSONObject: source) {
try? data.write(to: documents.appendingPathComponent(name), options: .atomic)
}
}
let controller = UIViewController()
controller.view.backgroundColor = .systemBackground
let label = UILabel()
label.text = "书源导入测试文件已准备好"
label.frame = CGRect(x: 20, y: 100, width: 350, height: 80)
controller.view.addSubview(label)
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = controller
window?.makeKeyAndVisible()
return true
}
}