fix page counter
This commit is contained in:
13 files changed
+310
-122
No files matched your search
@@ -214,7 +214,7 @@ public:
|
||||
} else {
|
||||
book.cover_image_url = std::nullopt;
|
||||
}
|
||||
ContentChunkValue fallbackChunk{book.file_path, 1, 0, 0, 0};
|
||||
ContentChunkValue fallbackChunk{book.file_path, 1, 0, 0};
|
||||
book.chunks = QVector<ContentChunkValue>{fallbackChunk};
|
||||
book.binaries = binary_resources;
|
||||
return true;
|
||||
@@ -324,19 +324,17 @@ private slots:
|
||||
// Obligation 5: value-equality.ContentChunkValue
|
||||
void testValueEqualityContentChunkValue()
|
||||
{
|
||||
ContentChunkValue c1{QStringLiteral("sec1"), 5, 100, 500, 2};
|
||||
ContentChunkValue c2{QStringLiteral("sec1"), 5, 100, 500, 2};
|
||||
ContentChunkValue cDiffHref{QStringLiteral("sec2"), 5, 100, 500, 2};
|
||||
ContentChunkValue cDiffBlocks{QStringLiteral("sec1"), 6, 100, 500, 2};
|
||||
ContentChunkValue cDiffWords{QStringLiteral("sec1"), 5, 101, 500, 2};
|
||||
ContentChunkValue cDiffChars{QStringLiteral("sec1"), 5, 100, 501, 2};
|
||||
ContentChunkValue cDiffContainers{QStringLiteral("sec1"), 5, 100, 500, 3};
|
||||
ContentChunkValue c1{QStringLiteral("sec1"), 5, 500, 2};
|
||||
ContentChunkValue c2{QStringLiteral("sec1"), 5, 500, 2};
|
||||
ContentChunkValue cDiffHref{QStringLiteral("sec2"), 5, 500, 2};
|
||||
ContentChunkValue cDiffBlocks{QStringLiteral("sec1"), 6, 500, 2};
|
||||
ContentChunkValue cDiffChars{QStringLiteral("sec1"), 5, 501, 2};
|
||||
ContentChunkValue cDiffContainers{QStringLiteral("sec1"), 5, 500, 3};
|
||||
|
||||
QVERIFY(c1 == c2);
|
||||
QVERIFY(!(c1 != c2));
|
||||
QVERIFY(c1 != cDiffHref);
|
||||
QVERIFY(c1 != cDiffBlocks);
|
||||
QVERIFY(c1 != cDiffWords);
|
||||
QVERIFY(c1 != cDiffChars);
|
||||
QVERIFY(c1 != cDiffContainers);
|
||||
}
|
||||
@@ -347,19 +345,16 @@ private slots:
|
||||
ContentChunkValue c;
|
||||
QVERIFY(c.section_href.isEmpty());
|
||||
QCOMPARE(c.blocks_count, 0);
|
||||
QCOMPARE(c.word_count, 0);
|
||||
QCOMPARE(c.char_count, 0);
|
||||
QCOMPARE(c.unnested_containers, 0);
|
||||
|
||||
c.section_href = QStringLiteral("body/s0");
|
||||
c.blocks_count = 3;
|
||||
c.word_count = 50;
|
||||
c.char_count = 250;
|
||||
c.unnested_containers = 1;
|
||||
|
||||
QCOMPARE(c.section_href, QStringLiteral("body/s0"));
|
||||
QCOMPARE(c.blocks_count, 3);
|
||||
QCOMPARE(c.word_count, 50);
|
||||
QCOMPARE(c.char_count, 250);
|
||||
QCOMPARE(c.unnested_containers, 1);
|
||||
}
|
||||
@@ -391,7 +386,6 @@ private slots:
|
||||
QCOMPARE(chunks1.size(), chunks2.size());
|
||||
QVERIFY(!chunks1.isEmpty());
|
||||
QCOMPARE(chunks1.first().sectionHref, chunks2.first().sectionHref);
|
||||
QCOMPARE(chunks1.first().wordCount, chunks2.first().wordCount);
|
||||
QCOMPARE(chunks1.first().charCount, chunks2.first().charCount);
|
||||
QCOMPARE(chunks1.first().blocks.size(), chunks2.first().blocks.size());
|
||||
|
||||
@@ -525,7 +519,7 @@ private slots:
|
||||
QCOMPARE(s.book.status, Fb2LoadStatus::loading_full);
|
||||
|
||||
// Edge 5: loading_full -> loaded
|
||||
ContentChunkValue chunk{"sec1", 1, 10, 50, 0};
|
||||
ContentChunkValue chunk{"sec1", 1, 50, 0};
|
||||
QVERIFY(s.completeFullOpenWithSections(client, "hash", "Title", "stem", {}, "Author", std::nullopt, {}, {chunk}));
|
||||
QCOMPARE(s.book.status, Fb2LoadStatus::loaded);
|
||||
}
|
||||
@@ -755,7 +749,7 @@ private slots:
|
||||
s.book.file_path = QStringLiteral("/books/novel.fb2");
|
||||
s.book.status = Fb2LoadStatus::loading_full;
|
||||
|
||||
ContentChunkValue chunk{"sec1", 2, 20, 100, 0};
|
||||
ContentChunkValue chunk{"sec1", 2, 100, 0};
|
||||
|
||||
// Failure 1: actor != client
|
||||
QVERIFY(!s.completeFullOpenWithSections(c2, "hash", "Title", "stem", {}, "", std::nullopt, {}, {chunk}));
|
||||
@@ -786,7 +780,7 @@ private slots:
|
||||
s.book.file_path = QStringLiteral("/books/empty.fb2");
|
||||
s.book.status = Fb2LoadStatus::loading_full;
|
||||
|
||||
ContentChunkValue chunk{"sec1", 1, 0, 0, 0};
|
||||
ContentChunkValue chunk{"sec1", 1, 0, 0};
|
||||
|
||||
// Failure 1: actor != client
|
||||
QVERIFY(!s.completeFullOpenWithEmptyBodyFallback(c2, "hash", "", "empty", {}, "", std::nullopt, {}, {}));
|
||||
@@ -806,7 +800,6 @@ private slots:
|
||||
ContentChunkValue fallback = s.book.chunks.value().first();
|
||||
QCOMPARE(fallback.section_href, QStringLiteral("/books/empty.fb2"));
|
||||
QCOMPARE(fallback.blocks_count, 1);
|
||||
QCOMPARE(fallback.word_count, 0);
|
||||
QCOMPARE(fallback.char_count, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user