author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 02 Feb 2010 00:43:10 +0200 | |
changeset 3 | 41300fa6a67c |
parent 0 | 1918ee327afb |
child 4 | 3b1da2848fc7 |
permissions | -rw-r--r-- |
0 | 1 |
/**************************************************************************** |
2 |
** |
|
3 |
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
4 |
** All rights reserved. |
|
5 |
** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 |
** |
|
7 |
** This file is part of the test suite of the Qt Toolkit. |
|
8 |
** |
|
9 |
** $QT_BEGIN_LICENSE:LGPL$ |
|
10 |
** No Commercial Usage |
|
11 |
** This file contains pre-release code and may not be distributed. |
|
12 |
** You may use this file in accordance with the terms and conditions |
|
13 |
** contained in the Technology Preview License Agreement accompanying |
|
14 |
** this package. |
|
15 |
** |
|
16 |
** GNU Lesser General Public License Usage |
|
17 |
** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 |
** General Public License version 2.1 as published by the Free Software |
|
19 |
** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 |
** packaging of this file. Please review the following information to |
|
21 |
** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 |
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 |
** |
|
24 |
** In addition, as a special exception, Nokia gives you certain additional |
|
25 |
** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 |
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 |
** |
|
28 |
** If you have questions regarding the use of this file, please contact |
|
29 |
** Nokia at qt-info@nokia.com. |
|
30 |
** |
|
31 |
** |
|
32 |
** |
|
33 |
** |
|
34 |
** |
|
35 |
** |
|
36 |
** |
|
37 |
** |
|
38 |
** $QT_END_LICENSE$ |
|
39 |
** |
|
40 |
****************************************************************************/ |
|
41 |
||
42 |
||
43 |
#include <QtTest/QtTest> |
|
44 |
||
45 |
#include <qapplication.h> |
|
46 |
#include <qdebug.h> |
|
47 |
#include <q3filedialog.h> |
|
48 |
#include <qlabel.h> |
|
49 |
||
50 |
//TESTED_CLASS= |
|
51 |
//TESTED_FILES= |
|
52 |
||
53 |
class tst_Q3FileDialog : public QObject |
|
54 |
{ |
|
55 |
Q_OBJECT |
|
56 |
||
57 |
public: |
|
58 |
tst_Q3FileDialog(); |
|
59 |
virtual ~tst_Q3FileDialog(); |
|
60 |
||
61 |
private slots: |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
#ifndef QT_MAC_USE_COCOA |
0 | 63 |
void getSetCheck(); |
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
64 |
#endif |
0 | 65 |
}; |
66 |
||
67 |
tst_Q3FileDialog::tst_Q3FileDialog() |
|
68 |
{ |
|
69 |
} |
|
70 |
||
71 |
tst_Q3FileDialog::~tst_Q3FileDialog() |
|
72 |
{ |
|
73 |
} |
|
74 |
||
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
75 |
#ifndef QT_MAC_USE_COCOA |
0 | 76 |
class Preview : public QLabel, public Q3FilePreview |
77 |
{ |
|
78 |
public: |
|
79 |
Preview(QWidget *parent=0) : QLabel(parent) {} |
|
80 |
||
81 |
void previewUrl(const Q3Url &u) |
|
82 |
{ |
|
83 |
QString path = u.path(); |
|
84 |
QPixmap pix(path); |
|
85 |
if (pix.isNull()) |
|
86 |
setText("This is not a pixmap"); |
|
87 |
else |
|
88 |
setText("This is a pixmap"); |
|
89 |
} |
|
90 |
}; |
|
91 |
||
92 |
||
93 |
// Testing get/set functions |
|
94 |
void tst_Q3FileDialog::getSetCheck() |
|
95 |
{ |
|
96 |
Q3FileDialog obj1; |
|
97 |
// bool Q3FileDialog::showHiddenFiles() |
|
98 |
// void Q3FileDialog::setShowHiddenFiles(bool) |
|
99 |
obj1.setShowHiddenFiles(false); |
|
100 |
QCOMPARE(false, obj1.showHiddenFiles()); |
|
101 |
obj1.setShowHiddenFiles(true); |
|
102 |
QCOMPARE(true, obj1.showHiddenFiles()); |
|
103 |
||
104 |
// ViewMode Q3FileDialog::viewMode() |
|
105 |
// void Q3FileDialog::setViewMode(ViewMode) |
|
106 |
obj1.setViewMode(Q3FileDialog::ViewMode(Q3FileDialog::Detail)); |
|
107 |
QCOMPARE(obj1.viewMode(), Q3FileDialog::ViewMode(Q3FileDialog::Detail)); |
|
108 |
obj1.setViewMode(Q3FileDialog::ViewMode(Q3FileDialog::List)); |
|
109 |
QCOMPARE(obj1.viewMode(), Q3FileDialog::ViewMode(Q3FileDialog::List)); |
|
110 |
||
111 |
Preview* p = new Preview; |
|
112 |
obj1.setContentsPreviewEnabled(true); |
|
113 |
obj1.setContentsPreview(p, p); |
|
114 |
obj1.setInfoPreviewEnabled(true); |
|
115 |
obj1.setInfoPreview(p, p); |
|
116 |
// PreviewMode Q3FileDialog::previewMode() |
|
117 |
// void Q3FileDialog::setPreviewMode(PreviewMode) |
|
118 |
obj1.setPreviewMode(Q3FileDialog::PreviewMode(Q3FileDialog::NoPreview)); |
|
119 |
QCOMPARE(obj1.previewMode(), Q3FileDialog::PreviewMode(Q3FileDialog::NoPreview)); |
|
120 |
||
121 |
obj1.setContentsPreviewEnabled(true); |
|
122 |
obj1.setInfoPreviewEnabled(false); |
|
123 |
obj1.setPreviewMode(Q3FileDialog::PreviewMode(Q3FileDialog::Contents)); |
|
124 |
QCOMPARE(obj1.previewMode(), Q3FileDialog::PreviewMode(Q3FileDialog::Contents)); |
|
125 |
||
126 |
obj1.setInfoPreviewEnabled(true); |
|
127 |
obj1.setContentsPreviewEnabled(false); |
|
128 |
obj1.setPreviewMode(Q3FileDialog::PreviewMode(Q3FileDialog::Info)); |
|
129 |
QCOMPARE(obj1.previewMode(), Q3FileDialog::PreviewMode(Q3FileDialog::Info)); |
|
130 |
} |
|
3
41300fa6a67c
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
131 |
#endif |
0 | 132 |
|
133 |
QTEST_MAIN(tst_Q3FileDialog) |
|
134 |
#include "tst_q3filedialog.moc" |