fix page counter
This commit is contained in:
13 files changed
+310
-122
No files matched your search
@@ -218,6 +218,9 @@ public:
|
||||
QStringLiteral("<p>Content paragraph for chunk index %1 with sufficient words for layout.</p>").arg(i),
|
||||
QStringLiteral("text/section_%1.xhtml").arg(i)
|
||||
);
|
||||
if (!parsed.isEmpty()) {
|
||||
parsed[0].charCount = kNormalizedCharsPerPage;
|
||||
}
|
||||
list.append(parsed);
|
||||
}
|
||||
return list;
|
||||
@@ -746,7 +749,6 @@ private slots:
|
||||
const auto &chunk = chunks.first();
|
||||
|
||||
QCOMPARE(chunk.sectionHref, QStringLiteral("section.xhtml"));
|
||||
QVERIFY(chunk.wordCount > 0);
|
||||
QVERIFY(chunk.charCount > 0);
|
||||
QCOMPARE(chunk.unnestedContainers, 0);
|
||||
}
|
||||
@@ -929,7 +931,7 @@ private slots:
|
||||
model.setScrollPosition(3, 45.0, 0.35);
|
||||
|
||||
QCOMPARE(posSpy.count(), 1);
|
||||
QCOMPARE(model.currentPage(), 4);
|
||||
QCOMPARE(model.currentChunk(), 3);
|
||||
QCOMPARE(model.progress(), 0.35);
|
||||
|
||||
BookPosition loaded = ctx.store->load(reader.contentHash());
|
||||
@@ -1157,8 +1159,7 @@ private slots:
|
||||
model.setReader(&reader);
|
||||
|
||||
model.setScrollPosition(5, 0.0, 0.5);
|
||||
const int page = model.currentPage();
|
||||
const int anchorChunk = page - 1;
|
||||
const int anchorChunk = model.currentChunk();
|
||||
QVERIFY(anchorChunk >= 0);
|
||||
QVERIFY(anchorChunk < model.rowCount());
|
||||
}
|
||||
@@ -1240,7 +1241,7 @@ private slots:
|
||||
// 2. progress
|
||||
QCOMPARE(model.progress(), 0.0);
|
||||
// 3. anchor_chunk
|
||||
QCOMPARE(model.currentPage() - 1, 0);
|
||||
QCOMPARE(model.currentChunk(), 0);
|
||||
// 4. use_book_colours
|
||||
QCOMPARE(model.useBookColours(), false);
|
||||
// 5. status
|
||||
|
||||
Reference in new issue
Block a user