@@ -48,8 +48,6 @@ void UpdaterTest::initTestCase()
4848 controller->createRepository ();
4949 controller->createInstaller ();
5050 controller->installLocal ();
51- controller->setVersion ({1 , 1 , 0 });
52- controller->createRepository ();
5351}
5452
5553void UpdaterTest::testUpdaterInitState ()
@@ -77,31 +75,34 @@ void UpdaterTest::testUpdaterInitState()
7775
7876void UpdaterTest::testUpdateCheck_data ()
7977{
80- QTest::addColumn<QString >(" toolPath " );
78+ QTest::addColumn<QVersionNumber >(" repoVersion " );
8179 QTest::addColumn<bool >(" hasUpdates" );
8280 QTest::addColumn<QList<Updater::UpdateInfo>>(" updates" );
8381
8482 QList<Updater::UpdateInfo> updates;
83+
84+ QTest::newRow (" noUpdates" ) << QVersionNumber (1 , 0 , 0 )
85+ << false
86+ << updates;
87+
8588 updates += {QStringLiteral (" QtAutoUpdaterTestInstaller" ), QVersionNumber::fromString (QStringLiteral (" 1.1.0" )), 45ull };
86- QString path = controller->maintenanceToolPath ();
87- QTest::newRow (" QtAutoUpdaterTestInstaller" ) << path + QStringLiteral (" /maintenancetool" )
88- << true
89- << updates;
89+ QTest::newRow (" simpleUpdate" ) << QVersionNumber (1 , 1 , 0 )
90+ << true
91+ << updates;
9092
9193 updates.clear ();
92-
93- QTest::newRow (" Qt" ) << QStringLiteral (QTDIR) + QStringLiteral (" MaintenanceTool" )
94- << false
95- << updates;
9694}
9795
9896void UpdaterTest::testUpdateCheck ()
9997{
100- QFETCH (QString, toolPath );
98+ QFETCH (QVersionNumber, repoVersion );
10199 QFETCH (bool , hasUpdates);
102100 QFETCH (QList<Updater::UpdateInfo>, updates);
103101
104- updater = new Updater (toolPath, this );
102+ controller->setVersion (repoVersion);
103+ controller->createRepository ();
104+
105+ updater = new Updater (controller->maintenanceToolPath () + QStringLiteral (" /maintenancetool" ), this );
105106 QVERIFY (updater);
106107 checkSpy = new QSignalSpy (updater, &Updater::checkUpdatesDone);
107108 QVERIFY (checkSpy->isValid ());
0 commit comments