qmimedata.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/kernel/qmimedata.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5struct QMimeDataStruct-
6{-
7 QString format;-
8 QVariant data;-
9};-
10template<> class QTypeInfo<QMimeDataStruct > { public: enum { isComplex = (((Q_MOVABLE_TYPE) & Q_PRIMITIVE_TYPE) == 0), isStatic = (((Q_MOVABLE_TYPE) & (Q_MOVABLE_TYPE | Q_PRIMITIVE_TYPE)) == 0), isRelocatable = !isStatic || ((Q_MOVABLE_TYPE) & Q_RELOCATABLE_TYPE), isLarge = (sizeof(QMimeDataStruct)>sizeof(void*)), isPointer = false, isIntegral = QtPrivate::is_integral< QMimeDataStruct >::value, isDummy = (((Q_MOVABLE_TYPE) & Q_DUMMY_TYPE) != 0), sizeOf = sizeof(QMimeDataStruct) }; static inline const char *name() { return "QMimeDataStruct"; } };-
11-
12class QMimeDataPrivate : public QObjectPrivate-
13{-
14 inline QMimeData* q_func() { return static_cast<QMimeData *>(q_ptr); } inline const QMimeData* q_func() const { return static_cast<const QMimeData *>(q_ptr); } friend class QMimeData;-
15public:-
16 void removeData(const QString &format);-
17 void setData(const QString &format, const QVariant &data);-
18 QVariant getData(const QString &format) const;-
19-
20 QVariant retrieveTypedData(const QString &format, QVariant::Type type) const;-
21-
22 QVector<QMimeDataStruct> dataList;-
23};-
24-
25void QMimeDataPrivate::removeData(const QString &format)-
26{-
27 for (int i=0; i<dataList.size()
i<dataList.size()Description
TRUEevaluated 43 times by 4 tests
Evaluated by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTextEdit
FALSEevaluated 118 times by 12 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
; i++) {
43-118
28 if (dataList.at(i).format == format
dataList.at(i)...rmat == formatDescription
TRUEevaluated 8 times by 2 tests
Evaluated by:
  • tst_QMimeData
  • tst_QTextEdit
FALSEevaluated 35 times by 4 tests
Evaluated by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTextEdit
) {
8-35
29 dataList.removeAt(i);-
30 return;
executed 8 times by 2 tests: return;
Executed by:
  • tst_QMimeData
  • tst_QTextEdit
8
31 }-
32 }
executed 35 times by 4 tests: end of block
Executed by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTextEdit
35
33}
executed 118 times by 12 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
118
34-
35void QMimeDataPrivate::setData(const QString &format, const QVariant &data)-
36{-
37-
38 removeData(format);-
39 QMimeDataStruct mimeData;-
40 mimeData.format = format;-
41 mimeData.data = data;-
42 dataList += mimeData;-
43}
executed 124 times by 12 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
124
44-
45-
46QVariant QMimeDataPrivate::getData(const QString &format) const-
47{-
48 QVariant data;-
49 for (int i=0; i<dataList.size()
i<dataList.size()Description
TRUEevaluated 173 times by 16 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 9 times by 1 test
Evaluated by:
  • tst_QMimeData
; i++) {
9-173
50 if (dataList.at(i).format == format
dataList.at(i)...rmat == formatDescription
TRUEevaluated 128 times by 16 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 45 times by 6 tests
Evaluated by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTextEdit
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
) {
45-128
51 data = dataList.at(i).data;-
52 break;
executed 128 times by 16 tests: break;
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
128
53 }-
54 }
executed 45 times by 6 tests: end of block
Executed by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTextEdit
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
45
55 return
executed 137 times by 16 tests: return data;
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
data;
executed 137 times by 16 tests: return data;
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
137
56}-
57-
58QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Type type) const-
59{-
60 const QMimeData * const q = q_func();-
61-
62 QVariant data = q->retrieveData(format, type);-
63-
64-
65 if (format == QLatin1String("text/plain")
format == QLat...("text/plain")Description
TRUEevaluated 90 times by 13 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 47 times by 8 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QListWidget
  • tst_QMimeData
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
&& !data.isValid()
!data.isValid()Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 86 times by 13 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
) {
4-90
66 data = retrieveTypedData(QLatin1String("text/uri-list"), QVariant::List);-
67 if (data.type() == QVariant::Url
data.type() == QVariant::UrlDescription
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QMimeData
) {
0-4
68 data = QVariant(data.toUrl().toDisplayString());-
69 }
never executed: end of block
else if (data.type() == QVariant::List
data.type() == QVariant::ListDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
) {
0-2
70 QString text;-
71 int numUrls = 0;-
72 const QList<QVariant> list = data.toList();-
73 for (int i = 0; i < list.size()
i < list.size()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
; ++i) {
2-3
74 if (list.at(i).type() == QVariant::Url
list.at(i).typ... QVariant::UrlDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEnever evaluated
) {
0-3
75 text.append(list.at(i).toUrl().toDisplayString() + QLatin1Char('\n'));-
76 ++numUrls;-
77 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QMimeData
3
78 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QMimeData
3
79 if (numUrls == 1
numUrls == 1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QMimeData
)
1
80 text.chop(1);
executed 1 time by 1 test: text.chop(1);
Executed by:
  • tst_QMimeData
1
81 data = QVariant(text);-
82 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QMimeData
2
83 }
executed 4 times by 1 test: end of block
Executed by:
  • tst_QMimeData
4
84-
85 if (data.type() == type
data.type() == typeDescription
TRUEevaluated 99 times by 15 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 38 times by 8 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
|| !data.isValid()
!data.isValid()Description
TRUEevaluated 7 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 31 times by 8 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
)
7-99
86 return
executed 106 times by 15 tests: return data;
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
data;
executed 106 times by 15 tests: return data;
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
106
87-
88-
89-
90-
91 if ((type == QVariant::Url
type == QVariant::UrlDescription
TRUEnever evaluated
FALSEevaluated 31 times by 8 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
&& data.type() == QVariant::List
data.type() == QVariant::ListDescription
TRUEnever evaluated
FALSEnever evaluated
)
0-31
92 || (type == QVariant::List
type == QVariant::ListDescription
TRUEnever evaluated
FALSEevaluated 31 times by 8 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
&& data.type() == QVariant::Url
data.type() == QVariant::UrlDescription
TRUEnever evaluated
FALSEnever evaluated
))
0-31
93 return
never executed: return data;
data;
never executed: return data;
0
94-
95-
96 if ((type == QVariant::Pixmap
type == QVariant::PixmapDescription
TRUEnever evaluated
FALSEevaluated 31 times by 8 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
&& data.type() == QVariant::Image
data.type() == QVariant::ImageDescription
TRUEnever evaluated
FALSEnever evaluated
)
0-31
97 || (type == QVariant::Image
type == QVariant::ImageDescription
TRUEnever evaluated
FALSEevaluated 31 times by 8 tests
Evaluated by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
&& data.type() == QVariant::Pixmap
data.type() ==...ariant::PixmapDescription
TRUEnever evaluated
FALSEnever evaluated
))
0-31
98 return
never executed: return data;
data;
never executed: return data;
0
99-
100 if (data.type() == QVariant::ByteArray
data.type() ==...ant::ByteArrayDescription
TRUEevaluated 8 times by 3 tests
Evaluated by:
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
FALSEevaluated 23 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QMimeData
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
) {
8-23
101-
102 switch(type) {-
103-
104 case
executed 8 times by 3 tests: case QVariant::String:
Executed by:
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
QVariant::String:
executed 8 times by 3 tests: case QVariant::String:
Executed by:
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
{
8
105 const QByteArray ba = data.toByteArray();-
106 QTextCodec *codec = QTextCodec::codecForName("utf-8");-
107 if (format == QLatin1String("text/html")
format == QLat...g("text/html")Description
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QMimeData
  • tst_QTextEdit
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QClipboard
)
3-5
108 codec = QTextCodec::codecForHtml(ba, codec);
executed 5 times by 2 tests: codec = QTextCodec::codecForHtml(ba, codec);
Executed by:
  • tst_QMimeData
  • tst_QTextEdit
5
109 return
executed 8 times by 3 tests: return codec->toUnicode(ba);
Executed by:
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
codec->toUnicode(ba);
executed 8 times by 3 tests: return codec->toUnicode(ba);
Executed by:
  • tst_QClipboard
  • tst_QMimeData
  • tst_QTextEdit
8
110 }-
111-
112 case
never executed: case QVariant::Color:
QVariant::Color:
never executed: case QVariant::Color:
{
0
113 QVariant newData = data;-
114 newData.convert(QVariant::Color);-
115 return
never executed: return newData;
newData;
never executed: return newData;
0
116 }-
117 case
never executed: case QVariant::List:
QVariant::List:
never executed: case QVariant::List:
{
0
118 if (format != QLatin1String("text/uri-list")
format != QLat...ext/uri-list")Description
TRUEnever evaluated
FALSEnever evaluated
)
0
119 break;
never executed: break;
0
120-
121 }-
122 case
never executed: case QVariant::Url:
QVariant::Url:
never executed: case QVariant::Url:
code before this statement never executed: case QVariant::Url:
{
0
123 QByteArray ba = data.toByteArray();-
124-
125-
126-
127 if (ba.endsWith('\0')
ba.endsWith('\0')Description
TRUEnever evaluated
FALSEnever evaluated
)
0
128 ba.chop(1);
never executed: ba.chop(1);
0
129-
130 QList<QByteArray> urls = ba.split('\n');-
131 QList<QVariant> list;-
132 for (int i = 0; i < urls.size()
i < urls.size()Description
TRUEnever evaluated
FALSEnever evaluated
; ++i) {
0
133 QByteArray ba = urls.at(i).trimmed();-
134 if (!ba.isEmpty()
!ba.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
135 list.append(QUrl::fromEncoded(ba));
never executed: list.append(QUrl::fromEncoded(ba));
0
136 }
never executed: end of block
0
137 return
never executed: return list;
list;
never executed: return list;
0
138 }-
139 default
never executed: default:
:
never executed: default:
0
140 break;
never executed: break;
0
141 }-
142-
143 } else if (type == QVariant::ByteArray
type == QVariant::ByteArrayDescription
TRUEevaluated 23 times by 6 tests
Evaluated by:
  • tst_QApplication
  • tst_QMimeData
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEnever evaluated
) {
0-23
144-
145-
146 switch(data.type()) {-
147 case
never executed: case QVariant::ByteArray:
QVariant::ByteArray:
never executed: case QVariant::ByteArray:
0
148 case
never executed: case QVariant::Color:
QVariant::Color:
never executed: case QVariant::Color:
0
149 return
never executed: return data.toByteArray();
data.toByteArray();
never executed: return data.toByteArray();
0
150 case
executed 22 times by 6 tests: case QVariant::String:
Executed by:
  • tst_QApplication
  • tst_QMimeData
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
QVariant::String:
executed 22 times by 6 tests: case QVariant::String:
Executed by:
  • tst_QApplication
  • tst_QMimeData
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
22
151 return
executed 22 times by 6 tests: return data.toString().toUtf8();
Executed by:
  • tst_QApplication
  • tst_QMimeData
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
data.toString().toUtf8();
executed 22 times by 6 tests: return data.toString().toUtf8();
Executed by:
  • tst_QApplication
  • tst_QMimeData
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
22
152 case
never executed: case QVariant::Url:
QVariant::Url:
never executed: case QVariant::Url:
0
153 return
never executed: return data.toUrl().toEncoded();
data.toUrl().toEncoded();
never executed: return data.toUrl().toEncoded();
0
154 case
executed 1 time by 1 test: case QVariant::List:
Executed by:
  • tst_QMimeData
QVariant::List:
executed 1 time by 1 test: case QVariant::List:
Executed by:
  • tst_QMimeData
{
1
155-
156 QByteArray result;-
157 QList<QVariant> list = data.toList();-
158 for (int i = 0; i < list.size()
i < list.size()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QMimeData
; ++i) {
1-2
159 if (list.at(i).type() == QVariant::Url
list.at(i).typ... QVariant::UrlDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEnever evaluated
) {
0-2
160 result += list.at(i).toUrl().toEncoded();-
161 result += "\r\n";-
162 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QMimeData
2
163 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QMimeData
2
164 if (!result.isEmpty()
!result.isEmpty()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QMimeData
FALSEnever evaluated
)
0-1
165 return
executed 1 time by 1 test: return result;
Executed by:
  • tst_QMimeData
result;
executed 1 time by 1 test: return result;
Executed by:
  • tst_QMimeData
1
166 break;
never executed: break;
0
167 }-
168 default
never executed: default:
:
never executed: default:
0
169 break;
never executed: break;
0
170 }-
171 }-
172 return
never executed: return data;
data;
never executed: return data;
0
173}-
174QMimeData::QMimeData()-
175 : QObject(*new QMimeDataPrivate, 0)-
176{-
177}
executed 231 times by 19 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QDrag
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGuiApplication
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QStyleSheetStyle
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qapplication - unknown status
  • tst_qprocess - unknown status
  • tst_selftests - unknown status
231
178-
179-
180-
181-
182QMimeData::~QMimeData()-
183{-
184}-
185QList<QUrl> QMimeData::urls() const-
186{-
187 const QMimeDataPrivate * const d = d_func();-
188 QVariant data = d->retrieveTypedData(QLatin1String("text/uri-list"), QVariant::List);-
189 QList<QUrl> urls;-
190 if (data.type() == QVariant::Url
data.type() == QVariant::UrlDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
)
0-2
191 urls.append(data.toUrl());
never executed: urls.append(data.toUrl());
0
192 else if (data.type() == QVariant::List
data.type() == QVariant::ListDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEnever evaluated
) {
0-2
193 QList<QVariant> list = data.toList();-
194 for (int i = 0; i < list.size()
i < list.size()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
; ++i) {
2-3
195 if (list.at(i).type() == QVariant::Url
list.at(i).typ... QVariant::UrlDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEnever evaluated
)
0-3
196 urls.append(list.at(i).toUrl());
executed 3 times by 1 test: urls.append(list.at(i).toUrl());
Executed by:
  • tst_QMimeData
3
197 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QMimeData
3
198 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QMimeData
2
199 return
executed 2 times by 1 test: return urls;
Executed by:
  • tst_QMimeData
urls;
executed 2 times by 1 test: return urls;
Executed by:
  • tst_QMimeData
2
200}-
201void QMimeData::setUrls(const QList<QUrl> &urls)-
202{-
203 QMimeDataPrivate * const d = d_func();-
204 QList<QVariant> list;-
205 const int numUrls = urls.size();-
206 list.reserve(numUrls);-
207 for (int i = 0; i < numUrls
i < numUrlsDescription
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
; ++i)
2-3
208 list.append(urls.at(i));
executed 3 times by 1 test: list.append(urls.at(i));
Executed by:
  • tst_QMimeData
3
209-
210 d->setData(QLatin1String("text/uri-list"), list);-
211}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QMimeData
2
212bool QMimeData::hasUrls() const-
213{-
214 return
executed 20 times by 3 tests: return hasFormat(QLatin1String("text/uri-list"));
Executed by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
hasFormat(QLatin1String("text/uri-list"));
executed 20 times by 3 tests: return hasFormat(QLatin1String("text/uri-list"));
Executed by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
20
215}-
216QString QMimeData::text() const-
217{-
218 const QMimeDataPrivate * const d = d_func();-
219 QVariant data = d->retrieveTypedData(QLatin1String("text/plain"), QVariant::String);-
220 return
executed 66 times by 9 tests: return data.toString();
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
  • tst_QWidget_window
data.toString();
executed 66 times by 9 tests: return data.toString();
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStyleSheetStyle
  • tst_QTextEdit
  • tst_QWidget_window
66
221}-
222-
223-
224-
225-
226-
227-
228-
229void QMimeData::setText(const QString &text)-
230{-
231 QMimeDataPrivate * const d = d_func();-
232 d->setData(QLatin1String("text/plain"), text);-
233}
executed 45 times by 8 tests: end of block
Executed by:
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
  • tst_QWidget_window
45
234-
235-
236-
237-
238-
239-
240-
241bool QMimeData::hasText() const-
242{-
243 return
executed 30 times by 3 tests: return hasFormat(QLatin1String("text/plain")) || hasUrls();
Executed by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
hasFormat(QLatin1String("text/plain"))
hasFormat(QLat..."text/plain"))Description
TRUEevaluated 12 times by 3 tests
Evaluated by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
FALSEevaluated 18 times by 3 tests
Evaluated by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
|| hasUrls()
hasUrls()Description
TRUEnever evaluated
FALSEevaluated 18 times by 3 tests
Evaluated by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
;
executed 30 times by 3 tests: return hasFormat(QLatin1String("text/plain")) || hasUrls();
Executed by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
0-30
244}-
245-
246-
247-
248-
249-
250-
251-
252QString QMimeData::html() const-
253{-
254 const QMimeDataPrivate * const d = d_func();-
255 QVariant data = d->retrieveTypedData(QLatin1String("text/html"), QVariant::String);-
256 return
executed 7 times by 2 tests: return data.toString();
Executed by:
  • tst_QMimeData
  • tst_QTextEdit
data.toString();
executed 7 times by 2 tests: return data.toString();
Executed by:
  • tst_QMimeData
  • tst_QTextEdit
7
257}-
258-
259-
260-
261-
262-
263-
264-
265void QMimeData::setHtml(const QString &html)-
266{-
267 QMimeDataPrivate * const d = d_func();-
268 d->setData(QLatin1String("text/html"), html);-
269}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QMimeData
2
270-
271-
272-
273-
274-
275-
276-
277bool QMimeData::hasHtml() const-
278{-
279 return
executed 25 times by 3 tests: return hasFormat(QLatin1String("text/html"));
Executed by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
hasFormat(QLatin1String("text/html"));
executed 25 times by 3 tests: return hasFormat(QLatin1String("text/html"));
Executed by:
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QTextEdit
25
280}-
281QVariant QMimeData::imageData() const-
282{-
283 const QMimeDataPrivate * const d = d_func();-
284 return
executed 3 times by 1 test: return d->retrieveTypedData(QLatin1String("application/x-qt-image"), QVariant::Image);
Executed by:
  • tst_QMimeData
d->retrieveTypedData(QLatin1String("application/x-qt-image"), QVariant::Image);
executed 3 times by 1 test: return d->retrieveTypedData(QLatin1String("application/x-qt-image"), QVariant::Image);
Executed by:
  • tst_QMimeData
3
285}-
286void QMimeData::setImageData(const QVariant &image)-
287{-
288 QMimeDataPrivate * const d = d_func();-
289 d->setData(QLatin1String("application/x-qt-image"), image);-
290}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QMimeData
2
291-
292-
293-
294-
295-
296-
297-
298bool QMimeData::hasImage() const-
299{-
300 return
executed 5 times by 1 test: return hasFormat(QLatin1String("application/x-qt-image"));
Executed by:
  • tst_QMimeData
hasFormat(QLatin1String("application/x-qt-image"));
executed 5 times by 1 test: return hasFormat(QLatin1String("application/x-qt-image"));
Executed by:
  • tst_QMimeData
5
301}-
302QVariant QMimeData::colorData() const-
303{-
304 const QMimeDataPrivate * const d = d_func();-
305 return
executed 2 times by 1 test: return d->retrieveTypedData(QLatin1String("application/x-color"), QVariant::Color);
Executed by:
  • tst_QMimeData
d->retrieveTypedData(QLatin1String("application/x-color"), QVariant::Color);
executed 2 times by 1 test: return d->retrieveTypedData(QLatin1String("application/x-color"), QVariant::Color);
Executed by:
  • tst_QMimeData
2
306}-
307void QMimeData::setColorData(const QVariant &color)-
308{-
309 QMimeDataPrivate * const d = d_func();-
310 d->setData(QLatin1String("application/x-color"), color);-
311}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QMimeData
3
312bool QMimeData::hasColor() const-
313{-
314 return
executed 6 times by 1 test: return hasFormat(QLatin1String("application/x-color"));
Executed by:
  • tst_QMimeData
hasFormat(QLatin1String("application/x-color"));
executed 6 times by 1 test: return hasFormat(QLatin1String("application/x-color"));
Executed by:
  • tst_QMimeData
6
315}-
316-
317-
318-
319-
320-
321QByteArray QMimeData::data(const QString &mimeType) const-
322{-
323 const QMimeDataPrivate * const d = d_func();-
324 QVariant data = d->retrieveTypedData(mimeType, QVariant::ByteArray);-
325 return
executed 53 times by 11 tests: return data.toByteArray();
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QListWidget
  • tst_QMimeData
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
data.toByteArray();
executed 53 times by 11 tests: return data.toByteArray();
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QListWidget
  • tst_QMimeData
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
53
326}-
327void QMimeData::setData(const QString &mimeType, const QByteArray &data)-
328{-
329 QMimeDataPrivate * const d = d_func();-
330-
331 if (mimeType == QLatin1String("text/uri-list")
mimeType == QL...ext/uri-list")Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 69 times by 8 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QClipboard
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
) {
1-69
332 QByteArray ba = data;-
333 if (ba.endsWith('\0')
ba.endsWith('\0')Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QMimeData
)
0-1
334 ba.chop(1);
never executed: ba.chop(1);
0
335 QList<QByteArray> urls = ba.split('\n');-
336 QList<QVariant> list;-
337 for (int i = 0; i < urls.size()
i < urls.size()Description
TRUEevaluated 3 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QMimeData
; ++i) {
1-3
338 QByteArray ba = urls.at(i).trimmed();-
339 if (!ba.isEmpty()
!ba.isEmpty()Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QMimeData
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QMimeData
)
1-2
340 list.append(QUrl::fromEncoded(ba));
executed 2 times by 1 test: list.append(QUrl::fromEncoded(ba));
Executed by:
  • tst_QMimeData
2
341 }
executed 3 times by 1 test: end of block
Executed by:
  • tst_QMimeData
3
342 d->setData(mimeType, list);-
343 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QMimeData
else {
1
344 d->setData(mimeType, QVariant(data));-
345 }
executed 69 times by 8 tests: end of block
Executed by:
  • tst_QAbstractItemModel
  • tst_QClipboard
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
69
346}-
347bool QMimeData::hasFormat(const QString &mimeType) const-
348{-
349 return
executed 126 times by 13 tests: return formats().contains(mimeType);
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
formats().contains(mimeType);
executed 126 times by 13 tests: return formats().contains(mimeType);
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
126
350}-
351QStringList QMimeData::formats() const-
352{-
353 const QMimeDataPrivate * const d = d_func();-
354 QStringList list;-
355 for (int i=0; i<d->dataList.size()
i<d->dataList.size()Description
TRUEevaluated 152 times by 13 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
FALSEevaluated 124 times by 13 tests
Evaluated by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
; i++)
124-152
356 list += d->dataList.at(i).format;
executed 152 times by 13 tests: list += d->dataList.at(i).format;
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
152
357 return
executed 124 times by 13 tests: return list;
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
list;
executed 124 times by 13 tests: return list;
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QGraphicsProxyWidget
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
124
358}-
359QVariant QMimeData::retrieveData(const QString &mimeType, QVariant::Type type) const-
360{-
361 (void)type;;-
362 const QMimeDataPrivate * const d = d_func();-
363 return
executed 137 times by 16 tests: return d->getData(mimeType);
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
d->getData(mimeType);
executed 137 times by 16 tests: return d->getData(mimeType);
Executed by:
  • tst_QAbstractItemModel
  • tst_QApplication
  • tst_QClipboard
  • tst_QGraphicsProxyWidget
  • tst_QLineEdit
  • tst_QListWidget
  • tst_QMimeData
  • tst_QPlainTextEdit
  • tst_QStandardItemModel
  • tst_QTableWidget
  • tst_QTextEdit
  • tst_QWidget_window
  • tst_qclipboard - unknown status
  • tst_qlineedit - unknown status
  • tst_qplaintextedit - unknown status
  • tst_qtextedit - unknown status
137
364}-
365-
366-
367-
368-
369void QMimeData::clear()-
370{-
371 QMimeDataPrivate * const d = d_func();-
372 d->dataList.clear();-
373}
executed 12 times by 2 tests: end of block
Executed by:
  • tst_QClipboard
  • tst_QMimeData
12
374-
375-
376-
377-
378-
379-
380void QMimeData::removeFormat(const QString &mimeType)-
381{-
382 QMimeDataPrivate * const d = d_func();-
383 d->removeData(mimeType);-
384}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QMimeData
2
385-
386-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9