classicui_pub/queries_api/tsrc/src/testsdkqueriesblocksquerydata.cpp
changeset 0 2f259fa3e83a
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 aknquerydata.h
       
    15 *
       
    16 */
       
    17 
       
    18 //INCLUDE
       
    19 #include <aknquerydata.h>
       
    20 #include <testsdkqueries.rsg>
       
    21 #include <aknquerydialog.h>
       
    22 
       
    23 #include "testsdkqueries.h"
       
    24 #include "testsdkaknquerydialogprotected.h"
       
    25 
       
    26 const TInt KZero = 0;
       
    27 const TInt KFive = 5;
       
    28 const TInt KTen = 10;
       
    29 const TInt KBufSize = 32;
       
    30 const TInt KHundred = 100;
       
    31 _LIT( KTestString, "It is a test!" );
       
    32 
       
    33 // -----------------------------------------------------------------------------
       
    34 // CTestSDKQueries::TestQdGetMaxTextLengthL
       
    35 // -----------------------------------------------------------------------------
       
    36 //
       
    37 TInt CTestSDKQueries::TestQdataGetMaxTextLengthL( CStifItemParser& /*aItem*/ )
       
    38     {
       
    39     TInt number = KTen;
       
    40     CAknNumberQueryDialog* numberDlg = new (ELeave) CAknNumberQueryDialog ( number );
       
    41     numberDlg->PrepareLC( R_AKNEXQUERY_NUMBER_LAYOUT );
       
    42     
       
    43     CTestCAknNumberQueryDialog* testNumberDlg = static_cast<CTestCAknNumberQueryDialog*>( numberDlg );
       
    44     CAknQueryControl* dlgControl = testNumberDlg->QueryControl();
       
    45     
       
    46     dlgControl->SetTextEntryLength( KFive );
       
    47     
       
    48     TBuf< KBufSize > buffer( KTestString );
       
    49     
       
    50     TInt length = GetMaxTextLength( dlgControl, buffer, KTen );
       
    51     STIF_ASSERT_EQUALS( KTen, length );
       
    52     
       
    53     length = GetMaxTextLength( dlgControl, buffer, KHundred );
       
    54     STIF_ASSERT_EQUALS( KFive, length );
       
    55     
       
    56     dlgControl->SetTextEntryLength( KZero );
       
    57     
       
    58     length = GetMaxTextLength( dlgControl, buffer, KHundred );
       
    59     STIF_ASSERT_EQUALS( KBufSize, length );
       
    60     
       
    61     CleanupStack::PopAndDestroy( numberDlg );
       
    62     return KErrNone;
       
    63     }
       
    64 
       
    65 //End file
       
    66 
       
    67