46
|
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: This class is test case for file manager internal api class.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include "fmfileiconprovider.h"
|
|
19 |
#include "fmfiletyperecognizer.h"
|
|
20 |
#include <QtTest/QtTest>
|
|
21 |
#include <QMap>
|
|
22 |
#include <QString>
|
|
23 |
#include <QStringList>
|
|
24 |
#include <qdebug.h>
|
|
25 |
|
|
26 |
|
|
27 |
class TestFmFileTypeProvider: public QObject
|
|
28 |
{
|
|
29 |
Q_OBJECT
|
|
30 |
|
|
31 |
private slots:
|
|
32 |
void initTestCase();
|
|
33 |
|
|
34 |
void testFmFileIconProvider(); // test the FmFileIconProvider() constructor funtion.
|
|
35 |
|
|
36 |
void testIconKnown(); // test the icon() funtion.
|
|
37 |
// void testIconUnKnown();
|
|
38 |
|
|
39 |
void cleanupTestCase(); // Finalize test data
|
|
40 |
};
|
|
41 |
|
|
42 |
/*!
|
|
43 |
\class TestFmFileTypeProvider
|
|
44 |
\brief describe the test case's goal, like: \n
|
|
45 |
class name: FmDriveModel \n
|
|
46 |
class's description: Test the File Manager internal api functions. \n
|
|
47 |
type of test case: unit test\n
|
|
48 |
test cases' number totally: \n
|
|
49 |
*/
|
|
50 |
|
|
51 |
void TestFmFileTypeProvider::initTestCase()
|
|
52 |
{
|
|
53 |
}
|
|
54 |
|
|
55 |
/*!
|
|
56 |
Test Case Description:\n
|
|
57 |
1. Fucntion Name: \n
|
|
58 |
FmFileIconProvider(); \n
|
|
59 |
2. Case Descrition: test the constructor function. \n
|
|
60 |
3. Input Parameters: \n
|
|
61 |
<1> no \n
|
|
62 |
4. Expected result: \n
|
|
63 |
<1> no crash \n
|
|
64 |
*/
|
|
65 |
void TestFmFileTypeProvider::testFmFileIconProvider()
|
|
66 |
{
|
|
67 |
FmFileIconProvider *testProvider = new FmFileIconProvider();
|
|
68 |
//QMap<QString, FileType> mFileExtensionMap is a private member, can not verify the result.
|
|
69 |
}
|
|
70 |
|
|
71 |
/*!
|
|
72 |
Test Case Description:\n
|
|
73 |
1. Fucntion Name: \n
|
|
74 |
virtual QIcon icon(const QFileInfo &info) const; \n
|
|
75 |
2. Case Descrition: Verify the right file type is returned \n
|
|
76 |
3. Input Parameters: \n
|
|
77 |
<1> path = QString(XX) \n
|
|
78 |
4. Expected result: \n
|
|
79 |
<1> retType = FileTypeDrive \n
|
|
80 |
*/
|
|
81 |
void TestFmFileTypeProvider::testIconKnown()
|
|
82 |
{
|
|
83 |
QFileInfo path1("C:\\image.jpg");
|
|
84 |
QFileInfo path2("D:\\Video.rm");
|
|
85 |
QFileInfo path3("D:\\Tone.wav");
|
|
86 |
QFileInfo path4("Z:\\Text.doc");
|
|
87 |
QFileInfo path5("Z:\\Install.sisx");
|
|
88 |
QFileInfo path6("D:\\Java.jar");
|
|
89 |
QFileInfo path7("C:\\Flash.swf");
|
|
90 |
|
|
91 |
FmFileIconProvider *testProvider = new FmFileIconProvider();
|
|
92 |
QIcon retIcon1 = testProvider->icon(Drive_C);
|
|
93 |
// QVERIFY(retIcon1 != QIcon());
|
|
94 |
|
|
95 |
QIcon retIcon2 = testProvider->icon(Drive_D);
|
|
96 |
// QVERIFY(retIcon2 != 0);
|
|
97 |
|
|
98 |
QIcon retIcon3 = testProvider->icon(Drive_Z);
|
|
99 |
// QVERIFY(retIcon3 != 0);
|
|
100 |
|
|
101 |
QIcon retIcon4 = testProvider->icon(Folder_C_Data);
|
|
102 |
// QVERIFY(retIcon4 != 0);
|
|
103 |
|
|
104 |
QIcon retIcon01 = testProvider->icon(path1);
|
|
105 |
// QVERIFY(retIcon01 != 0);
|
|
106 |
|
|
107 |
QIcon retIcon02 = testProvider->icon(path2);
|
|
108 |
// QVERIFY(retIcon02 != 0);
|
|
109 |
|
|
110 |
QIcon retIcon03 = testProvider->icon(path3);
|
|
111 |
// QVERIFY(retIcon03 != 0);
|
|
112 |
|
|
113 |
QIcon retIcon04 = testProvider->icon(path4);
|
|
114 |
// QVERIFY(retIcon04 != 0);
|
|
115 |
|
|
116 |
QIcon retIcon05 = testProvider->icon(path5);
|
|
117 |
// QVERIFY(retIcon05 != 0);
|
|
118 |
|
|
119 |
QIcon retIcon06 = testProvider->icon(path6);
|
|
120 |
// QVERIFY(retIcon06 != 0);
|
|
121 |
|
|
122 |
QIcon retIcon07 = testProvider->icon(path7);
|
|
123 |
// QVERIFY(retIcon07 != 0);
|
|
124 |
|
|
125 |
delete testProvider;
|
|
126 |
}
|
|
127 |
|
|
128 |
void TestFmFileTypeProvider::cleanupTestCase()
|
|
129 |
{
|
|
130 |
|
|
131 |
}
|
|
132 |
|
|
133 |
QTEST_MAIN(TestFmFileTypeProvider)
|
|
134 |
#include "ut_fmfiletypeprovider.moc"
|