os/textandloc/textrendering/textformatting/test/tbandformat/inc/bandtestactions.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/textrendering/textformatting/test/tbandformat/inc/bandtestactions.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,143 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* TESTACTIONS.H
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#ifndef __TESTACTIONS_H
    1.24 +#define __TESTACTIONS_H
    1.25 +
    1.26 +#include <e32std.h>
    1.27 +
    1.28 +/**
    1.29 +@file
    1.30 +@internalComponent 
    1.31 +*/
    1.32 +class CRichText;
    1.33 +class CBandMaintainer;
    1.34 +class CBandValidator;
    1.35 +class CFbsScreenDevice;
    1.36 +
    1.37 +/**
    1.38 +Base class for band test actions
    1.39 +This class is initialised with a CBandMaintainer, CBandValidator and a CRichText object.
    1.40 +These are used to perform the required action and then validate the test and reference view
    1.41 +*/
    1.42 +class TBandTestAction
    1.43 +	{
    1.44 +public:
    1.45 +	// result of a band test action
    1.46 +	enum TTestResult
    1.47 +		{
    1.48 +		ENotExecuted,
    1.49 +		EPassed,
    1.50 +		EFailed
    1.51 +		};
    1.52 +	/**
    1.53 +	Execute a test action.
    1.54 +	@param aDocPos The position in the document where the test action is to be performed
    1.55 +	@param aEditLength The length of the edit to be executed
    1.56 +	@return TTestResult The result of the band test action	
    1.57 +	*/
    1.58 +	IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength) = 0;
    1.59 +protected:
    1.60 +	TBandTestAction(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator);
    1.61 +	CBandMaintainer& iTextViews;
    1.62 +	CRichText& iRichText;
    1.63 +	CBandValidator& iValidator;
    1.64 +	};
    1.65 +
    1.66 +/**
    1.67 +Band test action used to carry out a delete
    1.68 +*/	
    1.69 +class TDeleteText : public TBandTestAction
    1.70 +	{
    1.71 +public:
    1.72 +	/**
    1.73 +	Constructor
    1.74 +	@param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects
    1.75 +	@param aRichText The document which is represented by a CRichText object 	
    1.76 +	@param aValidator The CBandValidator which is used to compare the test and reference views
    1.77 +	*/
    1.78 +	IMPORT_C TDeleteText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator);
    1.79 +	/**
    1.80 +	Execute a delete.
    1.81 +	@param aDocPos The position in the document where the test action is to be performed
    1.82 +	@param aEditLength The length of the edit to be executed
    1.83 +	@return TTestResult The result of the band test action	
    1.84 +	*/
    1.85 +	IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength);
    1.86 +	};
    1.87 +
    1.88 +/**
    1.89 +Band test action used to carry out an insert
    1.90 +*/	
    1.91 +class TInsertText : public TBandTestAction
    1.92 +	{
    1.93 +public:
    1.94 +	/**
    1.95 +	Constructor
    1.96 +	@param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects
    1.97 +	@param aRichText The document which is represented by a CRichText object 	
    1.98 +	@param aValidator The CBandValidator which is used to compare the test and reference views
    1.99 +	@param aTextToInsert The text to be inserted
   1.100 +	*/
   1.101 +	IMPORT_C TInsertText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator, const TDesC& aTextToInsert);
   1.102 +	/**
   1.103 +	Execute an insert,
   1.104 +	@param aDocPos The position in the document where the test action is to be performed
   1.105 +	@param aEditLength Not Used
   1.106 +	@return TTestResult The result of the band test action	
   1.107 +	*/
   1.108 +	IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength);
   1.109 +private:
   1.110 +	const TDesC& iTextToInsert;
   1.111 +	};
   1.112 +	
   1.113 +enum TReformatAction
   1.114 +	{
   1.115 +	EMakeBold,
   1.116 +	EIncreaseFontSize,
   1.117 +	EDecreaseFontSize,
   1.118 +	EChangeFont
   1.119 +	};
   1.120 +
   1.121 +/**
   1.122 +Band test action used to carry out a reformat
   1.123 +*/
   1.124 +class TReformatText : public TBandTestAction
   1.125 +	{
   1.126 +public:
   1.127 +	/**
   1.128 +	Constructor
   1.129 +	@param aTextViews The CBandMaintainer object which maintains the test and reference CTextView objects
   1.130 +	@param aRichText The document which is represented by a CRichText object 	
   1.131 +	@param aValidator The CBandValidator which is used to compare the test and reference views
   1.132 +	*/
   1.133 +	IMPORT_C TReformatText(CBandMaintainer& aTextViews, CRichText& aRichText, CBandValidator& aValidator, TReformatAction aReformatAction, CFbsScreenDevice& aDevice);
   1.134 +	/**
   1.135 +	Exectute a reformat
   1.136 +	@param aDocPos The position in the document where the test action is to be performed
   1.137 +	@param aEditLength The length of the edit to be executed
   1.138 +	@return TTestResult The result of the band test action	
   1.139 +	*/
   1.140 +	IMPORT_C virtual TTestResult ExecuteL(TInt aDocPos, TInt aEditLength);
   1.141 +private:
   1.142 +	TInt iReformatAction;
   1.143 +	CFbsScreenDevice& iDevice;
   1.144 +	};
   1.145 +	
   1.146 +#endif