printingservices/printerdriversupport/tps/T_PDRLST.CPP
author William Roberts <williamr@symbian.org>
Thu, 03 Jun 2010 17:39:46 +0100
branchNewGraphicsArchitecture
changeset 87 0709f76d91e5
parent 0 5d03bc08d59c
child 103 2717213c588a
child 110 7f25ef56562d
child 163 bbf46f59e123
permissions -rw-r--r--
Add MMP files to build libOpenVG_sw.lib which uses LINKAS to redirect to libOpenVG.dll (and the same for libEGL_sw.lib and libOpenVGU_sw.lib). Only the libEGL_sw.lib redirection isn't activated - this can't happen until there is a merged libEGL.dll which supports the OpenWF synchronisation and also implements the graphical support functions. The overall aim is to eliminate the *_sw.dll implementations, at least as a compile-time way of choosing a software-only implementation.The correct way to choose is to put the right set of libraries into a ROM with suitable renaming, and in the emulator to use the "switching DLL" technique to pick the right set. As the Symbian Foundation doesn't have any alternative implementations, we don't need the switching DLLs and we can build directly to the correct name.

// Copyright (c) 1996-2009 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:
//

#include <prnsetup.h>
#include "T_PDRLST.H"


class CTPdrLst : public CTGraphicsBase
	{
public:
	CTPdrLst(CTestStep* aStep);
	~CTPdrLst();
protected:
//from 	CTGraphicsStep
	virtual void RunTestCaseL(TInt aCurTestCase);
	virtual void ConstructL();
private:
	void Test1();
private:
	CPdrModelList* iModelList;
	};

CTPdrLst::CTPdrLst(CTestStep* aStep) :
	CTGraphicsBase(aStep)
	{
	
	}

CTPdrLst::~CTPdrLst()
	{
	// clean up
	INFO_PRINTF1( _L( "- Destroy the CPdrModelList" ) );
	delete iModelList;
	}

void CTPdrLst::ConstructL()
	{
	INFO_PRINTF1( _L( "Testing PdrList" ) );
	INFO_PRINTF1( _L( "- Create a CPdrModelList" ) );
	iModelList = CPdrModelList::NewL();
	}


void CTPdrLst::Test1()
	{
	INFO_PRINTF1( _L( "- Check that there are no models in the list" ) );
	TInt numModels = iModelList->ModelCount();
	TEST(numModels == 0);

	INFO_PRINTF1( _L( "- Add a directory to the search path" ) );
	TFileName dir( _L( "z:" ) );
	dir.Append( KDefaultPrinterDriverPath );
	TRAPD(ret, iModelList->AddDirectoryL(dir) ); 
	INFO_PRINTF2( _L( "ret %d\n" ), ret );
	TEST( ret == KErrNone );

	INFO_PRINTF1( _L( "- Scan the search path for models" ) );
	TRAP( ret, (void)iModelList->ScanForModelsL() );
	TEST( ret == KErrNone );
	numModels = iModelList->ModelCount();
	INFO_PRINTF2( _L( "   Models found: %d\n" ), numModels );

	TPrinterModelEntry entry;
	for ( TInt i = 0; i < numModels; i++ )
		{
		entry = (*iModelList)[i];
		INFO_PRINTF2( _L( "ModelName %S\n" ), &entry.iModelName );
		}

	INFO_PRINTF1( _L( "- Create a new printer driver" ) );
	RDebug::Print( _L( "Drivers: %d\r\n" ), numModels );
	CPrinterDriver* driver = NULL;
	TRAP( ret, driver = iModelList->CreatePrinterDriverL( numModels - 1 ) );
	TEST( ret == KErrNone );
	
	INFO_PRINTF1( _L( "- Get the model name of the new printer device from PdrStore" ) );
	TBuf<256> buf = driver->PrinterDevice()->Model().iModelName.Ptr();
	INFO_PRINTF2( _L( "   Name of current model: %S\n" ), &buf );

	// tidy up
	delete driver;
	}

void CTPdrLst::RunTestCaseL(TInt aCurTestCase)
// Test the model list interface to PdrStore.
//
    {
	((CTPdrLstStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
	switch(aCurTestCase)
		{
	case 1:
/**
@SYMTestCaseID			GRAPHICS-PDRLST-0001
*/
		((CTPdrLstStep*)iStep)->SetTestStepID(_L("GRAPHICS-PDRLST-0001"));
		Test1();
		break;	
	case 2:
		((CTPdrLstStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
		((CTPdrLstStep*)iStep)->CloseTMSGraphicsStep();
		TestComplete();
		break;	
		}
	((CTPdrLstStep*)iStep)->RecordTestResultL();
    }

//--------------
__CONSTRUCT_STEP__(PdrLst)