classicui_plat/notes_api/tsrc/src/testsdknotesblocksnc.cpp
changeset 49 31c16e0c5e3e
equal deleted inserted replaced
40:7165f928e888 49:31c16e0c5e3e
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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 AknNoteControl.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <aknnotecontrol.h>
       
    20 #include <aknnotedialog.h>
       
    21 #include <barsread.h>
       
    22 #include <coemain.h>
       
    23 #include <coeaui.h>
       
    24 #include <testsdknotes.rsg>
       
    25 
       
    26 #include "testsdknotesnotecontrol.h"
       
    27 #include "testsdknotes.h"
       
    28 #include "testsdknotes.hrh"
       
    29 
       
    30 const TInt KLength = 10;
       
    31 
       
    32 // ============================ MEMBER FUNCTIONS ===============================
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CTestSDKNotes::TestNNCCAknNoteControlL
       
    36 // -----------------------------------------------------------------------------
       
    37 TInt CTestSDKNotes::TestNNCCAknNoteControlL( CStifItemParser& /*aItem*/ )
       
    38     {
       
    39     CAknNoteControl* noteControl = new (ELeave) CAknNoteControl;
       
    40     CleanupStack::PushL( noteControl );
       
    41     STIF_ASSERT_NOT_NULL( noteControl );
       
    42     
       
    43     CleanupStack::PopAndDestroy( noteControl );
       
    44     
       
    45     return KErrNone;
       
    46     
       
    47     }
       
    48 
       
    49 // -----------------------------------------------------------------------------
       
    50 // CTestSDKNotes::TestNNCDeconstructorL
       
    51 // -----------------------------------------------------------------------------
       
    52 TInt CTestSDKNotes::TestNNCDeconstructorL( CStifItemParser& /*aItem*/ )
       
    53     {
       
    54     CAknNoteControl* noteControl = new (ELeave) CAknNoteControl;
       
    55     CleanupStack::PushL( noteControl );
       
    56     STIF_ASSERT_NOT_NULL( noteControl );
       
    57     
       
    58     CleanupStack::Pop( noteControl );
       
    59     delete noteControl;
       
    60     
       
    61     return KErrNone;
       
    62     }
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CTestSDKNotes::TestNNCSetImageL
       
    66 // -----------------------------------------------------------------------------
       
    67 TInt CTestSDKNotes::TestNNCSetImageL( CStifItemParser& /*aItem*/ )
       
    68     {
       
    69     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
    70     CleanupStack::PushL( noteDialog );
       
    71     STIF_ASSERT_NOT_NULL( noteDialog );
       
    72     CleanupStack::Pop( noteDialog );
       
    73     
       
    74     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
    75     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
    76     STIF_ASSERT_NOT_NULL( noteControl );
       
    77     
       
    78     CEikImage* image = new (ELeave) CEikImage;
       
    79     CleanupStack::PushL( image );
       
    80     
       
    81     TResourceReader reader;
       
    82     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_ANDIMAGE );
       
    83     image->ConstructFromResourceL( reader );
       
    84     CleanupStack::PopAndDestroy();
       
    85     noteControl->SetImageL( image );
       
    86     
       
    87     CleanupStack::Pop( image );
       
    88     CleanupStack::PopAndDestroy( noteDialog );
       
    89     
       
    90     return KErrNone;
       
    91     
       
    92     }
       
    93 
       
    94 // -----------------------------------------------------------------------------
       
    95 // CTestSDKNotes::TestNNCSetAnimationL
       
    96 // -----------------------------------------------------------------------------
       
    97 TInt CTestSDKNotes::TestNNCSetAnimationL( CStifItemParser& /*aItem*/ )
       
    98     {
       
    99     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   100     CleanupStack::PushL( noteDialog );
       
   101     STIF_ASSERT_NOT_NULL( noteDialog );
       
   102     CleanupStack::Pop( noteDialog );
       
   103     
       
   104     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   105     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   106     STIF_ASSERT_NOT_NULL( noteControl );
       
   107     
       
   108     noteControl->SetAnimationL( R_TESTSDK_ANIMATIONDATA );
       
   109     CleanupStack::PopAndDestroy( noteDialog );
       
   110     
       
   111     return KErrNone;
       
   112     
       
   113     }
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CTestSDKNotes::TestNNCSetIconL
       
   117 // -----------------------------------------------------------------------------
       
   118 TInt CTestSDKNotes::TestNNCSetIconL( CStifItemParser& /*aItem*/ )
       
   119     {
       
   120     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   121     CleanupStack::PushL( noteDialog );
       
   122     STIF_ASSERT_NOT_NULL( noteDialog );
       
   123     CleanupStack::Pop( noteDialog );
       
   124     
       
   125     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   126     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   127     STIF_ASSERT_NOT_NULL( noteControl );
       
   128     
       
   129     CEikImage* image = new (ELeave) CEikImage;
       
   130     CleanupStack::PushL( image );
       
   131     
       
   132     TResourceReader reader;
       
   133     CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_ANDIMAGE );
       
   134     image->ConstructFromResourceL( reader );
       
   135     CleanupStack::PopAndDestroy();
       
   136     noteControl->SetIconL( image );
       
   137     
       
   138     CleanupStack::Pop( image );
       
   139     CleanupStack::PopAndDestroy( noteDialog );
       
   140     
       
   141     return KErrNone;
       
   142     
       
   143     }
       
   144 
       
   145 // -----------------------------------------------------------------------------
       
   146 // CTestSDKNotes::TestNNCSetFinalProgressValueL
       
   147 // -----------------------------------------------------------------------------
       
   148 TInt CTestSDKNotes::TestNNCSetFinalProgressValueL( CStifItemParser& /*aItem*/ )
       
   149     {
       
   150     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   151     CleanupStack::PushL( noteDialog );
       
   152     STIF_ASSERT_NOT_NULL( noteDialog );
       
   153     CleanupStack::Pop( noteDialog );
       
   154     
       
   155     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLPROGRESS );
       
   156     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   157     STIF_ASSERT_NOT_NULL( noteControl );
       
   158     
       
   159     noteControl->CreateProgressBarL();
       
   160     CEikProgressInfo* progressInfo = noteControl->GetProgressInfo();
       
   161     STIF_ASSERT_NOT_NULL( progressInfo );
       
   162     
       
   163     const TInt progressValue = 10;
       
   164     noteControl->SetFinalProgressValue( progressValue );
       
   165     
       
   166     CleanupStack::PopAndDestroy( noteDialog );
       
   167     
       
   168     return KErrNone;
       
   169     
       
   170     }
       
   171 
       
   172 // -----------------------------------------------------------------------------
       
   173 // CTestSDKNotes::TestNNCIncrementBarsAndDrawL
       
   174 // -----------------------------------------------------------------------------
       
   175 TInt CTestSDKNotes::TestNNCIncrementBarsAndDrawL( CStifItemParser& /*aItem*/ )
       
   176     {
       
   177     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   178     CleanupStack::PushL( noteDialog );
       
   179     STIF_ASSERT_NOT_NULL( noteDialog );
       
   180     CleanupStack::Pop( noteDialog );
       
   181     
       
   182     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLPROGRESS );
       
   183     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   184     STIF_ASSERT_NOT_NULL( noteControl );
       
   185     
       
   186     noteControl->CreateProgressBarL();
       
   187     CEikProgressInfo* progressInfo = noteControl->GetProgressInfo();
       
   188     STIF_ASSERT_NOT_NULL( progressInfo );
       
   189     
       
   190     const TInt progressValue = 10;
       
   191     noteControl->SetFinalProgressValue( progressValue );
       
   192     const TInt increment = 2;
       
   193     noteControl->IncrementBarsAndDraw( increment );
       
   194     
       
   195     CleanupStack::PopAndDestroy( noteDialog );
       
   196     
       
   197     return KErrNone;
       
   198     
       
   199     }
       
   200 
       
   201 // -----------------------------------------------------------------------------
       
   202 // CTestSDKNotes::TestNNCCreateProgressBarL
       
   203 // -----------------------------------------------------------------------------
       
   204 TInt CTestSDKNotes::TestNNCCreateProgressBarL( CStifItemParser& /*aItem*/ )
       
   205     {
       
   206     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   207     CleanupStack::PushL( noteDialog );
       
   208     STIF_ASSERT_NOT_NULL( noteDialog );
       
   209     CleanupStack::Pop( noteDialog );
       
   210     
       
   211     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLPROGRESS );
       
   212     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   213     STIF_ASSERT_NOT_NULL( noteControl );
       
   214     
       
   215     noteControl->CreateProgressBarL();
       
   216     CEikProgressInfo* progressInfo = noteControl->GetProgressInfo();
       
   217     STIF_ASSERT_NOT_NULL( progressInfo );
       
   218     
       
   219     CleanupStack::PopAndDestroy( noteDialog );
       
   220     
       
   221     return KErrNone;
       
   222     
       
   223     }
       
   224 
       
   225 // -----------------------------------------------------------------------------
       
   226 // CTestSDKNotes::TestNNCGetProgressInfoL
       
   227 // -----------------------------------------------------------------------------
       
   228 TInt CTestSDKNotes::TestNNCGetProgressInfoL( CStifItemParser& /*aItem*/ )
       
   229     {
       
   230     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   231     CleanupStack::PushL( noteDialog );
       
   232     STIF_ASSERT_NOT_NULL( noteDialog );
       
   233     CleanupStack::Pop( noteDialog );
       
   234     
       
   235     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLPROGRESS );
       
   236     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   237     STIF_ASSERT_NOT_NULL( noteControl );
       
   238     
       
   239     noteControl->CreateProgressBarL();
       
   240     CEikProgressInfo* progressInfo = noteControl->GetProgressInfo();
       
   241     STIF_ASSERT_NOT_NULL( progressInfo );
       
   242     
       
   243     const TInt progressValue = 10;
       
   244     noteControl->SetFinalProgressValue( progressValue );
       
   245     const TInt increment = 2;
       
   246     noteControl->IncrementBarsAndDraw( increment );
       
   247     
       
   248     CleanupStack::PopAndDestroy( noteDialog );
       
   249     
       
   250     return KErrNone;
       
   251     
       
   252     }
       
   253 
       
   254 // -----------------------------------------------------------------------------
       
   255 // CTestSDKNotes::TestNNCStartAnimationL
       
   256 // -----------------------------------------------------------------------------
       
   257 TInt CTestSDKNotes::TestNNCStartAnimationL( CStifItemParser& /*aItem*/ )
       
   258     {
       
   259     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   260     CleanupStack::PushL( noteDialog );
       
   261     STIF_ASSERT_NOT_NULL( noteDialog );
       
   262     CleanupStack::Pop( noteDialog );
       
   263     
       
   264     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   265     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   266     STIF_ASSERT_NOT_NULL( noteControl );
       
   267     
       
   268     noteControl->SetAnimationL( R_TESTSDK_ANIMATIONDATA );
       
   269     noteControl->StartAnimationL();
       
   270     
       
   271     CleanupStack::PopAndDestroy( noteDialog );
       
   272     
       
   273     return KErrNone;
       
   274     
       
   275     }
       
   276 
       
   277 // -----------------------------------------------------------------------------
       
   278 // CTestSDKNotes::TestNNCCancelAnimationL
       
   279 // -----------------------------------------------------------------------------
       
   280 TInt CTestSDKNotes::TestNNCCancelAnimationL( CStifItemParser& /*aItem*/ )
       
   281     {
       
   282     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   283     CleanupStack::PushL( noteDialog );
       
   284     STIF_ASSERT_NOT_NULL( noteDialog );
       
   285     CleanupStack::Pop( noteDialog );
       
   286     
       
   287     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   288     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   289     STIF_ASSERT_NOT_NULL( noteControl );
       
   290     
       
   291     noteControl->SetAnimationL( R_TESTSDK_ANIMATIONDATA );
       
   292     noteControl->StartAnimationL();
       
   293     noteControl->CancelAnimation();
       
   294     
       
   295     CleanupStack::PopAndDestroy( noteDialog );
       
   296     
       
   297     return KErrNone;
       
   298     
       
   299     }
       
   300 
       
   301 // -----------------------------------------------------------------------------
       
   302 // CTestSDKNotes::TestNNCResetTextL
       
   303 // -----------------------------------------------------------------------------
       
   304 TInt CTestSDKNotes::TestNNCResetTextL( CStifItemParser& /*aItem*/ )
       
   305     {
       
   306     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   307     CleanupStack::PushL( noteDialog );
       
   308     STIF_ASSERT_NOT_NULL( noteDialog );
       
   309     CleanupStack::Pop( noteDialog );
       
   310     
       
   311     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   312     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   313     STIF_ASSERT_NOT_NULL( noteControl );
       
   314     
       
   315     _LIT( KText, "resettext" );
       
   316     TBuf<KLength> text( KText );
       
   317     noteControl->SetTextPluralityL( EFalse );
       
   318     noteControl->SetTextL( text );
       
   319     noteControl->ResetText();
       
   320     
       
   321     CleanupStack::PopAndDestroy( noteDialog );
       
   322     
       
   323     return KErrNone;
       
   324     
       
   325     }
       
   326 
       
   327 // -----------------------------------------------------------------------------
       
   328 // CTestSDKNotes::TestNNCSetTextL
       
   329 // -----------------------------------------------------------------------------
       
   330 TInt CTestSDKNotes::TestNNCSetTextL( CStifItemParser& aItem )
       
   331     {
       
   332     return TestNNCResetTextL( aItem );
       
   333     
       
   334     }
       
   335 
       
   336 // -----------------------------------------------------------------------------
       
   337 // CTestSDKNotes::TestNNCSetTextLineNumL
       
   338 // -----------------------------------------------------------------------------
       
   339 TInt CTestSDKNotes::TestNNCSetTextLineNumL( CStifItemParser& /*aItem*/ )
       
   340     {
       
   341     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   342     CleanupStack::PushL( noteDialog );
       
   343     STIF_ASSERT_NOT_NULL( noteDialog );
       
   344     CleanupStack::Pop( noteDialog );
       
   345     
       
   346     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   347     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   348     STIF_ASSERT_NOT_NULL( noteControl );
       
   349     
       
   350     _LIT( KText, "resettext" );
       
   351     TBuf<KLength> text( KText );
       
   352     noteControl->SetTextPluralityL( EFalse );
       
   353     noteControl->SetTextL( text, 1 );
       
   354     
       
   355     CleanupStack::PopAndDestroy( noteDialog );
       
   356     
       
   357     return KErrNone;
       
   358     
       
   359     }
       
   360 
       
   361 // -----------------------------------------------------------------------------
       
   362 // CTestSDKNotes::TestNNCSetTextNumberL
       
   363 // -----------------------------------------------------------------------------
       
   364 TInt CTestSDKNotes::TestNNCSetTextNumberL( CStifItemParser& /*aItem*/ )
       
   365     {
       
   366     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   367     CleanupStack::PushL( noteDialog );
       
   368     STIF_ASSERT_NOT_NULL( noteDialog );
       
   369     CleanupStack::Pop( noteDialog );
       
   370     
       
   371     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   372     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   373     STIF_ASSERT_NOT_NULL( noteControl );
       
   374     
       
   375     _LIT( KText, "resettext" );
       
   376     TBuf<KLength> text( KText );
       
   377     noteControl->SetTextPluralityL( EFalse );
       
   378     noteControl->SetTextL( text );
       
   379     noteControl->SetTextNumberL( 1 );
       
   380     
       
   381     CleanupStack::PopAndDestroy( noteDialog );
       
   382     
       
   383     return KErrNone;
       
   384     
       
   385     }
       
   386 
       
   387 // -----------------------------------------------------------------------------
       
   388 // CTestSDKNotes::TestNNCSetTextPluralityL
       
   389 // -----------------------------------------------------------------------------
       
   390 TInt CTestSDKNotes::TestNNCSetTextPluralityL( CStifItemParser& aItem )
       
   391     {
       
   392     return TestNNCResetTextL( aItem );
       
   393     
       
   394     }
       
   395 
       
   396 // -----------------------------------------------------------------------------
       
   397 // CTestSDKNotes::TestNNCNumberOfLinesL
       
   398 // -----------------------------------------------------------------------------
       
   399 TInt CTestSDKNotes::TestNNCNumberOfLinesL( CStifItemParser& /*aItem*/ )
       
   400     {
       
   401     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   402     CleanupStack::PushL( noteDialog );
       
   403     STIF_ASSERT_NOT_NULL( noteDialog );
       
   404     CleanupStack::Pop( noteDialog );
       
   405     
       
   406     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   407     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   408     STIF_ASSERT_NOT_NULL( noteControl );
       
   409     
       
   410     TInt num = noteControl->NumberOfLines();
       
   411     STIF_ASSERT_EQUALS( 0, num );
       
   412     
       
   413     CleanupStack::PopAndDestroy( noteDialog );
       
   414     
       
   415     return KErrNone;
       
   416     
       
   417     }
       
   418 
       
   419 // -----------------------------------------------------------------------------
       
   420 // CTestSDKNotes::TestNNCLayoutL
       
   421 // -----------------------------------------------------------------------------
       
   422 TInt CTestSDKNotes::TestNNCLayoutL( CStifItemParser& /*aItem*/ )
       
   423     {
       
   424     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   425     CleanupStack::PushL( noteDialog );
       
   426     STIF_ASSERT_NOT_NULL( noteDialog );
       
   427     CleanupStack::Pop( noteDialog );
       
   428     
       
   429     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   430     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   431     STIF_ASSERT_NOT_NULL( noteControl );
       
   432     
       
   433     noteControl->Layout();
       
   434     
       
   435     CleanupStack::PopAndDestroy( noteDialog );
       
   436     
       
   437     return KErrNone;
       
   438     
       
   439     }
       
   440 
       
   441 // -----------------------------------------------------------------------------
       
   442 // CTestSDKNotes::TestNNCNoteHeightL
       
   443 // -----------------------------------------------------------------------------
       
   444 TInt CTestSDKNotes::TestNNCNoteHeightL( CStifItemParser& /*aItem*/ )
       
   445     {
       
   446     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   447     CleanupStack::PushL( noteDialog );
       
   448     STIF_ASSERT_NOT_NULL( noteDialog );
       
   449     CleanupStack::Pop( noteDialog );
       
   450     
       
   451     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   452     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   453     STIF_ASSERT_NOT_NULL( noteControl );
       
   454     
       
   455     TInt height = noteControl->NoteHeight();
       
   456     STIF_ASSERT_NOT_EQUALS( 0, height );
       
   457     CleanupStack::PopAndDestroy( noteDialog );
       
   458     
       
   459     return KErrNone;
       
   460     
       
   461     }
       
   462 
       
   463 // -----------------------------------------------------------------------------
       
   464 // CTestSDKNotes::TestNNCNoteWidthL
       
   465 // -----------------------------------------------------------------------------
       
   466 TInt CTestSDKNotes::TestNNCNoteWidthL( CStifItemParser& /*aItem*/ )
       
   467     {
       
   468     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   469     CleanupStack::PushL( noteDialog );
       
   470     STIF_ASSERT_NOT_NULL( noteDialog );
       
   471     CleanupStack::Pop( noteDialog );
       
   472     
       
   473     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   474     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   475     STIF_ASSERT_NOT_NULL( noteControl );
       
   476     
       
   477     TInt height = noteControl->NoteWidth();
       
   478     STIF_ASSERT_NOT_EQUALS( 0, height );
       
   479     CleanupStack::PopAndDestroy( noteDialog );
       
   480     
       
   481     return KErrNone;
       
   482     
       
   483     }
       
   484 
       
   485 // -----------------------------------------------------------------------------
       
   486 // CTestSDKNotes::TestNNCHandlePointerEventL
       
   487 // -----------------------------------------------------------------------------
       
   488 TInt CTestSDKNotes::TestNNCHandlePointerEventL( CStifItemParser& /*aItem*/ )
       
   489     {
       
   490     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   491     CleanupStack::PushL( noteDialog );
       
   492     STIF_ASSERT_NOT_NULL( noteDialog );
       
   493     CleanupStack::Pop( noteDialog );
       
   494     
       
   495     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   496     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   497     STIF_ASSERT_NOT_NULL( noteControl );
       
   498     
       
   499     TPointerEvent event;
       
   500     event.iType = TPointerEvent::EButton1Down;
       
   501     event.iModifiers = 0;
       
   502     TPoint eventPos( 10, 30 );
       
   503     event.iPosition = eventPos;
       
   504     event.iParentPosition = eventPos;
       
   505     
       
   506     noteControl->HandlePointerEventL( event );
       
   507     
       
   508     CleanupStack::PopAndDestroy( noteDialog );
       
   509     
       
   510     return KErrNone;
       
   511     
       
   512     }
       
   513 
       
   514 // -----------------------------------------------------------------------------
       
   515 // CTestSDKNotes::TestNNCSetDynamicTextL
       
   516 // -----------------------------------------------------------------------------
       
   517 TInt CTestSDKNotes::TestNNCSetDynamicTextL( CStifItemParser& /*aItem*/ )
       
   518     {
       
   519     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   520     CleanupStack::PushL( noteDialog );
       
   521     STIF_ASSERT_NOT_NULL( noteDialog );
       
   522     CleanupStack::Pop( noteDialog );
       
   523     
       
   524     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   525     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   526     STIF_ASSERT_NOT_NULL( noteControl );
       
   527     
       
   528     _LIT( KText, "dynamic" );
       
   529     TBuf<KLength> text( KText );
       
   530     noteControl->SetDynamicTextL( text );
       
   531     CleanupStack::PopAndDestroy( noteDialog );
       
   532     
       
   533     return KErrNone;
       
   534     
       
   535     }
       
   536 
       
   537 // -----------------------------------------------------------------------------
       
   538 // CTestSDKNotes::TestNNCUpdateAndFormatLabelsL
       
   539 // -----------------------------------------------------------------------------
       
   540 TInt CTestSDKNotes::TestNNCUpdateAndFormatLabelsL( CStifItemParser& /*aItem*/ )
       
   541     {
       
   542     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   543     CleanupStack::PushL( noteDialog );
       
   544     STIF_ASSERT_NOT_NULL( noteDialog );
       
   545     CleanupStack::Pop( noteDialog );
       
   546     
       
   547     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   548     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   549     STIF_ASSERT_NOT_NULL( noteControl );
       
   550     
       
   551     _LIT( KLabel, "dynamic" );
       
   552     TBuf<KLength> label( KLabel );
       
   553     noteControl->UpdateAndFormatLabelsL( label );
       
   554     CleanupStack::PopAndDestroy( noteDialog );
       
   555     
       
   556     return KErrNone;
       
   557     
       
   558     }
       
   559 
       
   560 // -----------------------------------------------------------------------------
       
   561 // CTestSDKNotes::TestNNCUpdateLabelsLeaveL
       
   562 // -----------------------------------------------------------------------------
       
   563 TInt CTestSDKNotes::TestNNCUpdateLabelsLeaveL( CStifItemParser& /*aItem*/ )
       
   564     {
       
   565     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   566     CleanupStack::PushL( noteDialog );
       
   567     STIF_ASSERT_NOT_NULL( noteDialog );
       
   568     CleanupStack::Pop( noteDialog );
       
   569     
       
   570     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   571     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   572     STIF_ASSERT_NOT_NULL( noteControl );
       
   573     
       
   574     _LIT( KLabel, "dynamic" );
       
   575     TBuf<KLength> label( KLabel );
       
   576     noteControl->UpdateLabelsL( label );
       
   577     CleanupStack::PopAndDestroy( noteDialog );
       
   578     
       
   579     return KErrNone;
       
   580     
       
   581     }
       
   582 
       
   583 // -----------------------------------------------------------------------------
       
   584 // CTestSDKNotes::TestNNCUpdateLabelsL
       
   585 // -----------------------------------------------------------------------------
       
   586 TInt CTestSDKNotes::TestNNCUpdateLabelsL( CStifItemParser& /*aItem*/ )
       
   587     {
       
   588     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   589     CleanupStack::PushL( noteDialog );
       
   590     STIF_ASSERT_NOT_NULL( noteDialog );
       
   591     CleanupStack::Pop( noteDialog );
       
   592     
       
   593     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   594     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   595     STIF_ASSERT_NOT_NULL( noteControl );
       
   596     
       
   597     _LIT( KLabel, "dynamic" );
       
   598     TBuf<KLength> label( KLabel );
       
   599     noteControl->UpdateLabels( label );
       
   600     CleanupStack::PopAndDestroy( noteDialog );
       
   601     
       
   602     return KErrNone;
       
   603     
       
   604     }
       
   605 
       
   606 // -----------------------------------------------------------------------------
       
   607 // CTestSDKNotes::TestNNCSetLabelReserveLengthL
       
   608 // -----------------------------------------------------------------------------
       
   609 TInt CTestSDKNotes::TestNNCSetLabelReserveLengthL( CStifItemParser& /*aItem*/ )
       
   610     {
       
   611     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   612     CleanupStack::PushL( noteDialog );
       
   613     STIF_ASSERT_NOT_NULL( noteDialog );
       
   614     CleanupStack::Pop( noteDialog );
       
   615     
       
   616     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   617     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   618     STIF_ASSERT_NOT_NULL( noteControl );
       
   619     
       
   620     noteControl->SetLabelReserveLengthL();
       
   621     
       
   622     CleanupStack::PopAndDestroy( noteDialog );
       
   623     
       
   624     return KErrNone;
       
   625     
       
   626     }
       
   627 
       
   628 // -----------------------------------------------------------------------------
       
   629 // CTestSDKNotes::TestNNCMopSupplyObjectL
       
   630 // -----------------------------------------------------------------------------
       
   631 TInt CTestSDKNotes::TestNNCMopSupplyObjectL( CStifItemParser& /*aItem*/ )
       
   632     {
       
   633     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   634     CleanupStack::PushL( noteDialog );
       
   635     STIF_ASSERT_NOT_NULL( noteDialog );
       
   636     CleanupStack::Pop( noteDialog );
       
   637     
       
   638     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   639     CTestSDKNotesNoteControl* noteControl = static_cast<CTestSDKNotesNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   640     STIF_ASSERT_NOT_NULL( noteControl );
       
   641     
       
   642     TTypeUid::Ptr ptr = TTypeUid::Null();
       
   643     ptr = noteControl->MopSupplyObject( CEikDialog::ETypeId );
       
   644     CTestSDKNotesNoteControl* point = static_cast<CTestSDKNotesNoteControl*> ( ptr.Pointer() );
       
   645     
       
   646     CleanupStack::PopAndDestroy( noteDialog );
       
   647     
       
   648     return KErrNone;
       
   649     
       
   650     }
       
   651 
       
   652 // -----------------------------------------------------------------------------
       
   653 // CTestSDKNotes::TestNNCSetBgRectL
       
   654 // -----------------------------------------------------------------------------
       
   655 TInt CTestSDKNotes::TestNNCSetBgRectL( CStifItemParser& /*aItem*/ )
       
   656     {
       
   657     CAknNoteDialog* noteDialog = new (ELeave) CAknNoteDialog();
       
   658     CleanupStack::PushL( noteDialog );
       
   659     STIF_ASSERT_NOT_NULL( noteDialog );
       
   660     CleanupStack::Pop( noteDialog );
       
   661     
       
   662     noteDialog->PrepareLC( R_TESTSDK_NOTECONTROLIMAGE );
       
   663     CAknNoteControl* noteControl = static_cast<CAknNoteControl*> ( noteDialog->Control( ETestSDKNoteControl ) ); 
       
   664     STIF_ASSERT_NOT_NULL( noteControl );
       
   665     
       
   666     TPoint apoint( KLength, KLength );
       
   667     const TInt KCorner = 100;
       
   668     TPoint bpoint( KCorner, KCorner );
       
   669     TRect rect( apoint, bpoint );
       
   670     noteControl->SetBgRect( rect, apoint );
       
   671     noteControl->Layout();
       
   672     
       
   673     CleanupStack::PopAndDestroy( noteDialog );
       
   674     
       
   675     return KErrNone;
       
   676     
       
   677     }