phonebookengines/contactsmodel/tsrc/cntplsql/src/t_cpplpredictivesearchtable.h
changeset 24 0ba2181d7c28
child 25 76a2435edfd4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/phonebookengines/contactsmodel/tsrc/cntplsql/src/t_cpplpredictivesearchtable.h	Fri Mar 19 09:27:18 2010 +0200
@@ -0,0 +1,119 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Unit test class for character to key mappings
+*
+*/
+
+#ifndef __UT_CPPLPREDICTIVESEARCHTABLE_H__
+#define __UT_CPPLPREDICTIVESEARCHTABLE_H__
+
+//  EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <digia/eunit/eunitmacros.h>
+#include <sqldb.h>
+#include "cntdef.h" // TContactItemId
+
+//  FORWARD DECLARATIONS
+class CPplPredictiveSearchTable;
+
+//  CONSTANTS
+
+//  CLASS DEFINITION
+/**
+ * Tester class for CPcsKeyMap.
+ */
+NONSHARABLE_CLASS( UT_CPplPredictiveSearchTable ): public CEUnitTestSuiteClass
+    {
+    public: // Constructors and destructors
+
+        /**
+         * Two phase construction
+         */
+        static UT_CPplPredictiveSearchTable* NewL();
+        static UT_CPplPredictiveSearchTable* NewLC();
+        
+        /**
+         * Destructor
+         */
+        ~UT_CPplPredictiveSearchTable();
+
+    private: // Constructors
+
+        UT_CPplPredictiveSearchTable();
+        void ConstructL();
+        
+    private: // Test case setup and teardown
+
+        void SetupL();
+        void Teardown();
+
+    private: // Test functions
+
+        void UT_CreateInDbLL();
+        void UT_CreateInDbManyContactsL();
+        void UT_UpdateLL();
+        void UT_UpdateLBothFieldsL();
+        void UT_SearchL();
+        void UT_SearchWithSpacesL();
+        void UT_DeleteLL();
+        void UT_DeleteContactsL();
+        void UT_DeleteNonexistingContactL();
+        void UT_CheckIfTableExistsL();
+		void UT_CheckIfTableExists2L();
+        void UT_SynchronizeTableL();
+
+    private: // New functions
+
+        void CheckItemCountL(
+            TInt aCountInTable0 = 0,
+            TInt aCountInTable1 = 0,
+            TInt aCountInTable2 = 0,
+            TInt aCountInTable3 = 0,
+            TInt aCountInTable4 = 0,
+            TInt aCountInTable5 = 0,
+            TInt aCountInTable6 = 0,
+            TInt aCountInTable7 = 0,
+            TInt aCountInTable8 = 0,
+            TInt aCountInTable9 = 0);
+        
+        /**
+         * Adds a new contact to table.
+         */
+        void AddContactL(const TDesC& aFirstName,
+                         const TDesC& aLastName,
+                         const TDesC& aCompanyName,
+                         TContactItemId aContactId);
+        
+        /**
+         * Searches the table for matches, and returns an array containing
+         * matching contact's ids.
+         */
+        RArray<TContactItemId> DoPredictiveSearchL(const TDesC& aSearchString);
+
+        const TDesC& DetermineTableName(const TDesC& aSearchString);
+        
+        const TDesC& MultipleTables(const TDesC& aSearchString);
+
+    private:    // Data
+
+        CPplPredictiveSearchTable* iTable;
+        
+        RSqlDatabase iDB;
+
+        EUNIT_DECLARE_TEST_TABLE;
+    };
+
+#endif      //  __UT_CPPLPREDICTIVESEARCHTABLE_H__
+
+// End of file