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

+39 -11
View File
@@ -21,9 +21,11 @@ private slots:
BookPositionStore store(appState);
const BookPosition pos = store.load(QByteArray("nonexistent"));
QCOMPARE(pos.chapterIndex, 0);
QCOMPARE(pos.chunkIndex, 0);
QCOMPARE(pos.pageShift, true);
QCOMPARE(pos.mangaRTL, true);
QCOMPARE(pos.progress, 0.0);
QCOMPARE(pos.pageShift, true);
QCOMPARE(pos.mangaRTL, true);
}
void saveAndLoad()
@@ -36,11 +38,20 @@ private slots:
BookPositionStore store(appState);
const QByteArray hash = QByteArray("abc123deadbeef");
store.save(hash, 7, false, false);
BookPosition toSave;
toSave.chapterIndex = 2;
toSave.chunkIndex = 7;
toSave.progress = 0.65;
toSave.mangaRTL = false;
toSave.pageShift = false;
store.save(hash, toSave);
const BookPosition pos = store.load(hash);
QCOMPARE(pos.chapterIndex, 2);
QCOMPARE(pos.chunkIndex, 7);
QCOMPARE(pos.mangaRTL, false);
QCOMPARE(pos.pageShift, false);
QCOMPARE(pos.progress, 0.65);
QCOMPARE(pos.mangaRTL, false);
QCOMPARE(pos.pageShift, false);
}
void separateHashesStoredIndependently()
@@ -52,8 +63,17 @@ private slots:
AppState appState(s);
BookPositionStore store(appState);
store.save(QByteArray("hash1"), 1, true, false);
store.save(QByteArray("hash2"), 2, false, true);
BookPosition p1;
p1.chunkIndex = 1;
p1.mangaRTL = true;
p1.pageShift = false;
store.save(QByteArray("hash1"), p1);
BookPosition p2;
p2.chunkIndex = 2;
p2.mangaRTL = false;
p2.pageShift = true;
store.save(QByteArray("hash2"), p2);
QCOMPARE(store.load(QByteArray("hash1")).chunkIndex, 1);
QCOMPARE(store.load(QByteArray("hash2")).chunkIndex, 2);
@@ -71,8 +91,15 @@ private slots:
BookPositionStore store(appState);
const QByteArray hash = QByteArray("overwrite-hash");
store.save(hash, 3, true, true);
store.save(hash, 5, false, false);
BookPosition p1;
p1.chunkIndex = 3;
store.save(hash, p1);
BookPosition p2;
p2.chunkIndex = 5;
p2.mangaRTL = false;
p2.pageShift = false;
store.save(hash, p2);
const BookPosition pos = store.load(hash);
QCOMPARE(pos.chunkIndex, 5);
@@ -89,8 +116,9 @@ private slots:
AppState appState(s);
BookPositionStore store(appState);
// Neither save nor load should crash with an empty hash
store.save(QByteArray(), 1, true, true);
BookPosition p;
p.chunkIndex = 1;
store.save(QByteArray(), p);
const BookPosition pos = store.load(QByteArray());
QCOMPARE(pos.chunkIndex, 0);
}