Skip to content

Commit 2535cfe

Browse files
committed
added EULA test to webquery
1 parent 4e96600 commit 2535cfe

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

src/plugins/updater/qpackagekit/qpackagekitupdaterbackend.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ void QPackageKitUpdaterBackend::package(Transaction::Info info, const QString &p
173173
case Transaction::InfoImportant:
174174
case Transaction::InfoSecurity:{
175175
// TODO check if secondary info is given
176+
qCDebug(logPackageKitBackend).nospace() << packageID;
176177
auto parts = packageID.split(QStringLiteral(";"));
177178
if (!_packageFilter.contains(parts[0]))
178179
break;

src/plugins/updater/qwebquery/qwebqueryupdateinstaller.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void QWebQueryUpdateInstaller::startInstallImpl()
6666
const auto eulas = data.value(QStringLiteral("eulas")).toList();
6767
for (const auto &eulaVal : eulas) {
6868
QString text;
69-
auto required = false;
69+
auto required = true;
7070
if (eulaVal.userType() == QMetaType::QVariantMap) {
7171
const auto eulaMap = eulaVal.toMap();
7272
text = eulaMap.value(QStringLiteral("text")).toString();
@@ -125,9 +125,10 @@ void QWebQueryUpdateInstaller::replyDone()
125125
_hash.reset();
126126
_hashResult.clear();
127127
}
128-
_file->close();
129-
130-
finishInstall();
128+
if (_file) {
129+
_file->close();
130+
finishInstall();
131+
}
131132
}
132133

133134
void QWebQueryUpdateInstaller::replyData()

tests/auto/plugins/WebQueryTest/tst_webquery.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,17 @@ QList<UpdateInfo> WebQueryTest::createInfos(const QVersionNumber &versionFrom, c
121121
{QStringLiteral("arguments"), QStringList {
122122
QVariant{true}.toString(),
123123
versionTo.toString()
124+
}},
125+
{QStringLiteral("eulas"), QVariantList {
126+
QStringLiteral("EULA 1"),
127+
QVariantMap {
128+
{QStringLiteral("text"), QStringLiteral("EULA 2")},
129+
{QStringLiteral("required"), true},
130+
},
131+
QVariantMap {
132+
{QStringLiteral("text"), QStringLiteral("EULA 3")},
133+
{QStringLiteral("required"), false},
134+
}
124135
}}
125136
}
126137
}

tests/auto/plugins/testlib/plugintest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ void PluginTest::testPerformInstall()
197197
installer, [installer](const QVariant &id, const QString &, bool required) {
198198
if (required)
199199
installer->eulaHandled(id, true);
200-
});
200+
}, Qt::QueuedConnection);
201201

202202
// install the updates
203203
installer->setComponents(updates);

0 commit comments

Comments
 (0)