Update contrib.
1 // Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
19 class CTPdrLst : public CTGraphicsBase
22 CTPdrLst(CTestStep* aStep);
26 virtual void RunTestCaseL(TInt aCurTestCase);
27 virtual void ConstructL();
31 CPdrModelList* iModelList;
34 CTPdrLst::CTPdrLst(CTestStep* aStep) :
43 INFO_PRINTF1( _L( "- Destroy the CPdrModelList" ) );
47 void CTPdrLst::ConstructL()
49 INFO_PRINTF1( _L( "Testing PdrList" ) );
50 INFO_PRINTF1( _L( "- Create a CPdrModelList" ) );
51 iModelList = CPdrModelList::NewL();
55 void CTPdrLst::Test1()
57 INFO_PRINTF1( _L( "- Check that there are no models in the list" ) );
58 TInt numModels = iModelList->ModelCount();
61 INFO_PRINTF1( _L( "- Add a directory to the search path" ) );
62 TFileName dir( _L( "z:" ) );
63 dir.Append( KDefaultPrinterDriverPath );
64 TRAPD(ret, iModelList->AddDirectoryL(dir) );
65 INFO_PRINTF2( _L( "ret %d\n" ), ret );
66 TEST( ret == KErrNone );
68 INFO_PRINTF1( _L( "- Scan the search path for models" ) );
69 TRAP( ret, (void)iModelList->ScanForModelsL() );
70 TEST( ret == KErrNone );
71 numModels = iModelList->ModelCount();
72 INFO_PRINTF2( _L( " Models found: %d\n" ), numModels );
74 TPrinterModelEntry entry;
75 for ( TInt i = 0; i < numModels; i++ )
77 entry = (*iModelList)[i];
78 INFO_PRINTF2( _L( "ModelName %S\n" ), &entry.iModelName );
81 INFO_PRINTF1( _L( "- Create a new printer driver" ) );
82 RDebug::Print( _L( "Drivers: %d\r\n" ), numModels );
83 CPrinterDriver* driver = NULL;
84 TRAP( ret, driver = iModelList->CreatePrinterDriverL( numModels - 1 ) );
85 TEST( ret == KErrNone );
87 INFO_PRINTF1( _L( "- Get the model name of the new printer device from PdrStore" ) );
88 TBuf<256> buf = driver->PrinterDevice()->Model().iModelName.Ptr();
89 INFO_PRINTF2( _L( " Name of current model: %S\n" ), &buf );
95 void CTPdrLst::RunTestCaseL(TInt aCurTestCase)
96 // Test the model list interface to PdrStore.
99 ((CTPdrLstStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
104 @SYMTestCaseID GRAPHICS-PDRLST-0001
106 ((CTPdrLstStep*)iStep)->SetTestStepID(_L("GRAPHICS-PDRLST-0001"));
110 ((CTPdrLstStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
111 ((CTPdrLstStep*)iStep)->CloseTMSGraphicsStep();
115 ((CTPdrLstStep*)iStep)->RecordTestResultL();
119 __CONSTRUCT_STEP__(PdrLst)