contentstorage/castorage/tsrc/t_castorage/src/castoragetestgetparentids.cpp
changeset 117 c63ee96dbe5f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/castorage/tsrc/t_castorage/src/castoragetestgetparentids.cpp	Thu Sep 16 12:11:40 2010 +0100
@@ -0,0 +1,87 @@
+/*
+* 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:
+*
+*/
+/*
+ * castoragetestgetparentids.cpp
+ *
+ *  Created on: 2009-09-14
+ *      Author: michal.czerwiec
+ */
+
+#include "castoragetest.h"
+#include "castoragefactory.h"
+#include "castorage.h"
+#include "cainnerentry.h"
+#include "casqlquery.h"
+#include "casqlitestorage.h"
+#include "castoragetestsqlcommands.h"
+#include "casqlcommands.h"
+
+// ---------------------------------------------------------------------------
+// Test Sorting Order giving different attributes.
+//
+// ---------------------------------------------------------------------------
+//
+void CCAStorageTest::testGetParentIds()
+{
+    __UHEAP_MARK;
+    
+    TRAPD(err,
+          RArray<TInt> entryIdArray;
+          CleanupClosePushL(entryIdArray);
+          entryIdArray.AppendL(15);
+          RArray<TInt> parentIdArray;
+          CleanupClosePushL(parentIdArray);
+          //TInt err(KErrNone);
+          mStorage->GetParentsIdsL(entryIdArray, parentIdArray);
+    if (parentIdArray.Count() != 3) {
+    err == KErrNotFound;
+} else if (parentIdArray.Find(2) == KErrNotFound ||
+               parentIdArray.Find(3) == KErrNotFound ||
+    parentIdArray.Find(8) == KErrNotFound) {
+    err = KErrGeneral;
+}
+
+CleanupStack::PopAndDestroy(&parentIdArray);
+CleanupStack::PopAndDestroy(&entryIdArray);
+     );
+    __UHEAP_MARKEND;
+
+    QCOMPARE(err, KErrNone);
+}
+
+void CCAStorageTest::testGetParentIdsInLoop()
+{
+    __UHEAP_MARK;
+    TRAPD(err,
+          RArray<TInt> entryIdArray;
+          CleanupClosePushL(entryIdArray);
+          entryIdArray.AppendL(9);
+          RArray<TInt> parentIdArray;
+          CleanupClosePushL(parentIdArray);
+          //TInt err(KErrNone);
+          mStorage->GetParentsIdsL(entryIdArray, parentIdArray);
+    if (parentIdArray.Count() != 4) {
+    err == KErrNotFound;
+}
+
+CleanupStack::PopAndDestroy(&parentIdArray);
+CleanupStack::PopAndDestroy(&entryIdArray);
+     );
+    __UHEAP_MARKEND;
+
+    QCOMPARE(err, KErrNone);
+}