contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp
branchRCL_3
changeset 39 a6539d1e8e43
parent 15 e8e3147d53eb
child 64 c1e8ba0c2b16
--- a/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp	Tue May 25 12:26:45 2010 +0300
+++ b/contacts_plat/predictivesearch_client_api/tsrc/PsClientTestSuite/src/PsClientTestSuiteBlocks.cpp	Wed Jun 09 09:26:27 2010 +0300
@@ -71,6 +71,7 @@
         ENTRY( "TC_ITU_TestSearchingInCache",    CPsClientTestSuite::SearchCacheL ), // For easy handling of .cgf file
         ENTRY( "TC_N97_TestSearchingInCache",    CPsClientTestSuite::SearchCacheL ), // For easy handling of .cgf file
         ENTRY( "TC_N00_TestSearchingInCache",    CPsClientTestSuite::SearchCacheL ), // For easy handling of .cgf file
+	    ENTRY( "CheckAdaptiveString",            CPsClientTestSuite::CheckAdaptiveStringL ),
 	    ENTRY( "CheckCachingStatus",             CPsClientTestSuite::CheckCachingStatusL ),
 	    ENTRY( "CheckVersion",                   CPsClientTestSuite::CheckVersion),
 	    ENTRY( "CheckLanguageSupport",           CPsClientTestSuite::TestIsLanguageSupportedL),
@@ -137,6 +138,9 @@
     return iReturnStatus;
 }
 
+// -----------------------------------------------------------------------------
+// This test case creates groups in the phonebook
+// -----------------------------------------------------------------------------
 TInt CPsClientTestSuite::CreateGroupsInPhoneL( CStifItemParser& aItem )
 {
 	iReturnStatus = KErrNone;
@@ -422,7 +426,6 @@
     return iReturnStatus;
 }
 
-
 // -----------------------------------------------------------------------------
 // Searches for a query in input string.
 // -----------------------------------------------------------------------------
@@ -459,6 +462,67 @@
 }
 
 // -----------------------------------------------------------------------------
+// Checks the Adaptive Grid string.
+// -----------------------------------------------------------------------------
+TInt CPsClientTestSuite::CheckAdaptiveStringL(CStifItemParser& aItem)
+{
+    RTimerWait(KOneSecDelay);
+    iReturnStatus = KErrNone;
+    
+    // Create the input parser
+    iInputParsedData = CTestSuiteInputData::NewL(aItem,*iPsClientHandler);
+    
+    // Parse the input data
+    iInputParsedData->ParseInputL(aItem);
+
+    // If more than one cacheuris are configured, this is not
+    // supported by the test suite
+    HBufC* dataStore = HBufC::NewL(50);
+    if(iInputParsedData->CacheUrisCount() == 1)
+    {
+        dataStore->Des().Copy(iInputParsedData->CacheUris(0)); 
+    }
+    else
+    {
+        User::Leave(KErrArgument);
+    }
+
+    CDesCArrayFlat* dataStoreArr = NULL;
+    dataStoreArr = new (ELeave) CDesCArrayFlat( 1 );
+    CleanupStack::PushL( dataStoreArr );
+    dataStoreArr->AppendL( *dataStore );
+
+    // Search Text
+    //Get the input string
+    HBufC* searchText = iInputParsedData->InputSearchString().AllocL();
+
+    // Company Name
+    TBool companyName = iInputParsedData->InputBoolean();
+    
+    TBuf<KPsAdaptiveGridStringMaxLen> result;
+    // Wait for one second
+    RTimerWait(KOneSecDelay);
+
+    TPtrC16 ptr = dataStoreArr->MdcaPoint(0);
+    
+    // Get the Adaptive Grid
+    iPsClientHandler->GetAdaptiveGridCharactersL( *dataStoreArr,
+	                                              searchText->Des(),
+												  companyName,
+												  result );
+    
+    CleanupStack::PopAndDestroy( dataStoreArr );
+    delete dataStore;
+
+    if ( iInputParsedData->ExpectedResultString() != result )
+    {
+        iReturnStatus = KErrArgument;
+    }
+
+    return iReturnStatus;
+}
+
+// -----------------------------------------------------------------------------
 // Stores the caching status of the psengine
 // -----------------------------------------------------------------------------
 void CPsClientTestSuite::CachingStatus(TCachingStatus& aStatus, TInt& /*aError*/)
@@ -594,7 +658,6 @@
 	else
 	{
 		iReturnStatus =  KErrGeneral;
-	
 	}
 	
 	return iReturnStatus;
@@ -628,8 +691,6 @@
    
 	// return error code
     return iReturnStatus;
-
-
 }
 
 // -----------------------------------------------------------------------------
@@ -710,7 +771,7 @@
 	
 	//If more than one cacheuris are configured, then it is an error
 	HBufC* datastore = HBufC::NewL(50);
-	if(iInputParsedData->CacheUrisCount() ==1)
+	if(iInputParsedData->CacheUrisCount() == 1)
 	{
 		datastore->Des().Copy(iInputParsedData->CacheUris(0)); 
 	}
@@ -723,7 +784,6 @@
 	RArray<TInt> inputSortOrder;
 	iInputParsedData->SortOrder(inputSortOrder);
 	
-	
 	//Set the sort order
 	iPsClientHandler->ChangeSortOrderL(*datastore,inputSortOrder);
 	
@@ -745,9 +805,8 @@
 			{
 				iReturnStatus = KErrArgument;
 			}
-		
+
 			delete temp; temp = NULL;
-	
 		}
 	}
 	else
@@ -797,7 +856,6 @@
 	
 	// set search settings
 	iPsClientHandler->SetSearchSettingsL(*iSettings); 
-	
 
 	// Create the search query
 	iInputParsedData->CreateSearchQueryL(*iPsQuery, iInputParsedData->GroupToBeSearched());
@@ -935,7 +993,8 @@
 	//Perform the search
 	iPsClientHandler->SearchL(*iPsQuery,iMarkedContacts,NULL);
 	CActiveScheduler::Start();
-   return iReturnStatus;
+
+    return iReturnStatus;
 }
 
 // -----------------------------------------------------------------------------