pimappservices/calendar/tsrc/tcal_gsentry_testdata.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 // Copyright (c) 2005-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 __TCAL_GSENTRY_TESTDATA_H__
       
    17 #define __TCAL_GSENTRY_TESTDATA_H__
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <calentry.h>
       
    21 #include <calinstanceview.h>
       
    22 #include <calcommon.h>
       
    23 #include <e32test.h>
       
    24 
       
    25 class TCalRRule;
       
    26 class CCalEntryView;
       
    27 
       
    28 static RTest test(_L("tCal_GsEntry"));
       
    29 
       
    30 _LIT8(KGUID1, "A_Global_UID_1");
       
    31 _LIT8(KGUID2, "A_Global_UID_2");
       
    32 _LIT8(KGUID3, "A_Global_UID_3");
       
    33 
       
    34 
       
    35 enum TExceptionRDate
       
    36 	{
       
    37 	EException,
       
    38 	ERDate,
       
    39 	EExceptionAndRDate,
       
    40 	ERDateBeforeRRule,
       
    41 	ERDateAfterRRule
       
    42 	};
       
    43 	
       
    44 	
       
    45 struct TTestDataStruct
       
    46 	{
       
    47 public:
       
    48 	enum TTestType
       
    49 		{
       
    50 		EEntryTest,
       
    51 		EInstanceTest,
       
    52 		EGetSetTest,
       
    53 		EUpdateTest
       
    54 		};
       
    55 		
       
    56 	static const TInt KDescriptionLen = 628;
       
    57 		
       
    58 public:
       
    59 	TTestDataStruct();
       
    60 	~TTestDataStruct();
       
    61 	
       
    62 	RArray<TTime> 				iTimes; // local time
       
    63 	TTime 						iStartDate;
       
    64 	TTime 						iEndDate;
       
    65 	TBuf<KDescriptionLen> 		iDescription;
       
    66 	CalCommon::TCalViewFilter 	iFilter;
       
    67 	TCallBack*					iFunction;
       
    68 	HBufC*						iSearchString;
       
    69 	CalCommon::TCalSearchBehaviour iSearchBehaviour;
       
    70 	
       
    71 	RArray<TPtrC8> 				iGuidsToExtract;
       
    72 	TTestType					iTestType;
       
    73 	RArray<TTime> 				iRecIds; // Utc for fixed time test, local for floating time test
       
    74 	};
       
    75 
       
    76 class CTestData : public CBase
       
    77 	{
       
    78 public:
       
    79 	enum TTestNumber
       
    80 		{
       
    81 		// Entry Tests
       
    82 		ECreateParent,
       
    83 		ECreateAndDeleteParent,
       
    84 		ECreateSameParentTwice,
       
    85 		ECreateAndSingleDeleteParent,
       
    86 		ECreateParentAnd1Child,
       
    87 		ECreateParentAnd2Child,
       
    88 		EReplaceExistingChild,
       
    89 		EAddMultipleEntries,
       
    90 		ETestGetSetMethods,
       
    91 		ETestUpdate,
       
    92 		
       
    93 		
       
    94 		// Instance Tests
       
    95 		EGetInstancesParentOnly,
       
    96 		EGetInstancesParentWithExceptionDates,
       
    97 		EGetInstancesParentWithSporadicDates,
       
    98 		EGetInstancesParentAnd1ChildException,
       
    99 		EGetInstancesParentAnd1ChildExceptionMultiFetch,
       
   100 		EGetInstancesParentAnd1ChildRule,
       
   101 		EGetInstancesParentAnd1ChildRuleMultiFetch,
       
   102 		
       
   103 		// Instance Tests specifically to test a child entry modifying the parent rpt rule
       
   104 		EGetInstancesParentWithExceptionsAnd1ChildRuleThisAndFuture,
       
   105 		EGetInstancesParentWithExceptionsRDatesAnd1ChildRuleThisAndFuture,
       
   106 		EGetInstancesParentWithExceptionsRDatesNonRptChildsAnd1ChildRuleThisAndFuture,
       
   107 		EGetInstancesParentWithExceptionsAnd1ChildRuleThisAndPrior,
       
   108 		EGetInstancesParentWithExceptionsRDatesAnd1ChildRuleThisAndPrior,
       
   109 		EGetInstancesParentWithExceptionsRDatesNonRptChildsAnd1ChildRuleThisAndPrior,
       
   110 		
       
   111 		EDeleteAllChildExceptions,
       
   112 		EDeleteEntryThatHasNoInstances,
       
   113 		EStoreRestoreParentWithAChild,
       
   114 		
       
   115 		// These are similar to the above but test peculiar situations
       
   116 		EGetInstancesParentWithExceptionsAnd2ChildRuleThisAndFuture,	// Attempt storing 2 child rpt rules
       
   117 
       
   118 		EGetInstancesParentAnd1ChildExceptionModify, // DEF078804: get the rec id of child through instance.
       
   119 		EGetInstancesParentWithRDateBeforeRRule,
       
   120 		EGetInstancesParentWithRDateAfterRRule,
       
   121 		
       
   122 		ENumberOfTestsForFixedAndFloating,
       
   123 		
       
   124 		// failure test
       
   125 		ECreateParentInvalidChildFloating = ENumberOfTestsForFixedAndFloating, // use the same enum so that floating test can continue
       
   126 		ECreateParentInvalidChildFloating2,
       
   127 	
       
   128 		// Some defect fixes
       
   129 		EStoreParentHaveNoInstanceAndChildren,
       
   130 
       
   131 		ENumberOfTests,
       
   132 		};
       
   133 	
       
   134     static TTestDataStruct* GetTestDataL(TTestNumber aTestNumber, CCalInstanceView* aView, CCalEntryView* aEntryView, TBool aFloating, TBool aSummerTime = EFalse);
       
   135 
       
   136 private:
       
   137 	static void	CreateParentGsEntryL(TCalRRule* aRpt, CCalEntryView* aView, const TDesC8& aGuid, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   138 	static CCalEntry* CreateParentLC(TCalRRule* aRpt, const TDesC8& aGuid, CCalEntry::TType aType, TBool aFloating);
       
   139 	static void DeleteParentGsEntryL(CCalEntryView* aEntryView, const TDesC8& aGuid);
       
   140 	static void SingleDeleteParentGsEntryL(CCalEntryView* aEntryView, const TDesC8& aGuid);
       
   141 	static void CreateChildGsEntryL(TTestDataStruct* aTestData, TInt aRecIdToUse, CCalEntryView* aEntryView, const TDesC8& aGuid, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   142 	
       
   143 	static void DeleteAllEntriesByGuidL(CCalEntryView* aView);
       
   144 	
       
   145 	static void AddMultipleEntriesL(TCalRRule* aRpt, CCalEntryView* aView, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   146 	
       
   147 	static void SetExceptionsL(CCalEntry* aEntry, RArray<TTime>& aTimes, TBool aFloating);
       
   148 	static void CreateParentGsEntryWithExceptionsL(TCalRRule* aRpt, CCalEntryView* aEntryView, const TDesC8& aGuid, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   149 	static void CreateParentGsEntryWithSporadicsL(TCalRRule* aRpt, CCalEntryView* aEntryView, const TDesC8& aGuid, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   150 	
       
   151 	static void CreateChildExceptionGsEntryL(TTestDataStruct* aTestData, TInt aRecIdToUse, CCalEntryView* aEntryView, const TDesC8& aGuid, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   152 	static void CreateChildExceptionGsEntry_1L(TTestDataStruct* aTestData, TInt aRecIdToUse, CCalEntryView* aEntryView, const TDesC8& aGuid, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   153 	static void CreateChildRRuleGsEntryL(TCalRRule* aRpt, TTestDataStruct* aTestData, TInt aRecIdToUse, CalCommon::TRecurrenceRange aRange, CCalEntryView* aEntryView, const TDesC8& aGuid, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   154 	
       
   155 	static TCalRRule* GetWeeklyRuleL(TDay aDay);
       
   156 
       
   157     static TCalRRule* GetDailyTestData1L(TTestDataStruct& aData, TBool aSummerTime = EFalse);
       
   158 	static TCalRRule* GetWeeklyTestData1L(TTestDataStruct& aData);
       
   159 	static TCalRRule* GetWeeklyTestData1FloatingL(TTestDataStruct& aData);
       
   160 	static TCalRRule* GetWeeklyTestData2L(TTestDataStruct& aData);
       
   161 	static TCalRRule* GetWeeklyTestDataModification1L(TTestDataStruct& aData);
       
   162 	static TCalRRule* GetWeeklyTestDataModification1FloatingL(TTestDataStruct& aData);
       
   163 
       
   164 	static void TestSetGetMethodsL(CCalEntryView* aEntryView, const TDesC8& aGuid);
       
   165 	static void TestSetGetMethodsFloatingL(CCalEntryView* aEntryView, const TDesC8& aGuid);
       
   166 	static void TestUpdateL(CCalEntryView* aEntryView, const TDesC8& aGuid);
       
   167 	static void TestDeletionOfChildExceptionsL(CCalEntryView* aEntryView, CCalInstanceView* aInstanceView, const TDesC8& aGuid);
       
   168 	static void TestDeletionOfEntryThatHasNoInstancesL(TCalRRule* aRpt, TTestDataStruct& aData, CCalEntryView* aEntryView, CCalInstanceView* aInstanceView,
       
   169 													   const TDesC8& aGuid, CCalEntry::TType aType, TBool aFloating);
       
   170 	static void StoreRestoreL(CCalEntryView* aEntryView, const TDesC8& aGuid);
       
   171 	
       
   172 	static void CreateWeeklyParentGsEntryWithExceptionsRdatesL(TTestDataStruct& aData, CCalEntryView* aEntryView, const TDesC8& aGuid, TExceptionRDate aExcpnRDate, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   173 	static void CreateWeeklyParentGsEntryWithRDateRRuleL(TTestDataStruct& aData, CCalEntryView* aEntryView, const TDesC8& aGuid, TExceptionRDate aExcpnRDate, CCalEntry::TType aType = CCalEntry::EAppt, TBool aFloating = EFalse);
       
   174 
       
   175 	static void DoMultipleFetchAndStoreTestExceptionChildL(TTestDataStruct* aTestData, CCalEntryView* aEntryView, const TDesC8& aGuid, TInt aRecIdToUse);
       
   176 	static void DoMultipleFetchAndStoreTestRuleChildL(TTestDataStruct* aTestData, CCalEntryView* aEntryView, const TDesC8& aGuid, TInt aRecIdToUse);
       
   177 		
       
   178 	static void TestEntryFromInstanceAndModifyL(TTestDataStruct* aTestData, CCalEntryView* aView, CCalInstanceView* aInstanceView, const TDesC8& aGuid, TInt aRecIdToUse);
       
   179 	static void StoreParentHaveNoInstanceAndChildrenL(CCalEntryView* aEntryView, const TDesC8& aGuid);
       
   180 	};
       
   181 
       
   182 
       
   183 #endif //__TCAL_GSENTRY_TESTDATA_H__
       
   184