|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: test blocks for CWmImageConverter |
|
15 * |
|
16 */ |
|
17 |
|
18 //INCLUDE FILES |
|
19 #include <e32svr.h> |
|
20 #include <stdlib.h> |
|
21 #include <stifparser.h> |
|
22 #include <stiftestinterface.h> |
|
23 #include <bautils.h> |
|
24 #include <aknsskininstance.h> |
|
25 #include "wmunittest.h" |
|
26 // components to test |
|
27 #include "wmimageconverter.h" |
|
28 |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CWmUnitTest::ImageConverterCreateL |
|
32 // ----------------------------------------------------------------------------- |
|
33 // |
|
34 TInt CWmUnitTest::ImageConverterCreateL( CStifItemParser& /*aItem*/ ) |
|
35 { |
|
36 if ( iImageConverter != 0 ) User::Leave( KErrArgument ); |
|
37 TInt ret = KErrNone; |
|
38 _CLEANUPCHECK_BEGIN |
|
39 iImageConverter = CWmImageConverter::NewL(); |
|
40 _CLEANUPCHECK_END |
|
41 _RETURN("ImageConverterCreateL End", ret); |
|
42 } |
|
43 |
|
44 // ----------------------------------------------------------------------------- |
|
45 // CWmUnitTest::ImageConverterDeleteL |
|
46 // ----------------------------------------------------------------------------- |
|
47 // |
|
48 TInt CWmUnitTest::ImageConverterDeleteL( CStifItemParser& /*aItem*/ ) |
|
49 { |
|
50 if ( iImageConverter == 0 ) User::Leave( KErrArgument ); |
|
51 TInt ret = KErrNone; |
|
52 delete iImageConverter; |
|
53 iImageConverter = 0; |
|
54 _RETURN("ImageConverterDeleteL End", ret); |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // CWmUnitTest::ImageConverterConvertL |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 TInt CWmUnitTest::ImageConverterConvertL( CStifItemParser& aItem ) |
|
62 { |
|
63 if ( iImageConverter == 0 ) User::Leave( KErrArgument ); |
|
64 TInt ret = KErrNone; |
|
65 iConversionReady = EFalse; |
|
66 TPtrC inputStr; |
|
67 |
|
68 aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing ); |
|
69 User::LeaveIfError( aItem.GetNextString( inputStr ) ); |
|
70 if ( inputStr.Length() == 0 ) User::Leave( KErrArgument ); |
|
71 |
|
72 TInt expectedResult; |
|
73 User::LeaveIfError( aItem.GetNextInt( expectedResult ) ); |
|
74 |
|
75 CFbsBitmap* bitmap = NULL; |
|
76 CFbsBitmap* mask = NULL; |
|
77 TInt err = iImageConverter->HandleIconString( |
|
78 TSize (40, 40), inputStr, bitmap, mask ); |
|
79 if ( err != KErrNone && expectedResult == -1 ) |
|
80 { |
|
81 err = KErrNone; |
|
82 } |
|
83 |
|
84 _RETURN("ImageConverterConvertL End", ret ); |
|
85 } |
|
86 |
|
87 // End of File |