summaryrefslogtreecommitdiffstats
path: root/kioslave/smtp/test_headergeneration.cc
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kioslave/smtp/test_headergeneration.cc
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kioslave/smtp/test_headergeneration.cc')
-rw-r--r--kioslave/smtp/test_headergeneration.cc86
1 files changed, 86 insertions, 0 deletions
diff --git a/kioslave/smtp/test_headergeneration.cc b/kioslave/smtp/test_headergeneration.cc
new file mode 100644
index 000000000..bdf8b251f
--- /dev/null
+++ b/kioslave/smtp/test_headergeneration.cc
@@ -0,0 +1,86 @@
+#include "request.h"
+
+//#include <iostream>
+
+//using std::cout;
+//using std::endl;
+
+int main( int , char ** ) {
+ static QCString expected =
+ "From: mutz@kde.org\r\n"
+ "Subject: missing subject\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: Marc Mutz <mutz@kde.org>\r\n"
+ "Subject: missing subject\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: \"Mutz, Marc\" <mutz@kde.org>\r\n"
+ "Subject: missing subject\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: =?utf-8?b?TWFyYyBNw7Z0eg==?= <mutz@kde.org>\r\n"
+ "Subject: missing subject\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: mutz@kde.org\r\n"
+ "Subject: =?utf-8?b?QmzDtmRlcyBTdWJqZWN0?=\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: Marc Mutz <mutz@kde.org>\r\n"
+ "Subject: =?utf-8?b?QmzDtmRlcyBTdWJqZWN0?=\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: \"Mutz, Marc\" <mutz@kde.org>\r\n"
+ "Subject: =?utf-8?b?QmzDtmRlcyBTdWJqZWN0?=\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n"
+ "From: =?utf-8?b?TWFyYyBNw7Z0eg==?= <mutz@kde.org>\r\n"
+ "Subject: =?utf-8?b?QmzDtmRlcyBTdWJqZWN0?=\r\n"
+ "To: joe@user.org,\r\n"
+ "\tvalentine@14th.february.org\r\n"
+ "Cc: boss@example.com\r\n"
+ "\n";
+
+ KioSMTP::Request request;
+ QCString result;
+
+ request.setEmitHeaders( true );
+ request.setFromAddress( "mutz@kde.org" );
+ request.addTo( "joe@user.org" );
+ request.addTo( "valentine@14th.february.org" );
+ request.addCc( "boss@example.com" );
+
+ result += request.headerFields() + '\n';
+ result += request.headerFields( "Marc Mutz" ) + '\n';
+ result += request.headerFields( "Mutz, Marc" ) + '\n';
+ result += request.headerFields( "Marc Mötz" ) + '\n';
+
+ request.setSubject( "Blödes Subject" );
+
+ result += request.headerFields() + '\n';
+ result += request.headerFields( "Marc Mutz" ) + '\n';
+ result += request.headerFields( "Mutz, Marc" ) + '\n';
+ result += request.headerFields( "Marc Mötz" ) + '\n';
+
+ //cout << "Result:\n" << result.data() << endl;
+
+ return result == expected ? 0 : 1 ;
+}
+
+#include "request.cc"
+