MCPcopy Create free account
hub / github.com/TeXworks/texworks / FileVersionDatabase_addFileRecord

Method FileVersionDatabase_addFileRecord

unit-tests/Utils_test.cpp:119–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117}
118
119void 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
139void TestUtils::FileVersionDatabase_load()
140{

Callers

nothing calls this directly

Calls 3

hasFileRecordMethod · 0.80
getFileRecordMethod · 0.80
addFileRecordMethod · 0.80

Tested by

no test coverage detected