Skip to content

Commit

Permalink
[tests] Fix MockSyncItem key assignment
Browse files Browse the repository at this point in the history
Detected by CommandHandlerTest::testSyncAdd(),
CommandHandlerTest.cpp:286

The test case has most probably started failing when ec17dfc introduced
calling newItem->setKey() inside StorageHandler::addItem().  Anyway,
according to the documentation of StoragePlugin::addItems(), the
implementation was wrong since the initial commit. Also see 7b8c432
(removing the aLocalKey argument -- probably wrong conflict resolution)
and c4ce210 (adding aLocalKey again).

Relates NEMO#664
  • Loading branch information
martyone committed May 22, 2013
1 parent e4460e8 commit 379f52b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tests_meego/Mock.h
Expand Up @@ -111,6 +111,8 @@ class MockStorage: public StoragePlugin {
iFormats.setPreferredTx(format);
iFormats.rx().append(format);
iFormats.tx().append(format);

iIdCounter = 0;
}

virtual ~MockStorage() {}
Expand Down Expand Up @@ -198,7 +200,7 @@ class MockStorage: public StoragePlugin {

virtual SyncItem* newItem()
{
return new MockSyncItem( "1" );
return new MockSyncItem( "" );
}

virtual SyncItem* getSyncItem( const SyncItemKey& aKey )
Expand Down Expand Up @@ -228,6 +230,7 @@ class MockStorage: public StoragePlugin {
QList<StoragePluginStatus> results;

for( int i = 0; i < aItems.count(); ++i ) {
aItems[i]->setKey( QString("MockStorage-item-%1").arg( ++iIdCounter ) );
results.append( STATUS_OK );
}

Expand Down Expand Up @@ -267,7 +270,7 @@ class MockStorage: public StoragePlugin {
QString iSourceURI;
qint64 iMaxObjSize;
StorageContentFormatInfo iFormats;

int iIdCounter;
};

class MockTransport : public DataSync::Transport {
Expand Down

0 comments on commit 379f52b

Please sign in to comment.