old render cleanup part 2

This commit is contained in:
Agel committed 2026-10-25 15:10:38 +01:00
1 parent acc7e71e7b
commit cef762c3ee
40 files changed
+329 -3643

No files matched your search

+14 -40
View File
@@ -137,10 +137,7 @@ private slots:
CbzReader reader;
QVERIFY(reader.open(path));
QCOMPARE(reader.chapterCount(), 1);
const Chapter ch = reader.loadChapter(0);
QCOMPARE(ch.contentChunks.size(), 3);
QCOMPARE(reader.pages().size(), 3);
}
void pagesAreSorted()
@@ -155,14 +152,14 @@ private slots:
CbzReader reader;
QVERIFY(reader.open(path));
const Chapter ch = reader.loadChapter(0);
QCOMPARE(ch.contentChunks.size(), 3);
QVERIFY(ch.contentChunks.at(0).contains(QLatin1String("page001.png")));
QVERIFY(ch.contentChunks.at(1).contains(QLatin1String("page002.png")));
QVERIFY(ch.contentChunks.at(2).contains(QLatin1String("page003.png")));
const auto pages = reader.pages();
QCOMPARE(pages.size(), 3);
QVERIFY(pages.at(0).imageUrl.contains(QLatin1String("page001.png")));
QVERIFY(pages.at(1).imageUrl.contains(QLatin1String("page002.png")));
QVERIFY(pages.at(2).imageUrl.contains(QLatin1String("page003.png")));
}
void oneChunkPerPage()
void pagesHaveValidImageUrls()
{
const QString path = makeCbz({
{"p01.jpg", makePng()},
@@ -172,31 +169,18 @@ private slots:
CbzReader reader;
QVERIFY(reader.open(path));
const Chapter ch = reader.loadChapter(0);
QCOMPARE(ch.contentChunks.size(), 2);
const auto pages = reader.pages();
QCOMPARE(pages.size(), 2);
// Each chunk is an HTML fragment with a single image://cbz/ img tag
for (const QString &chunk : ch.contentChunks) {
QVERIFY(chunk.contains(QLatin1String("image://cbz/")));
QCOMPARE(chunk.count(QLatin1String("<img")), 1);
for (const PageInfo &page : pages) {
QVERIFY(page.imageUrl.startsWith(QLatin1String("image://cbz/")));
}
}
void outOfRangeChapterReturnsEmpty()
{
const QString path = makeCbz({{"page001.png", makePng()}});
QVERIFY(!path.isEmpty());
CbzReader reader;
QVERIFY(reader.open(path));
const Chapter ch = reader.loadChapter(5);
QVERIFY(ch.contentChunks.isEmpty());
}
void emptyChapterCountBeforeOpen()
void emptyPagesBeforeOpen()
{
CbzReader reader;
QCOMPARE(reader.chapterCount(), 0);
QVERIFY(reader.pages().isEmpty());
}
// --- metadata: ComicInfo.xml present ---
@@ -272,16 +256,6 @@ private slots:
QVERIFY(reader.author().isEmpty());
}
void tableOfContentsIsEmpty()
{
const QString path = makeCbz({{"page001.png", makePng()}});
QVERIFY(!path.isEmpty());
CbzReader reader;
QVERIFY(reader.open(path));
QVERIFY(reader.tableOfContents().isEmpty());
}
// --- cover ---
void coverFallbackToFirstSortedPage()
@@ -396,7 +370,7 @@ private slots:
CbzReader reader;
QVERIFY(reader.open(path));
QCOMPARE(reader.loadChapter(0).contentChunks.size(), 1);
QCOMPARE(reader.pages().size(), 1);
}
};