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