~ubuntu-branches/ubuntu/quantal/kdepimlibs/quantal-proposed

« back to all changes in this revision

Viewing changes to kmime/tests/auto/utiltest.cpp

  • Committer: Package Import Robot
  • Author(s): Philip Muškovac
  • Date: 2011-07-08 00:32:40 UTC
  • mfrom: (1.1.63 upstream)
  • Revision ID: package-import@ubuntu.com-20110708003240-0gzufcu25rui82r1
Tags: 4:4.6.90-0ubuntu1
* New upstream release candidate
  - Bump build-dep on libakonadi-dev
  - update install files with new library versions
  - update libkcal4.install
  - refresh libakonadi-kde4.symbols, libkcalcore4.symbols,
    libkholidays4.symbols and libkimap4.symbols
  - exclude kde-runtime not kdebase-runtime in rules.
  - Update Vcs links for new location

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
    Boston, MA 02110-1301, USA.
17
17
*/
18
18
 
 
19
#undef QT_USE_FAST_CONCATENATION
 
20
#undef QT_USE_FAST_OPERATOR_PLUS
 
21
 
 
22
 
19
23
#include <qtest_kde.h>
20
24
 
21
25
#include "utiltest.h"
22
26
#include "utiltest.moc"
23
27
 
24
28
#include <kmime_util.h>
 
29
#include <kmime_message.h>
25
30
 
26
31
using namespace KMime;
27
32
 
149
154
  QCOMPARE( string, QString::fromLatin1( "\"John \\\"the hacker\\\" Smith\"" ) );
150
155
}
151
156
 
152
 
 
 
157
void UtilTest::testIsSigned_data()
 
158
{
 
159
  QTest::addColumn<QByteArray>( "input" );
 
160
  QTest::addColumn<bool>( "hasSignature" );
 
161
 
 
162
  QTest::newRow( "pgp" ) << QByteArray(
 
163
    "From: xxx xxx <xxx@xxx.xxx>\n"
 
164
    "To: xxx xxx <xxx@xxx.xxx>\n"
 
165
    "Subject: Re: xxx\n"
 
166
    "Date: Mon, 13 Dec 2010 12:22:03 +0100\n"
 
167
    "MIME-Version: 1.0\n"
 
168
    "Content-Type: multipart/signed;\n"
 
169
    "  boundary=\"nextPart1571960.gHxU0aGA9V\";\n"
 
170
    "  protocol=\"application/pgp-signature\";\n"
 
171
    "  micalg=pgp-sha1\n"
 
172
    "Content-Transfer-Encoding: 7bit\n\n"
 
173
    "--nextPart1571960.gHxU0aGA9V\n"
 
174
    "Content-Type: text/plain;\n"
 
175
    "  charset=\"iso-8859-15\"\n"
 
176
    "Content-Transfer-Encoding: quoted-printable\n"
 
177
    "Content-Disposition: inline\n\n"
 
178
    "Hi there...\n\n"
 
179
    "--nextPart1571960.gHxU0aGA9V\n"
 
180
    "Content-Type: application/pgp-signature; name=signature.asc\n"
 
181
    "Content-Description: This is a digitally signed message part.\n\n"
 
182
    "-----BEGIN PGP SIGNATURE-----\n"
 
183
    "Version: GnuPG v2.0.15 (GNU/Linux)\n"
 
184
    "...\n"
 
185
    "-----END PGP SIGNATURE-----\n\n"
 
186
    "--nextPart1571960.gHxU0aGA9V--\n"    
 
187
  ) << true;
 
188
}
 
189
 
 
190
void UtilTest::testIsSigned()
 
191
{
 
192
  QFETCH( QByteArray, input );
 
193
  QFETCH( bool, hasSignature );
 
194
 
 
195
  KMime::Message::Ptr msg( new KMime::Message );
 
196
  msg->setContent( input );
 
197
  msg->parse();
 
198
  QCOMPARE( isSigned( msg.get() ), hasSignature );
 
199
}