|
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: Unit test for mpalbumcoverwidget |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <hbicon.h> |
|
20 |
|
21 #include "unittest_mpalbumcoverwidget.h" |
|
22 |
|
23 // Do this so we can access all member variables. |
|
24 #define private public |
|
25 #include "mpalbumcoverwidget.h" |
|
26 #undef private |
|
27 |
|
28 /*! |
|
29 Make our test case a stand-alone executable that runs all the test functions. |
|
30 */ |
|
31 int main(int argc, char *argv[]) |
|
32 { |
|
33 QApplication app(argc, argv); |
|
34 |
|
35 TestMpAlbumCoverWidget tv; |
|
36 |
|
37 if ( argc > 1 ) { |
|
38 return QTest::qExec( &tv, argc, argv); |
|
39 } |
|
40 else { |
|
41 char *pass[3]; |
|
42 pass[0] = argv[0]; |
|
43 pass[1] = "-o"; |
|
44 pass[2] = "c:\\data\\unittest_mpalbumcoverwidget.txt"; |
|
45 |
|
46 return QTest::qExec(&tv, 3, pass); |
|
47 } |
|
48 } |
|
49 |
|
50 TestMpAlbumCoverWidget::TestMpAlbumCoverWidget() |
|
51 : mTest(0) |
|
52 { |
|
53 } |
|
54 |
|
55 TestMpAlbumCoverWidget::~TestMpAlbumCoverWidget() |
|
56 { |
|
57 delete mTest; |
|
58 } |
|
59 |
|
60 /*! |
|
61 Called before the first testfunction is executed. |
|
62 */ |
|
63 void TestMpAlbumCoverWidget::initTestCase() |
|
64 { |
|
65 } |
|
66 |
|
67 /*! |
|
68 Called after the last testfunction was executed. |
|
69 */ |
|
70 void TestMpAlbumCoverWidget::cleanupTestCase() |
|
71 { |
|
72 } |
|
73 |
|
74 /*! |
|
75 Called before each testfunction is executed. |
|
76 */ |
|
77 void TestMpAlbumCoverWidget::init() |
|
78 { |
|
79 mTest = new MpAlbumCoverWidget(); |
|
80 } |
|
81 |
|
82 /*! |
|
83 Called after every testfunction. |
|
84 */ |
|
85 void TestMpAlbumCoverWidget::cleanup() |
|
86 { |
|
87 delete mTest; |
|
88 mTest = 0; |
|
89 } |
|
90 |
|
91 /*! |
|
92 test setIcon |
|
93 */ |
|
94 void TestMpAlbumCoverWidget::testSetIcon() |
|
95 { |
|
96 HbIcon *icon = new HbIcon(); |
|
97 mTest->setIcon( *icon ); |
|
98 |
|
99 QVERIFY( *icon == mTest->mIcon ); |
|
100 delete icon; |
|
101 } |
|
102 |
|
103 /*! |
|
104 test setDefaultIcon |
|
105 */ |
|
106 void TestMpAlbumCoverWidget::testSetDefaultIcon() |
|
107 { |
|
108 HbIcon *icon = new HbIcon(); |
|
109 mTest->setDefaultIcon( *icon ); |
|
110 |
|
111 QVERIFY( *icon == mTest->mDefaultIcon); |
|
112 delete icon; |
|
113 } |
|
114 |
|
115 |
|
116 |
|
117 // End of file |