lafagnosticuifoundation/uigraphicsutils/tef/t_phonenumberutils.cpp
branchRCL_3
changeset 9 0aa5fbdfbc30
parent 0 2f259fa3e83a
equal deleted inserted replaced
8:71dd06cfe933 9:0aa5fbdfbc30
    90    	   b. EFalse for Invalid Plain Phone no.
    90    	   b. EFalse for Invalid Plain Phone no.
    91  */
    91  */
    92 void CT_PhoneNumberUtilsStep::ParsePhoneNumberForPPN()
    92 void CT_PhoneNumberUtilsStep::ParsePhoneNumberForPPN()
    93     {
    93     {
    94 	INFO_PRINTF1(_L("Test to Parse PhoneNumber With Valid PlainPhoneNumber"));
    94 	INFO_PRINTF1(_L("Test to Parse PhoneNumber With Valid PlainPhoneNumber"));
    95     TBuf<50> number = _L("+46 345 34(34347) 42443 42"); // This should be a parseable Plain Phone Number
    95     TBuf<KMaxTestBufferSize> number = _L("+46 345 34(34347) 42443 42"); // This should be a parseable Plain Phone Number
    96 	TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::EPlainPhoneNumber));
    96 	TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::EPlainPhoneNumber));
    97 	INFO_PRINTF2(_L("Normalized Phone No. is %S"), &number);
    97 	INFO_PRINTF2(_L("Normalized Phone No. is %S"), &number);
    98 	
    98 	
    99 	number = _L("0500 -4990		00"); // This should be a parseable Plain Phone Number
    99 	number = _L("0500 -4990		00"); // This should be a parseable Plain Phone Number
   100 	TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::EPlainPhoneNumber));
   100 	TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::EPlainPhoneNumber));
   150 	   b. EFalse for Invalid Contact Card Number.
   150 	   b. EFalse for Invalid Contact Card Number.
   151  */
   151  */
   152  void CT_PhoneNumberUtilsStep::ParsePhoneNumberForCCN()
   152  void CT_PhoneNumberUtilsStep::ParsePhoneNumberForCCN()
   153     {
   153     {
   154   	INFO_PRINTF1(_L("Test to Parse PhoneNumber With Valid ContactCardNumber"));
   154   	INFO_PRINTF1(_L("Test to Parse PhoneNumber With Valid ContactCardNumber"));
   155   	TBuf<50> number = _L("*31*6(0)35/6546"); // This should be a parseable Contact Card Number
   155   	TBuf<KMaxTestBufferSize> number = _L("*31*6(0)35/6546"); // This should be a parseable Contact Card Number
   156 	TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::EContactCardNumber));
   156 	TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::EContactCardNumber));
   157 	INFO_PRINTF2(_L("Normalized Contact Card No. is %S"), &number);
   157 	INFO_PRINTF2(_L("Normalized Contact Card No. is %S"), &number);
   158 
   158 
   159    	INFO_PRINTF1(_L("Test to Validate ContactCardNumber"));
   159    	INFO_PRINTF1(_L("Test to Validate ContactCardNumber"));
   160     number = _L("*31#0w(08)3111113"); // This should  be a Valid Contact Card Number
   160     number = _L("*31#0w(08)3111113"); // This should  be a Valid Contact Card Number
   202 	   b. EFalse for Invalid SMS number.
   202 	   b. EFalse for Invalid SMS number.
   203  */
   203  */
   204 void CT_PhoneNumberUtilsStep::ParsePhoneNumberForSMSNumber()
   204 void CT_PhoneNumberUtilsStep::ParsePhoneNumberForSMSNumber()
   205    {
   205    {
   206    INFO_PRINTF1(_L("Test to Validate SMS number"));
   206    INFO_PRINTF1(_L("Test to Validate SMS number"));
   207    TBuf<50> number = _L("12*3-45/345-24.3"); // This should be a Valid SMS number
   207    TBuf<KMaxTestBufferSize> number = _L("12*3-45/345-24.3"); // This should be a Valid SMS number
   208    TEST(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::ESMSNumber));
   208    TEST(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::ESMSNumber));
   209    
   209    
   210    TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::ESMSNumber));
   210    TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::ESMSNumber));
   211    INFO_PRINTF2(_L("Normalized SMS No. is %S"), &number);
   211    INFO_PRINTF2(_L("Normalized SMS No. is %S"), &number);
   212 
   212 
   213    number = _L("123453452431234534524312345345243"); // This should be a NOT Valid SMS number
   213    if (KPhoneNoUtilsMaxNumbers < KMaxTestBufferSize)
   214    TEST(!(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::ESMSNumber)));
   214         {
   215 
   215         // form number more than max number
       
   216         number.Zero();
       
   217         for (TInt i = 0; i <= KPhoneNoUtilsMaxNumbers; ++i)
       
   218             {
       
   219             number.Append('0' + i % 10);
       
   220             }
       
   221         // This should be a NOT Valid SMS number
       
   222         TEST(!(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::ESMSNumber)));
       
   223         }
       
   224    
   216    number = _L(" "); // This should NOT be a Valid SMS numbernumber
   225    number = _L(" "); // This should NOT be a Valid SMS numbernumber
   217    TEST(!(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::ESMSNumber)));
   226    TEST(!(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::ESMSNumber)));
   218    
   227    
   219    number = _L("(345345243"); // This should NOT be a Valid SMS numbernumber as there is no closing braces.
   228    number = _L("(345345243"); // This should NOT be a Valid SMS numbernumber as there is no closing braces.
   220    TEST(!(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::ESMSNumber)));
   229    TEST(!(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::ESMSNumber)));
   248  */
   257  */
   249 void CT_PhoneNumberUtilsStep::ParsePhoneNumberForPCN()
   258 void CT_PhoneNumberUtilsStep::ParsePhoneNumberForPCN()
   250 	{
   259 	{
   251    	INFO_PRINTF1(_L("Test to Validate PhoneClientNumber"));
   260    	INFO_PRINTF1(_L("Test to Validate PhoneClientNumber"));
   252 
   261 
   253    	TBuf<50> number = _L("1p23-4534w5-2*43#34"); // This should be a Valid Phone Client Number
   262    	TBuf<KMaxTestBufferSize> number = _L("1p23-4534w5-2*43#34"); // This should be a Valid Phone Client Number
   254 	TEST(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::EPhoneClientNumber));
   263 	TEST(TulPhoneNumberUtils::IsValid(number, TulPhoneNumberUtils::EPhoneClientNumber));
   255     
   264     
   256     TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::EPhoneClientNumber));
   265     TEST(TulPhoneNumberUtils::Normalize(number, TulPhoneNumberUtils::EPhoneClientNumber));
   257     INFO_PRINTF2(_L("Normalized Phone Client Number is %S"), &number);
   266     INFO_PRINTF2(_L("Normalized Phone Client Number is %S"), &number);
   258 
   267