Merge lp:~tiagosh/telephony-service/fix-tests into lp:telephony-service

Proposed by Tiago Salem Herrmann
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 1082
Merged at revision: 1079
Proposed branch: lp:~tiagosh/telephony-service/fix-tests
Merge into: lp:telephony-service
Diff against target: 159 lines (+23/-7)
9 files modified
cmake/modules/GenerateTest.cmake (+2/-1)
libtelephonyservice/accountentry.cpp (+1/-1)
tests/common/CMakeLists.txt (+3/-2)
tests/common/telepathytest.cpp (+5/-0)
tests/common/telepathytest.h (+5/-0)
tests/handler/CMakeLists.txt (+1/-0)
tests/libtelephonyservice/CMakeLists.txt (+1/-0)
tests/libtelephonyservice/ChatManagerTest.cpp (+2/-0)
tests/libtelephonyservice/TelepathyHelperTest.cpp (+3/-3)
To merge this branch: bzr merge lp:~tiagosh/telephony-service/fix-tests
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Needs Fixing
Sebastien Bacher Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+260888@code.launchpad.net

Commit message

Fix TelepathyHelperTest and HandlerTest.

Description of the change

Fix TelepathyHelperTest and HandlerTest.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks, that's not enough for the CI issue but it makes test success in a consistent way on my wily desktop were they were failing most of the time before

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

seems like CI likes it now ;-)

review: Approve
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

60 +#include "qgsettings.h"

