messagingappbase/smsmtm/test/inc/T_smut.h
changeset 25 84d9eb65b26f
parent 23 238255e8b033
child 27 e4592d119491
child 37 518b245aa84c
child 79 2981cb3aa489
equal deleted inserted replaced
23:238255e8b033 25:84d9eb65b26f
     1 // Copyright (c) 1999-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 #ifndef T_SMCM2_H_
       
    17 #define T_SMCM2_H_
       
    18 #include <e32base.h>
       
    19 
       
    20 #include <s32std.h>
       
    21 #include <txtrich.h>    //CRichText
       
    22 #include <e32test.h>
       
    23 #include <msvuids.h>	// ServiceEntry, FolderEntry, etc.
       
    24 #include <mtmuids.h>	// query capabilities
       
    25 #include "smutset.h"	// sms settings
       
    26 #include "smuthdr.h"	// sms header
       
    27 #include "smsclnt.h"	// sms (a)sync commands
       
    28 #include <smstestbase.h>
       
    29 #include <csmsgetdetdescinterface.h>
       
    30 
       
    31 #include <commsdattypesv1_1.h>
       
    32 #include <commsdat.h>
       
    33 using namespace CommsDat;
       
    34 
       
    35 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS  
       
    36 #include <tmsvsmsentry.h>
       
    37 #endif
       
    38 
       
    39 class CSmsEmailFields;
       
    40 
       
    41 GLDEF_D RTest				test(_L("SMCM Test Harness"));
       
    42 GLDEF_D CTrapCleanup*		theCleanup;
       
    43 
       
    44 const TUid KUidSmcmTestNonSense = {0x00011111};
       
    45 const TUid KFileStreamId		= {0x01010101};
       
    46 
       
    47 const TMsvPartList KMsvMessagePartBody			= 0x00000001;
       
    48 const TMsvPartList KMsvMessagePartRecipient		= 0x00000002;
       
    49 const TMsvPartList KMsvMessagePartOriginator	= 0x00000004;
       
    50 const TMsvPartList KMsvMessagePartDescription	= 0x00000008;
       
    51 const TMsvPartList KMsvMessagePartDate			= 0x00000010;
       
    52 const TMsvPartList KMsvMessagePartAttachments	= 0x00000020;
       
    53 
       
    54 GLDEF_C TInt E32Main(void);
       
    55 LOCAL_C void doMainL(void);
       
    56 
       
    57 class TCompare
       
    58 	{
       
    59 	public:
       
    60 		TCompare(TBool aVal = ETrue) {iValue = aVal;}
       
    61 		TCompare(const TCompare& aVal) {iValue = aVal.iValue;}
       
    62 		void operator()(TBool aResult) {iValue = iValue && aResult;}
       
    63 		operator TBool() const {return iValue;}
       
    64 		TBool iValue;
       
    65 	};
       
    66 
       
    67 class CSmutTest : public CSmsTestBase
       
    68 	{
       
    69 public:
       
    70 	static CSmutTest* NewLC(CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aNextTest);
       
    71 	~CSmutTest();
       
    72 
       
    73 private:
       
    74 	CSmutTest(CSmsTestUtils& aSmsTest, const TDesC& aScriptFile, TInt& aNextTest);
       
    75 	void ConstructL();
       
    76 
       
    77 	void RunL() {};
       
    78 	void DoCancel() {};
       
    79 
       
    80 	void ShowMenuL();
       
    81 	void RunAutoL();
       
    82 
       
    83 	//Test Functions
       
    84 	void TestSettingsL();
       
    85 	void TestHeaderL();
       
    86 	void TestSmsUtilitiesL();
       
    87 	void TestSmsUtilities1L(CSmsHeader& aHeader);
       
    88 	void TestSmsUtilities2L(CSmsHeader& aHeader);
       
    89 	void TestSmsUtilities3L(CSmsHeader& aHeader);
       
    90 	void TestSmsUtilitiesTimeStampsL();
       
    91 	void TestInvalidTelephone(const TDesC& aTel, TDes& aDetails);
       
    92 	void TestInvalidContact(const TDesC& aTel, TDes& aDetails);
       
    93 	void TestDuplicateContact(const TDesC& aTel, TDes& aDetails);
       
    94 	void TestValidTel(const TDesC& aTel, const TDesC& aExpect1, const TDesC& aExpect2, const TDesC& aNotExpect, TDes& rDetails);
       
    95 	void TestSmsEmsExtensionsL();
       
    96 
       
    97 	void TestSmsUtilitiesBL();
       
    98 	void TestSmsUtilities4L(CSmsHeader& aHeader);
       
    99 	void TestSmsUtilities5L(CSmsHeader& aHeader);
       
   100 	void TestInvalidTelephone(CSmsGetDetDescInterface& aGetDetDesc, const TDesC& aTel, TDes& aDetails);
       
   101 	void TestInvalidContact(CSmsGetDetDescInterface& aGetDetDesc, const TDesC& aTel, TDes& aDetails);
       
   102 	void TestDuplicateContact(CSmsGetDetDescInterface& aGetDetDesc, const TDesC& aTel, TDes& aDetails);
       
   103 	void TestValidTel(CSmsGetDetDescInterface& aGetDetDesc, const TDesC& aTel, const TDesC& aExpect1, const TDesC& aExpect2, const TDesC& aNotExpect, TDes& rDetails);
       
   104 
       
   105 	//CSmsSettings utilities/tests
       
   106 	void TestSettingsStoreToCommDbL();
       
   107 	TBool CompareSettingsAndCommDbL(const CSmsSettings& aSettings) const;
       
   108 	TBool CompareSettingsAndSmsBearerL(const CSmsSettings& aSettings) const;
       
   109 //	void OpenCommDbModemTableLCC(CCommsDatabase*& rCommDb, CCommsDbTableView*& rTable) const;
       
   110 	void TestSettingsRestoreDefectL();
       
   111 	void TestRevertSettingsL();
       
   112 	TBool CompareSettings(const CSmsSettings& aLeft, const CSmsSettings& aRight, TBool aTestSC = ETrue);
       
   113 	TBool CompareMessageSettings(const CSmsMessageSettings& aLeft, const CSmsMessageSettings& aRight);
       
   114 	void TestSettingsMembersL(CSmsSettings& aSettings);
       
   115 	void TestMessageSettingsMembersL(CSmsMessageSettings& aSettings);
       
   116 	void StoreSettingsL(const CSmsSettings& aSettings);
       
   117 	void RestoreSettingsL(CSmsSettings& aSettings);
       
   118 	void StoreHeaderL(const CSmsHeader& aHeader);
       
   119 	void RestoreHeaderL(CSmsHeader& aHeader);
       
   120 	void TestStoreRestoreSettingsL(const CSmsSettings& aSettings);
       
   121 	TBool TestSmsSettingsCopyL(const CSmsSettings& aSettings);
       
   122 	TBool CompareSettingsFiles(
       
   123 		RFs& aFs, const TDesC& aCompare1, const TDesC& aCompare2
       
   124 		);
       
   125 
       
   126 	//TMsvSmsEntry
       
   127 	void TestSmsEntryL();
       
   128 	TBool CheckSmsEntry(
       
   129 					const TMsvSmsEntry& aEntry, 
       
   130 					TBool aClassExpected, 
       
   131 					TSmsDataCodingScheme::TSmsClass aClass, 
       
   132 					TUint8 aPID, 
       
   133 					TBool aUPI, 
       
   134 					TMsvSmsEntry::TMsvSmsEntryAckSummary aDeliverySummary, 
       
   135 					TBool aValidMessageId, 
       
   136 					TInt32 aMessageId) const;
       
   137 
       
   138 	TSmsProtocolIdentifier ConstructPID(TUint8 aVal) const;
       
   139 
       
   140 
       
   141 	//CSmsNumber utilities
       
   142 	void TestNumberL();
       
   143 	void StoreNumberL(const CSmsNumber& aNumber, TUid aStreamId = KFileStreamId);
       
   144 	void RestoreNumberL(CSmsNumber& rNumber, TUid aStreamId = KFileStreamId);
       
   145 	TBool CompareNumbers(const CSmsNumber& aLeft, const CSmsNumber& aRight);
       
   146 	TBool CompareServiceCenters(const CSmsServiceCenter& aLeft, const CSmsServiceCenter& aRight);
       
   147 
       
   148 	HBufC8* ConvertToBinaryLC(const TDesC8& aHex) const;
       
   149 	CSmsMessage* CreateSmsMessageLC(const TDesC8& aHexPdu) const;
       
   150 	void CheckDescriptionL(RResourceFile& aResFile, TInt aId, TRefByValue<const TDesC> aDesc, ...);
       
   151 	void TestSpecialSmsMessageIndicationPduL(RResourceFile& aResFile, TUint8 aMessageType, TUint8 aMessageCount, TInt aId);
       
   152 	void TestSpecialSmsMessageIndicationPduL(RResourceFile& aResFile, TSmsUtilities::TSmsUtilitiesSpecialMessageType aMessageType, TInt aId);
       
   153 	
       
   154 	// Test CSmsEmailFields
       
   155 	void TestEmailFieldsL();
       
   156 	void StoreEmailFieldsL(const CSmsEmailFields& aEmailFields);
       
   157 	void RestoreEmailFieldsL(CSmsEmailFields& aEmailFields);
       
   158 	void TestEmailFieldsParsePassL(const TDesC& aMessage, const TDesC& aAddress, const TDesC& aSubject, const TDesC& aBody);
       
   159 	void TestEmailFieldsParseFailL(const TDesC& aMessage);
       
   160 	void TestEmailFieldsComposeL(const TDesC& aFields, const TDesC& aAddress1, const TDesC& aAddress2, const TDesC& aSubject);
       
   161 	TBool CompareEmailFields(const CSmsEmailFields& aFields1, const CSmsEmailFields& aFields2);
       
   162 	TBool CompareEmailFieldsAddresses(const MDesCArray& aAddresses1, const MDesCArray& aAddresses2);
       
   163 	
       
   164 	CSmsHeader*			iSmsHeader;
       
   165 	CRichText*			iRichText;
       
   166 	CParaFormatLayer*	iParaLayer;
       
   167 	CCharFormatLayer*	iCharLayer;
       
   168 	CMDBSession*		iDBSession;
       
   169 	
       
   170 	};
       
   171 
       
   172 
       
   173 #endif