windowing/windowserver/test/tauto/TGRAPHICSDRAWER.CPP
author hgs
Tue, 22 Jun 2010 15:21:29 +0300
changeset 103 2717213c588a
child 121 d72fc2aace31
permissions -rw-r--r--
201024
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
103
hgs
parents:
diff changeset
     1
// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
hgs
parents:
diff changeset
     2
// All rights reserved.
hgs
parents:
diff changeset
     3
// This component and the accompanying materials are made available
hgs
parents:
diff changeset
     4
// under the terms of "Eclipse Public License v1.0"
hgs
parents:
diff changeset
     5
// which accompanies this distribution, and is available
hgs
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
hgs
parents:
diff changeset
     7
//
hgs
parents:
diff changeset
     8
// Initial Contributors:
hgs
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
hgs
parents:
diff changeset
    10
//
hgs
parents:
diff changeset
    11
// Contributors:
hgs
parents:
diff changeset
    12
//
hgs
parents:
diff changeset
    13
// Description:
hgs
parents:
diff changeset
    14
// Tests for the TWsGraphicMsgBufParser 
hgs
parents:
diff changeset
    15
// 
hgs
parents:
diff changeset
    16
//
hgs
parents:
diff changeset
    17
hgs
parents:
diff changeset
    18
/**
hgs
parents:
diff changeset
    19
 @file
hgs
parents:
diff changeset
    20
 @test
hgs
parents:
diff changeset
    21
 @internalComponent - Internal Symbian test code
hgs
parents:
diff changeset
    22
*/
hgs
parents:
diff changeset
    23
hgs
parents:
diff changeset
    24
#include "TGRAPHICSDRAWER.H"
hgs
parents:
diff changeset
    25
#include "Graphics/WSGRAPHICMSGBUF.H"
hgs
parents:
diff changeset
    26
hgs
parents:
diff changeset
    27
CTGraphicsDrawer::CTGraphicsDrawer(CTestStep* aStep):
hgs
parents:
diff changeset
    28
	CTGraphicsBase(aStep)
hgs
parents:
diff changeset
    29
	{
hgs
parents:
diff changeset
    30
	INFO_PRINTF1(_L("Testing TWsGraphicMsgBufParser"));
hgs
parents:
diff changeset
    31
	}
hgs
parents:
diff changeset
    32
		
hgs
parents:
diff changeset
    33
