diff -r 000000000000 -r 2f259fa3e83a classicui_pub/queries_api/tsrc/src/testsdkqueriesblocksquerydata.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/classicui_pub/queries_api/tsrc/src/testsdkqueriesblocksquerydata.cpp Tue Feb 02 01:00:49 2010 +0200 @@ -0,0 +1,67 @@ +/* +* Copyright (c) 2002 - 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Test aknquerydata.h +* +*/ + +//INCLUDE +#include +#include +#include + +#include "testsdkqueries.h" +#include "testsdkaknquerydialogprotected.h" + +const TInt KZero = 0; +const TInt KFive = 5; +const TInt KTen = 10; +const TInt KBufSize = 32; +const TInt KHundred = 100; +_LIT( KTestString, "It is a test!" ); + +// ----------------------------------------------------------------------------- +// CTestSDKQueries::TestQdGetMaxTextLengthL +// ----------------------------------------------------------------------------- +// +TInt CTestSDKQueries::TestQdataGetMaxTextLengthL( CStifItemParser& /*aItem*/ ) + { + TInt number = KTen; + CAknNumberQueryDialog* numberDlg = new (ELeave) CAknNumberQueryDialog ( number ); + numberDlg->PrepareLC( R_AKNEXQUERY_NUMBER_LAYOUT ); + + CTestCAknNumberQueryDialog* testNumberDlg = static_cast( numberDlg ); + CAknQueryControl* dlgControl = testNumberDlg->QueryControl(); + + dlgControl->SetTextEntryLength( KFive ); + + TBuf< KBufSize > buffer( KTestString ); + + TInt length = GetMaxTextLength( dlgControl, buffer, KTen ); + STIF_ASSERT_EQUALS( KTen, length ); + + length = GetMaxTextLength( dlgControl, buffer, KHundred ); + STIF_ASSERT_EQUALS( KFive, length ); + + dlgControl->SetTextEntryLength( KZero ); + + length = GetMaxTextLength( dlgControl, buffer, KHundred ); + STIF_ASSERT_EQUALS( KBufSize, length ); + + CleanupStack::PopAndDestroy( numberDlg ); + return KErrNone; + } + +//End file + +