@@ -48,8 +48,6 @@ void UpdaterTest::initTestCase()
48
48
controller->createRepository ();
49
49
controller->createInstaller ();
50
50
controller->installLocal ();
51
- controller->setVersion ({1 , 1 , 0 });
52
- controller->createRepository ();
53
51
}
54
52
55
53
void UpdaterTest::testUpdaterInitState ()
@@ -77,31 +75,34 @@ void UpdaterTest::testUpdaterInitState()
77
75
78
76
void UpdaterTest::testUpdateCheck_data ()
79
77
{
80
- QTest::addColumn<QString >(" toolPath " );
78
+ QTest::addColumn<QVersionNumber >(" repoVersion " );
81
79
QTest::addColumn<bool >(" hasUpdates" );
82
80
QTest::addColumn<QList<Updater::UpdateInfo>>(" updates" );
83
81
84
82
QList<Updater::UpdateInfo> updates;
83
+
84
+ QTest::newRow (" noUpdates" ) << QVersionNumber (1 , 0 , 0 )
85
+ << false
86
+ << updates;
87
+
85
88
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;
90
92
91
93
updates.clear ();
92
-
93
- QTest::newRow (" Qt" ) << QStringLiteral (QTDIR) + QStringLiteral (" MaintenanceTool" )
94
- << false
95
- << updates;
96
94
}
97
95
98
96
void UpdaterTest::testUpdateCheck ()
99
97
{
100
- QFETCH (QString, toolPath );
98
+ QFETCH (QVersionNumber, repoVersion );
101
99
QFETCH (bool , hasUpdates);
102
100
QFETCH (QList<Updater::UpdateInfo>, updates);
103
101
104
- updater = new Updater (toolPath, this );
102
+ controller->setVersion (repoVersion);
103
+ controller->createRepository ();
104
+
105
+ updater = new Updater (controller->maintenanceToolPath () + QStringLiteral (" /maintenancetool" ), this );
105
106
QVERIFY (updater);
106
107
checkSpy = new QSignalSpy (updater, &Updater::checkUpdatesDone);
107
108
QVERIFY (checkSpy->isValid ());
0 commit comments