mmappfw_plat/mpx_common_api/tsrc/ui_commontestclass/src/testmpxattribute.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: TMPXAttribute testing implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <s32mem.h>
       
    20 #include "commontestclass.h"
       
    21 
       
    22 // Begin TMPXAttribute testing implementation (mpxattribute.h)=======================================
       
    23 
       
    24 // -----------------------------------------------------------------------------
       
    25 // CCommonTestClass::MpxAttDefaultConst()
       
    26 // Returns: Symbian OS errors.
       
    27 // -----------------------------------------------------------------------------
       
    28 TInt CCommonTestClass::MpxAttDefaultConst(CStifItemParser& /*aItem*/)
       
    29     {
       
    30     FTRACE(FPrint(_L("CCommonTestClass::MpxAttDefaultConst testing TMPXAttribute::TMPXAttribute() begin")));
       
    31     iLog->Log(_L("CCommonTestClass::MpxAttDefaultConst testing TMPXAttribute::TMPXAttribute() begin"));
       
    32     TInt err=KErrNone;
       
    33     TMPXAttribute att;
       
    34     err = iMPXAttArray.Append(att);
       
    35     return err;
       
    36     }
       
    37 
       
    38 // -----------------------------------------------------------------------------
       
    39 // CCommonTestClass::MpxAttConst()
       
    40 // Returns: Symbian OS errors.
       
    41 // -----------------------------------------------------------------------------
       
    42 TInt CCommonTestClass::MpxAttConst(CStifItemParser& aItem)
       
    43     {
       
    44     FTRACE(FPrint(_L("CCommonTestClass::MpxAttConst testing TMPXAttribute::TMPXAttribute(TInt aContentId, TUint aAttributeId) begin")));
       
    45     iLog->Log(_L("CCommonTestClass::MpxAttConst testing TMPXAttribute::TMPXAttribute(TInt aContentId, TUint aAttributeId) begin"));
       
    46     TInt err=KErrNone;
       
    47     TInt contentId;
       
    48     TUint attId;
       
    49     
       
    50     // read in parameters
       
    51     if ( aItem.GetNextInt(contentId) )
       
    52         {
       
    53         iLog->Log(_L("Missing Parameter: content ID."));
       
    54         return KErrBadTestParameter;
       
    55         }
       
    56     if ( aItem.GetNextInt(attId) )
       
    57         {
       
    58         iLog->Log(_L("Missing Parameter: attribute ID."));
       
    59         return KErrBadTestParameter;
       
    60         }
       
    61     
       
    62     TMPXAttribute att(contentId, attId);
       
    63     err = iMPXAttArray.Append(att);
       
    64     return err;
       
    65     }
       
    66 		        
       
    67 // -----------------------------------------------------------------------------
       
    68 // CCommonTestClass::MpxAttCopyConstAtt()
       
    69 // Returns: Symbian OS errors.
       
    70 // -----------------------------------------------------------------------------
       
    71 TInt CCommonTestClass::MpxAttCopyConstAtt(CStifItemParser& aItem)
       
    72     {
       
    73     FTRACE(FPrint(_L("CCommonTestClass::MpxAttCopyConstAtt testing TMPXAttribute::TMPXAttribute(const TMPXAttribute& aId) begin")));
       
    74     iLog->Log(_L("CCommonTestClass::MpxAttCopyConstAtt testing TMPXAttribute::TMPXAttribute(const TMPXAttribute& aId) begin"));
       
    75     TInt err=KErrNone;
       
    76     TInt contentId;
       
    77     TUint attId;
       
    78     
       
    79     // read in parameters
       
    80     if ( aItem.GetNextInt(contentId) )
       
    81         {
       
    82         iLog->Log(_L("Missing Parameter: content ID."));
       
    83         return KErrBadTestParameter;
       
    84         }
       
    85     if ( aItem.GetNextInt(attId) )
       
    86         {
       
    87         iLog->Log(_L("Missing Parameter: attribute ID."));
       
    88         return KErrBadTestParameter;
       
    89         }
       
    90     
       
    91     TMPXAttribute tempAtt(contentId, attId);
       
    92     TMPXAttribute att(tempAtt);
       
    93     err = iMPXAttArray.Append(att);
       
    94     return err;
       
    95     }
       
    96 			        
       
    97 // -----------------------------------------------------------------------------
       
    98 // CCommonTestClass::MpxAttCopyConstAttData()
       
    99 // Returns: Symbian OS errors.
       
   100 // -----------------------------------------------------------------------------
       
   101 TInt CCommonTestClass::MpxAttCopyConstAttData(CStifItemParser& aItem)
       
   102     {
       
   103     FTRACE(FPrint(_L("CCommonTestClass::MpxAttCopyConstAttData testing TMPXAttribute::TMPXAttribute(const TMPXAttributeData& aData) begin")));
       
   104     iLog->Log(_L("CCommonTestClass::MpxAttCopyConstAttData testing TMPXAttribute::TMPXAttribute(const TMPXAttributeData& aData) begin"));
       
   105     TInt err=KErrNone;
       
   106     TInt contentId;
       
   107     TUint attId;
       
   108     
       
   109     // read in parameters
       
   110     if ( aItem.GetNextInt(contentId) )
       
   111         {
       
   112         iLog->Log(_L("Missing Parameter: content ID."));
       
   113         return KErrBadTestParameter;
       
   114         }
       
   115     if ( aItem.GetNextInt(attId) )
       
   116         {
       
   117         iLog->Log(_L("Missing Parameter: attribute ID."));
       
   118         return KErrBadTestParameter;
       
   119         }
       
   120     
       
   121     TMPXAttributeData attData;
       
   122     attData.iContentId = contentId;
       
   123     attData.iAttributeId = attId;
       
   124     TMPXAttribute att(attData);
       
   125     err = iMPXAttArray.Append(att);
       
   126     return err;
       
   127     }
       
   128 
       
   129 // -----------------------------------------------------------------------------
       
   130 // CCommonTestClass::MpxAttOperatorAssignment()
       
   131 // Returns: Symbian OS errors.
       
   132 // -----------------------------------------------------------------------------
       
   133 TInt CCommonTestClass::MpxAttOperatorAssignment(CStifItemParser& aItem)
       
   134     {
       
   135     FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorAssignment testing TMPXAttribute::operator=(const TMPXAttribute& aId) begin")));
       
   136     iLog->Log(_L("CCommonTestClass::MpxAttOperatorAssignment testing TMPXAttribute::operator=(const TMPXAttribute& aId) begin"));
       
   137     TInt err=KErrNone;
       
   138     TInt index;
       
   139 
       
   140     // read in parameters
       
   141     if ( aItem.GetNextInt(index) )
       
   142         {
       
   143         iLog->Log(_L("Missing Parameter: index."));
       
   144         return KErrBadTestParameter;
       
   145         }
       
   146     if ( index >= iMPXAttArray.Count() )
       
   147         {
       
   148         iLog->Log(_L("Bad Parameter: Index out of range."));
       
   149         return KErrBadTestParameter;
       
   150         }
       
   151 
       
   152     TMPXAttribute att;
       
   153     att.operator =(iMPXAttArray[index]);
       
   154     // verify assignment was correct
       
   155     if ( !TMPXAttribute::Match(att, iMPXAttArray[index]) )
       
   156         {
       
   157         iLog->Log(_L("Verification failed."));
       
   158         err = KErrUnexpectedValue;
       
   159         }
       
   160     return err;
       
   161     }
       
   162 
       
   163 // -----------------------------------------------------------------------------
       
   164 // CCommonTestClass::MpxAttOperatorEqual()
       
   165 // Returns: Symbian OS errors.
       
   166 // -----------------------------------------------------------------------------
       
   167 TInt CCommonTestClass::MpxAttOperatorEqual(CStifItemParser& aItem)
       
   168     {
       
   169     FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorEqual testing TMPXAttribute::operator==(const TMPXAttribute& aId) begin")));
       
   170     iLog->Log(_L("CCommonTestClass::MpxAttOperatorEqual testing TMPXAttribute::operator==(const TMPXAttribute& aId) begin"));
       
   171     TInt err=KErrNone;
       
   172     TUint op1;
       
   173     TUint op2;
       
   174     TBool expectedResult;
       
   175 
       
   176     // read in parameters
       
   177     if ( aItem.GetNextInt(op1) )
       
   178         {
       
   179         iLog->Log(_L("Missing Parameter: operand 1."));
       
   180         return KErrBadTestParameter;
       
   181         }
       
   182     if ( aItem.GetNextInt(op2) )
       
   183         {
       
   184         iLog->Log(_L("Missing Parameter: operand 2."));
       
   185         return KErrBadTestParameter;
       
   186         }
       
   187     if ( aItem.GetNextInt(expectedResult) )
       
   188         {
       
   189         iLog->Log(_L("Missing Parameter: expected result."));
       
   190         return KErrBadTestParameter;
       
   191         }
       
   192     if ( (op1>=iMPXAttArray.Count()) ||
       
   193          (op2>=iMPXAttArray.Count()) )
       
   194         {
       
   195         iLog->Log(_L("Bad Parameter: operand out of range."));
       
   196         return KErrBadTestParameter;
       
   197         }
       
   198     
       
   199     TBool result = iMPXAttArray[op1].operator ==(iMPXAttArray[op2]);
       
   200     if ( result != expectedResult )
       
   201         {
       
   202         iLog->Log(_L("Verification failed: result=%d, expected result=%d."), result, expectedResult);
       
   203         err = KErrUnexpectedValue;
       
   204         }
       
   205     return err;
       
   206     }
       
   207 
       
   208 // -----------------------------------------------------------------------------
       
   209 // CCommonTestClass::MpxAttStreamingL()
       
   210 // Returns: Symbian OS errors.
       
   211 // -----------------------------------------------------------------------------
       
   212 TInt CCommonTestClass::MpxAttStreamingL(CStifItemParser& aItem)
       
   213     {
       
   214     FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL testing TMPXAttribute ExternalizeL and InternalizeL begin")));
       
   215     iLog->Log(_L("CCommonTestClass::MpxAttStreamingL testing TMPXAttribute ExternalizeL and InternalizeL begin"));
       
   216     TInt err=KErrNone;
       
   217     TUint index;
       
   218     
       
   219     // read in parameters
       
   220     if ( aItem.GetNextInt(index) )
       
   221         {
       
   222         iLog->Log(_L("Missing Parameter: index."));
       
   223         return KErrBadTestParameter;
       
   224         }
       
   225     if ( index >= iMPXAttArray.Count() )
       
   226         {
       
   227         iLog->Log(_L("Bad Parameter: index out of range."));
       
   228         return KErrBadTestParameter;
       
   229         }
       
   230     
       
   231     FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL started ExternalizeL")));
       
   232     iLog->Log(_L("CCommonTestClass::MpxAttStreamingL started ExternalizeL"));
       
   233     CBufBase* buffer = CBufFlat::NewL( 50 );
       
   234     CleanupStack::PushL( buffer );
       
   235     RBufWriteStream writeStream( *buffer );
       
   236     CleanupClosePushL( writeStream );
       
   237     iMPXAttArray[index].ExternalizeL( writeStream );
       
   238     writeStream.CommitL();
       
   239     buffer->Compress();
       
   240     CleanupStack::PopAndDestroy( &writeStream );
       
   241 
       
   242     FTRACE(FPrint(_L("CCommonTestClass::MpxAttStreamingL started InternalizeL")));
       
   243     iLog->Log(_L("CCommonTestClass::MpxAttStreamingL started InternalizeL"));
       
   244     RBufReadStream readStream( *buffer );
       
   245     CleanupClosePushL( readStream );                
       
   246     TMPXAttribute att;
       
   247     att.InternalizeL( readStream );
       
   248     CleanupStack::PopAndDestroy( &readStream );
       
   249     CleanupStack::PopAndDestroy( buffer );
       
   250     
       
   251     // verify streaming was correct
       
   252     if ( !TMPXAttribute::Match(att, iMPXAttArray[index]) )
       
   253         {
       
   254         iLog->Log(_L("Streaming Failed Verification."));
       
   255         err = KErrUnexpectedValue;
       
   256         }
       
   257     return err;
       
   258     }
       
   259 
       
   260 // -----------------------------------------------------------------------------
       
   261 // CCommonTestClass::MpxAttContentId()
       
   262 // Returns: Symbian OS errors.
       
   263 // -----------------------------------------------------------------------------
       
   264 TInt CCommonTestClass::MpxAttContentId(CStifItemParser& aItem)
       
   265     {
       
   266     FTRACE(FPrint(_L("CCommonTestClass::MpxAttContentId testing TMPXAttribute::ContentId() begin")));
       
   267     iLog->Log(_L("CCommonTestClass::MpxAttContentId testing TMPXAttribute::ContentId() begin"));
       
   268     TInt err=KErrNone;
       
   269     TUint index;
       
   270     TInt expectedContentId;
       
   271     TInt contentId;
       
   272     
       
   273     // read in parameters
       
   274     if ( aItem.GetNextInt(expectedContentId) )
       
   275         {
       
   276         iLog->Log(_L("Missing Parameter: content ID."));
       
   277         return KErrBadTestParameter;
       
   278         }
       
   279     if ( aItem.GetNextInt(index) )
       
   280         {
       
   281         iLog->Log(_L("Missing Parameter: index."));
       
   282         return KErrBadTestParameter;
       
   283         }
       
   284     if ( index >= iMPXAttArray.Count() )
       
   285         {
       
   286         iLog->Log(_L("Bad Parameter: index out of range."));
       
   287         return KErrBadTestParameter;
       
   288         }
       
   289     
       
   290     contentId = iMPXAttArray[index].ContentId();
       
   291     // verification
       
   292     if ( contentId != expectedContentId )
       
   293         {
       
   294         iLog->Log(_L("Verification Failed: contentId=%d, expectedContentId=%d."), contentId, expectedContentId);
       
   295         err = KErrUnexpectedValue;
       
   296         }
       
   297     return err;
       
   298     }
       
   299 
       
   300 // -----------------------------------------------------------------------------
       
   301 // CCommonTestClass::MpxAttAttributeId()
       
   302 // Returns: Symbian OS errors.
       
   303 // -----------------------------------------------------------------------------
       
   304 TInt CCommonTestClass::MpxAttAttributeId(CStifItemParser& aItem)
       
   305     {
       
   306     FTRACE(FPrint(_L("CCommonTestClass::MpxAttAttributeId testing TMPXAttribute::AttributeId() begin")));
       
   307     iLog->Log(_L("CCommonTestClass::MpxAttAttributeId testing TMPXAttribute::AttributeId() begin"));
       
   308     TInt err=KErrNone;
       
   309     TUint index;
       
   310     TInt expectedAttId;
       
   311     TInt attId;
       
   312     
       
   313     // read in parameters
       
   314     if ( aItem.GetNextInt(expectedAttId) )
       
   315         {
       
   316         iLog->Log(_L("Missing Parameter: attribute ID."));
       
   317         return KErrBadTestParameter;
       
   318         }
       
   319     if ( aItem.GetNextInt(index) )
       
   320         {
       
   321         iLog->Log(_L("Missing Parameter: index."));
       
   322         return KErrBadTestParameter;
       
   323         }
       
   324     if ( index >= iMPXAttArray.Count() )
       
   325         {
       
   326         iLog->Log(_L("Bad Parameter: index out of range."));
       
   327         return KErrBadTestParameter;
       
   328         }
       
   329     
       
   330     attId = iMPXAttArray[index].AttributeId();
       
   331     // verification
       
   332     if ( attId != expectedAttId )
       
   333         {
       
   334         iLog->Log(_L("Verification Failed: attId=%d, expectedAttId=%d."), attId, expectedAttId);
       
   335         err = KErrUnexpectedValue;
       
   336         }
       
   337     return err;
       
   338     }
       
   339 
       
   340 // -----------------------------------------------------------------------------
       
   341 // CCommonTestClass::MpxAttMatch()
       
   342 // Returns: Symbian OS errors.
       
   343 // -----------------------------------------------------------------------------
       
   344 TInt CCommonTestClass::MpxAttMatch(CStifItemParser& aItem)
       
   345     {
       
   346     FTRACE(FPrint(_L("CCommonTestClass::MpxAttMatch testing TMPXAttribute::Match() begin")));
       
   347     iLog->Log(_L("CCommonTestClass::MpxAttMatch testing TMPXAttribute::Match() begin"));
       
   348     TInt err=KErrNone;
       
   349     TUint index1;
       
   350     TUint index2;
       
   351     TBool expectedResult;
       
   352     TBool result;
       
   353     
       
   354     // read in parameters
       
   355     if ( aItem.GetNextInt(index1) )
       
   356         {
       
   357         iLog->Log(_L("Missing Parameter: index 1."));
       
   358         return KErrBadTestParameter;
       
   359         }
       
   360     if ( index1 >= iMPXAttArray.Count() )
       
   361         {
       
   362         iLog->Log(_L("Bad Parameter: index 1 out of range."));
       
   363         return KErrBadTestParameter;
       
   364         }
       
   365     if ( aItem.GetNextInt(index2) )
       
   366         {
       
   367         iLog->Log(_L("Missing Parameter: index 2."));
       
   368         return KErrBadTestParameter;
       
   369         }
       
   370     if ( index2 >= iMPXAttArray.Count() )
       
   371         {
       
   372         iLog->Log(_L("Bad Parameter: index 2 out of range."));
       
   373         return KErrBadTestParameter;
       
   374         }
       
   375     if ( aItem.GetNextInt(expectedResult) )
       
   376         {
       
   377         iLog->Log(_L("Missing Parameter: expected result."));
       
   378         return KErrBadTestParameter;
       
   379         }
       
   380 
       
   381     result = TMPXAttribute::Match(iMPXAttArray[index1], iMPXAttArray[index2]);
       
   382     // verification
       
   383     if ( result != expectedResult )
       
   384         {
       
   385         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
   386         err = KErrUnexpectedValue;
       
   387         }
       
   388     return err;
       
   389     }
       
   390 
       
   391 // -----------------------------------------------------------------------------
       
   392 // CCommonTestClass::MpxAttMatchContentId()
       
   393 // Returns: Symbian OS errors.
       
   394 // -----------------------------------------------------------------------------
       
   395 TInt CCommonTestClass::MpxAttMatchContentId(CStifItemParser& aItem)
       
   396     {
       
   397     FTRACE(FPrint(_L("CCommonTestClass::MpxAttMatchContentId testing TMPXAttribute::MatchContentId() begin")));
       
   398     iLog->Log(_L("CCommonTestClass::MpxAttMatchContentId testing TMPXAttribute::MatchContentId() begin"));
       
   399     TInt err=KErrNone;
       
   400     TUint index1;
       
   401     TUint index2;
       
   402     TBool expectedResult;
       
   403     TBool result;
       
   404     
       
   405     // read in parameters
       
   406     if ( aItem.GetNextInt(index1) )
       
   407         {
       
   408         iLog->Log(_L("Missing Parameter: index 1."));
       
   409         return KErrBadTestParameter;
       
   410         }
       
   411     if ( index1 >= iMPXAttArray.Count() )
       
   412         {
       
   413         iLog->Log(_L("Bad Parameter: index 1 out of range."));
       
   414         return KErrBadTestParameter;
       
   415         }
       
   416     if ( aItem.GetNextInt(index2) )
       
   417         {
       
   418         iLog->Log(_L("Missing Parameter: index 2."));
       
   419         return KErrBadTestParameter;
       
   420         }
       
   421     if ( index2 >= iMPXAttArray.Count() )
       
   422         {
       
   423         iLog->Log(_L("Bad Parameter: index 2 out of range."));
       
   424         return KErrBadTestParameter;
       
   425         }
       
   426     if ( aItem.GetNextInt(expectedResult) )
       
   427         {
       
   428         iLog->Log(_L("Missing Parameter: expected result."));
       
   429         return KErrBadTestParameter;
       
   430         }
       
   431 
       
   432     result = TMPXAttribute::MatchContentId(iMPXAttArray[index1], iMPXAttArray[index2]);
       
   433     // verification
       
   434     if ( result != expectedResult )
       
   435         {
       
   436         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
   437         err = KErrUnexpectedValue;
       
   438         }
       
   439     return err;
       
   440     }
       
   441 
       
   442 // -----------------------------------------------------------------------------
       
   443 // CCommonTestClass::MpxAttOperatorAndAttData()
       
   444 // Returns: Symbian OS errors.
       
   445 // -----------------------------------------------------------------------------
       
   446 TInt CCommonTestClass::MpxAttOperatorAndAttData(CStifItemParser& aItem)
       
   447     {
       
   448     FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorAndAttData testing TMPXAttribute::operator& (const TMPXAttributeData& aData) begin")));
       
   449     iLog->Log(_L("CCommonTestClass::MpxAttOperatorAndAttData testing TMPXAttribute::operator& (const TMPXAttributeData& aData) begin"));
       
   450     TInt err=KErrNone;
       
   451     TUint index1;
       
   452     TUint index2;
       
   453     TBool expectedResult;
       
   454     TBool result;
       
   455     
       
   456     // read in parameters
       
   457     if ( aItem.GetNextInt(index1) )
       
   458         {
       
   459         iLog->Log(_L("Missing Parameter: index 1."));
       
   460         return KErrBadTestParameter;
       
   461         }
       
   462     if ( index1 >= iMPXAttArray.Count() )
       
   463         {
       
   464         iLog->Log(_L("Bad Parameter: index 1 out of range."));
       
   465         return KErrBadTestParameter;
       
   466         }
       
   467     if ( aItem.GetNextInt(index2) )
       
   468         {
       
   469         iLog->Log(_L("Missing Parameter: index 2."));
       
   470         return KErrBadTestParameter;
       
   471         }
       
   472     if ( index2 >= iMPXAttArray.Count() )
       
   473         {
       
   474         iLog->Log(_L("Bad Parameter: index 2 out of range."));
       
   475         return KErrBadTestParameter;
       
   476         }
       
   477     if ( aItem.GetNextInt(expectedResult) )
       
   478         {
       
   479         iLog->Log(_L("Missing Parameter: expected result."));
       
   480         return KErrBadTestParameter;
       
   481         }
       
   482     
       
   483     TMPXAttributeData data1 = {iMPXAttArray[index1].ContentId(), iMPXAttArray[index1].AttributeId()};
       
   484     TMPXAttributeData data2 = {iMPXAttArray[index2].ContentId(), iMPXAttArray[index2].AttributeId()};
       
   485     result = data1 & data2;
       
   486     // verification
       
   487     if ( result != expectedResult )
       
   488         {
       
   489         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
   490         err = KErrUnexpectedValue;
       
   491         }
       
   492     return err;
       
   493     }
       
   494 
       
   495 // -----------------------------------------------------------------------------
       
   496 // CCommonTestClass::MpxAttOperatorAndData()
       
   497 // Returns: Symbian OS errors.
       
   498 // -----------------------------------------------------------------------------
       
   499 TInt CCommonTestClass::MpxAttOperatorAndData(CStifItemParser& aItem)
       
   500     {
       
   501     FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorAndData testing TMPXAttribute::operator& (TUint& aData) begin")));
       
   502     iLog->Log(_L("CCommonTestClass::MpxAttOperatorAndData testing TMPXAttribute::operator& (TUint& aData) begin"));
       
   503     TInt err=KErrNone;
       
   504     TUint index1;
       
   505     TUint att;
       
   506     TBool expectedResult;
       
   507     TBool result;
       
   508     
       
   509     // read in parameters
       
   510     if ( aItem.GetNextInt(index1) )
       
   511         {
       
   512         iLog->Log(_L("Missing Parameter: index 1."));
       
   513         return KErrBadTestParameter;
       
   514         }
       
   515     if ( index1 >= iMPXAttArray.Count() )
       
   516         {
       
   517         iLog->Log(_L("Bad Parameter: index 1 out of range."));
       
   518         return KErrBadTestParameter;
       
   519         }
       
   520     if ( aItem.GetNextInt(att) )
       
   521         {
       
   522         iLog->Log(_L("Missing Parameter: attribute."));
       
   523         return KErrBadTestParameter;
       
   524         }
       
   525     if ( aItem.GetNextInt(expectedResult) )
       
   526         {
       
   527         iLog->Log(_L("Missing Parameter: expected result."));
       
   528         return KErrBadTestParameter;
       
   529         }
       
   530     
       
   531     TMPXAttributeData data1 = {iMPXAttArray[index1].ContentId(), iMPXAttArray[index1].AttributeId()};
       
   532     result = data1 & att;
       
   533     // verification
       
   534     if ( result != expectedResult )
       
   535         {
       
   536         iLog->Log(_L("Verification Failed: result=%d, expectedResult=%d."), result, expectedResult);
       
   537         err = KErrUnexpectedValue;
       
   538         }
       
   539     return err;
       
   540     }
       
   541 
       
   542 // -----------------------------------------------------------------------------
       
   543 // CCommonTestClass::MpxAttOperatorOr()
       
   544 // Returns: Symbian OS errors.
       
   545 // -----------------------------------------------------------------------------
       
   546 TInt CCommonTestClass::MpxAttOperatorOr(CStifItemParser& aItem)
       
   547     {
       
   548     FTRACE(FPrint(_L("CCommonTestClass::MpxAttOperatorOr testing TMPXAttribute::operator| () begin")));
       
   549     iLog->Log(_L("CCommonTestClass::MpxAttOperatorOr testing TMPXAttribute::operator| () begin"));
       
   550     TInt err=KErrNone;
       
   551     TUint index1;
       
   552     TUint index2;
       
   553     TUint expectedAtt;
       
   554     TMPXAttributeData result;
       
   555     
       
   556     // read in parameters
       
   557     if ( aItem.GetNextInt(index1) )
       
   558         {
       
   559         iLog->Log(_L("Missing Parameter: index 1."));
       
   560         return KErrBadTestParameter;
       
   561         }
       
   562     if ( index1 >= iMPXAttArray.Count() )
       
   563         {
       
   564         iLog->Log(_L("Bad Parameter: index 1 out of range."));
       
   565         return KErrBadTestParameter;
       
   566         }
       
   567     if ( aItem.GetNextInt(index2) )
       
   568         {
       
   569         iLog->Log(_L("Missing Parameter: index 2."));
       
   570         return KErrBadTestParameter;
       
   571         }
       
   572     if ( index2 >= iMPXAttArray.Count() )
       
   573         {
       
   574         iLog->Log(_L("Bad Parameter: index 2 out of range."));
       
   575         return KErrBadTestParameter;
       
   576         }
       
   577     if ( aItem.GetNextInt(expectedAtt) )
       
   578         {
       
   579         iLog->Log(_L("Missing Parameter: expected result."));
       
   580         return KErrBadTestParameter;
       
   581         }
       
   582     
       
   583     TMPXAttributeData data1 = {iMPXAttArray[index1].ContentId(), iMPXAttArray[index1].AttributeId()};
       
   584     TMPXAttributeData data2 = {iMPXAttArray[index2].ContentId(), iMPXAttArray[index2].AttributeId()};
       
   585     result = data1 | data2;
       
   586     // verification
       
   587     if ( result.iAttributeId != expectedAtt )
       
   588         {
       
   589         iLog->Log(_L("Verification Failed: att=%d, expectedAtt=%d."), result.iAttributeId, expectedAtt);
       
   590         err = KErrUnexpectedValue;
       
   591         }
       
   592     return err;
       
   593     }
       
   594 
       
   595 // end of TMPXAttribute (mpxattribute.h =============================================