|
1 // Copyright (c) 2007-2009 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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Tests for the TWsGraphicMsgBufParser |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 #include "TGRAPHICSDRAWER.H" |
|
25 #include "Graphics/WSGRAPHICMSGBUF.H" |
|
26 |
|
27 CTGraphicsDrawer::CTGraphicsDrawer(CTestStep* aStep): |
|
28 CTGraphicsBase(aStep) |
|
29 { |
|
30 INFO_PRINTF1(_L("Testing TWsGraphicMsgBufParser")); |
|
31 } |
|
32 |
|
33 void CTGraphicsDrawer::RunTestCaseL(TInt aCurTestCase) |
|
34 { |
|
35 ((CTGraphicsDrawerStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); |
|
36 switch(aCurTestCase) |
|
37 { |
|
38 case 1: |
|
39 ((CTGraphicsDrawerStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0449")); |
|
40 INFO_PRINTF1(_L("TWsGraphicMsgBufParser Indefinite Loop Test")); |
|
41 IndefiniteLoopL(); |
|
42 break; |
|
43 |
|
44 case 2: |
|
45 ((CTGraphicsDrawerStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
46 ((CTGraphicsDrawerStep*)iStep)->CloseTMSGraphicsStep(); |
|
47 INFO_PRINTF1(_L("Test complete\n")); |
|
48 TestComplete(); |
|
49 break; |
|
50 } |
|
51 ((CTGraphicsDrawerStep*)iStep)->RecordTestResultL(); |
|
52 } |
|
53 |
|
54 |
|
55 void CTGraphicsDrawer::ConstructL() |
|
56 { |
|
57 } |
|
58 |
|
59 CTGraphicsDrawer::~CTGraphicsDrawer() |
|
60 { |
|
61 } |
|
62 |
|
63 /** |
|
64 @SYMTestCaseID GRAPHICS-WSERV-0449 |
|
65 |
|
66 @SYMDEF DEF110513, PDEF112710 |
|
67 |
|
68 @SYMTestCaseDesc Tests that a zero length buffer does not cause an indefinate loop during verify |
|
69 |
|
70 @SYMTestPriority Normal |
|
71 |
|
72 @SYMTestStatus Implemented |
|
73 |
|
74 @SYMTestActions Creates a buffer, puts it into a TWsGraphicMsgBufParser and calls verify on it |
|
75 then removes the message from the buffer and re-tests verify. |
|
76 |
|
77 @SYMTestExpectedResults Test should pass and not timeout |
|
78 */ |
|
79 |
|
80 void CTGraphicsDrawer::IndefiniteLoopL() |
|
81 { |
|
82 RWsGraphicMsgBuf msgBuffer; |
|
83 msgBuffer.CleanupClosePushL(); |
|
84 msgBuffer.Append(TUid::Uid(0x12345670),KNullDesC8); |
|
85 TWsGraphicMsgBufParser msgParser(msgBuffer.Pckg()); |
|
86 |
|
87 // test the verify method with a single message in the buffer |
|
88 if(msgParser.Verify() != KErrNone) |
|
89 { |
|
90 INFO_PRINTF1(_L("TWsGraphicMsgBufParser::Verify() failed for buffer length 1")); |
|
91 TEST(EFalse); |
|
92 } |
|
93 |
|
94 // remove the (only) message so the message buffer now has a length of zero |
|
95 msgBuffer.Remove(0); |
|
96 TEST(msgBuffer.Count()==0); |
|
97 |
|
98 // test the verify method with an zero length buffer |
|
99 if(msgParser.Verify() != KErrNone) |
|
100 { |
|
101 INFO_PRINTF1(_L("TWsGraphicMsgBufParser::Verify() failed for zero length buffer")); |
|
102 TEST(EFalse); |
|
103 } |
|
104 |
|
105 CleanupStack::PopAndDestroy(&msgBuffer); |
|
106 } |
|
107 |
|
108 //-------------- |
|
109 __CONSTRUCT_STEP__(GraphicsDrawer) |
|
110 |
|
111 |
|
112 |