tests: move Facebook test from testpreferences

Remove Facebook test in testpreferences
add the same Facebook tests to testqPrefFacebook

Signed-off-by: Jan Iversen <jani@apache.org>
This commit is contained in:
jan Iversen 2018-07-23 18:50:08 +02:00 committed by Dirk Hohndel
parent 4102cc755f
commit 711b96a143
3 changed files with 27 additions and 17 deletions

View file

@ -160,23 +160,6 @@ void TestPreferences::testPreferences()
TEST(pp->po2ThresholdMin(), 4.0);
TEST(pp->po2ThresholdMax(), 5.0);
auto fb = qPrefFacebook::instance();
fb->set_access_token("rand-access-token");
fb->set_user_id("tomaz-user-id");
fb->set_album_id("album-id");
TEST(fb->access_token(),QStringLiteral("rand-access-token"));
TEST(fb->user_id(), QStringLiteral("tomaz-user-id"));
TEST(fb->album_id(), QStringLiteral("album-id"));
fb->set_access_token("rand-access-token-2");
fb->set_user_id("tomaz-user-id-2");
fb->set_album_id("album-id-2");
TEST(fb->access_token(),QStringLiteral("rand-access-token-2"));
TEST(fb->user_id(), QStringLiteral("tomaz-user-id-2"));
TEST(fb->album_id(), QStringLiteral("album-id-2"));
auto geo = pref->geocoding;
geo->setFirstTaxonomyCategory(TC_NONE);
geo->setSecondTaxonomyCategory(TC_OCEAN);

View file

@ -57,4 +57,30 @@ void TestQPrefFacebook::test_multiple()
QCOMPARE(tst->access_token(), tst_direct->access_token());
}
#define TEST(METHOD, VALUE) \
QCOMPARE(METHOD, VALUE); \
fb->sync(); \
fb->load(); \
QCOMPARE(METHOD, VALUE);
void TestQPrefFacebook::test_oldPreferences()
{
auto fb = qPrefFacebook::instance();
fb->set_access_token("rand-access-token");
fb->set_user_id("tomaz-user-id");
fb->set_album_id("album-id");
TEST(fb->access_token(),QStringLiteral("rand-access-token"));
TEST(fb->user_id(), QStringLiteral("tomaz-user-id"));
TEST(fb->album_id(), QStringLiteral("album-id"));
fb->set_access_token("rand-access-token-2");
fb->set_user_id("tomaz-user-id-2");
fb->set_album_id("album-id-2");
TEST(fb->access_token(),QStringLiteral("rand-access-token-2"));
TEST(fb->user_id(), QStringLiteral("tomaz-user-id-2"));
TEST(fb->album_id(), QStringLiteral("album-id-2"));
}
QTEST_MAIN(TestQPrefFacebook)

View file

@ -13,6 +13,7 @@ private slots:
void test_struct_get();
void test_set_struct();
void test_multiple();
void test_oldPreferences();
};
#endif // TESTQPREFFACEBOOK_H