[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdepim-runtime] resources/maildir/libmaildir/tests: Flesh out the
From:       Till Adam <till () kdab ! com>
Date:       2011-09-17 18:16:09
Message-ID: 20110917181609.6C4A6A607A () git ! kde ! org
[Download RAW message or body]

Git commit ba0ae6f73e9f344788a15a20881cd86dac8837c7 by Till Adam.
Committed on 17/09/2011 at 20:15.
Pushed by tilladam into branch 'master'.

Flesh out the flags writing test case.

M  +24   -0    resources/maildir/libmaildir/tests/testmaildir.cpp

http://commits.kde.org/kdepim-runtime/ba0ae6f73e9f344788a15a20881cd86dac8837c7

diff --git a/resources/maildir/libmaildir/tests/testmaildir.cpp \
b/resources/maildir/libmaildir/tests/testmaildir.cpp index d3a8c40..cf4bf23 100644
--- a/resources/maildir/libmaildir/tests/testmaildir.cpp
+++ b/resources/maildir/libmaildir/tests/testmaildir.cpp
@@ -405,5 +405,29 @@ void MaildirTest::testMaildirFlagsWriting()
 {
   initTestCase();
 
+  // create an initialy flagless mail
+  QFile file;
+  QDir::setCurrent( m_temp->name() + QLatin1Char( '/' ) + "cur" );
+  file.setFileName( QLatin1String( "testmail" ) );
+  file.open( QIODevice::WriteOnly );
+  file.write( testString );
+  file.flush();
+  file.close();
+
+  // add a single flag
+  Maildir d( m_temp->name() );
+  const QStringList entries = d.entryList();
+  QCOMPARE( entries.size(), 1 );
+  const QString newKey = d.changeEntryFlags( entries[0], Akonadi::Item::Flags() << \
Akonadi::MessageFlags::Seen ); +  // make sure the new key exists
+  QCOMPARE( newKey, d.entryList()[0] );
+  // and it's the right file
+  QCOMPARE( d.readEntry( newKey ), QByteArray( testString ) );
+  // now check the file name
+  QVERIFY( newKey.endsWith( QLatin1String("2,S") ) );
+  // and more flags
+  const QString newKey2 = d.changeEntryFlags( newKey, Akonadi::Item::Flags() << \
Akonadi::MessageFlags::Seen << Akonadi::MessageFlags::Replied ); +  // check the file name, and \
the sorting of markers +  QVERIFY( newKey2.endsWith( QLatin1String("2,RS") ) );
   cleanupTestCase();
 }


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic