classicui_plat/extended_editors_api/tsrc/src/testdomeditorblocksaknphonenumbereditor.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  test aknphonenumbereditor.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <aknphonenumbereditor.h>
       
    21 #include <barsread.h>
       
    22 #include <eiksbfrm.h>
       
    23 #include <frmtlay.h>
       
    24 #include <testdomeditor.rsg>
       
    25 
       
    26 #include "testdomeditor.h"
       
    27 #include "testdomeditorcontainer.h"
       
    28 
       
    29 // CONSTANTS
       
    30 const TInt KMaxChars = 30;
       
    31 const TInt KMaxLines = 3;
       
    32 const TInt KMaxFormats = 3;
       
    33 _LIT( KTruncation, "..." );
       
    34 const TInt KOuterRectAx = 10;
       
    35 const TInt KOuterRectAy = 10;
       
    36 const TInt KOuterRectBx = 70;
       
    37 const TInt KOuterRectBy = 55;
       
    38 const TInt KBorderType = 0;
       
    39 const TInt KNumLines = 3;
       
    40 const TInt KBottomBaselineOffset = 3;
       
    41 const TInt KBaselineSeparation = 15;
       
    42 const TInt KBufSize = 32;
       
    43 
       
    44 
       
    45 // ============================ MEMBER FUNCTIONS ===============================
       
    46 
       
    47 // -----------------------------------------------------------------------------
       
    48 // CTestDOMEditor::TestTForamtDefConsWithNoParam
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 TInt CTestDOMEditor::TestTForamtDefConsWithNoParam( CStifItemParser& /*aItem*/ )
       
    52     {
       
    53 
       
    54     // Print to UI
       
    55     _LIT( KTestDOMEditor, "testdomeditor" );
       
    56     _LIT( KTestTForamtDefConsWithNoParam, "In TForamtDefConsWithNoParam" );
       
    57     TestModuleIf().Printf( 0, KTestDOMEditor, KTestTForamtDefConsWithNoParam );
       
    58     // Print to log file
       
    59     iLog->Log( KTestTForamtDefConsWithNoParam );
       
    60 
       
    61     CAknPhoneNumberEditor::TFormat format( CAknPhoneNumberEditor::TFormat() );
       
    62 
       
    63     return KErrNone;
       
    64 
       
    65     }
       
    66 
       
    67 // -----------------------------------------------------------------------------
       
    68 // CTestDOMEditor::TestTForamtDefConsWithRes
       
    69 // -----------------------------------------------------------------------------
       
    70 //
       
    71 TInt CTestDOMEditor::TestTForamtDefConsWithResL( CStifItemParser& /*aItem*/ )
       
    72     {
       
    73 
       
    74     // Print to UI
       
    75     _LIT( KTestDOMEditor, "testdomeditor" );
       
    76     _LIT( KTestTForamtDefConsWithRes, "In TForamtDefConsWithRes" );
       
    77     TestModuleIf().Printf( 0, KTestDOMEditor, KTestTForamtDefConsWithRes );
       
    78     // Print to log file
       
    79     iLog->Log( KTestTForamtDefConsWithRes );
       
    80 
       
    81     TResourceReader reader;
       
    82     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
    83     CAknPhoneNumberEditor::TFormat format( CAknPhoneNumberEditor::TFormat( reader ) );
       
    84 
       
    85     CleanupStack::PopAndDestroy();
       
    86     return KErrNone;
       
    87 
       
    88     }
       
    89 
       
    90 // -----------------------------------------------------------------------------
       
    91 // CTestDOMEditor::TestTForamtDefConsWithFont
       
    92 // -----------------------------------------------------------------------------
       
    93 //
       
    94 TInt CTestDOMEditor::TestTForamtDefConsWithFont( CStifItemParser& /*aItem*/ )
       
    95     {
       
    96 
       
    97     // Print to UI
       
    98     _LIT( KTestDOMEditor, "testdomeditor" );
       
    99     _LIT( KTestTForamtDefConsWithFont, "In TForamtDefConsWithFont" );
       
   100     TestModuleIf().Printf( 0, KTestDOMEditor, KTestTForamtDefConsWithFont );
       
   101     // Print to log file
       
   102     iLog->Log( KTestTForamtDefConsWithFont );
       
   103 
       
   104     TRect outerRect( KOuterRectAx, KOuterRectAy, KOuterRectBx, KOuterRectBy );
       
   105     const CFont* font = CCoeEnv::Static()->NormalFont();
       
   106     CAknPhoneNumberEditor::TFormat format( CAknPhoneNumberEditor::TFormat(
       
   107             outerRect, KBorderType, KNumLines, KBottomBaselineOffset,
       
   108             KBaselineSeparation, font ) );
       
   109 
       
   110     return KErrNone;
       
   111 
       
   112     }
       
   113 
       
   114 // -----------------------------------------------------------------------------
       
   115 // CTestDOMEditor::TestEditorDefConsL
       
   116 // -----------------------------------------------------------------------------
       
   117 //
       
   118 TInt CTestDOMEditor::TestEditorDefConsL( CStifItemParser& /*aItem*/ )
       
   119     {
       
   120 
       
   121     // Print to UI
       
   122     _LIT( KTestDOMEditor, "testdomeditor" );
       
   123     _LIT( KTestEditorDefCons, "In EditorDefCons" );
       
   124     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorDefCons );
       
   125     // Print to log file
       
   126     iLog->Log( KTestEditorDefCons );
       
   127 
       
   128     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   129     CleanupStack::PushL( phoneNumEditor );
       
   130     STIF_ASSERT_NOT_NULL( phoneNumEditor );
       
   131 
       
   132     CleanupStack::Pop( phoneNumEditor );
       
   133     return KErrNone;
       
   134 
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CTestDOMEditor::TestEditorConstructL
       
   139 // -----------------------------------------------------------------------------
       
   140 //
       
   141 TInt CTestDOMEditor::TestEditorConstructL( CStifItemParser& /*aItem*/ )
       
   142     {
       
   143 
       
   144     // Print to UI
       
   145     _LIT( KTestDOMEditor, "testdomeditor" );
       
   146     _LIT( KTestEditorConstructL, "In EditorConstructL" );
       
   147     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorConstructL );
       
   148     // Print to log file
       
   149     iLog->Log( KTestEditorConstructL );
       
   150 
       
   151     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   152     CleanupStack::PushL( phoneNumEditor );
       
   153     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   154     CleanupStack::PushL( container );
       
   155     phoneNumEditor->SetContainerWindowL( *container );
       
   156 
       
   157     phoneNumEditor->ConstructL( KMaxChars, KMaxLines, KMaxFormats, KTruncation );
       
   158 
       
   159     CleanupStack::PopAndDestroy( container );
       
   160     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   161     return KErrNone;
       
   162 
       
   163     }
       
   164 
       
   165 // -----------------------------------------------------------------------------
       
   166 // CTestDOMEditor::TestEditorConstructFromResourceL
       
   167 // -----------------------------------------------------------------------------
       
   168 //
       
   169 TInt CTestDOMEditor::TestEditorConstructFromResourceL( CStifItemParser& /*aItem*/ )
       
   170     {
       
   171 
       
   172     // Print to UI
       
   173     _LIT( KTestDOMEditor, "testdomeditor" );
       
   174     _LIT( KTestEditorConstructFromResourceL, "In EditorConstructFromResourceL" );
       
   175     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorConstructFromResourceL );
       
   176     // Print to log file
       
   177     iLog->Log( KTestEditorConstructFromResourceL );
       
   178 
       
   179     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   180     CleanupStack::PushL( phoneNumEditor );
       
   181     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   182     CleanupStack::PushL( container );
       
   183     phoneNumEditor->SetContainerWindowL( *container );
       
   184 
       
   185     TResourceReader reader;
       
   186     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   187     phoneNumEditor->ConstructFromResourceL( reader );
       
   188 
       
   189     CleanupStack::PopAndDestroy();
       
   190     CleanupStack::PopAndDestroy( container );
       
   191     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   192     return KErrNone;
       
   193 
       
   194     }
       
   195 
       
   196 // -----------------------------------------------------------------------------
       
   197 // CTestDOMEditor::TestEditorAddFormatL
       
   198 // -----------------------------------------------------------------------------
       
   199 //
       
   200 TInt CTestDOMEditor::TestEditorAddFormatL( CStifItemParser& /*aItem*/ )
       
   201     {
       
   202 
       
   203     // Print to UI
       
   204     _LIT( KTestDOMEditor, "testdomeditor" );
       
   205     _LIT( KTestEditorAddFormat, "In EditorAddFormat" );
       
   206     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorAddFormat );
       
   207     // Print to log file
       
   208     iLog->Log( KTestEditorAddFormat );
       
   209 
       
   210     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   211     CleanupStack::PushL( phoneNumEditor );
       
   212     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   213     CleanupStack::PushL( container );
       
   214     phoneNumEditor->SetContainerWindowL( *container );
       
   215     phoneNumEditor->ConstructL( KMaxChars, KMaxLines, KMaxFormats, KTruncation );
       
   216 
       
   217     TRect outerRect( KOuterRectAx, KOuterRectAy, KOuterRectBx, KOuterRectBy );
       
   218     const CFont* font = CCoeEnv::Static()->NormalFont();
       
   219     CAknPhoneNumberEditor::TFormat format( CAknPhoneNumberEditor::TFormat(
       
   220             outerRect, KBorderType, KNumLines, KBottomBaselineOffset,
       
   221             KBaselineSeparation, font ) );
       
   222     phoneNumEditor->AddFormat( format );
       
   223 
       
   224     CleanupStack::PopAndDestroy( container );
       
   225     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   226     return KErrNone;
       
   227 
       
   228     }
       
   229 
       
   230 // -----------------------------------------------------------------------------
       
   231 // CTestDOMEditor::TestEditorCountFormatsL
       
   232 // -----------------------------------------------------------------------------
       
   233 //
       
   234 TInt CTestDOMEditor::TestEditorCountFormatsL( CStifItemParser& /*aItem*/ )
       
   235     {
       
   236 
       
   237     // Print to UI
       
   238     _LIT( KTestDOMEditor, "testdomeditor" );
       
   239     _LIT( KTestEditorCountFormats, "In EditorCountFormats" );
       
   240     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCountFormats );
       
   241     // Print to log file
       
   242     iLog->Log( KTestEditorCountFormats );
       
   243 
       
   244     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   245     CleanupStack::PushL( phoneNumEditor );
       
   246     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   247     CleanupStack::PushL( container );
       
   248     phoneNumEditor->SetContainerWindowL( *container );
       
   249 
       
   250     TResourceReader reader;
       
   251     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   252     phoneNumEditor->ConstructFromResourceL( reader );
       
   253     CleanupStack::PopAndDestroy();
       
   254 
       
   255     TInt formats = phoneNumEditor->CountFormats();
       
   256     STIF_ASSERT_EQUALS( 1, formats );
       
   257 
       
   258     CleanupStack::PopAndDestroy( container );
       
   259     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   260     return KErrNone;
       
   261 
       
   262     }
       
   263 
       
   264 // -----------------------------------------------------------------------------
       
   265 // CTestDOMEditor::TestEditorFormatL
       
   266 // -----------------------------------------------------------------------------
       
   267 //
       
   268 TInt CTestDOMEditor::TestEditorFormatL( CStifItemParser& /*aItem*/ )
       
   269     {
       
   270 
       
   271     // Print to UI
       
   272     _LIT( KTestDOMEditor, "testdomeditor" );
       
   273     _LIT( KTestEditorFormat, "In EditorFormat" );
       
   274     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorFormat );
       
   275     // Print to log file
       
   276     iLog->Log( KTestEditorFormat );
       
   277 
       
   278     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   279     CleanupStack::PushL( phoneNumEditor );
       
   280     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   281     CleanupStack::PushL( container );
       
   282     phoneNumEditor->SetContainerWindowL( *container );
       
   283     phoneNumEditor->ConstructL( KMaxChars, KMaxLines, KMaxFormats, KTruncation );
       
   284 
       
   285     TRect outerRect( KOuterRectAx, KOuterRectAy, KOuterRectBx, KOuterRectBy );
       
   286     const CFont* font = CCoeEnv::Static()->NormalFont();
       
   287     CAknPhoneNumberEditor::TFormat format( CAknPhoneNumberEditor::TFormat(
       
   288             outerRect, KBorderType, KNumLines, KBottomBaselineOffset,
       
   289             KBaselineSeparation, font ) );
       
   290     phoneNumEditor->AddFormat( format );
       
   291 
       
   292     CAknPhoneNumberEditor::TFormat editorFormat = phoneNumEditor->Format( 0 );
       
   293     STIF_ASSERT_EQUALS( format.iOuterRect, editorFormat.iOuterRect );
       
   294 
       
   295     CleanupStack::PopAndDestroy( container );
       
   296     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   297     return KErrNone;
       
   298 
       
   299     }
       
   300 
       
   301 // -----------------------------------------------------------------------------
       
   302 // CTestDOMEditor::TestEditorCurrentFormatIndexL
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 TInt CTestDOMEditor::TestEditorCurrentFormatIndexL( CStifItemParser& /*aItem*/ )
       
   306     {
       
   307 
       
   308     // Print to UI
       
   309     _LIT( KTestDOMEditor, "testdomeditor" );
       
   310     _LIT( KTestEditorCurrentFormatIndex, "In EditorCurrentFormatIndex" );
       
   311     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCurrentFormatIndex );
       
   312     // Print to log file
       
   313     iLog->Log( KTestEditorCurrentFormatIndex );
       
   314 
       
   315     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   316     CleanupStack::PushL( phoneNumEditor );
       
   317     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   318     CleanupStack::PushL( container );
       
   319     phoneNumEditor->SetContainerWindowL( *container );
       
   320 
       
   321     TResourceReader reader;
       
   322     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   323     phoneNumEditor->ConstructFromResourceL( reader );
       
   324     CleanupStack::PopAndDestroy();
       
   325 
       
   326     TInt currentIndex = phoneNumEditor->CurrentFormatIndex();
       
   327     STIF_ASSERT_EQUALS( 0, currentIndex );
       
   328 
       
   329     CleanupStack::PopAndDestroy( container );
       
   330     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   331     return KErrNone;
       
   332 
       
   333     }
       
   334 
       
   335 // -----------------------------------------------------------------------------
       
   336 // CTestDOMEditor::TestEditorWouldTextFitInFormatL
       
   337 // -----------------------------------------------------------------------------
       
   338 //
       
   339 TInt CTestDOMEditor::TestEditorWouldTextFitInFormatL( CStifItemParser& /*aItem*/ )
       
   340     {
       
   341 
       
   342     // Print to UI
       
   343     _LIT( KTestDOMEditor, "testdomeditor" );
       
   344     _LIT( KTestEditorWouldTextFitInFormat, "In EditorWouldTextFitInFormat" );
       
   345     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorWouldTextFitInFormat );
       
   346     // Print to log file
       
   347     iLog->Log( KTestEditorWouldTextFitInFormat );
       
   348 
       
   349     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   350     CleanupStack::PushL( phoneNumEditor );
       
   351     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   352     CleanupStack::PushL( container );
       
   353     phoneNumEditor->SetContainerWindowL( *container );
       
   354 
       
   355     TResourceReader reader;
       
   356     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   357     phoneNumEditor->ConstructFromResourceL( reader );
       
   358     CleanupStack::PopAndDestroy();
       
   359 
       
   360     TBool testFit = phoneNumEditor->WouldTextFitInFormat( 0 );
       
   361     STIF_ASSERT_TRUE( testFit );
       
   362 
       
   363     CleanupStack::PopAndDestroy( container );
       
   364     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   365     return KErrNone;
       
   366 
       
   367     }
       
   368 
       
   369 // -----------------------------------------------------------------------------
       
   370 // CTestDOMEditor::TestEditorSetFormatL
       
   371 // -----------------------------------------------------------------------------
       
   372 //
       
   373 TInt CTestDOMEditor::TestEditorSetFormatL( CStifItemParser& /*aItem*/ )
       
   374     {
       
   375 
       
   376     // Print to UI
       
   377     _LIT( KTestDOMEditor, "testdomeditor" );
       
   378     _LIT( KTestEditorSetFormat, "In EditorSetFormat" );
       
   379     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSetFormat );
       
   380     // Print to log file
       
   381     iLog->Log( KTestEditorSetFormat );
       
   382 
       
   383     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   384     CleanupStack::PushL( phoneNumEditor );
       
   385     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   386     CleanupStack::PushL( container );
       
   387     phoneNumEditor->SetContainerWindowL( *container );
       
   388 
       
   389     TResourceReader reader;
       
   390     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   391     phoneNumEditor->ConstructFromResourceL( reader );
       
   392     CleanupStack::PopAndDestroy();
       
   393 
       
   394     phoneNumEditor->SetFormat( 0 );
       
   395 
       
   396     CleanupStack::PopAndDestroy( container );
       
   397     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   398     return KErrNone;
       
   399 
       
   400     }
       
   401 
       
   402 // -----------------------------------------------------------------------------
       
   403 // CTestDOMEditor::TestEditorTextL
       
   404 // -----------------------------------------------------------------------------
       
   405 //
       
   406 TInt CTestDOMEditor::TestEditorTextL( CStifItemParser& /*aItem*/ )
       
   407     {
       
   408 
       
   409     // Print to UI
       
   410     _LIT( KTestDOMEditor, "testdomeditor" );
       
   411     _LIT( KTestEditorText, "In EditorText" );
       
   412     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorText );
       
   413     // Print to log file
       
   414     iLog->Log( KTestEditorText );
       
   415 
       
   416     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   417     CleanupStack::PushL( phoneNumEditor );
       
   418     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   419     CleanupStack::PushL( container );
       
   420     phoneNumEditor->SetContainerWindowL( *container );
       
   421 
       
   422     TResourceReader reader;
       
   423     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   424     phoneNumEditor->ConstructFromResourceL( reader );
       
   425     CleanupStack::PopAndDestroy();
       
   426 
       
   427     TPtrC text = phoneNumEditor->Text();
       
   428     TInt len = text.Length();
       
   429     STIF_ASSERT_EQUALS( 0, len );
       
   430 
       
   431     CleanupStack::PopAndDestroy( container );
       
   432     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   433     return KErrNone;
       
   434 
       
   435     }
       
   436 
       
   437 // -----------------------------------------------------------------------------
       
   438 // CTestDOMEditor::TestEditorSetTextL
       
   439 // -----------------------------------------------------------------------------
       
   440 //
       
   441 TInt CTestDOMEditor::TestEditorSetTextL( CStifItemParser& /*aItem*/ )
       
   442     {
       
   443 
       
   444     // Print to UI
       
   445     _LIT( KTestDOMEditor, "testdomeditor" );
       
   446     _LIT( KTestEditorSetText, "In EditorSetText" );
       
   447     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSetText );
       
   448     // Print to log file
       
   449     iLog->Log( KTestEditorSetText );
       
   450 
       
   451     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   452     CleanupStack::PushL( phoneNumEditor );
       
   453     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   454     CleanupStack::PushL( container );
       
   455     phoneNumEditor->SetContainerWindowL( *container );
       
   456 
       
   457     TResourceReader reader;
       
   458     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   459     phoneNumEditor->ConstructFromResourceL( reader );
       
   460     CleanupStack::PopAndDestroy();
       
   461 
       
   462     _LIT( KText, "text" );
       
   463     phoneNumEditor->SetText( KText );
       
   464 
       
   465     CleanupStack::PopAndDestroy( container );
       
   466     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   467     return KErrNone;
       
   468 
       
   469     }
       
   470 
       
   471 // -----------------------------------------------------------------------------
       
   472 // CTestDOMEditor::TestEditorSizeChangedL
       
   473 // -----------------------------------------------------------------------------
       
   474 //
       
   475 TInt CTestDOMEditor::TestEditorSizeChangedL( CStifItemParser& /*aItem*/ )
       
   476     {
       
   477 
       
   478     // Print to UI
       
   479     _LIT( KTestDOMEditor, "testdomeditor" );
       
   480     _LIT( KTestEditorSizeChanged, "In EditorSizeChanged" );
       
   481     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSizeChanged );
       
   482     // Print to log file
       
   483     iLog->Log( KTestEditorSizeChanged );
       
   484 
       
   485     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   486     CleanupStack::PushL( phoneNumEditor );
       
   487     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   488     CleanupStack::PushL( container );
       
   489     phoneNumEditor->SetContainerWindowL( *container );
       
   490 
       
   491     TResourceReader reader;
       
   492     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   493     phoneNumEditor->ConstructFromResourceL( reader );
       
   494     CleanupStack::PopAndDestroy();
       
   495 
       
   496     phoneNumEditor->SizeChanged();
       
   497 
       
   498     CleanupStack::PopAndDestroy( container );
       
   499     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   500     return KErrNone;
       
   501 
       
   502     }
       
   503 
       
   504 // -----------------------------------------------------------------------------
       
   505 // CTestDOMEditor::TestEditorOfferKeyEventL
       
   506 // -----------------------------------------------------------------------------
       
   507 //
       
   508 TInt CTestDOMEditor::TestEditorOfferKeyEventL( CStifItemParser& /*aItem*/ )
       
   509     {
       
   510 
       
   511     // Print to UI
       
   512     _LIT( KTestDOMEditor, "testdomeditor" );
       
   513     _LIT( KTestEditorOfferKeyEventL, "In EditorOfferKeyEventL" );
       
   514     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorOfferKeyEventL );
       
   515     // Print to log file
       
   516     iLog->Log( KTestEditorOfferKeyEventL );
       
   517 
       
   518     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   519     CleanupStack::PushL( phoneNumEditor );
       
   520     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   521     CleanupStack::PushL( container );
       
   522     phoneNumEditor->SetContainerWindowL( *container );
       
   523 
       
   524     TResourceReader reader;
       
   525     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   526     phoneNumEditor->ConstructFromResourceL( reader );
       
   527     CleanupStack::PopAndDestroy();
       
   528 
       
   529     TKeyEvent keyEvent;
       
   530     keyEvent.iScanCode = EStdKeyEnter;
       
   531     TKeyResponse keyResponse = phoneNumEditor->OfferKeyEventL( keyEvent, EEventKey );
       
   532     STIF_ASSERT_TRUE( keyResponse == EKeyWasNotConsumed );
       
   533 
       
   534     CleanupStack::PopAndDestroy( container );
       
   535     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   536     return KErrNone;
       
   537 
       
   538     }
       
   539 
       
   540 // -----------------------------------------------------------------------------
       
   541 // CTestDOMEditor::TestEditorMinimumSizeL
       
   542 // -----------------------------------------------------------------------------
       
   543 //
       
   544 TInt CTestDOMEditor::TestEditorMinimumSizeL( CStifItemParser& /*aItem*/ )
       
   545     {
       
   546 
       
   547     // Print to UI
       
   548     _LIT( KTestDOMEditor, "testdomeditor" );
       
   549     _LIT( KTestEditorMinimumSize, "In EditorMinimumSize" );
       
   550     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorMinimumSize );
       
   551     // Print to log file
       
   552     iLog->Log( KTestEditorMinimumSize );
       
   553 
       
   554     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   555     CleanupStack::PushL( phoneNumEditor );
       
   556     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   557     CleanupStack::PushL( container );
       
   558     phoneNumEditor->SetContainerWindowL( *container );
       
   559 
       
   560     TResourceReader reader;
       
   561     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   562     phoneNumEditor->ConstructFromResourceL( reader );
       
   563     CleanupStack::PopAndDestroy();
       
   564 
       
   565     TSize size( phoneNumEditor->MinimumSize() );
       
   566     STIF_ASSERT_TRUE( ( size.iWidth >= 0 ) && ( size.iHeight >= 0 ) );
       
   567 
       
   568     CleanupStack::PopAndDestroy( container );
       
   569     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   570     return KErrNone;
       
   571 
       
   572     }
       
   573 
       
   574 // -----------------------------------------------------------------------------
       
   575 // CTestDOMEditor::TestEditorFocusChangedL
       
   576 // -----------------------------------------------------------------------------
       
   577 //
       
   578 TInt CTestDOMEditor::TestEditorFocusChangedL( CStifItemParser& /*aItem*/ )
       
   579     {
       
   580 
       
   581     // Print to UI
       
   582     _LIT( KTestDOMEditor, "testdomeditor" );
       
   583     _LIT( KTestEditorFocusChanged, "In EditorFocusChanged" );
       
   584     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorFocusChanged );
       
   585     // Print to log file
       
   586     iLog->Log( KTestEditorFocusChanged );
       
   587 
       
   588     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   589     CleanupStack::PushL( phoneNumEditor );
       
   590     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   591     CleanupStack::PushL( container );
       
   592     phoneNumEditor->SetContainerWindowL( *container );
       
   593 
       
   594     TResourceReader reader;
       
   595     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   596     phoneNumEditor->ConstructFromResourceL( reader );
       
   597     CleanupStack::PopAndDestroy();
       
   598 
       
   599     phoneNumEditor->FocusChanged( EDrawNow );
       
   600 
       
   601     CleanupStack::PopAndDestroy( container );
       
   602     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   603     return KErrNone;
       
   604 
       
   605     }
       
   606 
       
   607 // -----------------------------------------------------------------------------
       
   608 // CTestDOMEditor::TestEditorDrawL
       
   609 // -----------------------------------------------------------------------------
       
   610 //
       
   611 TInt CTestDOMEditor::TestEditorDrawL( CStifItemParser& /*aItem*/ )
       
   612     {
       
   613 
       
   614     // Print to UI
       
   615     _LIT( KTestDOMEditor, "testdomeditor" );
       
   616     _LIT( KTestEditorDraw, "In EditorDraw" );
       
   617     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorDraw );
       
   618     // Print to log file
       
   619     iLog->Log( KTestEditorDraw );
       
   620 
       
   621     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   622     CleanupStack::PushL( phoneNumEditor );
       
   623     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   624     CleanupStack::PushL( container );
       
   625     phoneNumEditor->SetContainerWindowL( *container );
       
   626 
       
   627     TResourceReader reader;
       
   628     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   629     phoneNumEditor->ConstructFromResourceL( reader );
       
   630     CleanupStack::PopAndDestroy();
       
   631 
       
   632     // Draw() function will be called.
       
   633     phoneNumEditor->FocusChanged( EDrawNow );
       
   634 
       
   635     CleanupStack::PopAndDestroy( container );
       
   636     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   637     return KErrNone;
       
   638 
       
   639     }
       
   640 
       
   641 // -----------------------------------------------------------------------------
       
   642 // CTestDOMEditor::TestEditorInputCapabilitiesL
       
   643 // -----------------------------------------------------------------------------
       
   644 //
       
   645 TInt CTestDOMEditor::TestEditorInputCapabilitiesL( CStifItemParser& /*aItem*/ )
       
   646     {
       
   647 
       
   648     // Print to UI
       
   649     _LIT( KTestDOMEditor, "testdomeditor" );
       
   650     _LIT( KTestEditorInputCapabilities, "In EditorInputCapabilities" );
       
   651     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorInputCapabilities );
       
   652     // Print to log file
       
   653     iLog->Log( KTestEditorInputCapabilities );
       
   654 
       
   655     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   656     CleanupStack::PushL( phoneNumEditor );
       
   657     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   658     CleanupStack::PushL( container );
       
   659     phoneNumEditor->SetContainerWindowL( *container );
       
   660 
       
   661     TResourceReader reader;
       
   662     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   663     phoneNumEditor->ConstructFromResourceL( reader );
       
   664     CleanupStack::PopAndDestroy();
       
   665 
       
   666     TCoeInputCapabilities inputCapabilities ( phoneNumEditor->InputCapabilities() );
       
   667 
       
   668     CleanupStack::PopAndDestroy( container );
       
   669     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   670     return KErrNone;
       
   671 
       
   672     }
       
   673 
       
   674 // -----------------------------------------------------------------------------
       
   675 // CTestDOMEditor::TestEditorTextLengthL
       
   676 // -----------------------------------------------------------------------------
       
   677 //
       
   678 TInt CTestDOMEditor::TestEditorTextLengthL( CStifItemParser& /*aItem*/ )
       
   679     {
       
   680 
       
   681     // Print to UI
       
   682     _LIT( KTestDOMEditor, "testdomeditor" );
       
   683     _LIT( KTestEditorTextLength, "In EditorTextLength" );
       
   684     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorTextLength );
       
   685     // Print to log file
       
   686     iLog->Log( KTestEditorTextLength );
       
   687 
       
   688     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   689     CleanupStack::PushL( phoneNumEditor );
       
   690     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   691     CleanupStack::PushL( container );
       
   692     phoneNumEditor->SetContainerWindowL( *container );
       
   693 
       
   694     TResourceReader reader;
       
   695     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   696     phoneNumEditor->ConstructFromResourceL( reader );
       
   697     CleanupStack::PopAndDestroy();
       
   698 
       
   699     TInt textLength = phoneNumEditor->TextLength();
       
   700     STIF_ASSERT_EQUALS( 0, textLength );
       
   701 
       
   702     CleanupStack::PopAndDestroy( container );
       
   703     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   704     return KErrNone;
       
   705 
       
   706     }
       
   707 
       
   708 // -----------------------------------------------------------------------------
       
   709 // CTestDOMEditor::TestEditorCursorPosL
       
   710 // -----------------------------------------------------------------------------
       
   711 //
       
   712 TInt CTestDOMEditor::TestEditorCursorPosL( CStifItemParser& /*aItem*/ )
       
   713     {
       
   714 
       
   715     // Print to UI
       
   716     _LIT( KTestDOMEditor, "testdomeditor" );
       
   717     _LIT( KTestEditorCursorPos, "In EditorCursorPos" );
       
   718     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCursorPos );
       
   719     // Print to log file
       
   720     iLog->Log( KTestEditorCursorPos );
       
   721 
       
   722     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   723     CleanupStack::PushL( phoneNumEditor );
       
   724     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   725     CleanupStack::PushL( container );
       
   726     phoneNumEditor->SetContainerWindowL( *container );
       
   727 
       
   728     TResourceReader reader;
       
   729     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   730     phoneNumEditor->ConstructFromResourceL( reader );
       
   731     CleanupStack::PopAndDestroy();
       
   732 
       
   733     TInt cursorPos = phoneNumEditor->CursorPos();
       
   734     STIF_ASSERT_EQUALS( 0, cursorPos );
       
   735 
       
   736     CleanupStack::PopAndDestroy( container );
       
   737     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   738     return KErrNone;
       
   739 
       
   740     }
       
   741 
       
   742 // -----------------------------------------------------------------------------
       
   743 // CTestDOMEditor::TestEditorSelectionLengthL
       
   744 // -----------------------------------------------------------------------------
       
   745 //
       
   746 TInt CTestDOMEditor::TestEditorSelectionLengthL( CStifItemParser& /*aItem*/ )
       
   747     {
       
   748 
       
   749     // Print to UI
       
   750     _LIT( KTestDOMEditor, "testdomeditor" );
       
   751     _LIT( KTestEditorSelectionLength, "In EditorSelectionLength" );
       
   752     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSelectionLength );
       
   753     // Print to log file
       
   754     iLog->Log( KTestEditorSelectionLength );
       
   755 
       
   756     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   757     CleanupStack::PushL( phoneNumEditor );
       
   758     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   759     CleanupStack::PushL( container );
       
   760     phoneNumEditor->SetContainerWindowL( *container );
       
   761 
       
   762     TResourceReader reader;
       
   763     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   764     phoneNumEditor->ConstructFromResourceL( reader );
       
   765     CleanupStack::PopAndDestroy();
       
   766 
       
   767     TInt selectionLength = phoneNumEditor->SelectionLength();
       
   768     STIF_ASSERT_EQUALS( 0, selectionLength );
       
   769 
       
   770     CleanupStack::PopAndDestroy( container );
       
   771     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   772     return KErrNone;
       
   773 
       
   774     }
       
   775 
       
   776 // -----------------------------------------------------------------------------
       
   777 // CTestDOMEditor::TestEditorSelectionL
       
   778 // -----------------------------------------------------------------------------
       
   779 //
       
   780 TInt CTestDOMEditor::TestEditorSelectionL( CStifItemParser& /*aItem*/ )
       
   781     {
       
   782 
       
   783     // Print to UI
       
   784     _LIT( KTestDOMEditor, "testdomeditor" );
       
   785     _LIT( KTestEditorSelection, "In EditorSelection" );
       
   786     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSelection );
       
   787     // Print to log file
       
   788     iLog->Log( KTestEditorSelection );
       
   789 
       
   790     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   791     CleanupStack::PushL( phoneNumEditor );
       
   792     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   793     CleanupStack::PushL( container );
       
   794     phoneNumEditor->SetContainerWindowL( *container );
       
   795 
       
   796     TResourceReader reader;
       
   797     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   798     phoneNumEditor->ConstructFromResourceL( reader );
       
   799     CleanupStack::PopAndDestroy();
       
   800 
       
   801     TCursorSelection selection ( phoneNumEditor->Selection() );
       
   802 
       
   803     CleanupStack::PopAndDestroy( container );
       
   804     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   805     return KErrNone;
       
   806 
       
   807     }
       
   808 
       
   809 // -----------------------------------------------------------------------------
       
   810 // CTestDOMEditor::TestEditorClearSelectionL
       
   811 // -----------------------------------------------------------------------------
       
   812 //
       
   813 TInt CTestDOMEditor::TestEditorClearSelectionL( CStifItemParser& /*aItem*/ )
       
   814     {
       
   815 
       
   816     // Print to UI
       
   817     _LIT( KTestDOMEditor, "testdomeditor" );
       
   818     _LIT( KTestEditorClearSelectionL, "In EditorClearSelectionL" );
       
   819     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorClearSelectionL );
       
   820     // Print to log file
       
   821     iLog->Log( KTestEditorClearSelectionL );
       
   822 
       
   823     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   824     CleanupStack::PushL( phoneNumEditor );
       
   825     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   826     CleanupStack::PushL( container );
       
   827     phoneNumEditor->SetContainerWindowL( *container );
       
   828 
       
   829     TResourceReader reader;
       
   830     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   831     phoneNumEditor->ConstructFromResourceL( reader );
       
   832     CleanupStack::PopAndDestroy();
       
   833 
       
   834     phoneNumEditor->ClearSelectionL();
       
   835 
       
   836     CleanupStack::PopAndDestroy( container );
       
   837     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   838     return KErrNone;
       
   839 
       
   840     }
       
   841 
       
   842 // -----------------------------------------------------------------------------
       
   843 // CTestDOMEditor::TestEditorSetSelectionL
       
   844 // -----------------------------------------------------------------------------
       
   845 //
       
   846 TInt CTestDOMEditor::TestEditorSetSelectionL( CStifItemParser& /*aItem*/ )
       
   847     {
       
   848 
       
   849     // Print to UI
       
   850     _LIT( KTestDOMEditor, "testdomeditor" );
       
   851     _LIT( KTestEditorSetSelectionL, "In EditorSetSelectionL" );
       
   852     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSetSelectionL );
       
   853     // Print to log file
       
   854     iLog->Log( KTestEditorSetSelectionL );
       
   855 
       
   856     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   857     CleanupStack::PushL( phoneNumEditor );
       
   858     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   859     CleanupStack::PushL( container );
       
   860     phoneNumEditor->SetContainerWindowL( *container );
       
   861 
       
   862     TResourceReader reader;
       
   863     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   864     phoneNumEditor->ConstructFromResourceL( reader );
       
   865     CleanupStack::PopAndDestroy();
       
   866 
       
   867     phoneNumEditor->SetSelectionL( 0, 0 );
       
   868 
       
   869     CleanupStack::PopAndDestroy( container );
       
   870     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   871     return KErrNone;
       
   872 
       
   873     }
       
   874 
       
   875 // -----------------------------------------------------------------------------
       
   876 // CTestDOMEditor::TestEditorSetCursorPosL
       
   877 // -----------------------------------------------------------------------------
       
   878 //
       
   879 TInt CTestDOMEditor::TestEditorSetCursorPosL( CStifItemParser& /*aItem*/ )
       
   880     {
       
   881 
       
   882     // Print to UI
       
   883     _LIT( KTestDOMEditor, "testdomeditor" );
       
   884     _LIT( KTestEditorSetCursorPosL, "In EditorSetCursorPosL" );
       
   885     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSetCursorPosL );
       
   886     // Print to log file
       
   887     iLog->Log( KTestEditorSetCursorPosL );
       
   888 
       
   889     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   890     CleanupStack::PushL( phoneNumEditor );
       
   891     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   892     CleanupStack::PushL( container );
       
   893     phoneNumEditor->SetContainerWindowL( *container );
       
   894 
       
   895     TResourceReader reader;
       
   896     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   897     phoneNumEditor->ConstructFromResourceL( reader );
       
   898     CleanupStack::PopAndDestroy();
       
   899 
       
   900     phoneNumEditor->SetCursorPosL( 0, ETrue );
       
   901 
       
   902     CleanupStack::PopAndDestroy( container );
       
   903     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   904     return KErrNone;
       
   905 
       
   906     }
       
   907 
       
   908 // -----------------------------------------------------------------------------
       
   909 // CTestDOMEditor::TestEditorSelectAllL
       
   910 // -----------------------------------------------------------------------------
       
   911 //
       
   912 TInt CTestDOMEditor::TestEditorSelectAllL( CStifItemParser& /*aItem*/ )
       
   913     {
       
   914 
       
   915     // Print to UI
       
   916     _LIT( KTestDOMEditor, "testdomeditor" );
       
   917     _LIT( KTestEditorSelectAllL, "In EditorSelectAllL" );
       
   918     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSelectAllL );
       
   919     // Print to log file
       
   920     iLog->Log( KTestEditorSelectAllL );
       
   921 
       
   922     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   923     CleanupStack::PushL( phoneNumEditor );
       
   924     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   925     CleanupStack::PushL( container );
       
   926     phoneNumEditor->SetContainerWindowL( *container );
       
   927 
       
   928     TResourceReader reader;
       
   929     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   930     phoneNumEditor->ConstructFromResourceL( reader );
       
   931     CleanupStack::PopAndDestroy();
       
   932 
       
   933     phoneNumEditor->SelectAllL();
       
   934 
       
   935     CleanupStack::PopAndDestroy( container );
       
   936     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   937     return KErrNone;
       
   938 
       
   939     }
       
   940 
       
   941 // -----------------------------------------------------------------------------
       
   942 // CTestDOMEditor::TestEditorGetTextL
       
   943 // -----------------------------------------------------------------------------
       
   944 //
       
   945 TInt CTestDOMEditor::TestEditorGetTextL( CStifItemParser& /*aItem*/ )
       
   946     {
       
   947 
       
   948     // Print to UI
       
   949     _LIT( KTestDOMEditor, "testdomeditor" );
       
   950     _LIT( KTestEditorGetText, "In EditorGetText" );
       
   951     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorGetText );
       
   952     // Print to log file
       
   953     iLog->Log( KTestEditorGetText );
       
   954 
       
   955     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   956     CleanupStack::PushL( phoneNumEditor );
       
   957     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   958     CleanupStack::PushL( container );
       
   959     phoneNumEditor->SetContainerWindowL( *container );
       
   960 
       
   961     TResourceReader reader;
       
   962     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   963     phoneNumEditor->ConstructFromResourceL( reader );
       
   964     CleanupStack::PopAndDestroy();
       
   965 
       
   966     TBuf<KBufSize> text;
       
   967     phoneNumEditor->GetText( text );
       
   968     TInt length = text.Length();
       
   969     STIF_ASSERT_EQUALS( 0, length );
       
   970 
       
   971     CleanupStack::PopAndDestroy( container );
       
   972     CleanupStack::PopAndDestroy( phoneNumEditor );
       
   973     return KErrNone;
       
   974 
       
   975     }
       
   976 
       
   977 // -----------------------------------------------------------------------------
       
   978 // CTestDOMEditor::TestEditorGetTextInHBufL
       
   979 // -----------------------------------------------------------------------------
       
   980 //
       
   981 TInt CTestDOMEditor::TestEditorGetTextInHBufL( CStifItemParser& /*aItem*/ )
       
   982     {
       
   983 
       
   984     // Print to UI
       
   985     _LIT( KTestDOMEditor, "testdomeditor" );
       
   986     _LIT( KTestEditorGetTextInHBufL, "In EditorGetTextInHBufL" );
       
   987     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorGetTextInHBufL );
       
   988     // Print to log file
       
   989     iLog->Log( KTestEditorGetTextInHBufL );
       
   990 
       
   991     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
   992     CleanupStack::PushL( phoneNumEditor );
       
   993     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
   994     CleanupStack::PushL( container );
       
   995     phoneNumEditor->SetContainerWindowL( *container );
       
   996 
       
   997     TResourceReader reader;
       
   998     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
   999     phoneNumEditor->ConstructFromResourceL( reader );
       
  1000     CleanupStack::PopAndDestroy();
       
  1001 
       
  1002     HBufC* text = phoneNumEditor->GetTextInHBufL();
       
  1003     CleanupStack::PushL( text );
       
  1004     TInt length = text->Length();
       
  1005     STIF_ASSERT_EQUALS( 0, length );
       
  1006 
       
  1007     CleanupStack::PopAndDestroy( text );
       
  1008     CleanupStack::PopAndDestroy( container );
       
  1009     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1010     return KErrNone;
       
  1011 
       
  1012     }
       
  1013 
       
  1014 // -----------------------------------------------------------------------------
       
  1015 // CTestDOMEditor::TestEditorSetTextWithPoiL
       
  1016 // -----------------------------------------------------------------------------
       
  1017 //
       
  1018 TInt CTestDOMEditor::TestEditorSetTextWithPoiL( CStifItemParser& /*aItem*/ )
       
  1019     {
       
  1020 
       
  1021     // Print to UI
       
  1022     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1023     _LIT( KTestEditorSetTextL, "In EditorSetTextL" );
       
  1024     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorSetTextL );
       
  1025     // Print to log file
       
  1026     iLog->Log( KTestEditorSetTextL );
       
  1027 
       
  1028     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1029     CleanupStack::PushL( phoneNumEditor );
       
  1030     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1031     CleanupStack::PushL( container );
       
  1032     phoneNumEditor->SetContainerWindowL( *container );
       
  1033 
       
  1034     TResourceReader reader;
       
  1035     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1036     phoneNumEditor->ConstructFromResourceL( reader );
       
  1037     CleanupStack::PopAndDestroy();
       
  1038 
       
  1039     _LIT( KText, "text" );
       
  1040     TBuf<KBufSize> text( KText );
       
  1041     phoneNumEditor->SetTextL( &text );
       
  1042 
       
  1043     CleanupStack::PopAndDestroy( container );
       
  1044     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1045     return KErrNone;
       
  1046 
       
  1047     }
       
  1048 
       
  1049 // -----------------------------------------------------------------------------
       
  1050 // CTestDOMEditor::TestEditorCancelFepTransactionL
       
  1051 // -----------------------------------------------------------------------------
       
  1052 //
       
  1053 TInt CTestDOMEditor::TestEditorCancelFepTransactionL( CStifItemParser& /*aItem*/ )
       
  1054     {
       
  1055 
       
  1056     // Print to UI
       
  1057     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1058     _LIT( KTestEditorCancelFepTransaction, "In EditorCancelFepTransaction" );
       
  1059     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCancelFepTransaction );
       
  1060     // Print to log file
       
  1061     iLog->Log( KTestEditorCancelFepTransaction );
       
  1062 
       
  1063     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1064     CleanupStack::PushL( phoneNumEditor );
       
  1065     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1066     CleanupStack::PushL( container );
       
  1067     phoneNumEditor->SetContainerWindowL( *container );
       
  1068 
       
  1069     TResourceReader reader;
       
  1070     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1071     phoneNumEditor->ConstructFromResourceL( reader );
       
  1072     CleanupStack::PopAndDestroy();
       
  1073 
       
  1074     phoneNumEditor->CancelFepTransaction();
       
  1075 
       
  1076     CleanupStack::PopAndDestroy( container );
       
  1077     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1078     return KErrNone;
       
  1079 
       
  1080     }
       
  1081 
       
  1082 // -----------------------------------------------------------------------------
       
  1083 // CTestDOMEditor::TestEditorUpdateScrollBarsL
       
  1084 // -----------------------------------------------------------------------------
       
  1085 //
       
  1086 TInt CTestDOMEditor::TestEditorUpdateScrollBarsL( CStifItemParser& /*aItem*/ )
       
  1087     {
       
  1088 
       
  1089     // Print to UI
       
  1090     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1091     _LIT( KTestEditorUpdateScrollBarsL, "In EditorUpdateScrollBarsL" );
       
  1092     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorUpdateScrollBarsL );
       
  1093     // Print to log file
       
  1094     iLog->Log( KTestEditorUpdateScrollBarsL );
       
  1095 
       
  1096     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1097     CleanupStack::PushL( phoneNumEditor );
       
  1098     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1099     CleanupStack::PushL( container );
       
  1100     phoneNumEditor->SetContainerWindowL( *container );
       
  1101 
       
  1102     TResourceReader reader;
       
  1103     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1104     phoneNumEditor->ConstructFromResourceL( reader );
       
  1105     CleanupStack::PopAndDestroy();
       
  1106 
       
  1107     phoneNumEditor->UpdateScrollBarsL();
       
  1108 
       
  1109     CleanupStack::PopAndDestroy( container );
       
  1110     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1111     return KErrNone;
       
  1112 
       
  1113     }
       
  1114 
       
  1115 // -----------------------------------------------------------------------------
       
  1116 // CTestDOMEditor::TestEditorCreateScrollBarFrameL
       
  1117 // -----------------------------------------------------------------------------
       
  1118 //
       
  1119 TInt CTestDOMEditor::TestEditorCreateScrollBarFrameL( CStifItemParser& /*aItem*/ )
       
  1120     {
       
  1121 
       
  1122     // Print to UI
       
  1123     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1124     _LIT( KTestEditorCreateScrollBarFrameL, "In EditorCreateScrollBarFrameL" );
       
  1125     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCreateScrollBarFrameL );
       
  1126     // Print to log file
       
  1127     iLog->Log( KTestEditorCreateScrollBarFrameL );
       
  1128 
       
  1129     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1130     CleanupStack::PushL( phoneNumEditor );
       
  1131     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1132     CleanupStack::PushL( container );
       
  1133     phoneNumEditor->SetContainerWindowL( *container );
       
  1134 
       
  1135     TResourceReader reader;
       
  1136     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1137     phoneNumEditor->ConstructFromResourceL( reader );
       
  1138     CleanupStack::PopAndDestroy();
       
  1139 
       
  1140     CEikScrollBarFrame* sbFrame = phoneNumEditor->CreateScrollBarFrameL();
       
  1141     CleanupStack::PushL( sbFrame );
       
  1142     STIF_ASSERT_NULL( sbFrame );
       
  1143 
       
  1144     CleanupStack::PopAndDestroy( sbFrame );
       
  1145     CleanupStack::PopAndDestroy( container );
       
  1146     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1147     return KErrNone;
       
  1148 
       
  1149     }
       
  1150 
       
  1151 // -----------------------------------------------------------------------------
       
  1152 // CTestDOMEditor::TestEditorScrollBarFrameL
       
  1153 // -----------------------------------------------------------------------------
       
  1154 //
       
  1155 TInt CTestDOMEditor::TestEditorScrollBarFrameL( CStifItemParser& /*aItem*/ )
       
  1156     {
       
  1157 
       
  1158     // Print to UI
       
  1159     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1160     _LIT( KTestEditorScrollBarFrame, "In EditorScrollBarFrame" );
       
  1161     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorScrollBarFrame );
       
  1162     // Print to log file
       
  1163     iLog->Log( KTestEditorScrollBarFrame );
       
  1164 
       
  1165     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1166     CleanupStack::PushL( phoneNumEditor );
       
  1167     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1168     CleanupStack::PushL( container );
       
  1169     phoneNumEditor->SetContainerWindowL( *container );
       
  1170 
       
  1171     TResourceReader reader;
       
  1172     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1173     phoneNumEditor->ConstructFromResourceL( reader );
       
  1174     CleanupStack::PopAndDestroy();
       
  1175 
       
  1176     CEikScrollBarFrame* sbFrame = phoneNumEditor->ScrollBarFrame();
       
  1177     STIF_ASSERT_NULL( sbFrame );
       
  1178 
       
  1179     CleanupStack::PopAndDestroy( container );
       
  1180     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1181     return KErrNone;
       
  1182 
       
  1183     }
       
  1184 
       
  1185 // -----------------------------------------------------------------------------
       
  1186 // CTestDOMEditor::TestEditorLineCursorWidthL
       
  1187 // -----------------------------------------------------------------------------
       
  1188 //
       
  1189 TInt CTestDOMEditor::TestEditorLineCursorWidthL( CStifItemParser& /*aItem*/ )
       
  1190     {
       
  1191 
       
  1192     // Print to UI
       
  1193     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1194     _LIT( KTestEditorLineCursorWidth, "In EditorLineCursorWidth" );
       
  1195     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorLineCursorWidth );
       
  1196     // Print to log file
       
  1197     iLog->Log( KTestEditorLineCursorWidth );
       
  1198 
       
  1199     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1200     CleanupStack::PushL( phoneNumEditor );
       
  1201     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1202     CleanupStack::PushL( container );
       
  1203     phoneNumEditor->SetContainerWindowL( *container );
       
  1204 
       
  1205     TResourceReader reader;
       
  1206     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1207     phoneNumEditor->ConstructFromResourceL( reader );
       
  1208     CleanupStack::PopAndDestroy();
       
  1209 
       
  1210     TInt lineCursorWidth = phoneNumEditor->LineCursorWidth();
       
  1211     STIF_ASSERT_EQUALS( 0, lineCursorWidth );
       
  1212 
       
  1213     CleanupStack::PopAndDestroy( container );
       
  1214     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1215     return KErrNone;
       
  1216 
       
  1217     }
       
  1218 
       
  1219 // -----------------------------------------------------------------------------
       
  1220 // CTestDOMEditor::TestEditorMarginsL
       
  1221 // -----------------------------------------------------------------------------
       
  1222 //
       
  1223 TInt CTestDOMEditor::TestEditorMarginsL( CStifItemParser& /*aItem*/ )
       
  1224     {
       
  1225 
       
  1226     // Print to UI
       
  1227     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1228     _LIT( KTestEditorMargins, "In EditorMargins" );
       
  1229     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorMargins );
       
  1230     // Print to log file
       
  1231     iLog->Log( KTestEditorMargins );
       
  1232 
       
  1233     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1234     CleanupStack::PushL( phoneNumEditor );
       
  1235     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1236     CleanupStack::PushL( container );
       
  1237     phoneNumEditor->SetContainerWindowL( *container );
       
  1238 
       
  1239     TResourceReader reader;
       
  1240     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1241     phoneNumEditor->ConstructFromResourceL( reader );
       
  1242     CleanupStack::PopAndDestroy();
       
  1243 
       
  1244     TMargins8 margins = phoneNumEditor->Margins();
       
  1245     TInt left = margins.iLeft;
       
  1246     STIF_ASSERT_EQUALS( 0, left );
       
  1247 
       
  1248     CleanupStack::PopAndDestroy( container );
       
  1249     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1250     return KErrNone;
       
  1251 
       
  1252     }
       
  1253 
       
  1254 // -----------------------------------------------------------------------------
       
  1255 // CTestDOMEditor::TestEditorChangeEditorModeL
       
  1256 // -----------------------------------------------------------------------------
       
  1257 //
       
  1258 TInt CTestDOMEditor::TestEditorChangeEditorModeL( CStifItemParser& /*aItem*/ )
       
  1259     {
       
  1260 
       
  1261     // Print to UI
       
  1262     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1263     _LIT( KTestEditorChangeEditorMode, "In EditorChangeEditorMode" );
       
  1264     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorChangeEditorMode );
       
  1265     // Print to log file
       
  1266     iLog->Log( KTestEditorChangeEditorMode );
       
  1267 
       
  1268     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1269     CleanupStack::PushL( phoneNumEditor );
       
  1270     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1271     CleanupStack::PushL( container );
       
  1272     phoneNumEditor->SetContainerWindowL( *container );
       
  1273 
       
  1274     TResourceReader reader;
       
  1275     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1276     phoneNumEditor->ConstructFromResourceL( reader );
       
  1277     CleanupStack::PopAndDestroy();
       
  1278 
       
  1279     TInt code = 1;
       
  1280     TInt mode = phoneNumEditor->ChangeEditorMode();
       
  1281     STIF_ASSERT_EQUALS( code, mode );
       
  1282 
       
  1283     CleanupStack::PopAndDestroy( container );
       
  1284     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1285     return KErrNone;
       
  1286 
       
  1287     }
       
  1288 
       
  1289 // -----------------------------------------------------------------------------
       
  1290 // CTestDOMEditor::TestEditorGetEditorModeL
       
  1291 // -----------------------------------------------------------------------------
       
  1292 //
       
  1293 TInt CTestDOMEditor::TestEditorGetEditorModeL( CStifItemParser& /*aItem*/ )
       
  1294     {
       
  1295 
       
  1296     // Print to UI
       
  1297     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1298     _LIT( KTestEditorGetEditorMode, "In EditorGetEditorMode" );
       
  1299     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorGetEditorMode );
       
  1300     // Print to log file
       
  1301     iLog->Log( KTestEditorGetEditorMode );
       
  1302 
       
  1303     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1304     CleanupStack::PushL( phoneNumEditor );
       
  1305     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1306     CleanupStack::PushL( container );
       
  1307     phoneNumEditor->SetContainerWindowL( *container );
       
  1308 
       
  1309     TResourceReader reader;
       
  1310     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1311     phoneNumEditor->ConstructFromResourceL( reader );
       
  1312     CleanupStack::PopAndDestroy();
       
  1313 
       
  1314     TInt mode = phoneNumEditor->GetEditorMode();
       
  1315     STIF_ASSERT_EQUALS( 2, mode );
       
  1316 
       
  1317     CleanupStack::PopAndDestroy( container );
       
  1318     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1319     return KErrNone;
       
  1320 
       
  1321     }
       
  1322 
       
  1323 // -----------------------------------------------------------------------------
       
  1324 // CTestDOMEditor::TestEditorResetEditorToDefaultValuesL
       
  1325 // -----------------------------------------------------------------------------
       
  1326 //
       
  1327 TInt CTestDOMEditor::TestEditorResetEditorToDefaultValuesL( CStifItemParser& /*aItem*/ )
       
  1328     {
       
  1329 
       
  1330     // Print to UI
       
  1331     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1332     _LIT( KTestEditorResetEditorToDefaultValues, "In EditorResetEditorToDefaultValues" );
       
  1333     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorResetEditorToDefaultValues );
       
  1334     // Print to log file
       
  1335     iLog->Log( KTestEditorResetEditorToDefaultValues );
       
  1336 
       
  1337     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1338     CleanupStack::PushL( phoneNumEditor );
       
  1339     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1340     CleanupStack::PushL( container );
       
  1341     phoneNumEditor->SetContainerWindowL( *container );
       
  1342 
       
  1343     TResourceReader reader;
       
  1344     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1345     phoneNumEditor->ConstructFromResourceL( reader );
       
  1346     CleanupStack::PopAndDestroy();
       
  1347 
       
  1348     phoneNumEditor->ResetEditorToDefaultValues();
       
  1349 
       
  1350     CleanupStack::PopAndDestroy( container );
       
  1351     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1352     return KErrNone;
       
  1353 
       
  1354     }
       
  1355 
       
  1356 // -----------------------------------------------------------------------------
       
  1357 // CTestDOMEditor::TestEditorHandlePointerEventL
       
  1358 // -----------------------------------------------------------------------------
       
  1359 //
       
  1360 TInt CTestDOMEditor::TestEditorHandlePointerEventL( CStifItemParser& /*aItem*/ )
       
  1361     {
       
  1362 
       
  1363     // Print to UI
       
  1364     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1365     _LIT( KTestEditorHandlePointerEventL, "In EditorHandlePointerEventL" );
       
  1366     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorHandlePointerEventL );
       
  1367     // Print to log file
       
  1368     iLog->Log( KTestEditorHandlePointerEventL );
       
  1369 
       
  1370     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1371     CleanupStack::PushL( phoneNumEditor );
       
  1372     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1373     CleanupStack::PushL( container );
       
  1374     phoneNumEditor->SetContainerWindowL( *container );
       
  1375 
       
  1376     TResourceReader reader;
       
  1377     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1378     phoneNumEditor->ConstructFromResourceL( reader );
       
  1379     CleanupStack::PopAndDestroy();
       
  1380 
       
  1381     TPointerEvent event;
       
  1382     event.iType = TPointerEvent::EButton1Down;
       
  1383     event.iModifiers = 0;
       
  1384     TPoint eventPos( KOuterRectAx, KOuterRectAy );
       
  1385     event.iPosition = eventPos;
       
  1386     event.iParentPosition = eventPos;
       
  1387 
       
  1388     phoneNumEditor->HandlePointerEventL( event );
       
  1389 
       
  1390     CleanupStack::PopAndDestroy( container );
       
  1391     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1392     return KErrNone;
       
  1393 
       
  1394     }
       
  1395 
       
  1396 // -----------------------------------------------------------------------------
       
  1397 // CTestDOMEditor::TestEditorCcpuIsFocusedL
       
  1398 // -----------------------------------------------------------------------------
       
  1399 //
       
  1400 TInt CTestDOMEditor::TestEditorCcpuIsFocusedL( CStifItemParser& /*aItem*/ )
       
  1401     {
       
  1402 
       
  1403     // Print to UI
       
  1404     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1405     _LIT( KTestEditorCcpuIsFocused, "In EditorCcpuIsFocused" );
       
  1406     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuIsFocused );
       
  1407     // Print to log file
       
  1408     iLog->Log( KTestEditorCcpuIsFocused );
       
  1409 
       
  1410     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1411     CleanupStack::PushL( phoneNumEditor );
       
  1412     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1413     CleanupStack::PushL( container );
       
  1414     phoneNumEditor->SetContainerWindowL( *container );
       
  1415 
       
  1416     TResourceReader reader;
       
  1417     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1418     phoneNumEditor->ConstructFromResourceL( reader );
       
  1419     CleanupStack::PopAndDestroy();
       
  1420 
       
  1421     TBool isFocused = phoneNumEditor->CcpuIsFocused();
       
  1422     STIF_ASSERT_FALSE( isFocused );
       
  1423 
       
  1424     CleanupStack::PopAndDestroy( container );
       
  1425     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1426     return KErrNone;
       
  1427 
       
  1428     }
       
  1429 
       
  1430 // -----------------------------------------------------------------------------
       
  1431 // CTestDOMEditor::TestEditorCcpuCanCutL
       
  1432 // -----------------------------------------------------------------------------
       
  1433 //
       
  1434 TInt CTestDOMEditor::TestEditorCcpuCanCutL( CStifItemParser& /*aItem*/ )
       
  1435     {
       
  1436 
       
  1437     // Print to UI
       
  1438     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1439     _LIT( KTestEditorCcpuCanCut, "In EditorCcpuCanCut" );
       
  1440     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuCanCut );
       
  1441     // Print to log file
       
  1442     iLog->Log( KTestEditorCcpuCanCut );
       
  1443 
       
  1444     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1445     CleanupStack::PushL( phoneNumEditor );
       
  1446     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1447     CleanupStack::PushL( container );
       
  1448     phoneNumEditor->SetContainerWindowL( *container );
       
  1449 
       
  1450     TResourceReader reader;
       
  1451     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1452     phoneNumEditor->ConstructFromResourceL( reader );
       
  1453     CleanupStack::PopAndDestroy();
       
  1454 
       
  1455     TBool canCut = phoneNumEditor->CcpuCanCut();
       
  1456     STIF_ASSERT_FALSE( canCut );
       
  1457 
       
  1458     CleanupStack::PopAndDestroy( container );
       
  1459     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1460     return KErrNone;
       
  1461 
       
  1462     }
       
  1463 
       
  1464 // -----------------------------------------------------------------------------
       
  1465 // CTestDOMEditor::TestEditorCcpuCutL
       
  1466 // -----------------------------------------------------------------------------
       
  1467 //
       
  1468 TInt CTestDOMEditor::TestEditorCcpuCutL( CStifItemParser& /*aItem*/ )
       
  1469     {
       
  1470 
       
  1471     // Print to UI
       
  1472     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1473     _LIT( KTestEditorCcpuCutL, "In EditorCcpuCutL" );
       
  1474     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuCutL );
       
  1475     // Print to log file
       
  1476     iLog->Log( KTestEditorCcpuCutL );
       
  1477 
       
  1478     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1479     CleanupStack::PushL( phoneNumEditor );
       
  1480     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1481     CleanupStack::PushL( container );
       
  1482     phoneNumEditor->SetContainerWindowL( *container );
       
  1483 
       
  1484     TResourceReader reader;
       
  1485     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1486     phoneNumEditor->ConstructFromResourceL( reader );
       
  1487     CleanupStack::PopAndDestroy();
       
  1488 
       
  1489     phoneNumEditor->CcpuCutL();
       
  1490 
       
  1491     CleanupStack::PopAndDestroy( container );
       
  1492     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1493     return KErrNone;
       
  1494 
       
  1495     }
       
  1496 
       
  1497 // -----------------------------------------------------------------------------
       
  1498 // CTestDOMEditor::TestEditorCcpuCanCopyL
       
  1499 // -----------------------------------------------------------------------------
       
  1500 //
       
  1501 TInt CTestDOMEditor::TestEditorCcpuCanCopyL( CStifItemParser& /*aItem*/ )
       
  1502     {
       
  1503 
       
  1504     // Print to UI
       
  1505     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1506     _LIT( KTestEditorCcpuCanCopy, "In EditorCcpuCanCopy" );
       
  1507     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuCanCopy );
       
  1508     // Print to log file
       
  1509     iLog->Log( KTestEditorCcpuCanCopy );
       
  1510 
       
  1511     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1512     CleanupStack::PushL( phoneNumEditor );
       
  1513     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1514     CleanupStack::PushL( container );
       
  1515     phoneNumEditor->SetContainerWindowL( *container );
       
  1516 
       
  1517     TResourceReader reader;
       
  1518     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1519     phoneNumEditor->ConstructFromResourceL( reader );
       
  1520     CleanupStack::PopAndDestroy();
       
  1521 
       
  1522     TBool canCopy = phoneNumEditor->CcpuCanCopy();
       
  1523     STIF_ASSERT_FALSE( canCopy );
       
  1524 
       
  1525     CleanupStack::PopAndDestroy( container );
       
  1526     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1527     return KErrNone;
       
  1528 
       
  1529     }
       
  1530 
       
  1531 // -----------------------------------------------------------------------------
       
  1532 // CTestDOMEditor::TestEditorCcpuCopyL
       
  1533 // -----------------------------------------------------------------------------
       
  1534 //
       
  1535 TInt CTestDOMEditor::TestEditorCcpuCopyL( CStifItemParser& /*aItem*/ )
       
  1536     {
       
  1537 
       
  1538     // Print to UI
       
  1539     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1540     _LIT( KTestEditorCcpuCopyL, "In EditorCcpuCopyL" );
       
  1541     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuCopyL );
       
  1542     // Print to log file
       
  1543     iLog->Log( KTestEditorCcpuCopyL );
       
  1544 
       
  1545     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1546     CleanupStack::PushL( phoneNumEditor );
       
  1547     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1548     CleanupStack::PushL( container );
       
  1549     phoneNumEditor->SetContainerWindowL( *container );
       
  1550 
       
  1551     TResourceReader reader;
       
  1552     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1553     phoneNumEditor->ConstructFromResourceL( reader );
       
  1554     CleanupStack::PopAndDestroy();
       
  1555 
       
  1556     phoneNumEditor->CcpuCopyL();
       
  1557 
       
  1558     CleanupStack::PopAndDestroy( container );
       
  1559     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1560     return KErrNone;
       
  1561 
       
  1562     }
       
  1563 
       
  1564 // -----------------------------------------------------------------------------
       
  1565 // CTestDOMEditor::TestEditorCcpuCanPasteL
       
  1566 // -----------------------------------------------------------------------------
       
  1567 //
       
  1568 TInt CTestDOMEditor::TestEditorCcpuCanPasteL( CStifItemParser& /*aItem*/ )
       
  1569     {
       
  1570 
       
  1571     // Print to UI
       
  1572     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1573     _LIT( KTestEditorCcpuCanPaste, "In EditorCcpuCanPaste" );
       
  1574     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuCanPaste );
       
  1575     // Print to log file
       
  1576     iLog->Log( KTestEditorCcpuCanPaste );
       
  1577 
       
  1578     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1579     CleanupStack::PushL( phoneNumEditor );
       
  1580     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1581     CleanupStack::PushL( container );
       
  1582     phoneNumEditor->SetContainerWindowL( *container );
       
  1583 
       
  1584     TResourceReader reader;
       
  1585     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1586     phoneNumEditor->ConstructFromResourceL( reader );
       
  1587     CleanupStack::PopAndDestroy();
       
  1588 
       
  1589     TBool canPaste = phoneNumEditor->CcpuCanPaste();
       
  1590     STIF_ASSERT_FALSE( canPaste );
       
  1591 
       
  1592     CleanupStack::PopAndDestroy( container );
       
  1593     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1594     return KErrNone;
       
  1595 
       
  1596     }
       
  1597 
       
  1598 // -----------------------------------------------------------------------------
       
  1599 // CTestDOMEditor::TestEditorCcpuPasteL
       
  1600 // -----------------------------------------------------------------------------
       
  1601 //
       
  1602 TInt CTestDOMEditor::TestEditorCcpuPasteL( CStifItemParser& /*aItem*/ )
       
  1603     {
       
  1604 
       
  1605     // Print to UI
       
  1606     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1607     _LIT( KTestEditorCcpuPasteL, "In EditorCcpuPasteL" );
       
  1608     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuPasteL );
       
  1609     // Print to log file
       
  1610     iLog->Log( KTestEditorCcpuPasteL );
       
  1611 
       
  1612     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1613     CleanupStack::PushL( phoneNumEditor );
       
  1614     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1615     CleanupStack::PushL( container );
       
  1616     phoneNumEditor->SetContainerWindowL( *container );
       
  1617 
       
  1618     TResourceReader reader;
       
  1619     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1620     phoneNumEditor->ConstructFromResourceL( reader );
       
  1621     CleanupStack::PopAndDestroy();
       
  1622 
       
  1623     phoneNumEditor->CcpuPasteL();
       
  1624 
       
  1625     CleanupStack::PopAndDestroy( container );
       
  1626     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1627     return KErrNone;
       
  1628 
       
  1629     }
       
  1630 
       
  1631 // -----------------------------------------------------------------------------
       
  1632 // CTestDOMEditor::TestEditorCcpuCanUndoL
       
  1633 // -----------------------------------------------------------------------------
       
  1634 //
       
  1635 TInt CTestDOMEditor::TestEditorCcpuCanUndoL( CStifItemParser& /*aItem*/ )
       
  1636     {
       
  1637 
       
  1638     // Print to UI
       
  1639     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1640     _LIT( KTestEditorCcpuCanUndo, "In EditorCcpuCanUndo" );
       
  1641     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuCanUndo );
       
  1642     // Print to log file
       
  1643     iLog->Log( KTestEditorCcpuCanUndo );
       
  1644 
       
  1645     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1646     CleanupStack::PushL( phoneNumEditor );
       
  1647     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1648     CleanupStack::PushL( container );
       
  1649     phoneNumEditor->SetContainerWindowL( *container );
       
  1650 
       
  1651     TResourceReader reader;
       
  1652     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1653     phoneNumEditor->ConstructFromResourceL( reader );
       
  1654     CleanupStack::PopAndDestroy();
       
  1655 
       
  1656     TBool canUndo = phoneNumEditor->CcpuCanUndo();
       
  1657     STIF_ASSERT_FALSE( canUndo );
       
  1658 
       
  1659     CleanupStack::PopAndDestroy( container );
       
  1660     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1661     return KErrNone;
       
  1662 
       
  1663     }
       
  1664 
       
  1665 // -----------------------------------------------------------------------------
       
  1666 // CTestDOMEditor::TestEditorCcpuUndoL
       
  1667 // -----------------------------------------------------------------------------
       
  1668 //
       
  1669 TInt CTestDOMEditor::TestEditorCcpuUndoL( CStifItemParser& /*aItem*/ )
       
  1670     {
       
  1671 
       
  1672     // Print to UI
       
  1673     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1674     _LIT( KTestEditorCcpuUndoL, "In EditorCcpuUndoL" );
       
  1675     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorCcpuUndoL );
       
  1676     // Print to log file
       
  1677     iLog->Log( KTestEditorCcpuUndoL );
       
  1678 
       
  1679     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1680     CleanupStack::PushL( phoneNumEditor );
       
  1681     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1682     CleanupStack::PushL( container );
       
  1683     phoneNumEditor->SetContainerWindowL( *container );
       
  1684 
       
  1685     TResourceReader reader;
       
  1686     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1687     phoneNumEditor->ConstructFromResourceL( reader );
       
  1688     CleanupStack::PopAndDestroy();
       
  1689 
       
  1690     phoneNumEditor->CcpuUndoL();
       
  1691 
       
  1692     CleanupStack::PopAndDestroy( container );
       
  1693     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1694     return KErrNone;
       
  1695 
       
  1696     }
       
  1697 
       
  1698 // -----------------------------------------------------------------------------
       
  1699 // CTestDOMEditor::TestEditorOpenVKBL
       
  1700 // -----------------------------------------------------------------------------
       
  1701 //
       
  1702 TInt CTestDOMEditor::TestEditorOpenVKBL( CStifItemParser& /*aItem*/ )
       
  1703     {
       
  1704 
       
  1705     // Print to UI
       
  1706     _LIT( KTestDOMEditor, "testdomeditor" );
       
  1707     _LIT( KTestEditorOpenVKB, "In EditorOpenVKB" );
       
  1708     TestModuleIf().Printf( 0, KTestDOMEditor, KTestEditorOpenVKB );
       
  1709     // Print to log file
       
  1710     iLog->Log( KTestEditorOpenVKB );
       
  1711 
       
  1712     CAknPhoneNumberEditor* phoneNumEditor = new ( ELeave ) CAknPhoneNumberEditor;
       
  1713     CleanupStack::PushL( phoneNumEditor );
       
  1714     CTestDOMEditorContainer* container = CTestDOMEditorContainer::NewL();
       
  1715     CleanupStack::PushL( container );
       
  1716     phoneNumEditor->SetContainerWindowL( *container );
       
  1717 
       
  1718     TResourceReader reader;
       
  1719     CCoeEnv::Static()->CreateResourceReaderLC( reader , R_PHONENUM_EDITOR );
       
  1720     phoneNumEditor->ConstructFromResourceL( reader );
       
  1721     CleanupStack::PopAndDestroy();
       
  1722 
       
  1723     phoneNumEditor->OpenVKB();
       
  1724 
       
  1725     CleanupStack::PopAndDestroy( container );
       
  1726     CleanupStack::PopAndDestroy( phoneNumEditor );
       
  1727     return KErrNone;
       
  1728 
       
  1729     }
       
  1730 
       
  1731