AusweisApp2/test/qt/global/test_DeviceInfo.cpp

40 lines
783 B
C++
Raw Normal View History

2017-07-03 09:30:10 +02:00
/*!
* \brief Unit tests for \ref DeviceInfo
*
2019-05-22 10:08:38 +02:00
* \copyright Copyright (c) 2015-2019 Governikus GmbH & Co. KG, Germany
2017-07-03 09:30:10 +02:00
*/
2017-12-20 14:54:05 +01:00
#include <QSysInfo>
2017-07-03 09:30:10 +02:00
#include <QtTest>
#include "DeviceInfo.h"
using namespace governikus;
class test_DeviceInfo
: public QObject
{
Q_OBJECT
private Q_SLOTS:
void getter()
{
#ifdef Q_OS_ANDROID
QVERIFY(!DeviceInfo::getPrettyInfo().isEmpty());
QVERIFY(!DeviceInfo::getFingerprint().isEmpty());
2017-12-20 14:54:05 +01:00
QVERIFY(!DeviceInfo::getName().isEmpty());
2017-07-03 09:30:10 +02:00
#else
2017-12-20 14:54:05 +01:00
QCOMPARE(DeviceInfo::getPrettyInfo(), QSysInfo::machineHostName() + QStringLiteral(" ()"));
2017-07-03 09:30:10 +02:00
QVERIFY(DeviceInfo::getFingerprint().isNull());
2017-12-20 14:54:05 +01:00
QCOMPARE(DeviceInfo::getName(), QSysInfo::machineHostName());
2017-07-03 09:30:10 +02:00
#endif
}
};
QTEST_GUILESS_MAIN(test_DeviceInfo)
#include "test_DeviceInfo.moc"