diff options
-rw-r--r-- | test/ClientTest.cpp | 21 | ||||
-rw-r--r-- | test/ClientTest.h | 10 |
2 files changed, 29 insertions, 2 deletions
diff --git a/test/ClientTest.cpp b/test/ClientTest.cpp index 6f39268d..4553f575 100644 --- a/test/ClientTest.cpp +++ b/test/ClientTest.cpp @@ -2971,7 +2971,22 @@ void SyncTests::doInterruptResume(int changes, // no need for resend tests, unless they were interrupted at the first message if (!resend || interruptAtMessage == 0) { - accessClientB->doSync("retryB", SyncOptions(SYNC_TWO_WAY)); + SyncReport report; + accessClientB->doSync("retryB", + SyncOptions(SYNC_TWO_WAY, + CheckSyncReport().setMode(SYNC_TWO_WAY).setReport(&report))); + // Suspending at first and last message doesn't need a + // resume, everything else does. When multiple sources + // are involved, some may suspend, some may not, so we + // cannot check. + if (suspend && + interruptAtMessage != 0 && + interruptAtMessage + 1 != maxMsgNum && + report.size() == 1) { + BOOST_FOREACH(const SyncReport::SourceReport_t &sourceReport, report) { + CPPUNIT_ASSERT(sourceReport.second.isResumeSync()); + } + } } } @@ -4052,6 +4067,10 @@ void ClientTest::getTestData(const char *type, Config &config) void CheckSyncReport::check(SyncMLStatus status, SyncReport &report) const { + if (m_report) { + *m_report = report; + } + stringstream str; str << report; diff --git a/test/ClientTest.h b/test/ClientTest.h index d4ee4a64..0329c924 100644 --- a/test/ClientTest.h +++ b/test/ClientTest.h @@ -70,7 +70,8 @@ class CheckSyncReport { serverUpdated(srUpdated), serverDeleted(srDeleted), mustSucceed(mstSucceed), - syncMode(mode) + syncMode(mode), + m_report(NULL) {} virtual ~CheckSyncReport() {} @@ -80,6 +81,13 @@ class CheckSyncReport { bool mustSucceed; SyncMode syncMode; + // if set, then the report is copied here + SyncReport *m_report; + + CheckSyncReport &setMode(SyncMode mode) { syncMode = mode; return *this; } + CheckSyncReport &setReport(SyncReport *report) { m_report = report; return *this; } + + /** * checks that the sync completed as expected and throws * CPPUnit exceptions if something is wrong |