tests: add signal test to call testqPref*cpp

Add signal testing of all variables
this commit contains all qPref* that work directly
followup commit will do changes to qPref* to make signals work

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-08-28 12:33:47 +02:00 committed by Dirk Hohndel
parent 93ba8c583a
commit c01d9f60c1
28 changed files with 672 additions and 1 deletions

View file

@ -6,6 +6,7 @@
#include "core/settings/qPrefLocationService.h"
#include <QTest>
#include <QSignalSpy>
void TestQPrefLocationService::initTestCase()
{
@ -114,4 +115,20 @@ void TestQPrefLocationService::test_oldPreferences()
TEST(location->distance_threshold(), 40);
}
void TestQPrefLocationService::test_signals()
{
QSignalSpy spy1(qPrefLocationService::instance(), SIGNAL(distance_thresholdChanged(int)));
QSignalSpy spy2(qPrefLocationService::instance(), SIGNAL(time_thresholdChanged(int)));
qPrefLocationService::set_distance_threshold(-2000);
qPrefLocationService::set_time_threshold(-90);
QCOMPARE(spy1.count(), 1);
QCOMPARE(spy2.count(), 1);
QVERIFY(spy1.takeFirst().at(0).toInt() == -2000);
QVERIFY(spy2.takeFirst().at(0).toInt() == -90);
}
QTEST_MAIN(TestQPrefLocationService)