|
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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "unittest_imagedecoderwrapper.h" |
|
19 #include "glximagedecoderwrapper.h" |
|
20 #include "hbmainwindow.h" |
|
21 #include "hbapplication.h" |
|
22 #include <e32base.h> |
|
23 |
|
24 int main(int argc, char *argv[]) |
|
25 { |
|
26 Q_UNUSED(argc); |
|
27 HbApplication app(argc, argv); |
|
28 |
|
29 HbMainWindow *mMainWindow = new HbMainWindow(); |
|
30 TestGlxImageDecoderWrapper tv; |
|
31 |
|
32 char *pass[3]; |
|
33 pass[0] = argv[0]; |
|
34 pass[1] = "-o"; |
|
35 pass[2] = "c:\\data\\testdecoder.txt"; |
|
36 |
|
37 int res = QTest::qExec(&tv, 3, pass); |
|
38 |
|
39 return res; |
|
40 } |
|
41 |
|
42 // ----------------------------------------------------------------------------- |
|
43 // initTestCase |
|
44 // ----------------------------------------------------------------------------- |
|
45 // |
|
46 void TestGlxImageDecoderWrapper::initTestCase() |
|
47 { |
|
48 mTestObject = 0; |
|
49 //mMainWindow = new HbMainWindow(); |
|
50 } |
|
51 |
|
52 // ----------------------------------------------------------------------------- |
|
53 // init |
|
54 // ----------------------------------------------------------------------------- |
|
55 // |
|
56 void TestGlxImageDecoderWrapper::init() |
|
57 { |
|
58 TRAP_IGNORE(mTestObject = new GlxImageDecoderWrapper()); |
|
59 QVERIFY(mTestObject); |
|
60 } |
|
61 |
|
62 // ----------------------------------------------------------------------------- |
|
63 // cleanup |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 void TestGlxImageDecoderWrapper::cleanup() |
|
67 { |
|
68 if(mTestObject) |
|
69 { |
|
70 delete mTestObject; |
|
71 mTestObject = 0; |
|
72 } |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // cleanupTestCase |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 void TestGlxImageDecoderWrapper::cleanupTestCase() |
|
80 { |
|
81 |
|
82 } |
|
83 |
|
84 void TestGlxImageDecoderWrapper::testgetPixmap() |
|
85 { |
|
86 QVERIFY(mTestObject->getPixmap().isNull()); |
|
87 } |
|
88 |
|
89 void TestGlxImageDecoderWrapper::testDecodeImage() |
|
90 { |
|
91 QString imagePath = "c:\\data\\images\\Battle.jpg"; |
|
92 TRAP_IGNORE(mTestObject->decodeImage(imagePath)); |
|
93 //QTest::qWait(1000); |
|
94 //QEXPECT_FAIL("", "Will fix in the next release", Continue); |
|
95 QVERIFY(!mTestObject->getPixmap().isNull()); |
|
96 } |
|
97 |
|
98 void TestGlxImageDecoderWrapper::testResetDecoder() |
|
99 { |
|
100 QString imagePath = "c:\\data\\images\\Battle.jpg"; |
|
101 TRAP_IGNORE(mTestObject->decodeImage(imagePath)); |
|
102 //QTest::qWait(1000); |
|
103 //QEXPECT_FAIL("", "This should fail", Continue); |
|
104 QVERIFY(!mTestObject->getPixmap().isNull()); |
|
105 |
|
106 mTestObject->resetDecoder(); |
|
107 QVERIFY(mTestObject->getPixmap().isNull()); |
|
108 } |
|
109 |