Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/auto/gpgkeystate/tst_gpgkeystate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,13 @@ void tst_gpgkeystate::parseGpgColonOutputPubWithoutUid() {
// A pub record with a key_id but no uid record: the name is taken from the
// pub record's userid field (field index 9).
const QString input =
QStringLiteral("pub:u:4096:1:NOUIDKEY1:1774947438:::u::::Name Only:\n");
QStringLiteral("pub:u:4096:1:NOUIDKEY1:1774947438:::u:Name Only:\n");
QList<UserInfo> result = parseGpgColonOutput(input, false);
QVERIFY2(result.size() == 1,
"pub record without uid must still produce one UserInfo");
QVERIFY2(result.first().key_id == QStringLiteral("NOUIDKEY1"),
"key_id must be set from pub record");
QCOMPARE(result.first().name, QStringLiteral("Name Only"));
}

void tst_gpgkeystate::parseGpgColonOutputOnlySubRecords() {
Expand Down
23 changes: 16 additions & 7 deletions tests/auto/model/tst_storemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,25 @@ void tst_storemodel::setStoreUpdatesPath() {
QFileSystemModel fsm;
StoreModel sm;
sm.setModelAndStore(&fsm, tempDir.path());
QCOMPARE(sm.getStore(), tempDir.path());
QVERIFY2(sm.getStore() == tempDir.path(),
qPrintable(QStringLiteral("store should default to temporary "
"directory: expected %1 but was %2")
.arg(tempDir.path())
.arg(sm.getStore())));

QString newPath = tempDir.path() + "/substore";
sm.setStore(newPath);
QCOMPARE(sm.getStore(), newPath);
QVERIFY2(sm.getStore() == newPath,
qPrintable(QStringLiteral("store should update to substore after "
"setStore: expected %1 but was %2")
.arg(newPath)
.arg(sm.getStore())));
}

void tst_storemodel::dataEditRoleKeepsGpgExtension() {
QTemporaryDir tempDir;
QFile f(tempDir.path() + "/secret.gpg");
QVERIFY(f.open(QFile::WriteOnly));
QVERIFY2(f.open(QFile::WriteOnly), "Failed to open test file for writing");
f.close();

QFileSystemModel fsm;
Expand All @@ -558,11 +566,12 @@ void tst_storemodel::dataEditRoleKeepsGpgExtension() {

void tst_storemodel::filterAcceptsNonGpgFileMatchingRegex() {
QTemporaryDir tempDir;
// A plain text file (no .gpg) should not pass the filter because its
// name doesn't end in .gpg and won't match the default empty regex
// after extension stripping — unless the regex explicitly matches it.
// This test sets the filter to "readme" explicitly. A plain text file
// without a .gpg extension should not pass the filter unless the filter
// explicitly matches its basename. This test only covers the explicit
// "readme" filter behavior.
QFile f(tempDir.path() + "/readme.txt");
QVERIFY(f.open(QFile::WriteOnly));
QVERIFY2(f.open(QFile::WriteOnly), "Failed to open test file for writing");
f.close();

QFileSystemModel fsm;
Expand Down
Loading