mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/src/mpmpxcollectiondata.cpp
changeset 29 8192e5b5c935
child 47 4cc1412daed0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpdata/tsrc/unittest_mpcollectiontbonelistdatamodel/stub/src/mpmpxcollectiondata.cpp	Thu May 27 12:49:57 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: MpMpxCollectionData stub for testing MpCollectionDataModel
+*
+*/
+
+#include "mptrace.h"
+#include "stub/inc/mpmpxcollectiondata.h"
+
+
+int gInitCounter = 0;
+
+/*!
+ Returns gInitCounter.
+ gInitCounter counts the number of constructor/destructor calls.
+ */
+int MpMpxCollectionData::getInitCounter()
+{
+    return gInitCounter;
+}
+
+/*!
+ Resets gInitCounter to zero.
+ */
+void MpMpxCollectionData::resetInitCounter()
+{
+    gInitCounter = 0;
+}
+
+
+/*!
+ Stub function.
+ */
+MpMpxCollectionData::MpMpxCollectionData( QObject *parent )
+    : QObject(parent),
+      mAlbumSongCount(0),
+      mItemDataReturn(true)
+{
+    gInitCounter++;
+}
+
+/*!
+ Stub function.
+ */
+MpMpxCollectionData::~MpMpxCollectionData()
+{
+    gInitCounter--;
+}
+
+/*!
+ Stub function.
+ */
+int MpMpxCollectionData::albumSongsCount() const
+{
+    return mAlbumSongCount;
+}
+
+/*!
+ Stub function.
+ */
+QString MpMpxCollectionData::albumSongData( int index, MpMpxCollectionData::DataType type ) const
+{
+    QString data;
+    if ( !mItemDataReturn ) {
+        return data;
+    }
+    switch ( type ) {
+        case MpMpxCollectionData::Title:
+            data = QString("Title");
+            data.append( QString().setNum(index) );
+            break;
+        default:
+            qFatal("MpMpxCollectionData::itemData called with unknown type");
+            break;
+    }
+    return data;
+}
+