old render cleanup part 1
This commit is contained in:
38 files changed
+166
-1366
No files matched your search
@@ -21,8 +21,9 @@ private slots:
|
||||
BookPositionStore store(appState);
|
||||
|
||||
const BookPosition pos = store.load(QByteArray("nonexistent"));
|
||||
QCOMPARE(pos.chunkIndex, 0);
|
||||
QCOMPARE(pos.intraOffset, 0);
|
||||
QCOMPARE(pos.chunkIndex, 0);
|
||||
QCOMPARE(pos.pageShift, true);
|
||||
QCOMPARE(pos.mangaRTL, true);
|
||||
}
|
||||
|
||||
void saveAndLoad()
|
||||
@@ -35,10 +36,11 @@ private slots:
|
||||
BookPositionStore store(appState);
|
||||
|
||||
const QByteArray hash = QByteArray("abc123deadbeef");
|
||||
store.save(hash, 7, 42);
|
||||
store.save(hash, 7, false, false);
|
||||
const BookPosition pos = store.load(hash);
|
||||
QCOMPARE(pos.chunkIndex, 7);
|
||||
QCOMPARE(pos.intraOffset, 42);
|
||||
QCOMPARE(pos.chunkIndex, 7);
|
||||
QCOMPARE(pos.mangaRTL, false);
|
||||
QCOMPARE(pos.pageShift, false);
|
||||
}
|
||||
|
||||
void separateHashesStoredIndependently()
|
||||
@@ -50,13 +52,13 @@ private slots:
|
||||
AppState appState(s);
|
||||
BookPositionStore store(appState);
|
||||
|
||||
store.save(QByteArray("hash1"), 1, 10);
|
||||
store.save(QByteArray("hash2"), 2, 20);
|
||||
store.save(QByteArray("hash1"), 1, true, false);
|
||||
store.save(QByteArray("hash2"), 2, false, true);
|
||||
|
||||
QCOMPARE(store.load(QByteArray("hash1")).chunkIndex, 1);
|
||||
QCOMPARE(store.load(QByteArray("hash2")).chunkIndex, 2);
|
||||
QCOMPARE(store.load(QByteArray("hash1")).intraOffset, 10);
|
||||
QCOMPARE(store.load(QByteArray("hash2")).intraOffset, 20);
|
||||
QCOMPARE(store.load(QByteArray("hash1")).chunkIndex, 1);
|
||||
QCOMPARE(store.load(QByteArray("hash2")).chunkIndex, 2);
|
||||
QCOMPARE(store.load(QByteArray("hash1")).mangaRTL, true);
|
||||
QCOMPARE(store.load(QByteArray("hash2")).mangaRTL, false);
|
||||
}
|
||||
|
||||
void overwriteExistingPosition()
|
||||
@@ -69,12 +71,13 @@ private slots:
|
||||
BookPositionStore store(appState);
|
||||
|
||||
const QByteArray hash = QByteArray("overwrite-hash");
|
||||
store.save(hash, 3, 30);
|
||||
store.save(hash, 5, 55);
|
||||
store.save(hash, 3, true, true);
|
||||
store.save(hash, 5, false, false);
|
||||
|
||||
const BookPosition pos = store.load(hash);
|
||||
QCOMPARE(pos.chunkIndex, 5);
|
||||
QCOMPARE(pos.intraOffset, 55);
|
||||
QCOMPARE(pos.chunkIndex, 5);
|
||||
QCOMPARE(pos.mangaRTL, false);
|
||||
QCOMPARE(pos.pageShift, false);
|
||||
}
|
||||
|
||||
void emptyHashIgnored()
|
||||
@@ -87,10 +90,9 @@ private slots:
|
||||
BookPositionStore store(appState);
|
||||
|
||||
// Neither save nor load should crash with an empty hash
|
||||
store.save(QByteArray(), 1, 1);
|
||||
store.save(QByteArray(), 1, true, true);
|
||||
const BookPosition pos = store.load(QByteArray());
|
||||
QCOMPARE(pos.chunkIndex, 0);
|
||||
QCOMPARE(pos.intraOffset, 0);
|
||||
QCOMPARE(pos.chunkIndex, 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user