void CTGraphicsDrawer::RunTestCaseL(TInt aCurTestCase)
hgs
parents:
diff changeset
    34
	{	
hgs
parents:
diff changeset
    35
	((CTGraphicsDrawerStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
hgs
parents:
diff changeset
    36
	switch(aCurTestCase)
hgs
parents:
diff changeset
    37
		{
hgs
parents:
diff changeset
    38
	case 1:		
hgs
parents:
diff changeset
    39
		((CTGraphicsDrawerStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0449"));
hgs
parents:
diff changeset
    40
		INFO_PRINTF1(_L("TWsGraphicMsgBufParser Indefinite Loop Test"));		
hgs
parents:
diff changeset
    41
		IndefiniteLoopL();
hgs
parents:
diff changeset
    42
		break;
hgs
parents:
diff changeset
    43
		
hgs
parents:
diff changeset
    44
	case 2:
hgs
parents:
diff changeset
    45
		((CTGraphicsDrawerStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
hgs
parents:
diff changeset
    46
		((CTGraphicsDrawerStep*)iStep)->CloseTMSGraphicsStep();
hgs
parents:
diff changeset
    47
		INFO_PRINTF1(_L("Test complete\n"));
hgs
parents:
diff changeset
    48
		TestComplete();
hgs
parents:
diff changeset
    49
		break;
hgs
parents:
diff changeset
    50
		}
hgs
parents:
diff changeset
    51
	((CTGraphicsDrawerStep*)iStep)->RecordTestResultL();
hgs
parents:
diff changeset
    52
	}
hgs
parents:
diff changeset
    53
hgs
parents:
diff changeset
    54
hgs
parents:
diff changeset
    55
void CTGraphicsDrawer::ConstructL()
hgs
parents:
diff changeset
    56
	{
hgs
parents:
diff changeset
    57
	}
hgs
parents:
diff changeset
    58
	
hgs
parents:
diff changeset
    59
CTGraphicsDrawer::~CTGraphicsDrawer()
hgs
parents:
diff changeset
    60
	{
hgs
parents:
diff changeset
    61
	}
hgs
parents:
diff changeset
    62
hgs
parents:
diff changeset
    63
/**
hgs
parents:
diff changeset
    64
@SYMTestCaseID		GRAPHICS-WSERV-0449
hgs
parents:
diff changeset
    65
hgs
parents:
diff changeset
    66
@SYMDEF  			DEF110513, PDEF112710
hgs
parents:
diff changeset
    67
hgs
parents:
diff changeset
    68
@SYMTestCaseDesc    Tests that a zero length buffer does not cause an indefinate loop during verify 
hgs
parents:
diff changeset
    69
hgs
parents:
diff changeset
    70
@SYMTestPriority    Normal
hgs
parents:
diff changeset
    71
hgs
parents:
diff changeset
    72
@SYMTestStatus      Implemented
hgs
parents:
diff changeset
    73
hgs
parents:
diff changeset
    74
@SYMTestActions    	Creates a buffer, puts it into a TWsGraphicMsgBufParser and calls verify on it
hgs
parents:
diff changeset
    75
					then removes the message from the buffer and re-tests verify.
hgs
parents:
diff changeset
    76
hgs
parents:
diff changeset
    77
@SYMTestExpectedResults Test should pass and not timeout
hgs
parents:
diff changeset
    78
*/
hgs
parents:
diff changeset
    79
hgs
parents:
diff changeset
    80
void CTGraphicsDrawer::IndefiniteLoopL()
hgs
parents:
diff changeset
    81
	{
hgs
parents:
diff changeset
    82
	RWsGraphicMsgBuf msgBuffer;
hgs
parents:
diff changeset
    83
	msgBuffer.CleanupClosePushL();
hgs
parents:
diff changeset
    84
	msgBuffer.Append(TUid::Uid(0x12345670),KNullDesC8);
hgs
parents:
diff changeset
    85
	TWsGraphicMsgBufParser msgParser(msgBuffer.Pckg());
hgs
parents:
diff changeset
    86
	
hgs
parents:
diff changeset
    87
	// test the verify method with a single message in the buffer
hgs
parents:
diff changeset
    88
	if(msgParser.Verify() != KErrNone)
hgs
parents:
diff changeset
    89
		{
hgs
parents:
diff changeset
    90
		INFO_PRINTF1(_L("TWsGraphicMsgBufParser::Verify() failed for buffer length 1"));
hgs
parents:
diff changeset
    91
		TEST(EFalse);
hgs
parents:
diff changeset
    92
		}
hgs
parents:
diff changeset
    93
		
hgs
parents:
diff changeset
    94
	// remove the (only) message so the message buffer now has a length of zero
hgs
parents:
diff changeset
    95
	msgBuffer.Remove(0);
hgs
parents:
diff changeset
    96
	TEST(msgBuffer.Count()==0);
hgs
parents:
diff changeset
    97
	
hgs
parents:
diff changeset
    98
	// test the verify method with an zero length buffer
hgs
parents:
diff changeset
    99
	if(msgParser.Verify() != KErrNone)
hgs
parents:
diff changeset
   100
		{
hgs
parents:
diff changeset
   101
		INFO_PRINTF1(_L("TWsGraphicMsgBufParser::Verify() failed for zero length buffer"));
hgs
parents:
diff changeset
   102
		TEST(EFalse);
hgs
parents:
diff changeset
   103
		}
hgs
parents:
diff changeset
   104
	
hgs
parents:
diff changeset
   105
	CleanupStack::PopAndDestroy(&msgBuffer);
hgs
parents:
diff changeset
   106
	}
hgs
parents:
diff changeset
   107
hgs
parents:
diff changeset
   108
//--------------
hgs
parents:
diff changeset
   109
__CONSTRUCT_STEP__(GraphicsDrawer)
hgs
parents:
diff changeset
   110
hgs
parents:
diff changeset
   111
hgs
parents:
diff changeset
   112