MCPcopy Create free account
hub / github.com/Skycoder42/QtAutoUpdater / testTriggerInstall

Method testTriggerInstall

tests/auto/plugins/testlib/plugintest.cpp:126–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126void PluginTest::testTriggerInstall()
127{
128 QVERIFY(simulateInstall(QVersionNumber{1,0,0}));
129 QVERIFY(prepareUpdate(QVersionNumber{1,1,0}));
130
131 sptr updater { loadBackend() };
132 QVERIFY(updater);
133
134 if (!updater->features().testFlag(UpdaterBackend::Feature::ParallelTrigger)) {
135 QEXPECT_FAIL("", "Backend does not support parallel triggered installations", Abort);
136 QVERIFY(false);
137 }
138
139 // check for updates
140 QSignalSpy doneSpy{updater.data(), &UpdaterBackend::checkDone};
141 QVERIFY(doneSpy.isValid());
142 updater->checkForUpdates();
143 QVERIFY(doneSpy.wait(60000));
144 QCOMPARE(doneSpy.size(), 1);
145 QCOMPARE(doneSpy[0][0].toBool(), true);
146 const auto updates = doneSpy[0][1].value<QList<UpdateInfo>>();
147 QVERIFY(updates.size() > 0);
148
149 // install the updates
150 QSignalSpy installSpy{updater.data(), &UpdaterBackend::triggerInstallDone};
151 QVERIFY(installSpy.isValid());
152 QVERIFY(updater->triggerUpdates(updates, true));
153 QVERIFY(installSpy.wait(60000));
154 QCOMPARE(installSpy.size(), 1);
155 QCOMPARE(installSpy.takeFirst()[0].toBool(), true);
156
157 // check for updates again to make shure there are none
158 doneSpy.clear();
159 updater->checkForUpdates();
160 QVERIFY(doneSpy.wait(60000));
161 QCOMPARE(doneSpy.size(), 1);
162 QCOMPARE(doneSpy[0][0].toBool(), true);
163 QVERIFY(doneSpy[0][1].value<QList<UpdateInfo>>().isEmpty());
164}
165
166void PluginTest::testPerformInstall()
167{

Callers

nothing calls this directly

Calls 4

featuresMethod · 0.45
dataMethod · 0.45
checkForUpdatesMethod · 0.45
triggerUpdatesMethod · 0.45

Tested by

no test coverage detected