From 711b96a143165bf991c69193c0e65f88155e4ba4 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Mon, 23 Jul 2018 18:50:08 +0200 Subject: tests: move Facebook test from testpreferences Remove Facebook test in testpreferences add the same Facebook tests to testqPrefFacebook Signed-off-by: Jan Iversen --- tests/testpreferences.cpp | 17 ----------------- tests/testqPrefFacebook.cpp | 26 ++++++++++++++++++++++++++ tests/testqPrefFacebook.h | 1 + 3 files changed, 27 insertions(+), 17 deletions(-) (limited to 'tests') diff --git a/tests/testpreferences.cpp b/tests/testpreferences.cpp index 2fe863959..c9cef1e37 100644 --- a/tests/testpreferences.cpp +++ b/tests/testpreferences.cpp @@ -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); diff --git a/tests/testqPrefFacebook.cpp b/tests/testqPrefFacebook.cpp index 230197b10..815896cd1 100644 --- a/tests/testqPrefFacebook.cpp +++ b/tests/testqPrefFacebook.cpp @@ -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) diff --git a/tests/testqPrefFacebook.h b/tests/testqPrefFacebook.h index ecdbbe143..a11b43710 100644 --- a/tests/testqPrefFacebook.h +++ b/tests/testqPrefFacebook.h @@ -13,6 +13,7 @@ private slots: void test_struct_get(); void test_set_struct(); void test_multiple(); + void test_oldPreferences(); }; #endif // TESTQPREFFACEBOOK_H -- cgit v1.2.3-70-g09d2