classicui_pub/notes_api/tsrc/src/testsdknotesblockssdn.cpp
changeset 0 2f259fa3e83a
child 10 3d340a0166ff
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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 AknStaticNoteDialog.h
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <aknstaticnoteDialog.h>
       
    20 #include <barsread.h>
       
    21 #include <coeaui.h>
       
    22 #include <akncontrol.h>
       
    23 #include <aknsconstants.h>
       
    24 #include <testsdknotes.rsg>
       
    25 
       
    26 #include "testsdknotesstaticnotedialog.h"
       
    27 #include "testsdknotes.h"
       
    28 
       
    29 const TInt KPoint1 = 10;
       
    30 const TInt KPoint2 = 20;
       
    31 // ============================ MEMBER FUNCTIONS ===============================
       
    32 
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CTestSDKNotes::TestNSNSIHandleResourceChangeL
       
    36 // -----------------------------------------------------------------------------
       
    37 TInt CTestSDKNotes::TestNSNSIHandleResourceChangeL( CStifItemParser& /*aItem*/ )
       
    38     {
       
    39     CTestSDKNotesStaticNoteDialog* noteDialog = new (ELeave) CTestSDKNotesStaticNoteDialog;
       
    40     CleanupStack::PushL( noteDialog );
       
    41     STIF_ASSERT_NOT_NULL( noteDialog );
       
    42     CleanupStack::Pop( noteDialog );
       
    43     
       
    44     noteDialog->PrepareLC( R_TESTSDK_STATICNOTE );
       
    45     noteDialog->PostLayoutDynInitL();
       
    46     CAknStaticNoteStackIndicator* indicator = noteDialog->Indicator();
       
    47     
       
    48     indicator->HandleResourceChange( KAknsMessageSkinChange );
       
    49     
       
    50     CleanupStack::PopAndDestroy( noteDialog );
       
    51     
       
    52     return KErrNone;
       
    53     
       
    54     }
       
    55 
       
    56 // -----------------------------------------------------------------------------
       
    57 // CTestSDKNotes::TestNSNSIHandlePointerEventL
       
    58 // -----------------------------------------------------------------------------
       
    59 TInt CTestSDKNotes::TestNSNSIHandlePointerEventL( CStifItemParser& /*aItem*/ )
       
    60     {
       
    61     CTestSDKNotesStaticNoteDialog* noteDialog = new (ELeave) CTestSDKNotesStaticNoteDialog;
       
    62     CleanupStack::PushL( noteDialog );
       
    63     STIF_ASSERT_NOT_NULL( noteDialog );
       
    64     CleanupStack::Pop( noteDialog );
       
    65     
       
    66     noteDialog->PrepareLC( R_TESTSDK_STATICNOTE );
       
    67     noteDialog->PostLayoutDynInitL();
       
    68     CAknStaticNoteStackIndicator* indicator = noteDialog->Indicator();
       
    69     
       
    70     TPointerEvent event;
       
    71     event.iType = TPointerEvent::EButton1Down;
       
    72     event.iModifiers = 0;
       
    73     TPoint eventPos( KPoint1, KPoint2 );
       
    74     event.iPosition = eventPos;
       
    75     event.iParentPosition = eventPos;
       
    76     
       
    77     indicator->HandlePointerEventL( event );
       
    78     
       
    79     CleanupStack::PopAndDestroy( noteDialog );
       
    80     
       
    81     return KErrNone;
       
    82     
       
    83     }
       
    84 
       
    85 // -----------------------------------------------------------------------------
       
    86 // CTestSDKNotes::TestNSNDCAknStaticNoteDialogL
       
    87 // -----------------------------------------------------------------------------
       
    88 TInt CTestSDKNotes::TestNSNDCAknStaticNoteDialogL( CStifItemParser& /*aItem*/ )
       
    89     {
       
    90     CAknStaticNoteDialog* noteDialog = new (ELeave) CAknStaticNoteDialog;
       
    91     CleanupStack::PushL( noteDialog );
       
    92     STIF_ASSERT_NOT_NULL( noteDialog );
       
    93     
       
    94     CleanupStack::PopAndDestroy( noteDialog );
       
    95     
       
    96     return KErrNone;
       
    97     
       
    98     }
       
    99 
       
   100 // -----------------------------------------------------------------------------
       
   101 // CTestSDKNotes::TestNSNDCAknStaticNoteDialogPointerL
       
   102 // -----------------------------------------------------------------------------
       
   103 TInt CTestSDKNotes::TestNSNDCAknStaticNoteDialogPointerL( CStifItemParser& /*aItem*/ )
       
   104     {
       
   105     CEikDialog* dialog = new (ELeave) CEikDialog;
       
   106     CleanupStack::PushL( dialog );
       
   107     STIF_ASSERT_NOT_NULL( dialog );
       
   108     
       
   109     CAknStaticNoteDialog* noteDialog = new (ELeave) CAknStaticNoteDialog( &dialog );
       
   110     CleanupStack::PushL( noteDialog );
       
   111     STIF_ASSERT_NOT_NULL( noteDialog );
       
   112     
       
   113     CleanupStack::Pop( noteDialog );
       
   114     CleanupStack::PopAndDestroy( dialog );
       
   115     
       
   116     return KErrNone;
       
   117     
       
   118     }
       
   119 
       
   120 // -----------------------------------------------------------------------------
       
   121 // CTestSDKNotes::TestNSNDDeconstructorL
       
   122 // -----------------------------------------------------------------------------
       
   123 TInt CTestSDKNotes::TestNSNDDeconstructorL( CStifItemParser& /*aItem*/ )
       
   124     {
       
   125     CAknStaticNoteDialog* noteDialog = new (ELeave) CAknStaticNoteDialog;
       
   126     CleanupStack::PushL( noteDialog );
       
   127     STIF_ASSERT_NOT_NULL( noteDialog );
       
   128     
       
   129     CleanupStack::Pop( noteDialog );
       
   130     delete noteDialog;
       
   131     
       
   132     return KErrNone;
       
   133     
       
   134     }
       
   135 
       
   136 // -----------------------------------------------------------------------------
       
   137 // CTestSDKNotes::TestNSNDSetNumberOfBordersL
       
   138 // -----------------------------------------------------------------------------
       
   139 TInt CTestSDKNotes::TestNSNDSetNumberOfBordersL( CStifItemParser& /*aItem*/ )
       
   140     {
       
   141     CTestSDKNotesStaticNoteDialog* noteDialog = new (ELeave) CTestSDKNotesStaticNoteDialog;
       
   142     CleanupStack::PushL( noteDialog );
       
   143     STIF_ASSERT_NOT_NULL( noteDialog );
       
   144     
       
   145     const TInt number = 5;
       
   146     noteDialog->SetNumberOfBorders( number );
       
   147     
       
   148     CleanupStack::PopAndDestroy( noteDialog );
       
   149     
       
   150     return KErrNone;
       
   151     
       
   152     }
       
   153 
       
   154 // -----------------------------------------------------------------------------
       
   155 // CTestSDKNotes::TestNSNDHandlePointerEventL
       
   156 // -----------------------------------------------------------------------------
       
   157 TInt CTestSDKNotes::TestNSNDHandlePointerEventL( CStifItemParser& /*aItem*/ )
       
   158     {
       
   159     CTestSDKNotesStaticNoteDialog* noteDialog = new (ELeave) CTestSDKNotesStaticNoteDialog;
       
   160     CleanupStack::PushL( noteDialog );
       
   161     STIF_ASSERT_NOT_NULL( noteDialog );
       
   162     
       
   163     TPointerEvent event;
       
   164     event.iType = TPointerEvent::EButton2Up;
       
   165     
       
   166     noteDialog->HandlePointerEventL( event );
       
   167     
       
   168     CleanupStack::PopAndDestroy( noteDialog );
       
   169     
       
   170     return KErrNone;
       
   171     
       
   172     }
       
   173 
       
   174 // -----------------------------------------------------------------------------
       
   175 // CTestSDKNotes::TestNSNDPostLayoutDynInitL
       
   176 // -----------------------------------------------------------------------------
       
   177 TInt CTestSDKNotes::TestNSNDPostLayoutDynInitL( CStifItemParser& /*aItem*/ )
       
   178     {
       
   179     CTestSDKNotesStaticNoteDialog* noteDialog = new (ELeave) CTestSDKNotesStaticNoteDialog;
       
   180     CleanupStack::PushL( noteDialog );
       
   181     STIF_ASSERT_NOT_NULL( noteDialog );
       
   182     
       
   183     noteDialog->PrepareLC( R_TESTSDK_STATICNOTE );
       
   184     noteDialog->PostLayoutDynInitL();
       
   185     noteDialog->Layout();
       
   186     noteDialog->RunLD();
       
   187     
       
   188     CleanupStack::PopAndDestroy( noteDialog );
       
   189     
       
   190     return KErrNone;
       
   191     
       
   192     }
       
   193 
       
   194 // -----------------------------------------------------------------------------
       
   195 // CTestSDKNotes::TestNSNDOfferKeyEventL
       
   196 // -----------------------------------------------------------------------------
       
   197 TInt CTestSDKNotes::TestNSNDOfferKeyEventL( CStifItemParser& /*aItem*/ )
       
   198     {
       
   199     CTestSDKNotesStaticNoteDialog* noteDialog = new (ELeave) CTestSDKNotesStaticNoteDialog;
       
   200     CleanupStack::PushL( noteDialog );
       
   201     STIF_ASSERT_NOT_NULL( noteDialog );
       
   202     
       
   203     noteDialog->ExecuteLD( R_TESTSDK_STATICNOTE );
       
   204     TKeyEvent keyEvent;
       
   205     keyEvent.iCode = EKeyCBA1;
       
   206     STIF_ASSERT_TRUE( EKeyWasConsumed == noteDialog->OfferKeyEventL( keyEvent, EEventKey ) );
       
   207     
       
   208     CleanupStack::PopAndDestroy( noteDialog );
       
   209     
       
   210     return KErrNone;
       
   211     
       
   212     }