cbsref/telephonyrefplugins/atltsy/integrationtest/src/testltsysmsreadinvalidindex.cpp
branchRCL_3
changeset 65 630d2f34d719
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // 
       
    15 // 
       
    16 
       
    17 //user include
       
    18 #include "testltsysmsreadinvalidindex.h"
       
    19 #include "testltsysmsatutil.h"
       
    20 
       
    21 CTestLtsySmsReadInvalidIndex::CTestLtsySmsReadInvalidIndex(CTestLtsyModel& aTestModel)
       
    22 	: CTestLtsySmsBase(aTestModel)
       
    23 	{
       
    24 
       
    25 	}
       
    26 
       
    27 CTestLtsySmsReadInvalidIndex::~CTestLtsySmsReadInvalidIndex()
       
    28 	{
       
    29 	}
       
    30 
       
    31 CTestLtsySmsReadInvalidIndex* CTestLtsySmsReadInvalidIndex::NewLC(CTestLtsyModel& aTestModel)
       
    32 	{
       
    33 	CTestLtsySmsReadInvalidIndex* self = new (ELeave)CTestLtsySmsReadInvalidIndex(aTestModel);
       
    34 	CleanupStack::PushL(self);
       
    35 	self->ConstructL();
       
    36 	return self;
       
    37 	}
       
    38 
       
    39 CTestLtsySmsReadInvalidIndex* CTestLtsySmsReadInvalidIndex::NewL(CTestLtsyModel& aTestModel)
       
    40 	{
       
    41 	CTestLtsySmsReadInvalidIndex* self=CTestLtsySmsReadInvalidIndex::NewLC(aTestModel);
       
    42 	CleanupStack::Pop(self);
       
    43 	return self;
       
    44 	}
       
    45 
       
    46 void CTestLtsySmsReadInvalidIndex::ConstructL()
       
    47 	{
       
    48 
       
    49 	}
       
    50 
       
    51 TVerdict CTestLtsySmsReadInvalidIndex::doTestStepPreambleL()
       
    52 	{
       
    53 	INFO_PRINTF1(_L("CTestLtsySmsReadInvalidIndex::doTestStepPreambleL called"));
       
    54 	SetTestStepResult(EPass);
       
    55 	return TestStepResult();
       
    56 	}
       
    57 
       
    58 TVerdict CTestLtsySmsReadInvalidIndex::doTestStepL()
       
    59 	{
       
    60 	INFO_PRINTF1(_L("CTestLtsySmsReadInvalidIndex::doTestStepL called"));
       
    61 	TInt index(0);
       
    62 	TRAPD(err,ReadSmsL(index));
       
    63 	if(err != KErrNone)
       
    64 		{
       
    65 		INFO_PRINTF2(_L("The error was returned %d!! when delete sms"),err);
       
    66 	    SetTestStepResult(EFail);
       
    67 		}
       
    68 	
       
    69 	index = -2;
       
    70 	TRAPD(err1,ReadSmsL(index));
       
    71 	if(err1 != KErrNone)
       
    72 		{
       
    73 		INFO_PRINTF2(_L("The error was returned %d!! when delete sms"),err1);
       
    74 	    SetTestStepResult(EFail);
       
    75 		}
       
    76 	
       
    77 	index = 50;
       
    78 	TRAPD(err2,ReadSmsL(index));
       
    79 	if(err2 != KErrNone)
       
    80 		{
       
    81 		INFO_PRINTF2(_L("The error was returned %d!! when delete sms"),err2);
       
    82 	    SetTestStepResult(EFail);
       
    83 		}
       
    84 	return TestStepResult();
       
    85 	}
       
    86 
       
    87 TVerdict CTestLtsySmsReadInvalidIndex::doTestStepPostambleL()
       
    88 	{
       
    89 	INFO_PRINTF1(_L("CTestLtsySmsReadInvalidIndex::doTestStepPostambleL called"));
       
    90 	return TestStepResult();
       
    91 	}
       
    92 void CTestLtsySmsReadInvalidIndex::ReadSmsL(TInt aIndex)
       
    93 	{
       
    94 	TRequestStatus status;
       
    95 	TPckg<RMobileSmsStore::TMobileGsmSmsEntryV1> pckgEntryV1(iEntryV1);
       
    96 	iEntryV1.iIndex = aIndex;		
       
    97 	SmsStore().Read(status, pckgEntryV1);
       
    98 	User::WaitForRequest(status);
       
    99 	TInt r = status.Int();
       
   100 	INFO_PRINTF2(_L("Delete() request status = %d"),r);
       
   101 	TBuf<400>  msgAsciiData;
       
   102 	TBuf8<400> msgAscii; 
       
   103 	SmsAtUtil::AppendDataToAscii(msgAscii,iEntryV1.iMsgData);
       
   104 	msgAsciiData.Copy( msgAscii );
       
   105 	INFO_PRINTF4(_L("SmsStoreRead index=%d,status=%d,msgData=%S\n"),
       
   106 			        iEntryV1.iIndex,iEntryV1.iMsgStatus,&msgAsciiData);
       
   107 	}
       
   108 
       
   109 //End of file