contentstorage/castorage/tsrc/t_castorage/src/castoragetestgetparentids.cpp
changeset 117 c63ee96dbe5f
equal deleted inserted replaced
115:3ab5c078b490 117:c63ee96dbe5f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 /*
       
    18  * castoragetestgetparentids.cpp
       
    19  *
       
    20  *  Created on: 2009-09-14
       
    21  *      Author: michal.czerwiec
       
    22  */
       
    23 
       
    24 #include "castoragetest.h"
       
    25 #include "castoragefactory.h"
       
    26 #include "castorage.h"
       
    27 #include "cainnerentry.h"
       
    28 #include "casqlquery.h"
       
    29 #include "casqlitestorage.h"
       
    30 #include "castoragetestsqlcommands.h"
       
    31 #include "casqlcommands.h"
       
    32 
       
    33 // ---------------------------------------------------------------------------
       
    34 // Test Sorting Order giving different attributes.
       
    35 //
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 void CCAStorageTest::testGetParentIds()
       
    39 {
       
    40     __UHEAP_MARK;
       
    41     
       
    42     TRAPD(err,
       
    43           RArray<TInt> entryIdArray;
       
    44           CleanupClosePushL(entryIdArray);
       
    45           entryIdArray.AppendL(15);
       
    46           RArray<TInt> parentIdArray;
       
    47           CleanupClosePushL(parentIdArray);
       
    48           //TInt err(KErrNone);
       
    49           mStorage->GetParentsIdsL(entryIdArray, parentIdArray);
       
    50     if (parentIdArray.Count() != 3) {
       
    51     err == KErrNotFound;
       
    52 } else if (parentIdArray.Find(2) == KErrNotFound ||
       
    53                parentIdArray.Find(3) == KErrNotFound ||
       
    54     parentIdArray.Find(8) == KErrNotFound) {
       
    55     err = KErrGeneral;
       
    56 }
       
    57 
       
    58 CleanupStack::PopAndDestroy(&parentIdArray);
       
    59 CleanupStack::PopAndDestroy(&entryIdArray);
       
    60      );
       
    61     __UHEAP_MARKEND;
       
    62 
       
    63     QCOMPARE(err, KErrNone);
       
    64 }
       
    65 
       
    66 void CCAStorageTest::testGetParentIdsInLoop()
       
    67 {
       
    68     __UHEAP_MARK;
       
    69     TRAPD(err,
       
    70           RArray<TInt> entryIdArray;
       
    71           CleanupClosePushL(entryIdArray);
       
    72           entryIdArray.AppendL(9);
       
    73           RArray<TInt> parentIdArray;
       
    74           CleanupClosePushL(parentIdArray);
       
    75           //TInt err(KErrNone);
       
    76           mStorage->GetParentsIdsL(entryIdArray, parentIdArray);
       
    77     if (parentIdArray.Count() != 4) {
       
    78     err == KErrNotFound;
       
    79 }
       
    80 
       
    81 CleanupStack::PopAndDestroy(&parentIdArray);
       
    82 CleanupStack::PopAndDestroy(&entryIdArray);
       
    83      );
       
    84     __UHEAP_MARKEND;
       
    85 
       
    86     QCOMPARE(err, KErrNone);
       
    87 }