This needs to be:
#include <qgsettings.h>

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake/modules/GenerateTest.cmake'
2--- cmake/modules/GenerateTest.cmake 2015-05-07 20:36:24 +0000
3+++ cmake/modules/GenerateTest.cmake 2015-06-08 22:32:17 +0000
4@@ -76,7 +76,8 @@
5 set(ARG_ENVIRONMENT HOME=${TMPDIR}
6 HISTORY_SQLITE_DBPATH=:memory:
7 MC_ACCOUNT_DIR=${TMPDIR}
8- MC_MANAGER_DIR=${TMPDIR})
9+ MC_MANAGER_DIR=${TMPDIR}
10+ MC_CLIENTS_DIR=${TMPDIR})
11 endif ()
12
13 set(TEST_COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${TESTNAME} ${PLATFORM} -p -o -p -,txt -p -o -p ${CMAKE_BINARY_DIR}/test_${TESTNAME}.xml,xunitxml)
14
15=== modified file 'libtelephonyservice/accountentry.cpp'
16--- libtelephonyservice/accountentry.cpp 2015-04-29 23:00:26 +0000
17+++ libtelephonyservice/accountentry.cpp 2015-06-08 22:32:17 +0000
18@@ -181,7 +181,7 @@
19 void AccountEntry::ensureConnected()
20 {
21 // if the account is not connected, request it to connect
22- if (!mAccount->connection() || mAccount->connectionStatus() != Tp::ConnectionStatusConnected) {
23+ if (!mAccount->connection() || mAccount->connectionStatus() == Tp::ConnectionStatusDisconnected) {
24 Tp::Presence presence(Tp::ConnectionPresenceTypeAvailable, "available", "online");
25 mAccount->setRequestedPresence(presence);
26 } else {
27
28=== modified file 'tests/common/CMakeLists.txt'
29--- tests/common/CMakeLists.txt 2015-04-21 16:22:55 +0000
30+++ tests/common/CMakeLists.txt 2015-06-08 22:32:17 +0000
31@@ -1,6 +1,7 @@
32 include_directories(${TP_QT5_INCLUDE_DIRS}
33 ${CMAKE_SOURCE_DIR}/libtelephonyservice
34- ${CMAKE_CURRENT_BINARY_DIR})
35+ ${CMAKE_CURRENT_BINARY_DIR}
36+ ${GSETTINGS_QT_INCLUDE_DIRS})
37
38 configure_file(dbus-session.conf.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-session.conf)
39
40@@ -10,7 +11,7 @@
41
42 add_library(telepathytest STATIC telepathytest.cpp telepathytest.h)
43 qt5_use_modules(telepathytest Core DBus)
44-target_link_libraries(telepathytest telephonyservice ${TP_QT5_LIBRARIES})
45+target_link_libraries(telepathytest telephonyservice ${TP_QT5_LIBRARIES} ${GSETTINGS_QT_LDFLAGS})
46
47 add_subdirectory(mock)
48 add_subdirectory(dbus-services)
49
50=== modified file 'tests/common/telepathytest.cpp'
51--- tests/common/telepathytest.cpp 2015-04-29 20:11:14 +0000
52+++ tests/common/telepathytest.cpp 2015-06-08 22:32:17 +0000
53@@ -24,6 +24,11 @@
54 #include "telepathyhelper.h"
55 #include "accountentry.h"
56
57+TelepathyTest::TelepathyTest() : mPhoneSettings("com.ubuntu.phone")
58+{
59+
60+}
61+
62 void TelepathyTest::initialize()
63 {
64 Tp::registerTypes();
65
66=== modified file 'tests/common/telepathytest.h'
67--- tests/common/telepathytest.h 2015-05-08 13:28:09 +0000
68+++ tests/common/telepathytest.h 2015-06-08 22:32:17 +0000
69@@ -23,6 +23,7 @@
70 #include <QtTest/QtTest>
71 #include <TelepathyQt/Account>
72 #include <TelepathyQt/AccountManager>
73+#include <QGSettings>
74
75 #define DEFAULT_TIMEOUT 15000
76
77@@ -34,6 +35,8 @@
78 class TelepathyTest : public QObject
79 {
80 Q_OBJECT
81+public:
82+ TelepathyTest();
83
84 protected:
85 void initialize();
86@@ -51,6 +54,8 @@
87 private Q_SLOTS:
88 void cleanup();
89
90+protected:
91+ QGSettings mPhoneSettings;
92 private:
93 Tp::AccountManagerPtr mAccountManager;
94 bool mReady;
95
96=== modified file 'tests/handler/CMakeLists.txt'
97--- tests/handler/CMakeLists.txt 2015-04-21 16:29:11 +0000
98+++ tests/handler/CMakeLists.txt 2015-06-08 22:32:17 +0000
99@@ -5,6 +5,7 @@
100 ${CMAKE_SOURCE_DIR}/libtelephonyservice
101 ${CMAKE_BINARY_DIR}/tests/common
102 ${TP_QT5_INCLUDE_DIRS}
103+ ${GSETTINGS_QT_INCLUDE_DIRS}
104 )
105
106 generate_telepathy_test(HandlerTest SOURCES HandlerTest.cpp handlercontroller.cpp approver.cpp)
107
108=== modified file 'tests/libtelephonyservice/CMakeLists.txt'
109--- tests/libtelephonyservice/CMakeLists.txt 2015-05-07 16:44:43 +0000
110+++ tests/libtelephonyservice/CMakeLists.txt 2015-06-08 22:32:17 +0000
111@@ -5,6 +5,7 @@
112 ${TP_QT5_INCLUDE_DIRS}
113 ${CMAKE_SOURCE_DIR}/tests/common
114 ${CMAKE_BINARY_DIR}/tests/common
115+ ${GSETTINGS_QT_INCLUDE_DIRS}
116 )
117
118 add_executable(GreeterContactsTestServerExe GreeterContactsTestServer.cpp)
119
120=== modified file 'tests/libtelephonyservice/ChatManagerTest.cpp'
121--- tests/libtelephonyservice/ChatManagerTest.cpp 2015-05-07 16:44:43 +0000
122+++ tests/libtelephonyservice/ChatManagerTest.cpp 2015-06-08 22:32:17 +0000
123@@ -47,6 +47,8 @@
124 void ChatManagerTest::initTestCase()
125 {
126 initialize();
127+ // set to false so group chat messages are not sent as MMS
128+ mPhoneSettings.set("mmsGroupChatEnabled", false);
129 TelepathyHelper::instance()->registerChannelObserver();
130 }
131
132
133=== modified file 'tests/libtelephonyservice/TelepathyHelperTest.cpp'
134--- tests/libtelephonyservice/TelepathyHelperTest.cpp 2015-05-08 21:57:06 +0000
135+++ tests/libtelephonyservice/TelepathyHelperTest.cpp 2015-06-08 22:32:17 +0000
136@@ -255,21 +255,21 @@
137
138 // now set one of the accounts as offline and make sure it is captured
139 mGenericController->SetOnline(false);
140- TRY_COMPARE(activeAccountsSpy.count(), 1);
141+ TRY_VERIFY(activeAccountsSpy.count() >= 1);
142 QTRY_COMPARE(TelepathyHelper::instance()->activeAccounts().count(), 1);
143 QCOMPARE(TelepathyHelper::instance()->activeAccounts()[0]->accountId(), mPhoneTpAccount->uniqueIdentifier());
144
145 // set the other account offline to make sure
146 activeAccountsSpy.clear();
147 mPhoneController->SetOnline(false);
148- TRY_COMPARE(activeAccountsSpy.count(), 1);
149+ TRY_VERIFY(activeAccountsSpy.count() >= 1);
150 QVERIFY(TelepathyHelper::instance()->activeAccounts().isEmpty());
151
152 // and set both accounts online again
153 activeAccountsSpy.clear();
154 mGenericController->SetOnline(true);
155 mPhoneController->SetOnline(true);
156- TRY_COMPARE(activeAccountsSpy.count(), 2);
157+ TRY_VERIFY(activeAccountsSpy.count() >= 2);
158 QCOMPARE(TelepathyHelper::instance()->activeAccounts().count(), 2);
159 }
160

Subscribers

People subscribed via source and target branches