17 |
17 |
18 #include <QtTest/QtTest> |
18 #include <QtTest/QtTest> |
19 #include <QtGui> |
19 #include <QtGui> |
20 #include <hbapplication.h> |
20 #include <hbapplication.h> |
21 #include <QSignalSpy> |
21 #include <QSignalSpy> |
22 //#include <hbglobal_p.h> |
22 #include "phoneconstants.h" |
|
23 #include "cphonecenrepproxy.h" |
|
24 #include "cphonepubsubproxy.h" |
|
25 #include <settingsinternalcrkeys.h> |
23 #include "phonemessagecontroller.h" |
26 #include "phonemessagecontroller.h" |
24 #include "tphonecmdparamsfidata.h" |
27 #include "tphonecmdparamsfidata.h" |
|
28 |
|
29 QString mService; |
|
30 QString mMessage; |
|
31 bool mSend; |
|
32 QList<QVariant> mList; |
|
33 |
25 |
34 |
26 #define PHONE_QT_MESSAGE_CONTROLLER_TEST_MAIN(TestObject) \ |
35 #define PHONE_QT_MESSAGE_CONTROLLER_TEST_MAIN(TestObject) \ |
27 int main(int argc, char *argv[]) \ |
36 int main(int argc, char *argv[]) \ |
28 { \ |
37 { \ |
29 HbApplication app(argc, argv); \ |
38 HbApplication app(argc, argv); \ |
86 { |
97 { |
87 } |
98 } |
88 |
99 |
89 void TestPhoneMessageController::testOpenSoftRejectEditor() |
100 void TestPhoneMessageController::testOpenSoftRejectEditor() |
90 { |
101 { |
|
102 QString text = softRejectText(); |
91 TPhoneCmdParamSfiData sfiParam; |
103 TPhoneCmdParamSfiData sfiParam; |
92 sfiParam.SetNumber(_L("1234567")); |
104 sfiParam.SetNumber(_L("1234567")); |
93 sfiParam.SetName(_L("Tester")); |
105 sfiParam.SetName(_L("Tester")); |
94 |
106 |
95 m_messageController->openSoftRejectMessageEditor(&sfiParam); |
107 m_messageController->openSoftRejectMessageEditor(&sfiParam); |
|
108 |
|
109 QVERIFY( mService == "com.nokia.services.hbserviceprovider.conversationview" ); |
|
110 QVERIFY( mMessage == "send(QString,QString,QString)" ); |
|
111 QVERIFY( mList.contains("1234567") ); |
|
112 QVERIFY( mList.contains("Tester") ); |
|
113 QVERIFY( mList.contains(text) ); |
|
114 QVERIFY( mSend ); |
|
115 } |
|
116 |
|
117 QString TestPhoneMessageController::softRejectText() |
|
118 { |
|
119 QString messageBody; |
|
120 // Get message body |
|
121 TInt softRejectDefaultInUseValue = 0; |
|
122 const TInt err = CPhoneCenRepProxy::Instance()->GetInt( |
|
123 KCRUidTelephonySettings, |
|
124 KSettingsSoftRejectDefaultInUse, |
|
125 softRejectDefaultInUseValue ); |
|
126 |
|
127 if (softRejectDefaultInUseValue) { |
|
128 HBufC* softRejectTxt = NULL; |
|
129 TRAP_IGNORE( softRejectTxt = HBufC::NewL( KPhoneSMSLength ) ); |
|
130 |
|
131 if (softRejectTxt) { |
|
132 TPtr string( softRejectTxt->Des() ); |
|
133 |
|
134 // Default txt used or not |
|
135 CPhoneCenRepProxy::Instance()->GetString( |
|
136 KCRUidTelephonySettings, |
|
137 KSettingsSoftRejectText, |
|
138 string ); |
|
139 |
|
140 messageBody = QString::fromUtf16(string.Ptr(), string.Length()); |
|
141 delete softRejectTxt; |
|
142 } |
|
143 } else { |
|
144 messageBody = hbTrId("txt_phone_setlabel_soft_reject_val_default_text"); |
|
145 } |
|
146 |
|
147 return messageBody; |
96 } |
148 } |
97 |
149 |
98 PHONE_QT_MESSAGE_CONTROLLER_TEST_MAIN(TestPhoneMessageController) |
150 PHONE_QT_MESSAGE_CONTROLLER_TEST_MAIN(TestPhoneMessageController) |
99 #include "unit_tests.moc" |
151 #include "unit_tests.moc" |