2014-01-29 13:38:12 +04:00
|
|
|
/*
|
|
|
|
This software is in the public domain, furnished "as is", without technical
|
|
|
|
support, and with no warranty, express or implied, as to its usefulness for
|
|
|
|
any purpose.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <QtTest>
|
|
|
|
|
|
|
|
#include "updater/updater.h"
|
|
|
|
#include "updater/ocupdater.h"
|
2024-04-30 11:04:32 +03:00
|
|
|
#include "logger.h"
|
2014-01-29 13:38:12 +04:00
|
|
|
|
2014-11-10 00:36:49 +03:00
|
|
|
using namespace OCC;
|
2014-01-29 13:38:12 +04:00
|
|
|
|
|
|
|
class TestUpdater : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private slots:
|
2024-04-30 11:04:32 +03:00
|
|
|
void initTestCase()
|
|
|
|
{
|
|
|
|
OCC::Logger::instance()->setLogFlush(true);
|
|
|
|
OCC::Logger::instance()->setLogDebug(true);
|
|
|
|
|
|
|
|
QStandardPaths::setTestModeEnabled(true);
|
|
|
|
}
|
|
|
|
|
2014-01-29 15:01:17 +04:00
|
|
|
void testVersionToInt()
|
2014-01-29 13:38:12 +04:00
|
|
|
{
|
2014-01-29 15:01:17 +04:00
|
|
|
qint64 lowVersion = Updater::Helper::versionToInt(1,2,80,3000);
|
|
|
|
QCOMPARE(Updater::Helper::stringVersionToInt("1.2.80.3000"), lowVersion);
|
|
|
|
|
|
|
|
qint64 highVersion = Updater::Helper::versionToInt(99,2,80,3000);
|
2014-01-29 13:38:12 +04:00
|
|
|
qint64 currVersion = Updater::Helper::currentVersionToInt();
|
|
|
|
QVERIFY(currVersion > 0);
|
2014-01-29 15:01:17 +04:00
|
|
|
QVERIFY(currVersion > lowVersion);
|
|
|
|
QVERIFY(currVersion < highVersion);
|
2014-01-29 13:38:12 +04:00
|
|
|
}
|
2014-01-29 15:01:17 +04:00
|
|
|
|
2014-01-29 13:38:12 +04:00
|
|
|
};
|
|
|
|
|
2016-05-11 02:17:16 +03:00
|
|
|
QTEST_APPLESS_MAIN(TestUpdater)
|
2016-03-30 18:58:15 +03:00
|
|
|
#include "testupdater.moc"
|