| 117 | } |
| 118 | |
| 119 | void TestUtils::FileVersionDatabase_addFileRecord() |
| 120 | { |
| 121 | Tw::Utils::FileVersionDatabase db; |
| 122 | Tw::Utils::FileVersionDatabase::Record empty = {QFileInfo(), QString(), QByteArray::fromHex("d41d8cd98f00b204e9800998ecf8427e")}; |
| 123 | Tw::Utils::FileVersionDatabase::Record r1 = {QFileInfo(QStringLiteral("base14-fonts.pdf")), QStringLiteral("v1"), QByteArray()}; |
| 124 | Tw::Utils::FileVersionDatabase::Record r2 = {QFileInfo(QStringLiteral("base14-fonts.pdf")), QString(), QByteArray::fromHex("814514754a5680a57d172b6720d48a8d")}; |
| 125 | |
| 126 | QVERIFY(db.hasFileRecord(r1.filePath) == false); |
| 127 | QCOMPARE(db.getFileRecord(r1.filePath), empty); |
| 128 | QCOMPARE(db.getFileRecords(), QList<Tw::Utils::FileVersionDatabase::Record>()); |
| 129 | db.addFileRecord(r1.filePath, r1.hash, r1.version); |
| 130 | QVERIFY(db.hasFileRecord(r1.filePath)); |
| 131 | QCOMPARE(db.getFileRecord(r1.filePath), r1); |
| 132 | QCOMPARE(db.getFileRecords(), QList<Tw::Utils::FileVersionDatabase::Record>{r1}); |
| 133 | db.addFileRecord(r2.filePath, r2.hash, r2.version); |
| 134 | QVERIFY(db.hasFileRecord(r2.filePath)); |
| 135 | QCOMPARE(db.getFileRecord(r2.filePath), r2); |
| 136 | QCOMPARE(db.getFileRecords(), QList<Tw::Utils::FileVersionDatabase::Record>{r2}); |
| 137 | } |
| 138 | |
| 139 | void TestUtils::FileVersionDatabase_load() |
| 140 | { |
nothing calls this directly
no test coverage detected