old render cleanup part 3

This commit is contained in:
Agel committed 2026-10-25 15:43:51 +01:00
1 parent cef762c3ee
commit 3faedd4251
45 files changed
+1057 -1135

No files matched your search

+28
View File
@@ -50,6 +50,34 @@ private slots:
const auto parsed = ImageUrl::parseProviderId(QStringLiteral("page%2001.jpg"));
QCOMPARE(parsed.entry, QStringLiteral("page 01.jpg"));
}
void resolveWebUrls()
{
const QString book = QStringLiteral("/books/test.epub");
QCOMPARE(ImageUrl::resolve(QStringLiteral("epub"), QStringLiteral("http://example.com/pic.png"), book),
QStringLiteral("image://web/http://example.com/pic.png"));
QCOMPARE(ImageUrl::resolve(QStringLiteral("epub"), QStringLiteral("https://example.com/pic.png"), book),
QStringLiteral("image://web/https://example.com/pic.png"));
}
void resolveRelativeUrlsWithBaseDir()
{
const QString book = QStringLiteral("/books/test.epub");
const QString url = ImageUrl::resolve(QStringLiteral("epub"),
QStringLiteral("../images/pic.png"),
book,
QStringLiteral("OEBPS/text/"));
QVERIFY(url.startsWith(QStringLiteral("image://epub/OEBPS/images/pic.png?src=")));
}
void resolveFb2Fragment()
{
const QString book = QStringLiteral("/books/test.fb2");
const QString url = ImageUrl::resolve(QStringLiteral("fb2"),
QStringLiteral("#cover.png"),
book);
QVERIFY(url.startsWith(QStringLiteral("image://fb2/cover.png?src=")));
}
};
QTEST_MAIN(ImageUrlTest)