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 <QTest> |
|
19 |
|
20 #include "cxeerror.h" |
|
21 #include "cxutils.h" |
|
22 #include "cxeimagedataitemsymbian.h" |
|
23 #include "cxeimagedataqueueunit.h" |
|
24 #include "unittest_cxeimagedataqueuesymbian.h" |
|
25 |
|
26 |
|
27 /** |
|
28 * UnitTestCxeImageDataQueueSymbian::UnitTestCxeImageDataQueueSymbian() |
|
29 */ |
|
30 UnitTestCxeImageDataQueueSymbian::UnitTestCxeImageDataQueueSymbian() |
|
31 : mImageDataQueue(NULL) |
|
32 { |
|
33 } |
|
34 |
|
35 /** |
|
36 * UnitTestCxeImageDataQueueSymbian::~UnitTestCxeImageDataQueueSymbian() |
|
37 */ |
|
38 UnitTestCxeImageDataQueueSymbian::~UnitTestCxeImageDataQueueSymbian() |
|
39 { |
|
40 cleanup(); |
|
41 } |
|
42 |
|
43 /** |
|
44 * UnitTestCxeImageDataQueueSymbian::init() |
|
45 */ |
|
46 void UnitTestCxeImageDataQueueSymbian::init() |
|
47 { |
|
48 mImageDataQueue = new CxeImageDataQueueUnit(); |
|
49 } |
|
50 |
|
51 /** |
|
52 * UnitTestCxeImageDataQueueSymbian::cleanup() |
|
53 */ |
|
54 void UnitTestCxeImageDataQueueSymbian::cleanup() |
|
55 { |
|
56 delete mImageDataQueue; |
|
57 mImageDataQueue = NULL; |
|
58 } |
|
59 |
|
60 |
|
61 /** |
|
62 * UnitTestCxeImageDataQueueSymbian::testSize() |
|
63 */ |
|
64 void UnitTestCxeImageDataQueueSymbian::testSize() |
|
65 { |
|
66 QVERIFY(mImageDataQueue->size() == 0); |
|
67 } |
|
68 |
|
69 /** |
|
70 * UnitTestCxeImageDataQueueSymbian::testClear1() |
|
71 */ |
|
72 void UnitTestCxeImageDataQueueSymbian::testClear1() |
|
73 { |
|
74 // Call to empty queue, expect no errors. |
|
75 mImageDataQueue->clear(); |
|
76 QVERIFY(mImageDataQueue->size() == 0); |
|
77 } |
|
78 |
|
79 /** |
|
80 * UnitTestCxeImageDataQueueSymbian::testClear2() |
|
81 */ |
|
82 void UnitTestCxeImageDataQueueSymbian::testClear2() |
|
83 { |
|
84 // Add some items |
|
85 QByteArray data("test"); |
|
86 mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0, false); |
|
87 mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1, false); |
|
88 |
|
89 // Test that clearing works also with some content. |
|
90 mImageDataQueue->clear(); |
|
91 QVERIFY(mImageDataQueue->size() == 0); |
|
92 } |
|
93 |
|
94 /** |
|
95 * UnitTestCxeImageDataQueueSymbian::testOperatorAtIndex() |
|
96 */ |
|
97 void UnitTestCxeImageDataQueueSymbian::testOperatorAtIndex() |
|
98 { |
|
99 QByteArray data("test"); |
|
100 CxeImageDataItemSymbian* itemIn1 = mImageDataQueue->startSave(data, "C:\\Images\\unittest1.jpeg", 0, false); |
|
101 CxeImageDataItemSymbian* itemIn2 = mImageDataQueue->startSave(data, "C:\\Images\\unittest2.jpeg", 1, false); |
|
102 CxeImageDataItem& itemOut1 = (*mImageDataQueue)[0]; |
|
103 CxeImageDataItem& itemOut2 = (*mImageDataQueue)[1]; |
|
104 QVERIFY(itemIn1 == &itemOut1); |
|
105 QVERIFY(itemIn2 == &itemOut2); |
|
106 } |
|
107 |
|
108 /** |
|
109 * UnitTestCxeImageDataQueueSymbian::testStartSave() |
|
110 */ |
|
111 void UnitTestCxeImageDataQueueSymbian::testStartSave() |
|
112 { |
|
113 QByteArray data("test"); |
|
114 CxeImageDataItemSymbian* itemIn = mImageDataQueue->startSave(data, "C:\\Images\\unittest.jpeg", 0, false); |
|
115 QVERIFY(itemIn != NULL); |
|
116 } |
|
117 |
|
118 // main() function |
|
119 QTEST_APPLESS_MAIN(UnitTestCxeImageDataQueueSymbian); |
|
120 |
|
121 // end of file |
|