mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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:
parent
93ba8c583a
commit
c01d9f60c1
28 changed files with 672 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
|||
#include "core/qthelper.h"
|
||||
|
||||
#include <QTest>
|
||||
#include <QSignalSpy>
|
||||
|
||||
void TestQPrefFacebook::initTestCase()
|
||||
{
|
||||
|
@ -86,4 +87,23 @@ void TestQPrefFacebook::test_oldPreferences()
|
|||
TEST(fb->album_id(), QStringLiteral("album-id-2"));
|
||||
}
|
||||
|
||||
void TestQPrefFacebook::test_signals()
|
||||
{
|
||||
QSignalSpy spy1(qPrefFacebook::instance(), SIGNAL(access_tokenChanged(QString)));
|
||||
QSignalSpy spy2(qPrefFacebook::instance(), SIGNAL(album_idChanged(QString)));
|
||||
QSignalSpy spy3(qPrefFacebook::instance(), SIGNAL(user_idChanged(QString)));
|
||||
|
||||
qPrefFacebook::set_access_token("t_signal token");
|
||||
qPrefFacebook::set_album_id("t_signal album");
|
||||
qPrefFacebook::set_user_id("t_signal user");
|
||||
|
||||
QCOMPARE(spy1.count(), 1);
|
||||
QCOMPARE(spy2.count(), 1);
|
||||
QCOMPARE(spy3.count(), 1);
|
||||
QVERIFY(spy1.takeFirst().at(0).toString() == "t_signal token");
|
||||
QVERIFY(spy2.takeFirst().at(0).toString() == "t_signal album");
|
||||
QVERIFY(spy3.takeFirst().at(0).toString() == "t_signal user");
|
||||
}
|
||||
|
||||
|
||||
QTEST_MAIN(TestQPrefFacebook)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue