mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxcollectionpath.cpp
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     1 /*
       
     2 * Copyright (c) 2002 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:  MPXCollectionPath testing implementation (mpxcollectionpath.h)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <s32mem.h>
       
    20 #include <mpxcollectionpath.h>
       
    21 #include "commontestclass.h"
       
    22 
       
    23 // Begin MPXCollectionPath testing implementation mpxcollectionpath.h================================
       
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // CCommonTestClass::MpxItemIdConst()
       
    27 // Returns: Symbian OS errors.
       
    28 // -----------------------------------------------------------------------------
       
    29 TInt CCommonTestClass::MpxItemIdConst(CStifItemParser& aItem)
       
    30     {
       
    31     FTRACE(FPrint(_L("CCommonTestClass::MpxItemIdConst testing TMPXItemId::TMPXItemId() begin")));
       
    32     iLog->Log(_L("CCommonTestClass::MpxItemIdConst testing TMPXItemId::TMPXItemId() begin"));
       
    33     TInt err=KErrNone;
       
    34     TUint id1;
       
    35     TUint id2;
       
    36     TUint numParam=0;
       
    37     TMPXItemId item;
       
    38     
       
    39     // read in parameters
       
    40     if ( aItem.GetNextInt(id1) == KErrNone )
       
    41         {
       
    42         numParam++;
       
    43         if ( aItem.GetNextInt(id2) == KErrNone )
       
    44             {
       
    45             numParam++;
       
    46             }
       
    47         }
       
    48     
       
    49     switch (numParam)
       
    50         {
       
    51         case 1:
       
    52             item.iId1 = item.iId2 = id1;
       
    53             break;
       
    54         case 2:
       
    55             item.iId1 = id1;
       
    56             item.iId2 = id2;
       
    57             break;
       
    58         }
       
    59     
       
    60     iMPXItemIdArray.Append(item);
       
    61     return err;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CCommonTestClass::MpxItemIdReset()
       
    66 // Returns: Symbian OS errors.
       
    67 // -----------------------------------------------------------------------------
       
    68 TInt CCommonTestClass::MpxItemIdReset(CStifItemParser& /*aItem*/)
       
    69     {
       
    70     FTRACE(FPrint(_L("CCommonTestClass::MpxItemIdReset begin")));
       
    71     iLog->Log(_L("CCommonTestClass::MpxItemIdReset begin"));
       
    72     TInt err=KErrNone;
       
    73 
       
    74     iMPXItemIdArray.Reset();
       
    75     return err;
       
    76     }
       
    77 
       
    78 // -----------------------------------------------------------------------------
       
    79 // CCommonTestClass::MpxCollPathNewL()
       
    80 // Returns: Symbian OS errors.
       
    81 // -----------------------------------------------------------------------------
       
    82 TInt CCommonTestClass::MpxCollPathNewL(CStifItemParser& /*aItem*/)
       
    83     {
       
    84     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathNewL testing CMPXCollectionPath::NewL() begin")));
       
    85     iLog->Log(_L("CCommonTestClass::MpxCollPathNewL testing CMPXCollectionPath::NewL() begin"));
       
    86     TInt err=KErrNone;
       
    87 
       
    88     if ( iMPXCollectionPath )
       
    89         {
       
    90         delete iMPXCollectionPath;
       
    91         iMPXCollectionPath = NULL;
       
    92         }
       
    93     iMPXCollectionPath = CMPXCollectionPath::NewL();
       
    94     return err;
       
    95     }
       
    96 
       
    97 // -----------------------------------------------------------------------------
       
    98 // CCommonTestClass::MpxCollPathNewLPathL()
       
    99 // Returns: Symbian OS errors.
       
   100 // -----------------------------------------------------------------------------
       
   101 TInt CCommonTestClass::MpxCollPathNewLPathL(CStifItemParser& /*aItem*/)
       
   102     {
       
   103     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathNewLPathL testing CMPXCollectionPath::NewL() begin")));
       
   104     iLog->Log(_L("CCommonTestClass::MpxCollPathNewLPathL testing CMPXCollectionPath::NewL() begin"));
       
   105     TInt err=KErrNone;
       
   106 
       
   107     if ( !iMPXCollectionPath )
       
   108         {
       
   109         iLog->Log(_L("Error: MPXCollectionPath not created."));
       
   110         return KErrBadTestParameter;
       
   111         }
       
   112     CMPXCollectionPath* path = CMPXCollectionPath::NewL(*iMPXCollectionPath);
       
   113     // Verification
       
   114     if ( path->Levels() != iMPXCollectionPath->Levels() )
       
   115         {
       
   116         iLog->Log(_L("Verification Failed: new num levels=%d, old num levels=%d."), 
       
   117                 path->Levels(), iMPXCollectionPath->Levels());
       
   118         err = KErrUnexpectedValue;
       
   119         }
       
   120     if ( path->Count() != iMPXCollectionPath->Count() )
       
   121         {
       
   122         iLog->Log(_L("Verification Failed: new Count=%d, old Count=%d."), 
       
   123                 path->Count(), iMPXCollectionPath->Count());
       
   124         err = KErrUnexpectedValue;
       
   125         }
       
   126     
       
   127     delete path;
       
   128     return err;
       
   129     }
       
   130 
       
   131 // -----------------------------------------------------------------------------
       
   132 // CCommonTestClass::MpxCollPathNewLStreamL()
       
   133 // Returns: Symbian OS errors.
       
   134 // -----------------------------------------------------------------------------
       
   135 TInt CCommonTestClass::MpxCollPathNewLStreamL(CStifItemParser& /*aItem*/)
       
   136     {
       
   137     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathNewLPathL testing CMPXCollectionPath::NewL() begin")));
       
   138     iLog->Log(_L("CCommonTestClass::MpxCollPathNewLPathL testing CMPXCollectionPath::NewL() begin"));
       
   139     TInt err=KErrNone;
       
   140 
       
   141     if ( !iMPXCollectionPath )
       
   142         {
       
   143         iLog->Log(_L("Error: MPXCollectionPath not created."));
       
   144         return KErrBadTestParameter;
       
   145         }
       
   146 
       
   147     CBufBase* buffer = CBufFlat::NewL( 200 );
       
   148     CleanupStack::PushL( buffer );
       
   149     RBufWriteStream writeStream( *buffer );
       
   150     CleanupClosePushL( writeStream );
       
   151     iMPXCollectionPath->ExternalizeL( writeStream );
       
   152     writeStream.CommitL();
       
   153     buffer->Compress();
       
   154     CleanupStack::PopAndDestroy( &writeStream );
       
   155 
       
   156     RBufReadStream readStream( *buffer );
       
   157     CleanupClosePushL( readStream );                
       
   158     CMPXCollectionPath* path = CMPXCollectionPath::NewL(readStream);
       
   159     // Verification
       
   160     if ( path->Levels() != iMPXCollectionPath->Levels() )
       
   161         {
       
   162         iLog->Log(_L("Verification Failed: new num levels=%d, old num levels=%d."), 
       
   163                 path->Levels(), iMPXCollectionPath->Levels());
       
   164         err = KErrUnexpectedValue;
       
   165         }
       
   166     if ( path->Count() != iMPXCollectionPath->Count() )
       
   167         {
       
   168         iLog->Log(_L("Verification Failed: new Count=%d, old Count=%d."), 
       
   169                 path->Count(), iMPXCollectionPath->Count());
       
   170         err = KErrUnexpectedValue;
       
   171         }
       
   172     CleanupStack::PopAndDestroy( &readStream );
       
   173     CleanupStack::PopAndDestroy( buffer );
       
   174     return err;
       
   175     }
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // CCommonTestClass::MpxCollPathAppendLIdL()
       
   179 // Returns: Symbian OS errors.
       
   180 // -----------------------------------------------------------------------------
       
   181 TInt CCommonTestClass::MpxCollPathAppendLIdL(CStifItemParser& aItem)
       
   182     {
       
   183     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathAppendLIdL testing CMPXCollectionPath::AppendL() begin")));
       
   184     iLog->Log(_L("CCommonTestClass::MpxCollPathAppendLIdL testing CMPXCollectionPath::AppendL() begin"));
       
   185     TInt err=KErrNone;
       
   186     TUint itemId;
       
   187     
       
   188     // read in parameters
       
   189     if ( aItem.GetNextInt(itemId) )
       
   190         {
       
   191         iLog->Log(_L("Missing Parameter: ItemId."));
       
   192         return KErrBadTestParameter;
       
   193         }
       
   194 
       
   195     // if first time, generate TUid and use that value to append.
       
   196     if ( iMPXCollectionPath->Levels() == 0 )
       
   197         {
       
   198         iCollectionPathUid.Uid(itemId);
       
   199         itemId = iCollectionPathUid.iUid;
       
   200         }
       
   201     TMPXItemId item(itemId);
       
   202     iMPXCollectionPath->AppendL(item);
       
   203     return err;
       
   204     }
       
   205 
       
   206 // -----------------------------------------------------------------------------
       
   207 // CCommonTestClass::MpxCollPathAppendLIdsL()
       
   208 // Returns: Symbian OS errors.
       
   209 // -----------------------------------------------------------------------------
       
   210 TInt CCommonTestClass::MpxCollPathAppendLIdsL(CStifItemParser& /*aItem*/)
       
   211     {
       
   212     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathAppendLIdsL testing CMPXCollectionPath::AppendL() begin")));
       
   213     iLog->Log(_L("CCommonTestClass::MpxCollPathAppendLIdsL testing CMPXCollectionPath::AppendL() begin"));
       
   214     TInt err=KErrNone;
       
   215 
       
   216     iMPXCollectionPath->AppendL(iMPXItemIdArray.Array());
       
   217     return err;
       
   218     }
       
   219 
       
   220 // -----------------------------------------------------------------------------
       
   221 // CCommonTestClass::MpxCollPathLevels()
       
   222 // Returns: Symbian OS errors.
       
   223 // -----------------------------------------------------------------------------
       
   224 TInt CCommonTestClass::MpxCollPathLevels(CStifItemParser& aItem)
       
   225     {
       
   226     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathLevels testing CMPXCollectionPath::Levels() begin")));
       
   227     iLog->Log(_L("CCommonTestClass::MpxCollPathLevels testing CMPXCollectionPath::Levels() begin"));
       
   228     TInt err=KErrNone;
       
   229     TUint expectedLevels;
       
   230     
       
   231     // read in parameters
       
   232     if ( aItem.GetNextInt(expectedLevels) )
       
   233         {
       
   234         iLog->Log(_L("Missing Parameter: Expected Level."));
       
   235         return KErrBadTestParameter;
       
   236         }
       
   237 
       
   238     TInt levels = iMPXCollectionPath->Levels();
       
   239     // Verification
       
   240     if ( levels != expectedLevels )
       
   241         {
       
   242         iLog->Log(_L("Verification Failed: levels=%d, expectedLevels=%d."), levels, expectedLevels);
       
   243         err = KErrUnexpectedValue;
       
   244         }
       
   245     return err;
       
   246     }
       
   247 
       
   248 // -----------------------------------------------------------------------------
       
   249 // CCommonTestClass::MpxCollPathBack()
       
   250 // Returns: Symbian OS errors.
       
   251 // -----------------------------------------------------------------------------
       
   252 TInt CCommonTestClass::MpxCollPathBack(CStifItemParser& /*aItem*/)
       
   253     {
       
   254     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathBack testing CMPXCollectionPath::Back() begin")));
       
   255     iLog->Log(_L("CCommonTestClass::MpxCollPathBack testing CMPXCollectionPath::Back() begin"));
       
   256     TInt err=KErrNone;
       
   257 
       
   258     iMPXCollectionPath->Back();
       
   259     return err;
       
   260     }
       
   261 
       
   262 // -----------------------------------------------------------------------------
       
   263 // CCommonTestClass::MpxCollPathReset()
       
   264 // Returns: Symbian OS errors.
       
   265 // -----------------------------------------------------------------------------
       
   266 TInt CCommonTestClass::MpxCollPathReset(CStifItemParser& /*aItem*/)
       
   267     {
       
   268     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathReset testing CMPXCollectionPath::Reset() begin")));
       
   269     iLog->Log(_L("CCommonTestClass::MpxCollPathReset testing CMPXCollectionPath::Reset() begin"));
       
   270     TInt err=KErrNone;
       
   271 
       
   272     iMPXCollectionPath->Reset();
       
   273     return err;
       
   274     }
       
   275 
       
   276 // -----------------------------------------------------------------------------
       
   277 // CCommonTestClass::MpxCollPathIndex()
       
   278 // Returns: Symbian OS errors.
       
   279 // -----------------------------------------------------------------------------
       
   280 TInt CCommonTestClass::MpxCollPathIndex(CStifItemParser& aItem)
       
   281     {
       
   282     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIndex testing CMPXCollectionPath::Index() begin")));
       
   283     iLog->Log(_L("CCommonTestClass::MpxCollPathIndex testing CMPXCollectionPath::Index() begin"));
       
   284     TInt err=KErrNone;
       
   285     TUint expectedIndex;
       
   286     
       
   287     // read in parameters
       
   288     if ( aItem.GetNextInt(expectedIndex) )
       
   289         {
       
   290         iLog->Log(_L("Missing Parameter: Expected Index."));
       
   291         return KErrBadTestParameter;
       
   292         }
       
   293 
       
   294     TInt index = iMPXCollectionPath->Index();
       
   295     // Verification
       
   296     if ( index != expectedIndex )
       
   297         {
       
   298         iLog->Log(_L("Verification Failed: index=%d, expectedIndex=%d."), index, expectedIndex);
       
   299         err = KErrUnexpectedValue;
       
   300         }
       
   301     return err;
       
   302     }
       
   303 
       
   304 // -----------------------------------------------------------------------------
       
   305 // CCommonTestClass::MpxCollPathOperatorPlus()
       
   306 // Returns: Symbian OS errors.
       
   307 // -----------------------------------------------------------------------------
       
   308 TInt CCommonTestClass::MpxCollPathOperatorPlus(CStifItemParser& aItem)
       
   309     {
       
   310     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOperatorPlus testing CMPXCollectionPath::Operator++() begin")));
       
   311     iLog->Log(_L("CCommonTestClass::MpxCollPathOperatorPlus testing CMPXCollectionPath::Operator++() begin"));
       
   312     TInt err=KErrNone;
       
   313     TUint expectedResult;
       
   314     
       
   315     // read in parameters
       
   316     if ( aItem.GetNextInt(expectedResult) )
       
   317         {
       
   318         iLog->Log(_L("Missing Parameter: Expected Result."));
       
   319         return KErrBadTestParameter;
       
   320         }
       
   321 
       
   322     TBool result = iMPXCollectionPath->operator ++();
       
   323     // Verification
       
   324     if ( result != expectedResult )
       
   325         {
       
   326         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
   327         err = KErrUnexpectedValue;
       
   328         }
       
   329     return err;
       
   330     }
       
   331 
       
   332 // -----------------------------------------------------------------------------
       
   333 // CCommonTestClass::MpxCollPathOperatorMinus()
       
   334 // Returns: Symbian OS errors.
       
   335 // -----------------------------------------------------------------------------
       
   336 TInt CCommonTestClass::MpxCollPathOperatorMinus(CStifItemParser& aItem)
       
   337     {
       
   338     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOperatorMinus testing CMPXCollectionPath::Operator--() begin")));
       
   339     iLog->Log(_L("CCommonTestClass::MpxCollPathOperatorMinus testing CMPXCollectionPath::Operator--() begin"));
       
   340     TInt err=KErrNone;
       
   341     TUint expectedResult;
       
   342     
       
   343     // read in parameters
       
   344     if ( aItem.GetNextInt(expectedResult) )
       
   345         {
       
   346         iLog->Log(_L("Missing Parameter: Expected Result."));
       
   347         return KErrBadTestParameter;
       
   348         }
       
   349 
       
   350     TBool result = iMPXCollectionPath->operator --();
       
   351     // Verification
       
   352     if ( result != expectedResult )
       
   353         {
       
   354         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
   355         err = KErrUnexpectedValue;
       
   356         }
       
   357     return err;
       
   358     }
       
   359 
       
   360 // -----------------------------------------------------------------------------
       
   361 // CCommonTestClass::MpxCollPathSetToFirst()
       
   362 // Returns: Symbian OS errors.
       
   363 // -----------------------------------------------------------------------------
       
   364 TInt CCommonTestClass::MpxCollPathSetToFirst(CStifItemParser& /*aItem*/)
       
   365     {
       
   366     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetToFirst testing CMPXCollectionPath::SetToFirst() begin")));
       
   367     iLog->Log(_L("CCommonTestClass::MpxCollPathSetToFirst testing CMPXCollectionPath::SetToFirst() begin"));
       
   368     TInt err=KErrNone;
       
   369 
       
   370     iMPXCollectionPath->SetToFirst();
       
   371     return err;
       
   372     }
       
   373 
       
   374 // -----------------------------------------------------------------------------
       
   375 // CCommonTestClass::MpxCollPathSetToLast()
       
   376 // Returns: Symbian OS errors.
       
   377 // -----------------------------------------------------------------------------
       
   378 TInt CCommonTestClass::MpxCollPathSetToLast(CStifItemParser& /*aItem*/)
       
   379     {
       
   380     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetToLast testing CMPXCollectionPath::SetToLast() begin")));
       
   381     iLog->Log(_L("CCommonTestClass::MpxCollPathSetToLast testing CMPXCollectionPath::SetToLast() begin"));
       
   382     TInt err=KErrNone;
       
   383 
       
   384     iMPXCollectionPath->SetToLast();
       
   385     return err;
       
   386     }
       
   387 
       
   388 // -----------------------------------------------------------------------------
       
   389 // CCommonTestClass::MpxCollPathSetIndex()
       
   390 // Returns: Symbian OS errors.
       
   391 // -----------------------------------------------------------------------------
       
   392 TInt CCommonTestClass::MpxCollPathSetIndex(CStifItemParser& aItem)
       
   393     {
       
   394     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetIndex testing CMPXCollectionPath::Set() begin")));
       
   395     iLog->Log(_L("CCommonTestClass::MpxCollPathSetIndex testing CMPXCollectionPath::Set() begin"));
       
   396     TInt err=KErrNone;
       
   397     TInt index;
       
   398     
       
   399     // read in parameters
       
   400     if ( aItem.GetNextInt(index) )
       
   401         {
       
   402         iLog->Log(_L("Missing Parameter: Index."));
       
   403         return KErrBadTestParameter;
       
   404         }
       
   405     if ( index >= iMPXCollectionPath->Count() )
       
   406         {
       
   407         iLog->Log(_L("Bad Parameter: index out of range."));
       
   408         return KErrBadTestParameter;
       
   409         }
       
   410 
       
   411     iMPXCollectionPath->Set(index);
       
   412     return err;
       
   413     }
       
   414 
       
   415 // -----------------------------------------------------------------------------
       
   416 // CCommonTestClass::MpxCollPathSetId()
       
   417 // Returns: Symbian OS errors.
       
   418 // -----------------------------------------------------------------------------
       
   419 TInt CCommonTestClass::MpxCollPathSetId(CStifItemParser& aItem)
       
   420     {
       
   421     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetId testing CMPXCollectionPath::Set() begin")));
       
   422     iLog->Log(_L("CCommonTestClass::MpxCollPathSetId testing CMPXCollectionPath::Set() begin"));
       
   423     TInt err=KErrNone;
       
   424     TUint itemId;
       
   425     
       
   426     // read in parameters
       
   427     if ( aItem.GetNextInt(itemId) )
       
   428         {
       
   429         iLog->Log(_L("Missing Parameter: ItemId."));
       
   430         return KErrBadTestParameter;
       
   431         }
       
   432 
       
   433     TMPXItemId id(itemId);
       
   434     iMPXCollectionPath->Set(id);
       
   435     return err;
       
   436     }
       
   437 
       
   438 // -----------------------------------------------------------------------------
       
   439 // CCommonTestClass::MpxCollPathSetMode()
       
   440 // Returns: Symbian OS errors.
       
   441 // -----------------------------------------------------------------------------
       
   442 TInt CCommonTestClass::MpxCollPathSetMode(CStifItemParser& aItem)
       
   443     {
       
   444     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetMode testing CMPXCollectionPath::Set() begin")));
       
   445     iLog->Log(_L("CCommonTestClass::MpxCollPathSetMode testing CMPXCollectionPath::Set() begin"));
       
   446     TInt err=KErrNone;
       
   447     TUint mode;
       
   448     
       
   449     // read in parameters
       
   450     if ( aItem.GetNextInt(mode) )
       
   451         {
       
   452         iLog->Log(_L("Missing Parameter: Open mode."));
       
   453         return KErrBadTestParameter;
       
   454         }
       
   455 
       
   456     iMPXCollectionPath->Set(static_cast<TMPXOpenMode>(mode));
       
   457     return err;
       
   458     }
       
   459 
       
   460 // -----------------------------------------------------------------------------
       
   461 // CCommonTestClass::MpxCollPathSetLAttrsL()
       
   462 // Returns: Symbian OS errors.
       
   463 // -----------------------------------------------------------------------------
       
   464 TInt CCommonTestClass::MpxCollPathSetLAttrsL(CStifItemParser& /*aItem*/)
       
   465     {
       
   466     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetLAttrsL testing CMPXCollectionPath::SetL() begin")));
       
   467     iLog->Log(_L("CCommonTestClass::MpxCollPathSetLAttrsL testing CMPXCollectionPath::SetL() begin"));
       
   468     TInt err=KErrNone;
       
   469     
       
   470     iMPXCollectionPath->SetL(iMPXAttArray.Array());
       
   471     return err;
       
   472     }
       
   473 
       
   474 // -----------------------------------------------------------------------------
       
   475 // CCommonTestClass::MpxCollPathOpenNextMode()
       
   476 // Returns: Symbian OS errors.
       
   477 // -----------------------------------------------------------------------------
       
   478 TInt CCommonTestClass::MpxCollPathOpenNextMode(CStifItemParser& aItem)
       
   479     {
       
   480     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOpenNextMode testing CMPXCollectionPath::OpenNextMode() begin")));
       
   481     iLog->Log(_L("CCommonTestClass::MpxCollPathOpenNextMode testing CMPXCollectionPath::OpenNextMode() begin"));
       
   482     TInt err=KErrNone;
       
   483     TUint expectedMode;
       
   484     
       
   485     // read in parameters
       
   486     if ( aItem.GetNextInt(expectedMode) )
       
   487         {
       
   488         iLog->Log(_L("Missing Parameter: Expected open mode."));
       
   489         return KErrBadTestParameter;
       
   490         }
       
   491 
       
   492     TMPXOpenMode mode = iMPXCollectionPath->OpenNextMode();
       
   493     // Verification
       
   494     if ( mode != expectedMode )
       
   495         {
       
   496         iLog->Log(_L("Verification Failed: mode=%d, expectedMode=%d."), mode, expectedMode);
       
   497         err = KErrUnexpectedValue;
       
   498         }
       
   499     return err;
       
   500     }
       
   501 
       
   502 // -----------------------------------------------------------------------------
       
   503 // CCommonTestClass::MpxCollPathOpenPreviousMode()
       
   504 // Returns: Symbian OS errors.
       
   505 // -----------------------------------------------------------------------------
       
   506 TInt CCommonTestClass::MpxCollPathOpenPreviousMode(CStifItemParser& aItem)
       
   507     {
       
   508     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOpenPreviousMode testing CMPXCollectionPath::OpenPreviousMode() begin")));
       
   509     iLog->Log(_L("CCommonTestClass::MpxCollPathOpenPreviousMode testing CMPXCollectionPath::OpenPreviousMode() begin"));
       
   510     TInt err=KErrNone;
       
   511     TUint expectedMode;
       
   512     
       
   513     // read in parameters
       
   514     if ( aItem.GetNextInt(expectedMode) )
       
   515         {
       
   516         iLog->Log(_L("Missing Parameter: Expected open mode."));
       
   517         return KErrBadTestParameter;
       
   518         }
       
   519 
       
   520     TMPXOpenMode mode = iMPXCollectionPath->OpenPreviousMode();
       
   521     // Verification
       
   522     if ( mode != expectedMode )
       
   523         {
       
   524         iLog->Log(_L("Verification Failed: mode=%d, expectedMode=%d."), mode, expectedMode);
       
   525         err = KErrUnexpectedValue;
       
   526         }
       
   527     return err;
       
   528     }
       
   529 
       
   530 // -----------------------------------------------------------------------------
       
   531 // CCommonTestClass::MpxCollPathSelectLIdL()
       
   532 // Returns: Symbian OS errors.
       
   533 // -----------------------------------------------------------------------------
       
   534 TInt CCommonTestClass::MpxCollPathSelectLIdL(CStifItemParser& aItem)
       
   535     {
       
   536     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelectLIdL testing CMPXCollectionPath::SelectL() begin")));
       
   537     iLog->Log(_L("CCommonTestClass::MpxCollPathSelectLIdL testing CMPXCollectionPath::SelectL() begin"));
       
   538     TInt err=KErrNone;
       
   539     TUint itemId;
       
   540     
       
   541     // read in parameters
       
   542     if ( aItem.GetNextInt(itemId) )
       
   543         {
       
   544         iLog->Log(_L("Missing Parameter: ItemId."));
       
   545         return KErrBadTestParameter;
       
   546         }
       
   547 
       
   548     TMPXItemId id(itemId);
       
   549     iMPXCollectionPath->SelectL(id);
       
   550     return err;
       
   551     }
       
   552 
       
   553 // -----------------------------------------------------------------------------
       
   554 // CCommonTestClass::MpxCollPathSelectLIndexL()
       
   555 // Returns: Symbian OS errors.
       
   556 // -----------------------------------------------------------------------------
       
   557 TInt CCommonTestClass::MpxCollPathSelectLIndexL(CStifItemParser& aItem)
       
   558     {
       
   559     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelectLIndexL testing CMPXCollectionPath::SelectL() begin")));
       
   560     iLog->Log(_L("CCommonTestClass::MpxCollPathSelectLIndexL testing CMPXCollectionPath::SelectL() begin"));
       
   561     TInt err=KErrNone;
       
   562     TInt index;
       
   563     
       
   564     // read in parameters
       
   565     if ( aItem.GetNextInt(index) )
       
   566         {
       
   567         iLog->Log(_L("Missing Parameter: Index."));
       
   568         return KErrBadTestParameter;
       
   569         }
       
   570     if ( index >= iMPXCollectionPath->Count() )
       
   571         {
       
   572         iLog->Log(_L("Bad Parameter: index out of range."));
       
   573         return KErrBadTestParameter;
       
   574         }
       
   575 
       
   576     iMPXCollectionPath->SelectL(index);
       
   577     return err;
       
   578     }
       
   579 
       
   580 // -----------------------------------------------------------------------------
       
   581 // CCommonTestClass::MpxCollPathSelectAllL()
       
   582 // Returns: Symbian OS errors.
       
   583 // -----------------------------------------------------------------------------
       
   584 TInt CCommonTestClass::MpxCollPathSelectAllL(CStifItemParser& /*aItem*/)
       
   585     {
       
   586     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelectAllL testing CMPXCollectionPath::SelectAllL() begin")));
       
   587     iLog->Log(_L("CCommonTestClass::MpxCollPathSelectAllL testing CMPXCollectionPath::SelectAllL() begin"));
       
   588     TInt err=KErrNone;
       
   589     
       
   590     iMPXCollectionPath->SelectAllL();
       
   591     return err;
       
   592     }
       
   593 
       
   594 // -----------------------------------------------------------------------------
       
   595 // CCommonTestClass::MpxCollPathDeselectId()
       
   596 // Returns: Symbian OS errors.
       
   597 // -----------------------------------------------------------------------------
       
   598 TInt CCommonTestClass::MpxCollPathDeselectId(CStifItemParser& aItem)
       
   599     {
       
   600     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathDeselectId testing CMPXCollectionPath::Deselect() begin")));
       
   601     iLog->Log(_L("CCommonTestClass::MpxCollPathDeselectId testing CMPXCollectionPath::Deselect() begin"));
       
   602     TInt err=KErrNone;
       
   603     TUint itemId;
       
   604     
       
   605     // read in parameters
       
   606     if ( aItem.GetNextInt(itemId) )
       
   607         {
       
   608         iLog->Log(_L("Missing Parameter: ItemId."));
       
   609         return KErrBadTestParameter;
       
   610         }
       
   611 
       
   612     TMPXItemId id(itemId);
       
   613     iMPXCollectionPath->Deselect(id);
       
   614     return err;
       
   615     }
       
   616 
       
   617 // -----------------------------------------------------------------------------
       
   618 // CCommonTestClass::MpxCollPathDeselectIndex()
       
   619 // Returns: Symbian OS errors.
       
   620 // -----------------------------------------------------------------------------
       
   621 TInt CCommonTestClass::MpxCollPathDeselectIndex(CStifItemParser& aItem)
       
   622     {
       
   623     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathDeselectIndex testing CMPXCollectionPath::Deselect() begin")));
       
   624     iLog->Log(_L("CCommonTestClass::MpxCollPathDeselectIndex testing CMPXCollectionPath::Deselect() begin"));
       
   625     TInt err=KErrNone;
       
   626     TInt index;
       
   627     
       
   628     // read in parameters
       
   629     if ( aItem.GetNextInt(index) )
       
   630         {
       
   631         iLog->Log(_L("Missing Parameter: Index."));
       
   632         return KErrBadTestParameter;
       
   633         }
       
   634     if ( index >= iMPXCollectionPath->Count() )
       
   635         {
       
   636         iLog->Log(_L("Bad Parameter: index out of range."));
       
   637         return KErrBadTestParameter;
       
   638         }
       
   639 
       
   640     iMPXCollectionPath->Deselect(index);
       
   641     return err;
       
   642     }
       
   643 
       
   644 // -----------------------------------------------------------------------------
       
   645 // CCommonTestClass::MpxCollPathDeselectAll()
       
   646 // Returns: Symbian OS errors.
       
   647 // -----------------------------------------------------------------------------
       
   648 TInt CCommonTestClass::MpxCollPathDeselectAll(CStifItemParser& /*aItem*/)
       
   649     {
       
   650     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathDeselectAll testing CMPXCollectionPath::DeselectAll() begin")));
       
   651     iLog->Log(_L("CCommonTestClass::MpxCollPathDeselectAll testing CMPXCollectionPath::DeselectAll() begin"));
       
   652     TInt err=KErrNone;
       
   653     
       
   654     iMPXCollectionPath->DeselectAll();
       
   655     return err;
       
   656     }
       
   657 
       
   658 // -----------------------------------------------------------------------------
       
   659 // CCommonTestClass::MpxCollPathRemoveId()
       
   660 // Returns: Symbian OS errors.
       
   661 // -----------------------------------------------------------------------------
       
   662 TInt CCommonTestClass::MpxCollPathRemoveId(CStifItemParser& aItem)
       
   663     {
       
   664     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathRemoveId testing CMPXCollectionPath::Remove() begin")));
       
   665     iLog->Log(_L("CCommonTestClass::MpxCollPathRemoveId testing CMPXCollectionPath::Remove() begin"));
       
   666     TInt err=KErrNone;
       
   667     TUint itemId;
       
   668     
       
   669     // read in parameters
       
   670     if ( aItem.GetNextInt(itemId) )
       
   671         {
       
   672         iLog->Log(_L("Missing Parameter: ItemId."));
       
   673         return KErrBadTestParameter;
       
   674         }
       
   675 
       
   676     TMPXItemId id(itemId);
       
   677     iMPXCollectionPath->Remove(id);
       
   678     return err;
       
   679     }
       
   680 
       
   681 // -----------------------------------------------------------------------------
       
   682 // CCommonTestClass::MpxCollPathRemoveIndex()
       
   683 // Returns: Symbian OS errors.
       
   684 // -----------------------------------------------------------------------------
       
   685 TInt CCommonTestClass::MpxCollPathRemoveIndex(CStifItemParser& aItem)
       
   686     {
       
   687     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathRemoveIndex testing CMPXCollectionPath::Remove() begin")));
       
   688     iLog->Log(_L("CCommonTestClass::MpxCollPathRemoveIndex testing CMPXCollectionPath::Remove() begin"));
       
   689     TInt err=KErrNone;
       
   690     TInt index;
       
   691     
       
   692     // read in parameters
       
   693     if ( aItem.GetNextInt(index) )
       
   694         {
       
   695         iLog->Log(_L("Missing Parameter: Index."));
       
   696         return KErrBadTestParameter;
       
   697         }
       
   698     if ( index >= iMPXCollectionPath->Count() )
       
   699         {
       
   700         iLog->Log(_L("Bad Parameter: index out of range."));
       
   701         return KErrBadTestParameter;
       
   702         }
       
   703 
       
   704     iMPXCollectionPath->Remove(index);
       
   705     return err;
       
   706     }
       
   707 
       
   708 // -----------------------------------------------------------------------------
       
   709 // CCommonTestClass::MpxCollPathIsSelectedId()
       
   710 // Returns: Symbian OS errors.
       
   711 // -----------------------------------------------------------------------------
       
   712 TInt CCommonTestClass::MpxCollPathIsSelectedId(CStifItemParser& aItem)
       
   713     {
       
   714     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIsSelectedId testing CMPXCollectionPath::IsSelected() begin")));
       
   715     iLog->Log(_L("CCommonTestClass::MpxCollPathIsSelectedId testing CMPXCollectionPath::IsSelected() begin"));
       
   716     TInt err=KErrNone;
       
   717     TUint itemId;
       
   718     TInt expectedResult;
       
   719     
       
   720     // read in parameters
       
   721     if ( aItem.GetNextInt(itemId) )
       
   722         {
       
   723         iLog->Log(_L("Missing Parameter: ItemId."));
       
   724         return KErrBadTestParameter;
       
   725         }
       
   726     if ( aItem.GetNextInt(expectedResult) )
       
   727         {
       
   728         iLog->Log(_L("Missing Parameter: Expected result."));
       
   729         return KErrBadTestParameter;
       
   730         }
       
   731 
       
   732     TMPXItemId id(itemId);
       
   733     TBool result = iMPXCollectionPath->IsSelected(id);
       
   734     // Verification
       
   735     if ( result != expectedResult )
       
   736         {
       
   737         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
   738         err = KErrUnexpectedValue;
       
   739         }
       
   740     return err;
       
   741     }
       
   742 
       
   743 // -----------------------------------------------------------------------------
       
   744 // CCommonTestClass::MpxCollPathIsSelectedIndex()
       
   745 // Returns: Symbian OS errors.
       
   746 // -----------------------------------------------------------------------------
       
   747 TInt CCommonTestClass::MpxCollPathIsSelectedIndex(CStifItemParser& aItem)
       
   748     {
       
   749     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIsSelectedIndex testing CMPXCollectionPath::IsSelected() begin")));
       
   750     iLog->Log(_L("CCommonTestClass::MpxCollPathIsSelectedIndex testing CMPXCollectionPath::IsSelected() begin"));
       
   751     TInt err=KErrNone;
       
   752     TInt index;
       
   753     TInt expectedResult;
       
   754 
       
   755     // read in parameters
       
   756     if ( aItem.GetNextInt(index) )
       
   757         {
       
   758         iLog->Log(_L("Missing Parameter: Index."));
       
   759         return KErrBadTestParameter;
       
   760         }
       
   761     if ( index >= iMPXCollectionPath->Count() )
       
   762         {
       
   763         iLog->Log(_L("Bad Parameter: index out of range."));
       
   764         return KErrBadTestParameter;
       
   765         }
       
   766     if ( aItem.GetNextInt(expectedResult) )
       
   767         {
       
   768         iLog->Log(_L("Missing Parameter: Expected result."));
       
   769         return KErrBadTestParameter;
       
   770         }
       
   771 
       
   772     TBool result = iMPXCollectionPath->IsSelected(index);
       
   773     // Verification
       
   774     if ( result != expectedResult )
       
   775         {
       
   776         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
   777         err = KErrUnexpectedValue;
       
   778         }
       
   779     return err;
       
   780     }
       
   781 
       
   782 // -----------------------------------------------------------------------------
       
   783 // CCommonTestClass::MpxCollPathClearSelection()
       
   784 // Returns: Symbian OS errors.
       
   785 // -----------------------------------------------------------------------------
       
   786 TInt CCommonTestClass::MpxCollPathClearSelection(CStifItemParser& /*aItem*/)
       
   787     {
       
   788     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathClearSelection testing CMPXCollectionPath::ClearSelection() begin")));
       
   789     iLog->Log(_L("CCommonTestClass::MpxCollPathClearSelection testing CMPXCollectionPath::ClearSelection() begin"));
       
   790     TInt err=KErrNone;
       
   791     
       
   792     iMPXCollectionPath->ClearSelection();
       
   793     return err;
       
   794     }
       
   795 
       
   796 // -----------------------------------------------------------------------------
       
   797 // CCommonTestClass::MpxCollPathSelection()
       
   798 // Returns: Symbian OS errors.
       
   799 // -----------------------------------------------------------------------------
       
   800 TInt CCommonTestClass::MpxCollPathSelection(CStifItemParser& aItem)
       
   801     {
       
   802     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelection testing CMPXCollectionPath::Selection() begin")));
       
   803     iLog->Log(_L("CCommonTestClass::MpxCollPathSelection testing CMPXCollectionPath::Selection() begin"));
       
   804     TInt err=KErrNone;
       
   805     TInt data;
       
   806     RArray<TInt> expectedIndices;
       
   807     
       
   808     // read in parameters
       
   809     while ( aItem.GetNextInt(data) == KErrNone )
       
   810         {
       
   811         expectedIndices.Append(data);
       
   812         }
       
   813     
       
   814     TArray<TInt> indices = iMPXCollectionPath->Selection();
       
   815     // Verification
       
   816     if ( indices.Count() == expectedIndices.Count() )
       
   817         {
       
   818         for (TInt i=0; i<indices.Count(); i++)
       
   819             {
       
   820             if ( expectedIndices.Find(indices[i]) == KErrNotFound )
       
   821                 {
       
   822                 iLog->Log(_L("Verification Failed: Index not Found = %d."), indices[i]);
       
   823                 err = KErrUnexpectedValue;
       
   824                 }
       
   825             }
       
   826         }
       
   827     else
       
   828         {
       
   829         iLog->Log(_L("Verification Failed: count=%d, expected count=%d."), 
       
   830                 indices.Count(), expectedIndices.Count());
       
   831         err = KErrUnexpectedValue;
       
   832         }
       
   833     return err;
       
   834     }
       
   835 
       
   836 // -----------------------------------------------------------------------------
       
   837 // CCommonTestClass::MpxCollPathSelectionL()
       
   838 // Returns: Symbian OS errors.
       
   839 // -----------------------------------------------------------------------------
       
   840 TInt CCommonTestClass::MpxCollPathSelectionL(CStifItemParser& aItem)
       
   841     {
       
   842     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSelectionL testing CMPXCollectionPath::SelectionL() begin")));
       
   843     iLog->Log(_L("CCommonTestClass::MpxCollPathSelectionL testing CMPXCollectionPath::SelectionL() begin"));
       
   844     TInt err=KErrNone;
       
   845     TUint data;
       
   846     RArray<TMPXItemId> expectedIds;
       
   847     RArray<TMPXItemId> ids;
       
   848     
       
   849     // read in parameters
       
   850     while ( aItem.GetNextInt(data) == KErrNone )
       
   851         {
       
   852         TMPXItemId id(data);
       
   853         expectedIds.Append(id);
       
   854         }
       
   855     
       
   856     iMPXCollectionPath->SelectionL(ids);
       
   857     // Verification
       
   858     if ( ids.Count() == expectedIds.Count() )
       
   859         {
       
   860         for (TInt i=0; i<ids.Count(); i++)
       
   861             {
       
   862             if ( expectedIds.Find(ids[i]) == KErrNotFound )
       
   863                 {
       
   864                 iLog->Log(_L("Verification Failed: Index not Found = %d."), ids[i].iId1);
       
   865                 err = KErrUnexpectedValue;
       
   866                 }
       
   867             }
       
   868         }
       
   869     else
       
   870         {
       
   871         iLog->Log(_L("Verification Failed: count=%d, expected count=%d."), 
       
   872                 ids.Count(), expectedIds.Count());
       
   873         err = KErrUnexpectedValue;
       
   874         }
       
   875     return err;
       
   876     }
       
   877 
       
   878 // -----------------------------------------------------------------------------
       
   879 // CCommonTestClass::MpxCollPathId()
       
   880 // Returns: Symbian OS errors.
       
   881 // -----------------------------------------------------------------------------
       
   882 TInt CCommonTestClass::MpxCollPathId(CStifItemParser& aItem)
       
   883     {
       
   884     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathId testing CMPXCollectionPath::Id() begin")));
       
   885     iLog->Log(_L("CCommonTestClass::MpxCollPathId testing CMPXCollectionPath::Id() begin"));
       
   886     TInt err=KErrNone;
       
   887     TUint data;
       
   888     
       
   889     // read in parameters
       
   890     if ( aItem.GetNextInt(data) )
       
   891         {
       
   892         iLog->Log(_L("Missing Parameter: Expected ItemId."));
       
   893         return KErrBadTestParameter;
       
   894         }
       
   895 
       
   896     TMPXItemId id = iMPXCollectionPath->Id();
       
   897     // Verification
       
   898     TMPXItemId expectedId(data);
       
   899     if ( id != expectedId )
       
   900         {
       
   901         iLog->Log(_L("Verification Failed: id=%d, expectedId=%d."), TUint(id), TUint(expectedId));
       
   902         err = KErrUnexpectedValue;
       
   903         }
       
   904     return err;
       
   905     }
       
   906 
       
   907 // -----------------------------------------------------------------------------
       
   908 // CCommonTestClass::MpxCollPathCount()
       
   909 // Returns: Symbian OS errors.
       
   910 // -----------------------------------------------------------------------------
       
   911 TInt CCommonTestClass::MpxCollPathCount(CStifItemParser& aItem)
       
   912     {
       
   913     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathCount testing CMPXCollectionPath::Count() begin")));
       
   914     iLog->Log(_L("CCommonTestClass::MpxCollPathCount testing CMPXCollectionPath::Count() begin"));
       
   915     TInt err=KErrNone;
       
   916     TUint expectedCount;
       
   917     
       
   918     // read in parameters
       
   919     if ( aItem.GetNextInt(expectedCount) )
       
   920         {
       
   921         iLog->Log(_L("Missing Parameter: Expected Count."));
       
   922         return KErrBadTestParameter;
       
   923         }
       
   924 
       
   925     TInt count = iMPXCollectionPath->Count();
       
   926     // Verification
       
   927     if ( count != expectedCount )
       
   928         {
       
   929         iLog->Log(_L("Verification Failed: count=%d, expectedCount=%d."), count, expectedCount);
       
   930         err = KErrUnexpectedValue;
       
   931         }
       
   932     return err;
       
   933     }
       
   934 
       
   935 // -----------------------------------------------------------------------------
       
   936 // CCommonTestClass::MpxCollPathIndexOfId()
       
   937 // Returns: Symbian OS errors.
       
   938 // -----------------------------------------------------------------------------
       
   939 TInt CCommonTestClass::MpxCollPathIndexOfId(CStifItemParser& aItem)
       
   940     {
       
   941     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIndexOfId testing CMPXCollectionPath::IndexOfId() begin")));
       
   942     iLog->Log(_L("CCommonTestClass::MpxCollPathIndexOfId testing CMPXCollectionPath::IndexOfId() begin"));
       
   943     TInt err=KErrNone;
       
   944     TUint id;
       
   945     TInt expectedIndex;
       
   946     
       
   947     // read in parameters
       
   948     if ( aItem.GetNextInt(id) )
       
   949         {
       
   950         iLog->Log(_L("Missing Parameter: Item Id."));
       
   951         return KErrBadTestParameter;
       
   952         }
       
   953     if ( aItem.GetNextInt(expectedIndex) )
       
   954         {
       
   955         iLog->Log(_L("Missing Parameter: Expected index."));
       
   956         return KErrBadTestParameter;
       
   957         }
       
   958 
       
   959     TMPXItemId itemId(id);
       
   960     TInt index = iMPXCollectionPath->IndexOfId(itemId);
       
   961     // Verification
       
   962     if ( index != expectedIndex )
       
   963         {
       
   964         iLog->Log(_L("Verification Failed: index=%d, expectedIndex=%d."), index, expectedIndex);
       
   965         err = KErrUnexpectedValue;
       
   966         }
       
   967     return err;
       
   968     }
       
   969 
       
   970 // -----------------------------------------------------------------------------
       
   971 // CCommonTestClass::MpxCollPathIdOfIndex()
       
   972 // Returns: Symbian OS errors.
       
   973 // -----------------------------------------------------------------------------
       
   974 TInt CCommonTestClass::MpxCollPathIdOfIndex(CStifItemParser& aItem)
       
   975     {
       
   976     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIdOfIndex testing CMPXCollectionPath::IdOfIndex() begin")));
       
   977     iLog->Log(_L("CCommonTestClass::MpxCollPathIdOfIndex testing CMPXCollectionPath::IdOfIndex() begin"));
       
   978     TInt err=KErrNone;
       
   979     TUint expectedId;
       
   980     TInt index;
       
   981     
       
   982     // read in parameters
       
   983     if ( aItem.GetNextInt(index) )
       
   984         {
       
   985         iLog->Log(_L("Missing Parameter: Index."));
       
   986         return KErrBadTestParameter;
       
   987         }
       
   988     if ( aItem.GetNextInt(expectedId) )
       
   989         {
       
   990         iLog->Log(_L("Missing Parameter: Expected itemId."));
       
   991         return KErrBadTestParameter;
       
   992         }
       
   993 
       
   994     TMPXItemId id = iMPXCollectionPath->IdOfIndex(index);
       
   995     // Verification
       
   996     if ( TUint(id) != expectedId )
       
   997         {
       
   998         iLog->Log(_L("Verification Failed: id=%d, expectedId=%d."), TUint(id), expectedId);
       
   999         err = KErrUnexpectedValue;
       
  1000         }
       
  1001     return err;
       
  1002     }
       
  1003 
       
  1004 // -----------------------------------------------------------------------------
       
  1005 // CCommonTestClass::MpxCollPathOpenAttributes()
       
  1006 // Returns: Symbian OS errors.
       
  1007 // -----------------------------------------------------------------------------
       
  1008 TInt CCommonTestClass::MpxCollPathOpenAttributes(CStifItemParser& /*aItem*/)
       
  1009     {
       
  1010     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathOpenAttributes testing CMPXCollectionPath::OpenAttributes() begin")));
       
  1011     iLog->Log(_L("CCommonTestClass::MpxCollPathOpenAttributes testing CMPXCollectionPath::OpenAttributes() begin"));
       
  1012     TInt err=KErrNone;
       
  1013     
       
  1014     TArray<TMPXAttribute> atts = iMPXCollectionPath->OpenAttributes();
       
  1015     // Verification
       
  1016     if ( atts.Count() == iMPXAttArray.Count() )
       
  1017         {
       
  1018         for (TInt i=0; i<atts.Count(); i++)
       
  1019             {
       
  1020             if ( iMPXAttArray.Find(atts[i]) == KErrNotFound )
       
  1021                 {
       
  1022                 iLog->Log(_L("Verification Failed: Attribute not Found, contentId=%d, attributeId=%d."), 
       
  1023                         atts[i].ContentId(), atts[i].AttributeId());
       
  1024                 err = KErrUnexpectedValue;
       
  1025                 }
       
  1026             }
       
  1027         }
       
  1028     else
       
  1029         {
       
  1030         iLog->Log(_L("Verification Failed: count=%d, expected count=%d."), 
       
  1031                 atts.Count(), iMPXAttArray.Count());
       
  1032         err = KErrUnexpectedValue;
       
  1033         }
       
  1034     return err;
       
  1035     }
       
  1036 
       
  1037 // -----------------------------------------------------------------------------
       
  1038 // CCommonTestClass::MpxCollPathIndexLevel()
       
  1039 // Returns: Symbian OS errors.
       
  1040 // -----------------------------------------------------------------------------
       
  1041 TInt CCommonTestClass::MpxCollPathIndexLevel(CStifItemParser& aItem)
       
  1042     {
       
  1043     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIndexLevel testing CMPXCollectionPath::Index() begin")));
       
  1044     iLog->Log(_L("CCommonTestClass::MpxCollPathIndexLevel testing CMPXCollectionPath::Index() begin"));
       
  1045     TInt err=KErrNone;
       
  1046     TInt level;
       
  1047     TInt expectedIndex;
       
  1048     
       
  1049     // read in parameters
       
  1050     if ( aItem.GetNextInt(level) )
       
  1051         {
       
  1052         iLog->Log(_L("Missing Parameter: level."));
       
  1053         return KErrBadTestParameter;
       
  1054         }
       
  1055     if ( aItem.GetNextInt(expectedIndex) )
       
  1056         {
       
  1057         iLog->Log(_L("Missing Parameter: Expected index."));
       
  1058         return KErrBadTestParameter;
       
  1059         }
       
  1060 
       
  1061     TInt index = iMPXCollectionPath->Index(level);
       
  1062     // Verification
       
  1063     if ( index != expectedIndex )
       
  1064         {
       
  1065         iLog->Log(_L("Verification Failed: index=%d, expectedIndex=%d."), index, expectedIndex);
       
  1066         err = KErrUnexpectedValue;
       
  1067         }
       
  1068     return err;
       
  1069     }
       
  1070 
       
  1071 // -----------------------------------------------------------------------------
       
  1072 // CCommonTestClass::MpxCollPathIdLevel()
       
  1073 // Returns: Symbian OS errors.
       
  1074 // -----------------------------------------------------------------------------
       
  1075 TInt CCommonTestClass::MpxCollPathIdLevel(CStifItemParser& aItem)
       
  1076     {
       
  1077     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathIdLevel testing CMPXCollectionPath::Id() begin")));
       
  1078     iLog->Log(_L("CCommonTestClass::MpxCollPathIdLevel testing CMPXCollectionPath::Id() begin"));
       
  1079     TInt err=KErrNone;
       
  1080     TInt level;
       
  1081     TUint expectedId;
       
  1082     
       
  1083     // read in parameters
       
  1084     if ( aItem.GetNextInt(level) )
       
  1085         {
       
  1086         iLog->Log(_L("Missing Parameter: level."));
       
  1087         return KErrBadTestParameter;
       
  1088         }
       
  1089     if ( aItem.GetNextInt(expectedId) )
       
  1090         {
       
  1091         iLog->Log(_L("Missing Parameter: Expected itemId."));
       
  1092         return KErrBadTestParameter;
       
  1093         }
       
  1094 
       
  1095     TMPXItemId id = iMPXCollectionPath->Id(level);
       
  1096     // Verification
       
  1097     if ( TUint(id) != expectedId )
       
  1098         {
       
  1099         iLog->Log(_L("Verification Failed: id=%d, expectedId=%d."), TUint(id), expectedId);
       
  1100         err = KErrUnexpectedValue;
       
  1101         }
       
  1102     return err;
       
  1103     }
       
  1104 
       
  1105 // -----------------------------------------------------------------------------
       
  1106 // CCommonTestClass::MpxCollPathStreamingL()
       
  1107 // Returns: Symbian OS errors.
       
  1108 // -----------------------------------------------------------------------------
       
  1109 TInt CCommonTestClass::MpxCollPathStreamingL(CStifItemParser& /*aItem*/)
       
  1110     {
       
  1111     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathStreamingL testing CMPXCollectionPath ExternalizeL and InternalizeL begin")));
       
  1112     iLog->Log(_L("CCommonTestClass::MpxCollPathStreamingL testing CMPXCollectionPath ExternalizeL and InternalizeL begin"));
       
  1113     TInt err=KErrNone;
       
  1114     
       
  1115     iLog->Log(_L("Start ExternalizeL"));
       
  1116     CBufBase* buffer = CBufFlat::NewL( 200 );
       
  1117     CleanupStack::PushL( buffer );
       
  1118     RBufWriteStream writeStream( *buffer );
       
  1119     CleanupClosePushL( writeStream );
       
  1120     iMPXCollectionPath->ExternalizeL( writeStream );
       
  1121     writeStream.CommitL();
       
  1122     buffer->Compress();
       
  1123     CleanupStack::PopAndDestroy( &writeStream );
       
  1124 
       
  1125     iLog->Log(_L("Start InternalizeL"));
       
  1126     RBufReadStream readStream( *buffer );
       
  1127     CleanupClosePushL( readStream );                
       
  1128     CMPXCollectionPath* path = CMPXCollectionPath::NewL();
       
  1129     CleanupStack::PushL( path );
       
  1130     path->InternalizeL( readStream );
       
  1131     // verification
       
  1132     if ( path->Count() != iMPXCollectionPath->Count() )
       
  1133         {
       
  1134         iLog->Log(_L("Verification Failed: New Array Count=%d, Old Array Count=%d."), 
       
  1135                 path->Count(), iMPXCollectionPath->Count());
       
  1136         err = KErrUnexpectedValue;
       
  1137         }
       
  1138     CleanupStack::PopAndDestroy( path );
       
  1139     CleanupStack::PopAndDestroy( &readStream );
       
  1140     CleanupStack::PopAndDestroy( buffer );
       
  1141     return err;
       
  1142     }
       
  1143 
       
  1144 // -----------------------------------------------------------------------------
       
  1145 // CCommonTestClass::MpxCollPathHandleChange()
       
  1146 // Returns: Symbian OS errors.
       
  1147 // -----------------------------------------------------------------------------
       
  1148 TInt CCommonTestClass::MpxCollPathHandleChange(CStifItemParser& aItem)
       
  1149     {
       
  1150     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathHandleChange testing CMPXCollectionPath::HandleChange() begin")));
       
  1151     iLog->Log(_L("CCommonTestClass::MpxCollPathHandleChange testing CMPXCollectionPath::IdHandleChange() begin"));
       
  1152     TInt err=KErrNone;
       
  1153     TUint id;
       
  1154     TUint deprecatedId;
       
  1155     TInt change;
       
  1156     TInt selection;
       
  1157     TInt expectedSelection;
       
  1158     TInt expectedResult;
       
  1159     
       
  1160     // read in parameters
       
  1161     if ( aItem.GetNextInt(id) )
       
  1162         {
       
  1163         iLog->Log(_L("Missing Parameter: itemId."));
       
  1164         return KErrBadTestParameter;
       
  1165         }
       
  1166     if ( aItem.GetNextInt(deprecatedId) )
       
  1167         {
       
  1168         iLog->Log(_L("Missing Parameter: Deprecated itemId."));
       
  1169         return KErrBadTestParameter;
       
  1170         }
       
  1171     if ( aItem.GetNextInt(change) )
       
  1172         {
       
  1173         iLog->Log(_L("Missing Parameter: Change type."));
       
  1174         return KErrBadTestParameter;
       
  1175         }
       
  1176     if ( aItem.GetNextInt(expectedSelection) )
       
  1177         {
       
  1178         iLog->Log(_L("Missing Parameter: Expected selection."));
       
  1179         return KErrBadTestParameter;
       
  1180         }
       
  1181     if ( aItem.GetNextInt(expectedResult) )
       
  1182         {
       
  1183         iLog->Log(_L("Missing Parameter: Expected result."));
       
  1184         return KErrBadTestParameter;
       
  1185         }
       
  1186 
       
  1187     TMPXItemId itemId(id);
       
  1188     TMPXItemId deprecatedItemId(deprecatedId);
       
  1189     TInt result = iMPXCollectionPath->HandleChange(iCollectionPathUid, itemId, deprecatedItemId, 
       
  1190             (CMPXCollectionPath::TMPXCollectionPathChange)change, selection);
       
  1191     // Verification
       
  1192     if ( selection != expectedSelection )
       
  1193         {
       
  1194         iLog->Log(_L("Verification Failed: selection=%d, expectedSelection=%d."), selection, expectedSelection);
       
  1195         err = KErrUnexpectedValue;
       
  1196         }
       
  1197     else if ( result != expectedResult )
       
  1198         {
       
  1199         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
  1200         err = KErrUnexpectedValue;
       
  1201         }
       
  1202     return err;
       
  1203     }
       
  1204 // -----------------------------------------------------------------------------
       
  1205 // CCommonTestClass::MpxCollPathReset()
       
  1206 // Returns: Symbian OS errors.
       
  1207 // -----------------------------------------------------------------------------
       
  1208 TInt CCommonTestClass::MpxCollectionpathContainerPathL(CStifItemParser& /*aItem*/)
       
  1209     {
       
  1210     FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathContainerPathL testing CMPXCollectionPath::ContainerPathL() begin")));
       
  1211     iLog->Log(_L("CCommonTestClass::MpxCollectionpathContainerPathL testing CMPXCollectionPath::ContainerPathL() begin"));
       
  1212     
       
  1213     TInt err=KErrNone;
       
  1214     iMPXCollectionPath->ContainerPathL();
       
  1215     
       
  1216     FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathContainerPathL testing CMPXCollectionPath::ContainerPathL() end")));
       
  1217     iLog->Log(_L("CCommonTestClass::MpxCollectionpathContainerPathL testing CMPXCollectionPath::ContainerPathL() end"));
       
  1218         
       
  1219     return err;
       
  1220     }
       
  1221 // -----------------------------------------------------------------------------
       
  1222 // CCommonTestClass::MpxCollPathReset()
       
  1223 // Returns: Symbian OS errors.
       
  1224 // -----------------------------------------------------------------------------
       
  1225 TInt CCommonTestClass::MpxCollectionpathInsertL(CStifItemParser& aItem)
       
  1226     {
       
  1227     FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathInsertL testing CMPXCollectionPath::InsertL() begin")));
       
  1228     iLog->Log(_L("CCommonTestClass::MpxCollectionpathInsertL testing CMPXCollectionPath::InsertL() begin"));
       
  1229     TInt err=KErrNone;
       
  1230     TUint itemId;
       
  1231     TInt apos = 1;
       
  1232     // read in parameters
       
  1233     if ( aItem.GetNextInt(itemId) )
       
  1234         {
       
  1235         iLog->Log(_L("Missing Parameter: ItemId."));
       
  1236         return KErrBadTestParameter;
       
  1237         }
       
  1238     // if first time, generate TUid and use that value to append.
       
  1239     if ( iMPXCollectionPath->Levels() == 0 )
       
  1240         {
       
  1241         iCollectionPathUid.Uid(itemId);
       
  1242         itemId = iCollectionPathUid.iUid;
       
  1243         }
       
  1244     TMPXItemId item(itemId);
       
  1245     iMPXCollectionPath->InsertL(item,apos);
       
  1246     return err;
       
  1247     }
       
  1248 // -----------------------------------------------------------------------------
       
  1249 // CCommonTestClass::MpxCollPathReset()
       
  1250 // Returns: Symbian OS errors.
       
  1251 // -----------------------------------------------------------------------------
       
  1252 TInt CCommonTestClass::MpxCollectionpathItems(CStifItemParser& /*aItem*/)
       
  1253     {
       
  1254     FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathItems testing CMPXCollectionPath::Items() begin")));
       
  1255     iLog->Log(_L("CCommonTestClass::MpxCollectionpathItems testing CMPXCollectionPath::Items() begin"));
       
  1256     
       
  1257     TInt err=KErrNone;
       
  1258     iMPXCollectionPath->Items();
       
  1259     
       
  1260     FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathItems testing CMPXCollectionPath::Items() end")));
       
  1261     iLog->Log(_L("CCommonTestClass::MpxCollectionpathItems testing CMPXCollectionPath::Items() end"));
       
  1262 
       
  1263     return err;
       
  1264     }
       
  1265 // -----------------------------------------------------------------------------
       
  1266 // CCommonTestClass::MpxCollPathReset()
       
  1267 // Returns: Symbian OS errors.
       
  1268 // -----------------------------------------------------------------------------
       
  1269 TInt CCommonTestClass::MpxCollectionpathUpdate(CStifItemParser& aItem)
       
  1270     {
       
  1271     FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathUpdate testing CMPXCollectionPath::Update() begin")));
       
  1272     iLog->Log(_L("CCommonTestClass::MpxCollectionpathUpdate testing CMPXCollectionPath::Update() begin"));
       
  1273     TInt err=KErrNone;
       
  1274     TInt index;
       
  1275     TInt newId;
       
  1276     if ( aItem.GetNextInt(index) )
       
  1277         {
       
  1278         iLog->Log(_L("Missing Parameter: Index."));
       
  1279         return KErrBadTestParameter;
       
  1280         }
       
  1281     if ( aItem.GetNextInt(newId) )
       
  1282         {
       
  1283         iLog->Log(_L("Missing Parameter: newId."));
       
  1284         return KErrBadTestParameter;
       
  1285         }
       
  1286     TMPXItemId newId1(newId);
       
  1287     iMPXCollectionPath->Update(index,newId1);
       
  1288     
       
  1289     return err;
       
  1290     }
       
  1291 // -----------------------------------------------------------------------------
       
  1292 // CCommonTestClass::MpxDelete()
       
  1293 // Returns: Symbian OS errors.
       
  1294 // -----------------------------------------------------------------------------
       
  1295 TInt CCommonTestClass::MpxCollectionpathDelete(CStifItemParser& /*aItem*/)
       
  1296     {
       
  1297     FTRACE(FPrint(_L("CCommonTestClass::MpxCollectionpathDelete testing CMPXCollectionPath::~ begin")));
       
  1298     iLog->Log(_L("CCommonTestClass::MpxCollectionpathDelete testing CMPXCollectionPath::~ begin"));
       
  1299     
       
  1300     TInt err = KErrNone;
       
  1301     delete iMPXCollectionPath;
       
  1302     iMPXCollectionPath = NULL;
       
  1303     
       
  1304     return err;
       
  1305     }
       
  1306 // -----------------------------------------------------------------------------
       
  1307 // CCommonTestClass::MpxCollPathSetAttrsL()
       
  1308 // Returns: Symbian OS errors.
       
  1309 // -----------------------------------------------------------------------------
       
  1310 TInt CCommonTestClass::MpxCollectionpathCollPathSetAttrsL(CStifItemParser& /*aItem*/)
       
  1311     {
       
  1312     FTRACE(FPrint(_L("CCommonTestClass::MpxCollPathSetAttrsL testing CMPXCollectionPath::Set() begin")));
       
  1313     iLog->Log(_L("CCommonTestClass::MpxCollPathSetAttrsL testing CMPXCollectionPath::Set() begin"));
       
  1314    
       
  1315     TInt err=KErrNone;
       
  1316     iMPXCollectionPath->Set(iMPXAttArray.Array());
       
  1317     
       
  1318     return err;
       
  1319     }
       
  1320 // end of MPXCollectionPath mpxcollectionpath.h =====================================================