plugins/contacts/symbian/contactsmodel/tsrc/cntplsql/src/t_cqwertypredictivesearchtable.cpp
changeset 5 603d3f8b6302
parent 0 876b1a06bc25
--- a/plugins/contacts/symbian/contactsmodel/tsrc/cntplsql/src/t_cqwertypredictivesearchtable.cpp	Fri Sep 17 08:34:34 2010 +0300
+++ b/plugins/contacts/symbian/contactsmodel/tsrc/cntplsql/src/t_cqwertypredictivesearchtable.cpp	Mon Oct 04 01:37:06 2010 +0300
@@ -92,13 +92,10 @@
     // The ConstructL from the base class CEUnitTestSuiteClass must be called.
     // It generates the test case table.
     CEUnitTestSuiteClass::ConstructL();
-    
 
-#if defined(USE_ORBIT_KEYMAP)
     // Create singleton outside actual test cases so that it is not treated as
     // resource leak, since it can't be deleted.
     HbKeymapFactory::instance();
-#endif
     }
     
 // -----------------------------------------------------------------------------
@@ -240,6 +237,44 @@
     }
 
 // -----------------------------------------------------------------------------
+// UT_CQwertyPredictiveSearchTable::UT_UnmappedMailAddressL
+// -----------------------------------------------------------------------------
+//
+void UT_CQwertyPredictiveSearchTable::UT_UnmappedMailAddressL()
+    {
+    // All names and mail addresses begin with unmapped characters, so contact
+    // is not stored to QWERTY tables at all.
+    _LIT(KUnmappedName, "8nbrAtStart");
+    _LIT(KNameWithUnmappedChars, "rname28afterNbr");
+    _LIT(KUnmappedMail, "mailto:123user@domain");
+    _LIT(KUnmappedMail2, "800@call.id");
+    _LIT(KUnmappedMail3, "5begins@by.nbr");
+    AddContactL(KTestContactId, KUnmappedName, KNullDesC, KUnmappedMail, KUnmappedMail2); 
+    // Check tables are empty
+    CheckItemCountL(InitTableVector());
+    
+    
+    // One mail address begin with a mapped character
+    AddContactL(KTestContactId2, KNullDesC, KNameWithUnmappedChars, 
+                KUnmappedMail, KUnmappedMail2, KMail);
+    
+    QVector<TInt> result = InitTableVector();
+    result[3] = 1; // KNameWithUnmappedChars
+    result[4] = 1; // KMail
+    CheckItemCountL(result);
+    
+   
+    // All mail addresses begin with unmapped characters, but contact can be
+    // searched by first name and last name. Contact is stored to QWERTY tables.
+    AddContactL(KTestContactId3, KNameWithUnmappedChars, KLastName, 
+                KUnmappedMail, KUnmappedMail2, KUnmappedMail3);
+    
+    result[2] = 1; // KLastName
+    result[3] = 2; // Second KNameWithUnmappedChars
+    CheckItemCountL(result);
+    }
+
+// -----------------------------------------------------------------------------
 // UT_CQwertyPredictiveSearchTable::InitTableVector
 // -----------------------------------------------------------------------------
 //
@@ -398,6 +433,13 @@
     "FUNCTIONALITY",
     SetupL, UT_DeleteLL, Teardown )
 
+EUNIT_TEST(
+    "CreateInDbL - unmapped mail address",
+    "UT_CQwertyPredictiveSearchTable",
+    "CreateInDbL",
+    "FUNCTIONALITY",
+    SetupL, UT_UnmappedMailAddressL, Teardown )
+
 EUNIT_END_TEST_TABLE
 
 //  END OF FILE