/*
* 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);
}