phonebookengines_old/contactsmodel/tsrc/T_CustFilter.h
changeset 40 b46a585f6909
equal deleted inserted replaced
37:fd64c38c277d 40:b46a585f6909
       
     1 // Copyright (c) 2003-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 #include <cntview.h>
       
    17 #include "t_utils2.h"
       
    18 
       
    19 
       
    20 //
       
    21 // Forward declarations.
       
    22 //
       
    23 
       
    24 class CViewTesterBase;
       
    25 
       
    26 
       
    27 //
       
    28 // CTestConductor.
       
    29 //
       
    30 
       
    31 class CTestConductor : public CBase
       
    32 	{
       
    33 public:
       
    34 	enum TContactFieldToFill
       
    35 		{
       
    36 		ELocation,
       
    37 		ENickname
       
    38 		};
       
    39 
       
    40 	static CTestConductor* NewL();
       
    41 	~CTestConductor();
       
    42 	void AddContactL(TInt aBitwiseFilterType);
       
    43 	void SetTestError(TInt aTestError);
       
    44 
       
    45 private:
       
    46 	CTestConductor();
       
    47 	void ConstructL();
       
    48 	void RunTestsL();
       
    49 	void AddContactsL();
       
    50 
       
    51 	void RestoreFilterableFieldsFromSystemTemplateL();
       
    52 	TUid CustomFilterableField(TInt aIndex) const;
       
    53 
       
    54 	//
       
    55 	TContactItemId CreateContactL(TContactFieldToFill aFld);
       
    56 
       
    57 public:
       
    58 	TInt iAcceptCount;
       
    59 	TInt iAskCount;
       
    60 
       
    61 	TUid iLocationFieldUID;
       
    62 	TUid iNicknameFieldUID;
       
    63 
       
    64 private:
       
    65 	RFs iFs;
       
    66 	CLog* iLog;
       
    67 	CContactDatabase* iDb;
       
    68 	CRandomContactGenerator* iRandomGenerator;
       
    69 	TInt iTotalContacts;
       
    70 	TInt iTestError;
       
    71 	};
       
    72 
       
    73 
       
    74 //
       
    75 // CViewTester.
       
    76 //
       
    77 
       
    78 class CViewTester : public CActive, public MContactViewObserver
       
    79 	{
       
    80 public:
       
    81 	static CViewTester* NewL(CLog& aLog,CContactDatabase& iDb,CTestConductor* aTestConductor);
       
    82 	~CViewTester();
       
    83 private:
       
    84 	CViewTester(CLog& aLog,CContactDatabase& iDb,CTestConductor* aTestConductor);
       
    85 	void ConstructL();
       
    86 	void NextTest();
       
    87 	void ExceriseViewL(CContactViewBase& aView);
       
    88 private: // From CActive.
       
    89 	void RunL();
       
    90 	TInt RunError(TInt aError);
       
    91 	void DoCancel();
       
    92 private: // From MContactViewObserver.
       
    93 	virtual void HandleContactViewEvent(const CContactViewBase& aView,const TContactViewEvent& aEvent);
       
    94 private:
       
    95 	void TestViewNotificationsL(CContactViewBase& aView);
       
    96 private:
       
    97 	void TestViewIndiciesL(const CContactViewBase& aView);
       
    98 	void PrintTimeTaken(TInt aProfile);
       
    99 	void PrintTotalTimeTaken();
       
   100 
       
   101 private:
       
   102 	void HandleViewCreation(const CContactViewBase& aView, const TContactViewEvent& aEvent, CContactViewBase* aPtrView);
       
   103 
       
   104 private:
       
   105 	CContactFilteredView* CreateFilterViewL();
       
   106 
       
   107 private:
       
   108 	enum TTest
       
   109 		{
       
   110 		ECreateLocalView,
       
   111 		EExerciseLocalView,
       
   112 		ECreateCustom1View,
       
   113 		ECreateCustom2View,
       
   114 		ETestCustom1,
       
   115 		ETestCustom2,
       
   116 
       
   117 		ENumTests
       
   118 		};
       
   119 private:
       
   120 	CLog& iLog;
       
   121 	CContactDatabase& iDb;
       
   122 	TInt iCurrentTest;
       
   123 	RContactViewSortOrder iSortOrder_1;
       
   124 	CContactTextDef* iTextDef;
       
   125 	TBuf<128> iScratchBuf;
       
   126 	CContactNamedRemoteView* iNamedRemoteView;
       
   127 	CContactFilteredView* iCustom1View;
       
   128 	CContactFilteredView* iCustom2View;
       
   129 	
       
   130 	TInt iFilter;
       
   131 	TInt iNumNotificationExpected;
       
   132 	CTestConductor* iTestConductor;
       
   133 	TInt iItemEventsExpected;
       
   134 	TInt iItemsEventsRecieved;
       
   135 	TInt iTimeForTestsToComplete[ENumTests];
       
   136 	TCntProfile iProfile;
       
   137 	};