summaryrefslogtreecommitdiffstats
path: root/doc/src/examples/tooltips.qdoc
blob: c9073758158548bc6cc509733a7cc8f3c90b63c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

/*!
    \example widgets/tooltips
    \title Tool Tips Example

    The Tool Tips example shows how to provide static and dynamic tool
    tips for an application's widgets.

    The simplest and most common way to set a widget's tool tip is by
    calling its QWidget::setToolTip() function (static tool
    tips). Then the tool tip is shown whenever the cursor points at
    the widget. We show how to do this with our application's tool
    buttons. But it is also possible to show different tool tips
    depending on the cursor's position (dynamic tooltips). This
    approach uses mouse tracking and event handling to determine what
    widgets are located under the cursor at any point in time, and
    displays their tool tips. The tool tips for the shape items in our
    application are implemented using the latter approach.

    \image tooltips-example.png

    With the \c Tooltips application the user can create new shape
    items with the provided tool buttons, and move the items around
    using the mouse. Tooltips are provided whenever the cursor is
    pointing to a shape item or one of the buttons.

    The Tooltips example consists of two classes:

    \list
    \o \c ShapeItem is a custom widget representing one single shape item.
    \o \c SortingBox inherits from QWidget and is the application's main
        widget.
    \endlist

    First we will review the \c SortingBox class, then we will take a
    look at the \c ShapeItem class.

    \section1  SortingBox Class Definition

    \snippet examples/widgets/tooltips/sortingbox.h 0

    The \c SortingBox class inherits QWidget, and it is the Tooltips
    application's main widget. We reimplement several of the event
    handlers.

    The \c event() function provides tooltips, the \c resize()
    function makes sure the application appears consistently when the
    user resizes the main widget, and the \c paintEvent() function
    displays the shape items within the \c SortingBox widget. The
    mouse event handlers are reimplemented to make the user able to
    move the items around.

    In addition we need three private slots to make the user able to
    create new shape items.

    \snippet examples/widgets/tooltips/sortingbox.h 1

    We also create several private functions: We use the \c
    initialItemPosition(), \c initialItemColor() and \c
    createToolButton() functions when we are constructing the widget,
    and we use the \c updateButtonGeometry() function whenever the
    user is resizing the application's main widget.

    The \c itemAt() function determines if there is a shape item at a
    particular position, and the \c moveItemTo() function moves an
    item to a new position. We use the \c createShapeItem(), \c
    randomItemPosition() and \c randomItemColor() functions to create
    new shape items.

    \snippet examples/widgets/tooltips/sortingbox.h 2

    We keep all the shape items in a QList, and we keep three
    QPainterPath objects holding the shapes of a circle, a square and
    a triangle. We also need to have a pointer to an item when it is
    moving, and we need to know its previous position.

    \section1 SortingBox Class Implementation

    \snippet examples/widgets/tooltips/sortingbox.cpp 0

    In the constructor, we first set the Qt::WA_StaticContents
    attribute on the widget. This attribute indicates that the widget
    contents are north-west aligned and static. On resize, such a
    widget will receive paint events only for the newly visible part
    of itself.

    \snippet examples/widgets/tooltips/sortingbox.cpp 1

    To be able to show the appropiate tooltips while the user is
    moving the cursor around, we need to enable mouse tracking for the
    widget.

    If mouse tracking is disabled (the default), the widget only
    receives mouse move events when at least one mouse button is
    pressed while the mouse is being moved. If mouse tracking is
    enabled, the widget receives mouse move events even if no buttons
    are pressed.

    \snippet examples/widgets/tooltips/sortingbox.cpp 2

    A widget's background role defines the brush from the widget's
    palette that is used to render the background, and QPalette::Base
    is typically white.

    \snippet examples/widgets/tooltips/sortingbox.cpp 3

    After creating the application's tool buttons using the private \c
    createToolButton() function, we construct the shapes of a circle,
    a square and a triangle using QPainterPath.

    The QPainterPath class provides a container for painting
    operations, enabling graphical shapes to be constructed and
    reused. The main advantage of painter paths over normal drawing
    operations is that complex shapes only need to be created once,
    but they can be drawn many times using only calls to
    QPainter::drawPath().

    \snippet examples/widgets/tooltips/sortingbox.cpp 4

    Then we set the window title, resize the widget to a suitable
    size, and finally create three initial shape items using the
    private \c createShapeItem(), \c initialItemPosition() and \c
    initialItemColor() functions.

    \snippet examples/widgets/tooltips/sortingbox.cpp 5

    QWidget::event() is the main event handler and receives all the
    widget's events. Normally, we recommend reimplementing one of the
    specialized event handlers instead of this function. But here we
    want to catch the QEvent::ToolTip events, and since these are
    rather rare, there exists no specific event handler. For that
    reason we reimplement the main event handler, and the first thing
    we need to do is to determine the event's type:

    \snippet examples/widgets/tooltips/sortingbox.cpp 6

    If the type is QEvent::ToolTip, we cast the event to a QHelpEvent,
    otherwise we propagate the event using the QWidget::event()
    function.

    The QHelpEvent class provides an event that is used to request
    helpful information about a particular point in a widget.

    For example, the QHelpEvent::pos() function returns the event's
    position relative to the widget to which the event is dispatched.
    Here we use this information to determine if the position of the
    event is contained within the area of any of the shape items. If
    it is, we display the shape item's tooltip at the position of the
    event. If not, we hide the tooltip and explicitly ignore the event.
    This makes sure that the calling code does not start any tooltip
    specific modes as a result of the event. Note that the
    QToolTip::showText() function needs the event's position in global
    coordinates provided by QHelpEvent::globalPos().

    \snippet examples/widgets/tooltips/sortingbox.cpp 7

    The \c resizeEvent() function is reimplemented to receive the
    resize events dispatched to the widget. It makes sure that the
    tool buttons keep their position relative to the main widget when
    the widget is resized. We want the buttons to always be vertically
    aligned in the application's bottom right corner, so each time the
    main widget is resized we update the buttons geometry.

    \snippet examples/widgets/tooltips/sortingbox.cpp 8

    The \c paintEvent() function is reimplemented to receive paint
    events for the widget. We create a QPainter for the \c SortingBox
    widget, and run through the list of created shape items, drawing
    each item at its defined position.

    \snippet examples/widgets/tooltips/sortingbox.cpp 9

    The painter will by default draw all the shape items at position
    (0,0) in the \c SortingBox widget. The QPainter::translate()
    function translates the coordinate system by the given offset,
    making each shape item appear at its defined position. But
    remember to translate the coordinate system back when the item is
    drawn, otherwise the next shape item will appear at a position
    relative to the item we drawed last.

    \snippet examples/widgets/tooltips/sortingbox.cpp 10

    The QPainter::setBrush() function sets the current brush used by
    the painter. When the provided argument is a QColor, the function
    calls the appropiate QBrush constructor which creates a brush with
    the specified color and Qt::SolidPattern style. The
    QPainter::drawPath() function draws the given path using the
    current pen for outline and the current brush for filling.

    \snippet examples/widgets/tooltips/sortingbox.cpp 11

    The \c mousePressEvent() function is reimplemented to receive the
    mouse press events dispatched to the widget. It determines if an
    event's position is contained within the area of any of the shape
    items, using the private \c itemAt() function.

    If an item covers the position, we store a pointer to that item
    and the event's position. If several of the shape items cover the
    position, we store the pointer to the uppermost item. Finally, we
    move the shape item to the end of the list, and make a call to the
    QWidget::update() function to make the item appear on top.

    The QWidget::update() function does not cause an immediate
    repaint; instead it schedules a paint event for processing when Qt
    returns to the main event loop.

    \snippet examples/widgets/tooltips/sortingbox.cpp 12

    The \c mouseMoveEvent() function is reimplemented to receive mouse
    move events for the widget. If the left mouse button is pressed
    and there exists a shape item in motion, we use the private \c
    moveItemTo() function to move the item with an offset
    corresponding to the offset between the positions of the current
    mouse event and the previous one.

    \snippet examples/widgets/tooltips/sortingbox.cpp 13

    The \c mouseReleaseEvent() function is reimplemented to receive
    the mouse release events dispatched to the widget. If the left
    mouse button is pressed and there exists a shape item in motion,
    we use the private \c moveItemTo() function to move the item like
    we did in \c mouseMoveEvent(). But then we remove the pointer to
    the item in motion, making the shape item's position final for
    now. To move the item further, the user will need to press the
    left mouse button again.

    \snippet examples/widgets/tooltips/sortingbox.cpp 14
    \codeline
    \snippet examples/widgets/tooltips/sortingbox.cpp 15
    \codeline
    \snippet examples/widgets/tooltips/sortingbox.cpp 16

    The \c createNewCircle(), \c createNewSquare() and \c
    createNewTriangle() slots simply create new shape items, using the
    private \c createShapeItem(), \c randomItemPosition() and \c
    randomItemColor() functions.

    \snippet examples/widgets/tooltips/sortingbox.cpp 17

    In the \c itemAt() function, we run through the list of created
    shape items to check if the given position is contained within the
    area of any of the shape items.

    For each shape item we use the QPainterPath::contains() function
    to find out if the item's painter path contains the position. If
    it does we return the index of the item, otherwise we return
    -1. We run through the list backwards to get the index of the
    uppermost shape item in case several items cover the position.

    \snippet examples/widgets/tooltips/sortingbox.cpp 18

    The \c moveItemTo() function moves the shape item in motion, and
    the parameter \c pos is the position of a mouse event. First we
    calculate the offset between the parameter \c pos and the previous
    mouse event position. Then we add the offset to the current
    position of the item in motion.

    It is tempting to simply set the position of the item to be the
    parameter \c pos. But an item's position defines the top left
    corner of the item's bounding rectangle, and the parameter \c pos
    can be any point; The suggested shortcut would cause the item to
    jump to a position where the cursor is pointing to the bounding
    rectangle's top left corner, regardless of the item's previous
    position.

    \snippet examples/widgets/tooltips/sortingbox.cpp 19

    Finally, we update the previous mouse event position, and make a
    call to the QWidget::update() function to make the item appear at
    its new position.

    \snippet examples/widgets/tooltips/sortingbox.cpp 20

    In the \c updateButtonGeometry() function we set the geometry for
    the given button. The parameter coordinates define the bottom
    right corner of the button. We use these coordinates and the
    button's size hint to determine the position of the upper left
    corner. This position, and the button's width and height, are the
    arguments required by the QWidget::setGeometry() function.

    In the end, we calculate and return the y-coordinate of the bottom
    right corner of the next button. We use the QWidget::style()
    function to retrieve the widget's GUI style, and then
    QStyle::pixelMetric() to determine the widget's preferred default
    spacing between its child widgets.

    \snippet examples/widgets/tooltips/sortingbox.cpp 21

    The \c createShapeItem() function creates a single shape item. It
    sets the path, tooltip, position and color, using the item's own
    functions. In the end, the function appends the new item to the
    list of shape items, and calls the QWidget::update() function to
    make it appear with the other items within the \c SortingBox
    widget.

    \snippet examples/widgets/tooltips/sortingbox.cpp 22

    The \c createToolButton() function is called from the \c
    SortingBox constructor. We create a tool button with the given
    tooltip and icon. The button's parent is the \c SortingBox widget,
    and its size is 32 x 32 pixels. Before we return the button, we
    connect it to the given slot.

    \snippet examples/widgets/tooltips/sortingbox.cpp 23

    The \c initialItemPosition() function is also called from the
    constructor. We want the three first items to initially be
    centered in the middle of the \c SortingBox widget, and we use
    this function to calculate their positions.

    \snippet examples/widgets/tooltips/sortingbox.cpp 24

    Whenever the user creates a new shape item, we want the new item
    to appear at a random position, and we use the \c
    randomItemPosition() function to calculate such a position. We
    make sure that the item appears within the visible area of the
    \c SortingBox widget, using the widget's current width and heigth
    when calculating the random coordinates.

    \snippet examples/widgets/tooltips/sortingbox.cpp 25

    As with \c initialItemPosition(), the \c initialItemColor()
    function is called from the constructor. The purposes of both
    functions are purely cosmetic: We want to control the inital
    position and color of the three first items.

    \snippet examples/widgets/tooltips/sortingbox.cpp 26

    Finally the \c randomItemColor() function is implemented to give
    the shape items the user creates, a random color.

    \section1 ShapeItem Class Definition

    \snippet examples/widgets/tooltips/shapeitem.h 0

    The \c ShapeItem class is a custom widget representing one single
    shape item. The widget has a path, a position, a color and a
    tooltip. We need functions to set or modify these objects, as well
    as functions that return them. We make the latter functions \c
    const to prohibit any modifications of the objects,
    i.e. prohibiting unauthorized manipulation of the shape items
    appearance.

    \section1 ShapeItem Class Implementation

    \snippet examples/widgets/tooltips/shapeitem.cpp 0
    \codeline
    \snippet examples/widgets/tooltips/shapeitem.cpp 1
    \codeline
    \snippet examples/widgets/tooltips/shapeitem.cpp 2
    \codeline
    \snippet examples/widgets/tooltips/shapeitem.cpp 3

    This first group of functions simply return the objects that are
    requested. The objects are returned as constants, i.e. they cannot
    be modified.

    \snippet examples/widgets/tooltips/shapeitem.cpp 4
    \codeline
    \snippet examples/widgets/tooltips/shapeitem.cpp 5
    \codeline
    \snippet examples/widgets/tooltips/shapeitem.cpp 6
    \codeline
    \snippet examples/widgets/tooltips/shapeitem.cpp 7

    The last group of functions set or modify the shape item's path,
    position, color and tooltip, respectively.
*/
(char const *, char const *, int) ?staticMetaObject@QDeclarativeEngine@@2UQMetaObject@@B @ 1123 NONAME ; struct QMetaObject const QDeclarativeEngine::staticMetaObject ?staticMetaObject@QDeclarativeStateOperation@@2UQMetaObject@@B @ 1124 NONAME ; struct QMetaObject const QDeclarativeStateOperation::staticMetaObject ?actions@QDeclarativeStateOperation@@UAE?AV?$QList@VQDeclarativeAction@@@@XZ @ 1125 NONAME ; class QList QDeclarativeStateOperation::actions(void) @@ -1145,7 +1145,7 @@ EXPORTS ?sourceFile@QDeclarativeExpression@@QBE?AVQString@@XZ @ 1144 NONAME ; class QString QDeclarativeExpression::sourceFile(void) const ??_EQDeclarativeAnchors@@UAE@I@Z @ 1145 NONAME ABSENT ; QDeclarativeAnchors::~QDeclarativeAnchors(unsigned int) ?removeNotifySignal@QMetaPropertyBuilder@@QAEXXZ @ 1146 NONAME ABSENT ; void QMetaPropertyBuilder::removeNotifySignal(void) - ?trUtf8@QDeclarativeDebugService@@SA?AVQString@@PBD0@Z @ 1147 NONAME ABSENT ; class QString QDeclarativeDebugService::trUtf8(char const *, char const *) + ?trUtf8@QDeclarativeDebugService@@SA?AVQString@@PBD0@Z @ 1147 NONAME ; class QString QDeclarativeDebugService::trUtf8(char const *, char const *) ?setImportPathList@QDeclarativeEngine@@QAEXABVQStringList@@@Z @ 1148 NONAME ; void QDeclarativeEngine::setImportPathList(class QStringList const &) ?enabledChanged@QDeclarativeDebugService@@MAEX_N@Z @ 1149 NONAME ABSENT ; void QDeclarativeDebugService::enabledChanged(bool) ?addWatch@QDeclarativeEngineDebug@@QAEPAVQDeclarativeDebugWatch@@ABVQDeclarativeDebugObjectReference@@PAVQObject@@@Z @ 1150 NONAME ABSENT ; class QDeclarativeDebugWatch * QDeclarativeEngineDebug::addWatch(class QDeclarativeDebugObjectReference const &, class QObject *) @@ -1176,7 +1176,7 @@ EXPORTS ?paint@QDeclarativeRectangle@@UAEXPAVQPainter@@PBVQStyleOptionGraphicsItem@@PAVQWidget@@@Z @ 1175 NONAME ABSENT ; void QDeclarativeRectangle::paint(class QPainter *, class QStyleOptionGraphicsItem const *, class QWidget *) ??6QDeclarativeState@@QAEAAV0@PAVQDeclarativeStateOperation@@@Z @ 1176 NONAME ; class QDeclarativeState & QDeclarativeState::operator<<(class QDeclarativeStateOperation *) ?destroy@QDeclarativeAbstractBinding@@UAEXXZ @ 1177 NONAME ABSENT ; void QDeclarativeAbstractBinding::destroy(void) - ?qt_metacast@QDeclarativeDebugService@@UAEPAXPBD@Z @ 1178 NONAME ABSENT ; void * QDeclarativeDebugService::qt_metacast(char const *) + ?qt_metacast@QDeclarativeDebugService@@UAEPAXPBD@Z @ 1178 NONAME ; void * QDeclarativeDebugService::qt_metacast(char const *) ?qt_metacast@QDeclarativeValueType@@UAEPAXPBD@Z @ 1179 NONAME ABSENT ; void * QDeclarativeValueType::qt_metacast(char const *) ?childAt@QDeclarativeItem@@QBEPAV1@MM@Z @ 1180 NONAME ; class QDeclarativeItem * QDeclarativeItem::childAt(float, float) const ?paintedWidth@QDeclarativeText@@QBEMXZ @ 1181 NONAME ABSENT ; float QDeclarativeText::paintedWidth(void) const @@ -1297,7 +1297,7 @@ EXPORTS ?value@QDeclarativeOpenMetaObject@@QBE?AVQVariant@@H@Z @ 1296 NONAME ABSENT ; class QVariant QDeclarativeOpenMetaObject::value(int) const ?tr@QDeclarativeDebugRootContextQuery@@SA?AVQString@@PBD0H@Z @ 1297 NONAME ABSENT ; class QString QDeclarativeDebugRootContextQuery::tr(char const *, char const *, int) ?setFromState@QDeclarativeTransition@@QAEXABVQString@@@Z @ 1298 NONAME ; void QDeclarativeTransition::setFromState(class QString const &) - ?metaObject@QDeclarativeDebugService@@UBEPBUQMetaObject@@XZ @ 1299 NONAME ABSENT ; struct QMetaObject const * QDeclarativeDebugService::metaObject(void) const + ?metaObject@QDeclarativeDebugService@@UBEPBUQMetaObject@@XZ @ 1299 NONAME ; struct QMetaObject const * QDeclarativeDebugService::metaObject(void) const ?state@QDeclarativeDebugQuery@@QBE?AW4State@1@XZ @ 1300 NONAME ABSENT ; enum QDeclarativeDebugQuery::State QDeclarativeDebugQuery::state(void) const ?setBottom@QDeclarativeScaleGrid@@QAEXH@Z @ 1301 NONAME ABSENT ; void QDeclarativeScaleGrid::setBottom(int) ?topMarginChanged@QDeclarativeAnchors@@IAEXXZ @ 1302 NONAME ABSENT ; void QDeclarativeAnchors::topMarginChanged(void) @@ -1305,7 +1305,7 @@ EXPORTS ?position@QDeclarativeDomObject@@QBEHXZ @ 1304 NONAME ABSENT ; int QDeclarativeDomObject::position(void) const ?update@QDeclarativeBinding@@UAEXV?$QFlags@W4WriteFlag@QDeclarativePropertyPrivate@@@@@Z @ 1305 NONAME ABSENT ; void QDeclarativeBinding::update(class QFlags) ?tr@QDeclarativeBehavior@@SA?AVQString@@PBD0@Z @ 1306 NONAME ABSENT ; class QString QDeclarativeBehavior::tr(char const *, char const *) - ?isDebuggingEnabled@QDeclarativeDebugService@@SA_NXZ @ 1307 NONAME ABSENT ; bool QDeclarativeDebugService::isDebuggingEnabled(void) + ?isDebuggingEnabled@QDeclarativeDebugService@@SA_NXZ @ 1307 NONAME ; bool QDeclarativeDebugService::isDebuggingEnabled(void) ?tr@QDeclarativeText@@SA?AVQString@@PBD0H@Z @ 1308 NONAME ABSENT ; class QString QDeclarativeText::tr(char const *, char const *, int) ?reset@QDeclarativeProperty@@QBE_NXZ @ 1309 NONAME ; bool QDeclarativeProperty::reset(void) const ?objectDebugId@QDeclarativeDebugWatch@@QBEHXZ @ 1310 NONAME ABSENT ; int QDeclarativeDebugWatch::objectDebugId(void) const @@ -1344,7 +1344,7 @@ EXPORTS ?maximumPacketSize@QPacketProtocol@@QBEHXZ @ 1343 NONAME ABSENT ; int QPacketProtocol::maximumPacketSize(void) const ??_EQDeclarativeDebuggerStatus@@UAE@I@Z @ 1344 NONAME ABSENT ; QDeclarativeDebuggerStatus::~QDeclarativeDebuggerStatus(unsigned int) ?error@QDeclarativeCustomParser@@IAEXABVQString@@@Z @ 1345 NONAME ; void QDeclarativeCustomParser::error(class QString const &) - ?messageReceived@QDeclarativeDebugService@@MAEXABVQByteArray@@@Z @ 1346 NONAME ABSENT ; void QDeclarativeDebugService::messageReceived(class QByteArray const &) + ?messageReceived@QDeclarativeDebugService@@MAEXABVQByteArray@@@Z @ 1346 NONAME ; void QDeclarativeDebugService::messageReceived(class QByteArray const &) ??0QDeclarativeParserStatus@@QAE@XZ @ 1347 NONAME ; QDeclarativeParserStatus::QDeclarativeParserStatus(void) ?isNumber@Variant@QDeclarativeParser@@QBE_NXZ @ 1348 NONAME ; bool QDeclarativeParser::Variant::isNumber(void) const ?getStaticMetaObject@QDeclarativeEngineDebug@@SAABUQMetaObject@@XZ @ 1349 NONAME ABSENT ; struct QMetaObject const & QDeclarativeEngineDebug::getStaticMetaObject(void) @@ -1475,7 +1475,7 @@ EXPORTS ?packetWritten@QPacketProtocol@@IAEXXZ @ 1474 NONAME ABSENT ; void QPacketProtocol::packetWritten(void) ?getStaticMetaObject@QDeclarativeDebugObjectQuery@@SAABUQMetaObject@@XZ @ 1475 NONAME ABSENT ; struct QMetaObject const & QDeclarativeDebugObjectQuery::getStaticMetaObject(void) ?isSignalProperty@QDeclarativeProperty@@QBE_NXZ @ 1476 NONAME ; bool QDeclarativeProperty::isSignalProperty(void) const - ?d_func@QDeclarativeDebugService@@AAEPAVQDeclarativeDebugServicePrivate@@XZ @ 1477 NONAME ABSENT ; class QDeclarativeDebugServicePrivate * QDeclarativeDebugService::d_func(void) + ?d_func@QDeclarativeDebugService@@AAEPAVQDeclarativeDebugServicePrivate@@XZ @ 1477 NONAME ; class QDeclarativeDebugServicePrivate * QDeclarativeDebugService::d_func(void) ?qmlTypeNames@QDeclarativeMetaType@@SA?AV?$QList@VQByteArray@@@@XZ @ 1478 NONAME ABSENT ; class QList QDeclarativeMetaType::qmlTypeNames(void) ?componentComplete@QDeclarativeItem@@MAEXXZ @ 1479 NONAME ; void QDeclarativeItem::componentComplete(void) ?creationContext@QDeclarativeComponent@@QBEPAVQDeclarativeContext@@XZ @ 1480 NONAME ; class QDeclarativeContext * QDeclarativeComponent::creationContext(void) const @@ -1575,7 +1575,7 @@ EXPORTS ?keyCount@QMetaEnumBuilder@@QBEHXZ @ 1574 NONAME ABSENT ; int QMetaEnumBuilder::keyCount(void) const ??1QDeclarativeDomProperty@@QAE@XZ @ 1575 NONAME ABSENT ; QDeclarativeDomProperty::~QDeclarativeDomProperty(void) ?url@QDeclarativePixmap@@QBEABVQUrl@@XZ @ 1576 NONAME ; class QUrl const & QDeclarativePixmap::url(void) const - ?sendMessage@QDeclarativeDebugService@@QAEXABVQByteArray@@@Z @ 1577 NONAME ABSENT ; void QDeclarativeDebugService::sendMessage(class QByteArray const &) + ?sendMessage@QDeclarativeDebugService@@QAEXABVQByteArray@@@Z @ 1577 NONAME ; void QDeclarativeDebugService::sendMessage(class QByteArray const &) ?context@QDeclarativeScriptString@@QBEPAVQDeclarativeContext@@XZ @ 1578 NONAME ; class QDeclarativeContext * QDeclarativeScriptString::context(void) const ?queryObject@QDeclarativeEngineDebug@@QAEPAVQDeclarativeDebugObjectQuery@@ABVQDeclarativeDebugObjectReference@@PAVQObject@@@Z @ 1579 NONAME ABSENT ; class QDeclarativeDebugObjectQuery * QDeclarativeEngineDebug::queryObject(class QDeclarativeDebugObjectReference const &, class QObject *) ?tr@QDeclarativePropertyMap@@SA?AVQString@@PBD0H@Z @ 1580 NONAME ; class QString QDeclarativePropertyMap::tr(char const *, char const *, int) @@ -1608,7 +1608,7 @@ EXPORTS ??_EQDeclarativeComponent@@UAE@I@Z @ 1607 NONAME ; QDeclarativeComponent::~QDeclarativeComponent(unsigned int) ?get@QDeclarativeItemPrivate@@SAPAV1@PAVQDeclarativeItem@@@Z @ 1608 NONAME ; class QDeclarativeItemPrivate * QDeclarativeItemPrivate::get(class QDeclarativeItem *) ?staticMetaObject@QDeclarativeView@@2UQMetaObject@@B @ 1609 NONAME ; struct QMetaObject const QDeclarativeView::staticMetaObject - ?objectToString@QDeclarativeDebugService@@SA?AVQString@@PAVQObject@@@Z @ 1610 NONAME ABSENT ; class QString QDeclarativeDebugService::objectToString(class QObject *) + ?objectToString@QDeclarativeDebugService@@SA?AVQString@@PAVQObject@@@Z @ 1610 NONAME ; class QString QDeclarativeDebugService::objectToString(class QObject *) ?defaultValue@QDeclarativeDomDynamicProperty@@QBE?AVQDeclarativeDomProperty@@XZ @ 1611 NONAME ABSENT ; class QDeclarativeDomProperty QDeclarativeDomDynamicProperty::defaultValue(void) const ?relatedMetaObject@QMetaObjectBuilder@@QBEPBUQMetaObject@@H@Z @ 1612 NONAME ABSENT ; struct QMetaObject const * QMetaObjectBuilder::relatedMetaObject(int) const ?addKey@QMetaEnumBuilder@@QAEHABVQByteArray@@H@Z @ 1613 NONAME ABSENT ; int QMetaEnumBuilder::addKey(class QByteArray const &, int) @@ -1633,7 +1633,7 @@ EXPORTS ?tr@QDeclarativeView@@SA?AVQString@@PBD0@Z @ 1632 NONAME ; class QString QDeclarativeView::tr(char const *, char const *) ?qt_metacall@QPacketProtocol@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1633 NONAME ABSENT ; int QPacketProtocol::qt_metacall(enum QMetaObject::Call, int, void * *) ??0QDeclarativeItem@@QAE@PAV0@@Z @ 1634 NONAME ; QDeclarativeItem::QDeclarativeItem(class QDeclarativeItem *) - ?hasDebuggingClient@QDeclarativeDebugService@@SA_NXZ @ 1635 NONAME ABSENT ; bool QDeclarativeDebugService::hasDebuggingClient(void) + ?hasDebuggingClient@QDeclarativeDebugService@@SA_NXZ @ 1635 NONAME ; bool QDeclarativeDebugService::hasDebuggingClient(void) ?staticMetaObject@QDeclarativeContext@@2UQMetaObject@@B @ 1636 NONAME ; struct QMetaObject const QDeclarativeContext::staticMetaObject ?setContextForObject@QDeclarativeEngine@@SAXPAVQObject@@PAVQDeclarativeContext@@@Z @ 1637 NONAME ; void QDeclarativeEngine::setContextForObject(class QObject *, class QDeclarativeContext *) ?baselineOffsetChanged@QDeclarativeItem@@IAEXM@Z @ 1638 NONAME ; void QDeclarativeItem::baselineOffsetChanged(float) @@ -1733,7 +1733,7 @@ EXPORTS ?start@QDeclarativeTimer@@QAEXXZ @ 1732 NONAME ABSENT ; void QDeclarativeTimer::start(void) ?transition@QDeclarativeAbstractAnimation@@UAEXAAV?$QList@VQDeclarativeAction@@@@AAV?$QList@VQDeclarativeProperty@@@@W4TransitionDirection@1@@Z @ 1733 NONAME ABSENT ; void QDeclarativeAbstractAnimation::transition(class QList &, class QList &, enum QDeclarativeAbstractAnimation::TransitionDirection) ?componentComplete@QDeclarativeAbstractAnimation@@UAEXXZ @ 1734 NONAME ABSENT ; void QDeclarativeAbstractAnimation::componentComplete(void) - ?statusChanged@QDeclarativeDebugService@@MAEXW4Status@1@@Z @ 1735 NONAME ABSENT ; void QDeclarativeDebugService::statusChanged(enum QDeclarativeDebugService::Status) + ?statusChanged@QDeclarativeDebugService@@MAEXW4Status@1@@Z @ 1735 NONAME ; void QDeclarativeDebugService::statusChanged(enum QDeclarativeDebugService::Status) ?runningChanged@QDeclarativeAbstractAnimation@@IAEX_N@Z @ 1736 NONAME ABSENT ; void QDeclarativeAbstractAnimation::runningChanged(bool) ?trUtf8@QDeclarativeAbstractAnimation@@SA?AVQString@@PBD0H@Z @ 1737 NONAME ABSENT ; class QString QDeclarativeAbstractAnimation::trUtf8(char const *, char const *, int) ??_EQDeclarativeBasePositioner@@UAE@I@Z @ 1738 NONAME ABSENT ; QDeclarativeBasePositioner::~QDeclarativeBasePositioner(unsigned int) @@ -1813,7 +1813,7 @@ EXPORTS ?setTarget@QDeclarativeAbstractAnimation@@EAEXABVQDeclarativeProperty@@@Z @ 1812 NONAME ABSENT ; void QDeclarativeAbstractAnimation::setTarget(class QDeclarativeProperty const &) ?alwaysRunToEnd@QDeclarativeAbstractAnimation@@QBE_NXZ @ 1813 NONAME ABSENT ; bool QDeclarativeAbstractAnimation::alwaysRunToEnd(void) const ?tr@QDeclarativeTimer@@SA?AVQString@@PBD0H@Z @ 1814 NONAME ABSENT ; class QString QDeclarativeTimer::tr(char const *, char const *, int) - ?status@QDeclarativeDebugService@@QBE?AW4Status@1@XZ @ 1815 NONAME ABSENT ; enum QDeclarativeDebugService::Status QDeclarativeDebugService::status(void) const + ?status@QDeclarativeDebugService@@QBE?AW4Status@1@XZ @ 1815 NONAME ; enum QDeclarativeDebugService::Status QDeclarativeDebugService::status(void) const ?intervalChanged@QDeclarativeTimer@@IAEXXZ @ 1816 NONAME ABSENT ; void QDeclarativeTimer::intervalChanged(void) ?isPaused@QDeclarativeAbstractAnimation@@QBE_NXZ @ 1817 NONAME ABSENT ; bool QDeclarativeAbstractAnimation::isPaused(void) const ?getStaticMetaObject@QDeclarativeAbstractAnimation@@SAABUQMetaObject@@XZ @ 1818 NONAME ABSENT ; struct QMetaObject const & QDeclarativeAbstractAnimation::getStaticMetaObject(void) diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 1ed68a8..b4f54d8 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -761,20 +761,20 @@ EXPORTS _ZN24QDeclarativeCustomParser5errorERK28QDeclarativeCustomParserNodeRK7QString @ 760 NONAME _ZN24QDeclarativeCustomParser5errorERK32QDeclarativeCustomParserPropertyRK7QString @ 761 NONAME _ZN24QDeclarativeCustomParser5errorERK7QString @ 762 NONAME - _ZN24QDeclarativeDebugService11idForObjectEP7QObject @ 763 NONAME ABSENT - _ZN24QDeclarativeDebugService11objectForIdEi @ 764 NONAME ABSENT - _ZN24QDeclarativeDebugService11qt_metacallEN11QMetaObject4CallEiPPv @ 765 NONAME ABSENT - _ZN24QDeclarativeDebugService11qt_metacastEPKc @ 766 NONAME ABSENT - _ZN24QDeclarativeDebugService11sendMessageERK10QByteArray @ 767 NONAME ABSENT + _ZN24QDeclarativeDebugService11idForObjectEP7QObject @ 763 NONAME + _ZN24QDeclarativeDebugService11objectForIdEi @ 764 NONAME + _ZN24QDeclarativeDebugService11qt_metacallEN11QMetaObject4CallEiPPv @ 765 NONAME + _ZN24QDeclarativeDebugService11qt_metacastEPKc @ 766 NONAME + _ZN24QDeclarativeDebugService11sendMessageERK10QByteArray @ 767 NONAME _ZN24QDeclarativeDebugService14enabledChangedEb @ 768 NONAME ABSENT - _ZN24QDeclarativeDebugService14objectToStringEP7QObject @ 769 NONAME ABSENT - _ZN24QDeclarativeDebugService15messageReceivedERK10QByteArray @ 770 NONAME ABSENT - _ZN24QDeclarativeDebugService16staticMetaObjectE @ 771 NONAME DATA 16 ABSENT - _ZN24QDeclarativeDebugService18hasDebuggingClientEv @ 772 NONAME ABSENT - _ZN24QDeclarativeDebugService18isDebuggingEnabledEv @ 773 NONAME ABSENT - _ZN24QDeclarativeDebugService19getStaticMetaObjectEv @ 774 NONAME ABSENT - _ZN24QDeclarativeDebugServiceC1ERK7QStringP7QObject @ 775 NONAME ABSENT - _ZN24QDeclarativeDebugServiceC2ERK7QStringP7QObject @ 776 NONAME ABSENT + _ZN24QDeclarativeDebugService14objectToStringEP7QObject @ 769 NONAME + _ZN24QDeclarativeDebugService15messageReceivedERK10QByteArray @ 770 NONAME + _ZN24QDeclarativeDebugService16staticMetaObjectE @ 771 NONAME DATA 16 + _ZN24QDeclarativeDebugService18hasDebuggingClientEv @ 772 NONAME + _ZN24QDeclarativeDebugService18isDebuggingEnabledEv @ 773 NONAME + _ZN24QDeclarativeDebugService19getStaticMetaObjectEv @ 774 NONAME + _ZN24QDeclarativeDebugServiceC1ERK7QStringP7QObject @ 775 NONAME + _ZN24QDeclarativeDebugServiceC2ERK7QStringP7QObject @ 776 NONAME _ZN24QDeclarativeDomComponentC1ERKS_ @ 777 NONAME ABSENT _ZN24QDeclarativeDomComponentC1Ev @ 778 NONAME ABSENT _ZN24QDeclarativeDomComponentC2ERKS_ @ 779 NONAME ABSENT @@ -1425,8 +1425,8 @@ EXPORTS _ZNK23QDeclarativePropertyMapixERK7QString @ 1424 NONAME _ZNK24QDeclarativeCustomParser11resolveTypeERK10QByteArray @ 1425 NONAME _ZNK24QDeclarativeCustomParser12evaluateEnumERK10QByteArray @ 1426 NONAME - _ZNK24QDeclarativeDebugService10metaObjectEv @ 1427 NONAME ABSENT - _ZNK24QDeclarativeDebugService4nameEv @ 1428 NONAME ABSENT + _ZNK24QDeclarativeDebugService10metaObjectEv @ 1427 NONAME + _ZNK24QDeclarativeDebugService4nameEv @ 1428 NONAME _ZNK24QDeclarativeDebugService9isEnabledEv @ 1429 NONAME ABSENT _ZNK24QDeclarativeDomComponent13componentRootEv @ 1430 NONAME ABSENT _ZNK24QDeclarativeScriptString11scopeObjectEv @ 1431 NONAME @@ -1554,7 +1554,7 @@ EXPORTS _ZTI23QDeclarativeItemPrivate @ 1553 NONAME _ZTI23QDeclarativePropertyMap @ 1554 NONAME _ZTI24QDeclarativeCustomParser @ 1555 NONAME - _ZTI24QDeclarativeDebugService @ 1556 NONAME ABSENT + _ZTI24QDeclarativeDebugService @ 1556 NONAME _ZTI24QDeclarativeParserStatus @ 1557 NONAME _ZTI25QDeclarativeImageProvider @ 1558 NONAME _ZTI26QDeclarativeDebuggerStatus @ 1559 NONAME ABSENT @@ -1604,7 +1604,7 @@ EXPORTS _ZTV23QDeclarativeItemPrivate @ 1603 NONAME _ZTV23QDeclarativePropertyMap @ 1604 NONAME _ZTV24QDeclarativeCustomParser @ 1605 NONAME - _ZTV24QDeclarativeDebugService @ 1606 NONAME ABSENT + _ZTV24QDeclarativeDebugService @ 1606 NONAME _ZTV24QDeclarativeParserStatus @ 1607 NONAME _ZTV25QDeclarativeImageProvider @ 1608 NONAME _ZTV26QDeclarativeDebuggerStatus @ 1609 NONAME ABSENT @@ -1777,10 +1777,10 @@ EXPORTS _ZN23QDeclarativeDebugClientD1Ev @ 1776 NONAME ABSENT _ZN23QDeclarativeDebugClientD2Ev @ 1777 NONAME ABSENT _ZN23QDeclarativeEngineDebug13statusChangedENS_6StatusE @ 1778 NONAME ABSENT - _ZN24QDeclarativeDebugService13statusChangedENS_6StatusE @ 1779 NONAME ABSENT - _ZN24QDeclarativeDebugServiceD0Ev @ 1780 NONAME ABSENT - _ZN24QDeclarativeDebugServiceD1Ev @ 1781 NONAME ABSENT - _ZN24QDeclarativeDebugServiceD2Ev @ 1782 NONAME ABSENT + _ZN24QDeclarativeDebugService13statusChangedENS_6StatusE @ 1779 NONAME + _ZN24QDeclarativeDebugServiceD0Ev @ 1780 NONAME + _ZN24QDeclarativeDebugServiceD1Ev @ 1781 NONAME + _ZN24QDeclarativeDebugServiceD2Ev @ 1782 NONAME _ZN26QDeclarativeBasePositioner10addChangedEv @ 1783 NONAME ABSENT _ZN26QDeclarativeBasePositioner10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 1784 NONAME ABSENT _ZN26QDeclarativeBasePositioner10setSpacingEi @ 1785 NONAME ABSENT @@ -1851,7 +1851,7 @@ EXPORTS _ZNK17QDeclarativeTimer9isRunningEv @ 1850 NONAME ABSENT _ZNK23QDeclarativeDebugClient6statusEv @ 1851 NONAME ABSENT _ZNK23QDeclarativeEngineDebug6statusEv @ 1852 NONAME ABSENT - _ZNK24QDeclarativeDebugService6statusEv @ 1853 NONAME ABSENT + _ZNK24QDeclarativeDebugService6statusEv @ 1853 NONAME _ZNK26QDeclarativeBasePositioner10metaObjectEv @ 1854 NONAME ABSENT _ZNK26QDeclarativeBasePositioner3addEv @ 1855 NONAME ABSENT _ZNK26QDeclarativeBasePositioner4moveEv @ 1856 NONAME ABSENT -- cgit v0.12 From cc016cc9cfba9b35a852399603c6d3f99e31af58 Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Mon, 14 Mar 2011 12:06:04 +0200 Subject: QS60Style: QTreeView::indexRowSizeHint returns incorrect value Fix for http://bugreports.qt.nokia.com/browse/QTBUG-17786. QS60Style tries to work around the hardcoded margin that the QCommonStyle adds to menu items (line 4782 in my QCommonStyle.cpp). Unfortunately regular itemview items are handled in the same code branch in QS60Style, so the class incorrectly reduces the itemview height 8 pixels. The reduction should only happen with menu items. Task-number: QTBUG-17786 Reviewed-by: Laszlo Agocs (cherry picked from commit 8b7c98123eadf9263c6bde4b1263bd64fc388c8d) --- src/gui/styles/qs60style.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index c949326..d0ca407 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -2643,10 +2643,13 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt, sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget); //native items have small empty areas at the beginning and end of menu item sz.setWidth(sz.width() + 2 * pixelMetric(PM_MenuHMargin) + 2 * QS60StylePrivate::pixelMetric(PM_FrameCornerWidth)); - if (QS60StylePrivate::isTouchSupported()) + if (QS60StylePrivate::isTouchSupported()) { //Make itemview easier to use in touch devices + sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin)); //QCommonStyle does not adjust height with horizontal margin, it only adjusts width - sz.setHeight(sz.height() + 2 * pixelMetric(PM_FocusFrameVMargin) - 8); //QCommonstyle adds 8 to height that this style handles through PM values + if (ct == CT_MenuItem) + sz.setHeight(sz.height() - 8); //QCommonstyle adds 8 to height that this style handles through PM values + } break; #ifndef QT_NO_COMBOBOX case CT_ComboBox: { -- cgit v0.12 From 3fa85afd04ba67c762ca7489c63b4bfc4a6deac0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 14 Mar 2011 13:53:44 +0200 Subject: Fix qgraphicstransform autotest for Symbian, where qreal is float. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-17907 Reviewed-by: Samuel Rødal (cherry picked from commit 99aa67f649c44dda8c0da639b4925dbb0e4c9b70) --- tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index fe66ffa..c8de7fd 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -163,10 +163,11 @@ static inline bool fuzzyCompare(qreal p1, qreal p2) { // increase delta on small machines using float instead of double if (sizeof(qreal) == sizeof(float)) - return (qAbs(p1 - p2) <= 0.00002f * qMin(qAbs(p1), qAbs(p2))); + return (qAbs(p1 - p2) <= 0.00003f * qMin(qAbs(p1), qAbs(p2))); else return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); } + static bool fuzzyCompare(const QTransform& t1, const QTransform& t2) { return fuzzyCompare(t1.m11(), t2.m11()) && @@ -180,6 +181,15 @@ static bool fuzzyCompare(const QTransform& t1, const QTransform& t2) fuzzyCompare(t1.m33(), t2.m33()); } +static inline bool fuzzyCompare(const QMatrix4x4& m1, const QMatrix4x4& m2) +{ + bool ok = true; + for (int y = 0; y < 4; ++y) + for (int x = 0; x < 4; ++x) + ok &= fuzzyCompare(m1(y, x), m2(y, x)); + return ok; +} + void tst_QGraphicsTransform::rotation() { QGraphicsRotation rotation; @@ -267,7 +277,7 @@ void tst_QGraphicsTransform::rotation3d() // because the deg2rad value in QTransform is not accurate // enough to match what QMatrix4x4 is doing. } else { - QVERIFY(qFuzzyCompare(t, r)); + QVERIFY(fuzzyCompare(t, r)); } //now let's check that a null vector will not change the transform -- cgit v0.12 From a92f15eaae6981bf420477e4736f169b4224a6c4 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 16 Mar 2011 13:52:28 +0200 Subject: Fix for wrong dpi metrics for raster pixmaps on Symbian. The original implementation relied on SizeInTwips() for the underlying bitmap which unfortunately returns 0, leading to incorrect results from QPixmap::logicalDpiX/Y(). This caused issues in text rendering onto pixmaps (QTBUG-17628). This fix changes QS60PixmapData to use a slightly different metrics() implementation (the one VG and GL PixmapData are using). Task-number: QTBUG-18154 Reviewed-by: Jani Hautakangas (cherry picked from commit 48629ab39aa4e20b21a359dc251569a98606983d) --- src/gui/image/qpixmap_s60.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 2bde2e5..0de99f8 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -599,6 +599,9 @@ bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) return res; } +Q_GUI_EXPORT int qt_defaultDpiX(); +Q_GUI_EXPORT int qt_defaultDpiY(); + int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { if (!cfbsBitmap) @@ -609,28 +612,18 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const return cfbsBitmap->SizeInPixels().iWidth; case QPaintDevice::PdmHeight: return cfbsBitmap->SizeInPixels().iHeight; - case QPaintDevice::PdmWidthMM: { - TInt twips = cfbsBitmap->SizeInTwips().iWidth; - return (int)(twips * (25.4/KTwipsPerInch)); - } - case QPaintDevice::PdmHeightMM: { - TInt twips = cfbsBitmap->SizeInTwips().iHeight; - return (int)(twips * (25.4/KTwipsPerInch)); - } + case QPaintDevice::PdmWidthMM: + return qRound(cfbsBitmap->SizeInPixels().iWidth * 25.4 / qt_defaultDpiX()); + case QPaintDevice::PdmHeightMM: + return qRound(cfbsBitmap->SizeInPixels().iHeight * 25.4 / qt_defaultDpiY()); case QPaintDevice::PdmNumColors: return TDisplayModeUtils::NumDisplayModeColors(cfbsBitmap->DisplayMode()); case QPaintDevice::PdmDpiX: - case QPaintDevice::PdmPhysicalDpiX: { - TReal inches = cfbsBitmap->SizeInTwips().iWidth / (TReal)KTwipsPerInch; - TInt pixels = cfbsBitmap->SizeInPixels().iWidth; - return pixels / inches; - } + case QPaintDevice::PdmPhysicalDpiX: + return qt_defaultDpiX(); case QPaintDevice::PdmDpiY: - case QPaintDevice::PdmPhysicalDpiY: { - TReal inches = cfbsBitmap->SizeInTwips().iHeight / (TReal)KTwipsPerInch; - TInt pixels = cfbsBitmap->SizeInPixels().iHeight; - return pixels / inches; - } + case QPaintDevice::PdmPhysicalDpiY: + return qt_defaultDpiY(); case QPaintDevice::PdmDepth: return TDisplayModeUtils::NumDisplayModeBitsPerPixel(cfbsBitmap->DisplayMode()); default: -- cgit v0.12 From 7f76be56573f47fc163fa5556061a890cf0c338f Mon Sep 17 00:00:00 2001 From: Timo Turunen Date: Tue, 22 Mar 2011 15:21:10 +0200 Subject: Changes for 4.7.3 Reviewed-by: Trust Me (cherry picked from commit 5054d7ecdb3bd3fc1c5bf77a99b1675c26ba9795) --- dist/changes-4.7.3 | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/dist/changes-4.7.3 b/dist/changes-4.7.3 index e69de29..fa8a71e 100644 --- a/dist/changes-4.7.3 +++ b/dist/changes-4.7.3 @@ -0,0 +1,47 @@ +Qt 4.7.3 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 4.7.0. For more details, +refer to the online documentation included in this distribution. The +documentation is also available online: + +http://qt.nokia.com/doc/4.7 + +The Qt version 4.7 series is binary compatible with the 4.6.x series. +Applications compiled for 4.6 will continue to run with 4.7. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker or the Merge Request queue +of the public source repository. + +Qt Bug Tracker: http://bugreports.qt.nokia.com +Merge Request: http://qt.gitorious.org + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + +Qt for Symbian +-------------- + +- Bearer Management +* [QTBUG-15108] Deadlock between SymbianEngine mutex and +QNetworkConfigurationPrivate mutex in the symbian bearer code +* [QTBUG-17627] qnetworksession.h Q_DECLARE_METATYPE breaks building +QtMobility QtBearer depending applications + +- GraphicsView +* [QTBUG-17966] Major regression in QGraphicsView OpenVG backend + +- Declarative +* [QTBUG-17503] Export qml debugging symbols on Symbian + +- Widgets +* [QTBUG-17786] BC between Qt 4.7.3 and 4.6.3 QTreeView::indexRowSizeHint +doesn't return correct value on Symbian for row when QPushButton widget is +inserted in the treeview + +- Painting +* [QTBUG-17907] tst_QGraphicsTransform::rotation3d test case from +tests/auto/qgraphicstransfor is failed for some rotation angle on +Symbian^3 devices +* [QTBUG-18154] Symbian's QPixmap::logicalDpi[X\Y]() incorrectly +returns MAXINT -- cgit v0.12 From 1f6c02c290b3330c7c784c83b1c0f8a94155f9e5 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 25 Mar 2011 15:17:16 +0100 Subject: QSslSocket: add test for blacklisted certificates Reviewed-by: Richard J. Moore Task-number: QTBUG-18338 (cherry picked from commit 764e060a389a18a5804d23c528abdaebcee3ca13) --- .../auto/qsslsocket/certs/fake-login.live.com.key | 15 ++++++++ .../auto/qsslsocket/certs/fake-login.live.com.pem | 19 ++++++++++ tests/auto/qsslsocket/tst_qsslsocket.cpp | 43 ++++++++++++++++++++-- 3 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 tests/auto/qsslsocket/certs/fake-login.live.com.key create mode 100644 tests/auto/qsslsocket/certs/fake-login.live.com.pem diff --git a/tests/auto/qsslsocket/certs/fake-login.live.com.key b/tests/auto/qsslsocket/certs/fake-login.live.com.key new file mode 100644 index 0000000..692a7bd --- /dev/null +++ b/tests/auto/qsslsocket/certs/fake-login.live.com.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDOtxdvMa0VHUQYG5q7Tsi1Jj4qKEJppyZEkmuRXOi0fDbd1SwE +bwHrLGMvDO6OMrYBbq3WDNrtnIfF9CvzUOEch+gjr4hEVQqecU5fb45Wor7yNel3 +/C/gxfbzuXHrsj/gUjNghL2i10+c2NW+hUo/sWO6OusaBT6d6s7ee+YBcQIDAQAB +AoGAb8cVhu0HuLkgjyCuJMbPRRUu3ED02Iin6sB6JhplQuNAD+grayJTmUVhRJnr +jTziqhedLHe7Em1oBaSo92MutfMpXvWiccSlbNygI61VgmrJpVB+qIN5H9cQc9ql +Zymc+nIPa1+i5rsrOzlpUytTh7AsbZ27QG4tQXR/kQejEiECQQD6BgTxBeT8D7x9 +DuukoBaSCkLwx7U7P1NXx15EI3lA1nO51t6UHfvk/jGPp8Sl4wv4alJ7AQxr5uQ/ +vC3kzA/1AkEA06gNu10se8pe3n8qL2RRt+FmVjHkQdD9Mm2Dx9oWCs2A4wOSOrlo +6/nKYF1CaQNYn9HgsNbHVEUpnICVO18qDQJBALEw/uOJ1+TDikPfBSWgxx4s45Ad +GNWqZXh6NNZ5hX9r/IwiOZAjR9fcRmeW8IjYRi2BvH6sGY+HDRAWXzgdXtkCQCma +dOiJTf8fLjqp4E7kdzOfuI/kyqstOze4Uxjrgz2oW1dEEnA8laUcumzqp+0gXUE8 +7d+UuCWWWrGKjMrYz9kCQQDh5E5+b6Djn082Jo6gvyuXWC5eXju6IdmihlJ2SMzD +s2y3IDjOUtTeQQRDymLneteMz0ha79KeUp6VnAvZCOVe +-----END RSA PRIVATE KEY----- diff --git a/tests/auto/qsslsocket/certs/fake-login.live.com.pem b/tests/auto/qsslsocket/certs/fake-login.live.com.pem new file mode 100644 index 0000000..429f951 --- /dev/null +++ b/tests/auto/qsslsocket/certs/fake-login.live.com.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDjCCAnegAwIBAgIRALC3Ez7Qlvm1b66RyHS9OsAwDQYJKoZIhvcNAQEFBQAw +XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMObG9naW4ubGl2ZS5jb20w +HhcNMTEwMzI1MTMyODUwWhcNMTEwNDI0MTMyODUwWjBeMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRcwFQYDVQQDEw5sb2dpbi5saXZlLmNvbTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEAzrcXbzGtFR1EGBuau07ItSY+KihCaacmRJJrkVzotHw23dUs +BG8B6yxjLwzujjK2AW6t1gza7ZyHxfQr81DhHIfoI6+IRFUKnnFOX2+OVqK+8jXp +d/wv4MX287lx67I/4FIzYIS9otdPnNjVvoVKP7FjujrrGgU+nerO3nvmAXECAwEA +AaOByzCByDAdBgNVHQ4EFgQUpSOEcmtkQITvBdM2IDfcXnJ0FCAwgZgGA1UdIwSB +kDCBjYAUpSOEcmtkQITvBdM2IDfcXnJ0FCChYqRgMF4xCzAJBgNVBAYTAkFVMRMw +EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 +eSBMdGQxFzAVBgNVBAMTDmxvZ2luLmxpdmUuY29tghEAsLcTPtCW+bVvrpHIdL06 +wDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAD+2HT4GSHHKCdbl9VkX +zsl+D+drMm2b0ksxz9SgPihP7aW50EEIJDEEihNMTa27mhpeOXHc/sLqDi4ECUao +/0Ns/5uoVuAIrAKCydmtPsonVFh9XWjyrfUzPOHAc9p2bmJ1i9a3kTsLB6jlrVDO +VufGzsowHlHZ0TtKf5omojU5 +-----END CERTIFICATE----- diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 569a593..aa695e7 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -183,6 +183,7 @@ private slots: void ignoreSslErrorsListWithSlot(); void readFromClosedSocket(); void writeBigChunk(); + void blacklist(); void setEmptyDefaultConfiguration(); static void exitLoop() @@ -868,8 +869,13 @@ class SslServer : public QTcpServer { Q_OBJECT public: - SslServer() : socket(0) { } + SslServer(const QString &keyFile = SRCDIR "certs/fluke.key", const QString &certFile = SRCDIR "certs/fluke.cert") + : socket(0), + m_keyFile(keyFile), + m_certFile(certFile) { } QSslSocket *socket; + QString m_keyFile; + QString m_certFile; protected: void incomingConnection(int socketDescriptor) @@ -877,13 +883,13 @@ protected: socket = new QSslSocket(this); connect(socket, SIGNAL(sslErrors(const QList &)), this, SLOT(ignoreErrorSlot())); - QFile file(SRCDIR "certs/fluke.key"); + QFile file(m_keyFile); QVERIFY(file.open(QIODevice::ReadOnly)); QSslKey key(file.readAll(), QSsl::Rsa, QSsl::Pem, QSsl::PrivateKey); QVERIFY(!key.isNull()); socket->setPrivateKey(key); - QList localCert = QSslCertificate::fromPath(SRCDIR "certs/fluke.cert"); + QList localCert = QSslCertificate::fromPath(m_certFile); QVERIFY(!localCert.isEmpty()); QVERIFY(localCert.first().handle()); socket->setLocalCertificate(localCert.first()); @@ -1837,6 +1843,37 @@ void tst_QSslSocket::writeBigChunk() socket->close(); } +void tst_QSslSocket::blacklist() +{ + QFETCH_GLOBAL(bool, setProxy); + if (setProxy) + return; + + SslServer server(SRCDIR "certs/fake-login.live.com.key", SRCDIR "certs/fake-login.live.com.pem"); + QSslSocket *receiver = new QSslSocket(this); + connect(receiver, SIGNAL(readyRead()), SLOT(exitLoop())); + + // connect two sockets to each other: + QVERIFY(server.listen(QHostAddress::LocalHost)); + receiver->connectToHost("127.0.0.1", server.serverPort()); + QVERIFY(receiver->waitForConnected(5000)); + QVERIFY(server.waitForNewConnection(0)); + + QSslSocket *sender = server.socket; + QVERIFY(sender); + QVERIFY(sender->state() == QAbstractSocket::ConnectedState); + receiver->setObjectName("receiver"); + sender->setObjectName("sender"); + receiver->ignoreSslErrors(); + receiver->startClientEncryption(); + + connect(receiver, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(exitLoop())); + connect(receiver, SIGNAL(encrypted()), SLOT(exitLoop())); + enterLoop(1); + QCOMPARE(receiver->error(), QAbstractSocket::SslHandshakeFailedError); + QCOMPARE(receiver->errorString(), QString("The peer certificate is blacklisted")); +} + void tst_QSslSocket::setEmptyDefaultConfiguration() { // used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265 -- cgit v0.12 From b3f64f1b4eb949bd639c4a088121a4c5ad2eb743 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 25 Mar 2011 13:45:24 +0100 Subject: QSslSocket internals: abort on encountering blacklisted certificates tested manually with "openssl s_server -cert blacklisted.pem -key key.pem" and connecting a QSslSocket. Reviewed-by: Markus Goetz Task-number: QTBUG-18338 (cherry picked from commit b87528a71b66e786c11804d7b79e408aae612748) --- src/network/ssl/qsslsocket_openssl.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 7395c0a..0024ee6 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1183,6 +1183,13 @@ bool QSslSocketBackendPrivate::startHandshake() X509 *x509 = q_SSL_get_peer_certificate(ssl); configuration.peerCertificate = QSslCertificatePrivate::QSslCertificate_from_X509(x509); q_X509_free(x509); + if (QSslCertificatePrivate::isBlacklisted(configuration.peerCertificate)) { + q->setErrorString(QSslSocket::tr("The peer certificate is blacklisted")); + q->setSocketError(QAbstractSocket::SslHandshakeFailedError); + emit q->error(QAbstractSocket::SslHandshakeFailedError); + plainSocket->disconnectFromHost(); + return false; + } // Start translating errors. QList errors; -- cgit v0.12 From c9511d642e7ab38ad2a47ba834580cfbda43ab65 Mon Sep 17 00:00:00 2001 From: Timo Turunen Date: Mon, 28 Mar 2011 20:01:19 +0300 Subject: QSslCertificate: fix test for blacklisted certs on Windows Apparently the wildcard matching and the SRCDIR hack don't go well together. Reviewed-by: Markus Goetz Task-number: QTBUG-18338 (cherry picked from commit aeabe790203e7dcb1786e0dad7b4608f1e45b7d5) Conflicts: tests/auto/qsslcertificate/tst_qsslcertificate.cpp --- tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index ccc6af9..a8c5a4d 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -817,6 +817,15 @@ void tst_QSslCertificate::largeExpirationDate() // QTBUG-12489 QCOMPARE(cert.expiryDate().toUTC(), QDateTime(QDate(2051, 8, 29), QTime(9, 53, 41), Qt::UTC)); } +void tst_QSslCertificate::blacklistedCertificates() +{ + QList blacklistedCerts = QSslCertificate::fromPath("more-certificates/blacklisted*.pem", QSsl::Pem, QRegExp::Wildcard); + QVERIFY2(blacklistedCerts.count() > 0, "Please run this test from the source directory"); + for (int a = 0; a < blacklistedCerts.count(); a++) { + QVERIFY(! blacklistedCerts.at(a).isValid()); + } +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslCertificate) -- cgit v0.12 From 43a8e3115fc9d13c2da2f32c3d2aafcfe0c6e543 Mon Sep 17 00:00:00 2001 From: Timo Turunen Date: Mon, 28 Mar 2011 20:24:32 +0300 Subject: QSslCertificate: report fraudulent certificates as invalid There are some fraudulent certificates in the wild that are not valid; this patch introduces a blacklist of serial numbers of those certificates. Reviewed-by: Richard J. Moore Reviewed-by: Markus Goetz Task-number: QTBUG-18338 (cherry picked from commit 04e074e8d7c097295505e63565abdc7ca2b49f7b) Conflicts: tests/auto/qsslcertificate/tst_qsslcertificate.cpp --- src/network/ssl/qsslcertificate.cpp | 34 +++++++++++++++++++--- src/network/ssl/qsslcertificate_p.h | 1 + .../more-certificates/blacklisted1.pem | 19 ++++++++++++ .../more-certificates/blacklisted2.pem | 19 ++++++++++++ .../more-certificates/blacklisted3.pem | 19 ++++++++++++ .../more-certificates/blacklisted4.pem | 19 ++++++++++++ .../more-certificates/blacklisted5.pem | 19 ++++++++++++ .../more-certificates/blacklisted6.pem | 19 ++++++++++++ .../more-certificates/blacklisted7.pem | 19 ++++++++++++ .../more-certificates/blacklisted8.pem | 19 ++++++++++++ .../more-certificates/blacklisted9.pem | 19 ++++++++++++ tests/auto/qsslcertificate/tst_qsslcertificate.cpp | 2 ++ 12 files changed, 204 insertions(+), 4 deletions(-) create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted1.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted2.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted3.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted4.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted5.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted6.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted7.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted8.pem create mode 100644 tests/auto/qsslcertificate/more-certificates/blacklisted9.pem diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 3053351..1bcc3c9 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -219,17 +219,19 @@ bool QSslCertificate::isNull() const Returns true if this certificate is valid; otherwise returns false. - Note: Currently, this function only checks that the current + Note: Currently, this function checks that the current data-time is within the date-time range during which the - certificate is considered valid. No other checks are - currently performed. + certificate is considered valid, and checks that the + certificate is not in a blacklist of fraudulent certificates. \sa isNull() */ bool QSslCertificate::isValid() const { const QDateTime currentTime = QDateTime::currentDateTime(); - return currentTime >= d->notValidBefore && currentTime <= d->notValidAfter; + return currentTime >= d->notValidBefore && + currentTime <= d->notValidAfter && + ! QSslCertificatePrivate::isBlacklisted(*this); } /*! @@ -798,6 +800,30 @@ QList QSslCertificatePrivate::certificatesFromDer(const QByteAr return certificates; } +// These certificates are known to be fraudulent and were created during the comodo +// compromise. See http://www.comodo.com/Comodo-Fraud-Incident-2011-03-23.html +static const char *certificate_blacklist[] = { + "04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e", + "f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06", + "d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3", + "39:2a:43:4f:0e:07:df:1f:8a:a3:05:de:34:e0:c2:29", + "3e:75:ce:d4:6b:69:30:21:21:88:30:ae:86:a8:2a:71", + "e9:02:8b:95:78:e4:15:dc:1a:71:0a:2b:88:15:44:47", + "92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43", + "b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0", + "d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0", + 0 +}; + +bool QSslCertificatePrivate::isBlacklisted(const QSslCertificate &certificate) +{ + for (int a = 0; certificate_blacklist[a] != 0; a++) { + if (certificate.serialNumber() == certificate_blacklist[a]) + return true; + } + return false; +} + #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug debug, const QSslCertificate &certificate) { diff --git a/src/network/ssl/qsslcertificate_p.h b/src/network/ssl/qsslcertificate_p.h index 1f99b09..4dd0e75 100644 --- a/src/network/ssl/qsslcertificate_p.h +++ b/src/network/ssl/qsslcertificate_p.h @@ -96,6 +96,7 @@ public: static QSslCertificate QSslCertificate_from_X509(X509 *x509); static QList certificatesFromPem(const QByteArray &pem, int count = -1); static QList certificatesFromDer(const QByteArray &der, int count = -1); + static bool isBlacklisted(const QSslCertificate &certificate); friend class QSslSocketBackendPrivate; diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem new file mode 100644 index 0000000..3945aea --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted1.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDzCCAnigAwIBAgIQBH7L6fylX3vQnq424QyuHjANBgkqhkiG9w0BAQUFADBf +MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 +ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb20w +HhcNMTEwMzI0MTMwNjI1WhcNMTEwNDIzMTMwNjI1WjBfMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEB +BQADgY0AMIGJAoGBAOeAGV2FbGnT4rLjTvCNEEDjj0/iIUATa6RT8WKF2PVaOzbE +oceiODx6hTStvBnCgs+h/d3eVKgp+uAyBde5sW/HlOwHrNgKF3ZDvxegzIOEHaVI +ndNtBpFS3UyOEkO0NxfioBatNRYpeTRU/DVmazu3yvzgrV1V2mDsrNngVWxJAgMB +AAGjgcswgcgwHQYDVR0OBBYEFHcF1eqRpm7B78aY8ZjseN6zSYbvMIGYBgNVHSME +gZAwgY2AFHcF1eqRpm7B78aY8ZjseN6zSYbvoWOkYTBfMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRgwFgYDVQQDEw9tYWlsLmdvb2dsZS5jb22CEAR+y+n8pV970J6uNuEM +rh4wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQBEb1iF+EbhAJli5Sj2 ++iEdJ5xMP8R6FtgqAYknqXD8+tyEyXxJXdN186qdAWuTD9N22AUqi61BPWxUkufW +xH8FYMEHdFCkitvYE0321+GT5pJz6ON/d5Co+wusumt7T5oSjzj8Ax9V+nmo3Nkb +dSANM4/Lnc6moijcpJZq+GC1ng== +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem new file mode 100644 index 0000000..4b8d059 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted2.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDjCCAnegAwIBAgIRAPXIavNhYvE6ZPVPbclYfAYwDQYJKoZIhvcNAQEFBQAw +XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMOd3d3Lmdvb2dsZS5jb20w +HhcNMTEwMzI0MTMwNzExWhcNMTEwNDIzMTMwNzExWjBeMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRcwFQYDVQQDEw53d3cuZ29vZ2xlLmNvbTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEAy1fNDFl65Njfcd1EUJeaxvyiKln+JKlqUmk1x4mrE1BQoa0C +QZaiXAF21rDhivWejZWBiEQ4IWbg3b12ANY74G1KqAfLC4BNKS9UP94hy18vezRA +pFc+m/HAClwc8AdACpl8eZpQW8cMgdvnMBMZTrQkgV0JYykX+uDD9Tb+QNUCAwEA +AaOByzCByDAdBgNVHQ4EFgQUSelG6IVRj2ZQbp049zkQ0X/Po9wwgZgGA1UdIwSB +kDCBjYAUSelG6IVRj2ZQbp049zkQ0X/Po9yhYqRgMF4xCzAJBgNVBAYTAkFVMRMw +EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 +eSBMdGQxFzAVBgNVBAMTDnd3dy5nb29nbGUuY29tghEA9chq82Fi8Tpk9U9tyVh8 +BjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBALQyDC/AMQMNj2fa6E8L +umILCklWJwG1K1p/1bUAgm0CB8zm94n1xrh/ZK4+HS+k2a9OQmvLRbFyJn8Wua8p +3UU0267UNkCanA1FKHuO3Mo18wLvjMLWjjCQ4g1C9IvJx6P+8EFDQFG+MJBV/w2k +gJXXVl3q1T1dvahIgfav9QBL +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem new file mode 100644 index 0000000..e47ece6 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted3.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDETCCAnqgAwIBAgIRANdVj9r18RBbshMoK3B3KaMwDQYJKoZIhvcNAQEFBQAw +XzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29t +MB4XDTExMDMyNDEzMDg0MloXDTExMDQyMzEzMDg0MlowXzELMAkGA1UEBhMCQVUx +EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg +UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29tMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQCosFLKRvGtxjvdAjWdEAHYycFTa4VtdpXmCNhNHf2xbeLn +xzde10KjEe44pQxNI+UUD1rJkyuH6wUfloyefn0D2Mu+MvusmvOEzFosa4EDbK9s +BAAlsSiyJgrp/GgbEPq/XOl4XJRBIVP1WC6LllduNbskFCipDqS+HQwifXmmwQID +AQABo4HMMIHJMB0GA1UdDgQWBBSEgWnsoYtd5GEx/MGJvKxuIuROJzCBmQYDVR0j +BIGRMIGOgBSEgWnsoYtd5GEx/MGJvKxuIuROJ6FjpGEwXzELMAkGA1UEBhMCQVUx +EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg +UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4ueWFob28uY29tghEA11WP2vXxEFuyEygr +cHcpozAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAKNpIrzTOxIykKZt +EE6HU2nW1lrWUkIMjwjL8ntw7QI4JLMDN1ADVIxWaGTeQ+U/eXFou6dDNAYVAijK +ONDXgOItxW2YvSw0wOZsZj6INX2x88/0yRH+19TqaL/r+Y1D1h/0zefkHgfXufnY +Ex7BHju/rGBTp6R1mr+Tlh1tewva +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem new file mode 100644 index 0000000..64c7d41 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted4.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDzCCAnigAwIBAgIQOSpDTw4H3x+KowXeNODCKTANBgkqhkiG9w0BAQUFADBf +MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 +ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20w +HhcNMTEwMzI0MTMwOTE1WhcNMTEwNDIzMTMwOTE1WjBfMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20wgZ8wDQYJKoZIhvcNAQEB +BQADgY0AMIGJAoGBANO2gz9x2H92xz5OvZSEul9gHxqqd+kdjeoS2exyvjC9wzqb +gYXqNmAsbtNp4WmieEQFd0riCAEkIAn8JpHTCsMHN4rHhS+W+4D5a/drI2jfnZEF +orNYJG1PHSQV/rvh6d7wkVdT+0SYOjrFTAA2biGWaK3W9ztf2yX577w+uQtBAgMB +AAGjgcswgcgwHQYDVR0OBBYEFJjDp8Prs7oReRmskIeFixp0vDkGMIGYBgNVHSME +gZAwgY2AFJjDp8Prs7oReRmskIeFixp0vDkGoWOkYTBfMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb22CEDkqQ08OB98fiqMF3jTg +wikwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQAZyo0Q3leeM1+lxeCd +Wp0ZYHMSW11ANc6nuMWOmJC+nIQGlyGiP3IqeUvIfekwboV638bahVPwcl2HYWsS +/l01Bgyd25Zn6VTQBfMK01dILyxscjVwdHuojzYBN05sl+qkVoqQr5EroQQbgDc9 +6I88p6Kjajv3IusCwfK6wlqISw== +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem new file mode 100644 index 0000000..c7ddbf2 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted5.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDzCCAnigAwIBAgIQPnXO1GtpMCEhiDCuhqgqcTANBgkqhkiG9w0BAQUFADBf +MQswCQYDVQQGEwJBVTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50 +ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20w +HhcNMTEwMzI0MTMwOTQ4WhcNMTEwNDIzMTMwOTQ4WjBfMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb20wgZ8wDQYJKoZIhvcNAQEB +BQADgY0AMIGJAoGBALkiHG9TgTw/00CMW8D23NBDAa3331AL5kTkAaXbAWg2R/1o +yKQfXq3hgHbyWGPccUT+tU6FmaBf3bIndLK7iGx81RGzGgXeoQ5mpgnJ50iCeW73 +G99VlVwutPia7d9qqui84YdcG9t+P2Fuxv+xRqAB6lKOaa4qTPIbH50PgwOvAgMB +AAGjgcswgcgwHQYDVR0OBBYEFBWJrs8bnZ5fikfaLbTxK0ssj69MMIGYBgNVHSME +gZAwgY2AFBWJrs8bnZ5fikfaLbTxK0ssj69MoWOkYTBfMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRgwFgYDVQQDEw9sb2dpbi55YWhvby5jb22CED51ztRraTAhIYgwroao +KnEwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQCIfqqs1a7RzdmV8U00 +v/xAsxscKvQvmu6BK+HwvY5iL2pSwXTYgRLJLoj5QGOd3mmgOFsyW3BPSCP1+fVE +M1ROhU2u8wHub+hGGds18Fx6F4yZjdh8pNUoOUR9A0Ym+VDJr2p50oUNTTy0RbH8 +9ns/gbemx84cjF9DD2G5stQhYg== +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem new file mode 100644 index 0000000..bc2be2a --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted6.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDETCCAnqgAwIBAgIRAOkCi5V45BXcGnEKK4gVREcwDQYJKoZIhvcNAQEFBQAw +XzELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29t +MB4XDTExMDMyNDEzMTAxNloXDTExMDQyMzEzMTAxNlowXzELMAkGA1UEBhMCQVUx +EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg +UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29tMIGfMA0GCSqGSIb3DQEB +AQUAA4GNADCBiQKBgQDFq06qqRl86pP7GRX3m7FMMSaSU6zlNGAo+WPoRfYAzB6x +5KpvlfxMCo3T/nWtInX3Bw9TBWCZSweQ2GEjggO0irjw5UX3MiToLxK+rwzWztm9 +H3LBxTWR0cOOa78kRFvNQ1onvNHbs8fJzXjG7b2IJDOIwG1HAT1LK80oPXZc1wID +AQABo4HMMIHJMB0GA1UdDgQWBBTiGNxw0ImW/wfW0mD3eA65PY5CAzCBmQYDVR0j +BIGRMIGOgBTiGNxw0ImW/wfW0mD3eA65PY5CA6FjpGEwXzELMAkGA1UEBhMCQVUx +EzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdpdHMg +UHR5IEx0ZDEYMBYGA1UEAxMPbG9naW4uc2t5cGUuY29tghEA6QKLlXjkFdwacQor +iBVERzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAHdb1QY/oxuro/4x +GX9jbm930ysoeXkWZSKVtVxoxrPIferu8jVpb1SLRjGcMnmjJoNWNFpvnbZgoYei +f3wdSWun7ndyQBh61k8eM7UABDOUXUHOsHuHj7s1koMKtet4gykmMfd6VxBkwBvN +ZXOll4X+TKe8nrxbnGUByIwQaRM+ +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem new file mode 100644 index 0000000..19d4353 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted7.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDGjCCAoOgAwIBAgIRAJI51TSPQNFpWnRUcOHyP0MwDQYJKoZIhvcNAQEFBQAw +YjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEu +b3JnMB4XDTExMDMyNDEzMTA0NFoXDTExMDQyMzEzMTA0NFowYjELMAkGA1UEBhMC +QVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdpZGdp +dHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEub3JnMIGfMA0GCSqG +SIb3DQEBAQUAA4GNADCBiQKBgQC1lsoAcZTwF8Pf0E9do5avLdobB/O7EhhrCMs2 +/EMO07aIlrLwl3UP/Fmu/cAkKuX8Mx+Eif9x+XT3ZqGKGYKiqPTJcNfeZvgwbn0j +wXDtEo4DuURrwtBU9okS+v4dF6F4RtHQKAGcsXoOjhR7ah71kve+PG2GG0sJ167V +klK1xwIDAQABo4HPMIHMMB0GA1UdDgQWBBRgGDJ4Qp0WFyLIzm4Nz5wgqDSSxjCB +nAYDVR0jBIGUMIGRgBRgGDJ4Qp0WFyLIzm4Nz5wgqDSSxqFmpGQwYjELMAkGA1UE +BhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGEludGVybmV0IFdp +ZGdpdHMgUHR5IEx0ZDEbMBkGA1UEAxMSYWRkb25zLm1vemlsbGEub3JnghEAkjnV +NI9A0WladFRw4fI/QzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACeE +DHMQ+LWEuoa/6z2EgrgM1k9rvBbUtCR+rjTuyzVW4OLXdpiVwZPOAiKphpq7q8Sb +TQ3zwsCoPLLJk5VolwcPfcD8Y2/tYK3NCYl+HzGxxnzPDFVaZM5Jh8RI861Hc00D +hVoQaptPK/V/lr0KEevqjhusAdFZbwlWA923zASa +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem new file mode 100644 index 0000000..aedf3f7 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted8.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDjCCAnegAwIBAgIRALC3Ez7Qlvm1b66RyHS9OsAwDQYJKoZIhvcNAQEFBQAw +XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMObG9naW4ubGl2ZS5jb20w +HhcNMTEwMzI0MTMxMTA2WhcNMTEwNDIzMTMxMTA2WjBeMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRcwFQYDVQQDEw5sb2dpbi5saXZlLmNvbTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEA3OVNj9ijzMewvDeZYzgCWoKtyjclyIHxrQfHZpcexaKbxUap +1MtF6L0ayjtRWpiBYuPteUSy/Ja4Oh6zZz8K6z5rVgXhmy3xPIYuOoWaTKEOhb0Z +oHTBtGh8aWWai1XWw37HIm2FP8cmfgdH4lZwVvpTZIUxYidsyqyjB9IrhiMCAwEA +AaOByzCByDAdBgNVHQ4EFgQU4CcQcIvEhJC0tqHlNFMkv6MlDN4wgZgGA1UdIwSB +kDCBjYAU4CcQcIvEhJC0tqHlNFMkv6MlDN6hYqRgMF4xCzAJBgNVBAYTAkFVMRMw +EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 +eSBMdGQxFzAVBgNVBAMTDmxvZ2luLmxpdmUuY29tghEAsLcTPtCW+bVvrpHIdL06 +wDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAMNzIStXDNSNQ8ayxrcj +4RrUMsHWUG/6XPrgfYqCP5TfPGAa5qBfNb9LfUbiS4b0flJVN1RlHVwwRo0yf9v4 +LGg0dSuPQAOWlLeUR1GminO1jHZw7E4dYfR7QEmiiOgaQU+CbxLsf5vCaKInN9Gu +jv/5xytVCbMoLoZ4EBVb0tka +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem b/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem new file mode 100644 index 0000000..d179b29 --- /dev/null +++ b/tests/auto/qsslcertificate/more-certificates/blacklisted9.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDDjCCAnegAwIBAgIRANjzX063hystqwaS4xU4L7AwDQYJKoZIhvcNAQEFBQAw +XjELMAkGA1UEBhMCQVUxEzARBgNVBAgTClNvbWUtU3RhdGUxITAfBgNVBAoTGElu +dGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEXMBUGA1UEAxMOZ2xvYmFsIHRydXN0ZWUw +HhcNMTEwMzI0MTMxMTM3WhcNMTEwNDIzMTMxMTM3WjBeMQswCQYDVQQGEwJBVTET +MBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0cyBQ +dHkgTHRkMRcwFQYDVQQDEw5nbG9iYWwgdHJ1c3RlZTCBnzANBgkqhkiG9w0BAQEF +AAOBjQAwgYkCgYEArHCVym7AEZDBhDkrUSG3Q94a+caNcCk5fE6ltZHiZHv096xr +cixHYvSGvms780bkI+oot2xI/e9awwkV+7VjWNvr0HrajzBWeimwk+myjP+3ddMY +Kmr0eI6bmvmPHtOFJE5Ar8/62FwD0wlLogRIx56JtXcCpkiUQktJVPz2gtMCAwEA +AaOByzCByDAdBgNVHQ4EFgQUUJwC/qSGBmcB+DVrd43ovRLdLmQwgZgGA1UdIwSB +kDCBjYAUUJwC/qSGBmcB+DVrd43ovRLdLmShYqRgMF4xCzAJBgNVBAYTAkFVMRMw +EQYDVQQIEwpTb21lLVN0YXRlMSEwHwYDVQQKExhJbnRlcm5ldCBXaWRnaXRzIFB0 +eSBMdGQxFzAVBgNVBAMTDmdsb2JhbCB0cnVzdGVlghEA2PNfTreHKy2rBpLjFTgv +sDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBACAYxI+r3+JNelL6SBB0 +Pda3LkbCm+schP64NBYDdGl2Kus2b2QZ83T7xENBFEhyNoXvc6pRI4/Oh6JDxmG1 +7WmqOVStS/4JeAu6ygiyI1ImRKq2/MvJx/kaKh6IiXanB5nW1U+fhDV6kMOEfpwV +i6FBibpHboPQoqzPPRe7qHSL +-----END CERTIFICATE----- diff --git a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp index a8c5a4d..aadfb5e 100644 --- a/tests/auto/qsslcertificate/tst_qsslcertificate.cpp +++ b/tests/auto/qsslcertificate/tst_qsslcertificate.cpp @@ -111,6 +111,8 @@ private slots: void nulInSan(); void largeSerialNumber(); void largeExpirationDate(); + void blacklistedCertificates(); + // ### add tests for certificate bundles (multiple certificates concatenated into a single // structure); both PEM and DER formatted #endif -- cgit v0.12 From abc6e08c72427feea29c9826f72990f2c4e2565f Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 28 Mar 2011 15:55:28 +0300 Subject: Show softkeys when opening a dialog that has a fullscreen parent. Now shows the CBA for each window that defines softkeys even if topmost parent is fullscreen. Task-number: QTBUG-4953 Reviewed-by: Sami Merila (cherry picked from commit 5a6acc0ba1ed3b056f4c7a9c37481f4cb347a352) --- src/gui/kernel/qapplication_s60.cpp | 39 ++++++++++++++++++++++++-------- src/gui/kernel/qwidget_s60.cpp | 44 ++++++++++++++++++++++++++++--------- 2 files changed, 64 insertions(+), 19 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index dd403d8..57dc218 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1243,15 +1243,36 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */) qwidget->d_func()->setWindowIcon_sys(true); qwidget->d_func()->setWindowTitle_sys(qwidget->windowTitle()); #ifdef Q_WS_S60 - // If widget is fullscreen/minimized, hide status pane and button container otherwise show them. - QWidget *const window = qwidget->window(); - if (!window->parentWidget()) { // Only top level native windows have control over cba/status pane - const bool decorationsVisible = !(window->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); - const bool statusPaneVisibility = decorationsVisible; - const bool isFullscreen = window->windowState() & Qt::WindowFullScreen; - const bool cbaVisibilityHint = window->windowFlags() & Qt::WindowSoftkeysVisibleHint; - const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaVisibilityHint)); - S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + if (qwidget->isWindow()) { + QWidget *const window = qwidget->window(); + QWidget *parentWindow = window->parentWidget(); + if (parentWindow) { + while (parentWindow->parentWidget()) + parentWindow = parentWindow->parentWidget(); + } else { + parentWindow = window; + } + + const bool parentDecorationsVisible = !(parentWindow->windowState() & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool parentIsFullscreen = parentWindow->windowState() & Qt::WindowFullScreen; + const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint; + bool buttonGroupVisibility = (parentDecorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint)); + + // For non-toplevel normal and maximized windows, show cba if window has softkey + // actions even if topmost parent is not showing cba. Do the same for fullscreen + // windows that request it. + if (!buttonGroupVisibility + && window->parentWidget() + && !(window->windowState() & Qt::WindowMinimized) + && ((window->windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(window->windowState() & Qt::WindowFullScreen))) { + for (int i = 0; i < window->actions().size(); ++i) { + if (window->actions().at(i)->softKeyRole() != QAction::NoSoftKey) { + buttonGroupVisibility = true; + break; + } + } + } + S60->setStatusPaneAndButtonGroupVisibility(parentDecorationsVisible, buttonGroupVisibility); } #endif } else if (QApplication::activeWindow() == qwidget->window()) { diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 1e0f1c1..d2bd614 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1184,17 +1184,41 @@ void QWidget::setWindowState(Qt::WindowStates newstate) } #ifdef Q_WS_S60 - bool decorationsVisible(false); - if (!parentWidget()) { // Only top level native windows have control over cba/status pane - // Hide window decoration when switching to fullscreen / minimized otherwise show decoration. - // The window decoration visibility has to be changed before doing actual window state - // change since in that order the availableGeometry will return directly the right size and - // we will avoid unnecessary redraws - decorationsVisible = !(newstate & (Qt::WindowFullScreen | Qt::WindowMinimized)); - const bool statusPaneVisibility = decorationsVisible; - const bool buttonGroupVisibility = (decorationsVisible || (isFullscreen && cbaRequested)); - S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility); + // Hide window decoration when switching to fullscreen / minimized otherwise show decoration. + // The window decoration visibility has to be changed before doing actual window state + // change since in that order the availableGeometry will return directly the right size and + // we will avoid unnecessary redraws + Qt::WindowStates comparisonState = newstate; + QWidget *parentWindow = parentWidget(); + if (parentWindow) { + while (parentWindow->parentWidget()) + parentWindow = parentWindow->parentWidget(); + comparisonState = parentWindow->windowState(); + } else { + parentWindow = this; + } + + const bool decorationsVisible = !(comparisonState & (Qt::WindowFullScreen | Qt::WindowMinimized)); + const bool parentIsFullscreen = comparisonState & Qt::WindowFullScreen; + const bool parentCbaVisibilityHint = parentWindow->windowFlags() & Qt::WindowSoftkeysVisibleHint; + bool buttonGroupVisibility = (decorationsVisible || (parentIsFullscreen && parentCbaVisibilityHint)); + + // For non-toplevel normal and maximized windows, show cba if window has softkey + // actions even if topmost parent is not showing cba. Do the same for fullscreen + // windows that request it. + if (!buttonGroupVisibility + && parentWidget() + && !(newstate & Qt::WindowMinimized) + && ((windowFlags() & Qt::WindowSoftkeysVisibleHint) || !(newstate & Qt::WindowFullScreen))) { + for (int i = 0; i < actions().size(); ++i) { + if (actions().at(i)->softKeyRole() != QAction::NoSoftKey) { + buttonGroupVisibility = true; + break; + } + } } + S60->setStatusPaneAndButtonGroupVisibility(decorationsVisible, buttonGroupVisibility); + #endif // Q_WS_S60 // Ensure the initial size is valid, since we store it as normalGeometry below. -- cgit v0.12 From a5f89cb5e52554b59b308ca0ceed76873f833c46 Mon Sep 17 00:00:00 2001 From: Timo Turunen Date: Mon, 28 Mar 2011 21:18:40 +0300 Subject: Update changes for 4.7.3 Reviewed-by: Trust Me (cherry picked from commit 45c4c792c48605de4cbc28637a39bce5a65b1613) --- dist/changes-4.7.3 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dist/changes-4.7.3 b/dist/changes-4.7.3 index fa8a71e..1ff23c6 100644 --- a/dist/changes-4.7.3 +++ b/dist/changes-4.7.3 @@ -16,6 +16,16 @@ Qt Bug Tracker: http://bugreports.qt.nokia.com Merge Request: http://qt.gitorious.org **************************************************************************** +* Library * +**************************************************************************** + +QtNetwork +--------- + +- SSL +* [QTBUG-18338] blacklist fraudulent SSL certificates + +**************************************************************************** * Platform Specific Changes * **************************************************************************** @@ -38,6 +48,8 @@ QtMobility QtBearer depending applications * [QTBUG-17786] BC between Qt 4.7.3 and 4.6.3 QTreeView::indexRowSizeHint doesn't return correct value on Symbian for row when QPushButton widget is inserted in the treeview +* [QTBUG-4953] QMessageBox can not be closed/dismissed on touch phones if any +widget is fullscreen - Painting * [QTBUG-17907] tst_QGraphicsTransform::rotation3d test case from -- cgit v0.12 From f55d5a5a3c2842d4e5f66cc86219cea56f2a4612 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 6 Apr 2011 17:18:09 +1000 Subject: Fix missing equality and inequality operator docs for QPointer. Task-number: QTBUG-18565 Reviewed-by: Rohan McGovern --- src/corelib/kernel/qpointer.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp index 7d63088..73f695b 100644 --- a/src/corelib/kernel/qpointer.cpp +++ b/src/corelib/kernel/qpointer.cpp @@ -183,6 +183,7 @@ /*! \fn bool operator==(const T *o, const QPointer &p) + \relates QPointer Equality operator. Returns true if \a o and the guarded pointer \a p are pointing to the same object, otherwise @@ -191,6 +192,7 @@ */ /*! \fn bool operator==(const QPointer &p, const T *o) + \relates QPointer Equality operator. Returns true if \a o and the guarded pointer \a p are pointing to the same object, otherwise @@ -199,6 +201,7 @@ */ /*! \fn bool operator==(T *o, const QPointer &p) + \relates QPointer Equality operator. Returns true if \a o and the guarded pointer \a p are pointing to the same object, otherwise @@ -207,6 +210,7 @@ */ /*! \fn bool operator==(const QPointer &p, T *o) + \relates QPointer Equality operator. Returns true if \a o and the guarded pointer \a p are pointing to the same object, otherwise @@ -215,6 +219,7 @@ */ /*! \fn bool operator==(const QPointer &p1, const QPointer &p2) + \relates QPointer Equality operator. Returns true if the guarded pointers \a p1 and \a p2 are pointing to the same object, otherwise @@ -225,6 +230,7 @@ /*! \fn bool operator!=(const T *o, const QPointer &p) + \relates QPointer Inequality operator. Returns true if \a o and the guarded pointer \a p are not pointing to the same object, otherwise @@ -232,6 +238,7 @@ */ /*! \fn bool operator!=(const QPointer &p, const T *o) + \relates QPointer Inequality operator. Returns true if \a o and the guarded pointer \a p are not pointing to the same object, otherwise @@ -239,6 +246,7 @@ */ /*! \fn bool operator!=(T *o, const QPointer &p) + \relates QPointer Inequality operator. Returns true if \a o and the guarded pointer \a p are not pointing to the same object, otherwise @@ -246,6 +254,7 @@ */ /*! \fn bool operator!=(const QPointer &p, T *o) + \relates QPointer Inequality operator. Returns true if \a o and the guarded pointer \a p are not pointing to the same object, otherwise @@ -253,6 +262,7 @@ */ /*! \fn bool operator!=(const QPointer &p1, const QPointer &p2) + \relates QPointer Inequality operator. Returns true if the guarded pointers \a p1 and \a p2 are not pointing to the same object, otherwise -- cgit v0.12 From 78722d6b6e9ba0f6de1a4eba232aad2f96a339f2 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 11 Apr 2011 12:43:28 +1000 Subject: Remove autotest code related to old Qt versions Reviewed-by: Rohan McGovern --- tests/auto/qbuttongroup/tst_qbuttongroup.cpp | 10 +--------- tests/auto/qeasingcurve/tst_qeasingcurve.cpp | 6 ------ tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 4 +--- tests/auto/selftests/tst_selftests.cpp | 14 -------------- tests/auto/symbols/tst_symbols.cpp | 4 ---- 5 files changed, 2 insertions(+), 36 deletions(-) diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp index a809101..34be20c 100644 --- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp +++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp @@ -98,10 +98,7 @@ private slots: void task106609(); - // fixed for Qt 4.6.0 -#if QT_VERSION >= 0x040600 void autoIncrementId(); -#endif void task209485_removeFromGroupInEventHandler_data(); void task209485_removeFromGroupInEventHandler(); @@ -338,10 +335,7 @@ void tst_QButtonGroup::testSignals() QCOMPARE(clickedSpy.count(), 1); QCOMPARE(clickedIdSpy.count(), 1); - int expectedId = -1; -#if QT_VERSION >= 0x040600 - expectedId = -2; -#endif + int expectedId = -2; QVERIFY(clickedIdSpy.takeFirst().at(0).toInt() == expectedId); QCOMPARE(pressedSpy.count(), 1); @@ -500,7 +494,6 @@ void tst_QButtonGroup::task209485_removeFromGroupInEventHandler() QCOMPARE(spy1.count() + spy2.count(), signalCount); } -#if QT_VERSION >= 0x040600 void tst_QButtonGroup::autoIncrementId() { QDialog dlg(0); @@ -529,7 +522,6 @@ void tst_QButtonGroup::autoIncrementId() dlg.show(); } -#endif QTEST_MAIN(tst_QButtonGroup) #include "tst_qbuttongroup.moc" diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp index 327b6f3..f10d35b 100644 --- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp @@ -42,10 +42,6 @@ #include -#if QT_VERSION < 0x040200 -QTEST_NOOP_MAIN -#else - #include //TESTED_CLASS= @@ -578,5 +574,3 @@ void tst_QEasingCurve::metaTypes() QTEST_MAIN(tst_QEasingCurve) #include "tst_qeasingcurve.moc" - -#endif //QT_VERSION diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index e7c8175..bb04621 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -698,7 +698,7 @@ void tst_QSharedPointer::noSharedPointerFromWeakQObject() QSharedPointer strong = weak.toStrongRef(); QVERIFY(strong.isNull()); - // is something went wrong, we'll probably crash here + // if something went wrong, we'll probably crash here } void tst_QSharedPointer::weakQObjectFromSharedPointer() @@ -1747,7 +1747,6 @@ void tst_QSharedPointer::invalidConstructs_data() "QSharedPointer b;\n" "if (a + b) return;"; -#if QT_VERSION >= 0x040600 // two objects with the same pointer QTest::newRow("same-pointer") << &QTest::QExternalTest::tryRunFail @@ -1761,7 +1760,6 @@ void tst_QSharedPointer::invalidConstructs_data() << "Data *aData = new Data;\n" "QSharedPointer ptr1 = QSharedPointer(aData);" "ptr1 = QSharedPointer(aData);"; -#endif // any type of cast for unrelated types: // (we have no reinterpret_cast) diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 0d27d38..1c01c5f 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -515,8 +515,6 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error) } bool ok; -#if QT_VERSION >= 0x040700 - // Qt 4.7 uses floating point double total = sTotal.toDouble(&ok); if (!ok) { if (error) *error = sTotal + " is not a valid number"; @@ -527,18 +525,6 @@ BenchmarkResult BenchmarkResult::parse(QString const& line, QString* error) if (error) *error = sIterations + " is not a valid number"; return out; } -#else - qlonglong total = sTotal.toLongLong(&ok); - if (!ok) { - if (error) *error = sTotal + " is not a valid integer"; - return out; - } - qlonglong iterations = sIterations.toLongLong(&ok); - if (!ok) { - if (error) *error = sIterations + " is not a valid integer"; - return out; - } -#endif out.unit = unit; out.total = total; diff --git a/tests/auto/symbols/tst_symbols.cpp b/tests/auto/symbols/tst_symbols.cpp index db1cbea..6f21c71 100644 --- a/tests/auto/symbols/tst_symbols.cpp +++ b/tests/auto/symbols/tst_symbols.cpp @@ -169,11 +169,7 @@ void tst_Symbols::globalObjects() } if (isFailed) { -#if QT_VERSION >= 0x040600 QVERIFY2(!isFailed, "Libraries contain static global objects. See Debug output above."); -#else - QSKIP("Libraries contains static global objects. See Debug output above. [These errors cannot be fixed in 4.5 in time]", SkipSingle); -#endif } } -- cgit v0.12 From 3475168550c1a804f04f2a4edfeb30c04cd36551 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 12 Apr 2011 14:53:36 +1000 Subject: Reduce usage of Q_ASSERT in autotests. Using Q_ASSERT does nothing in release-mode builds, and in debug builds it causes tests to terminate prematurely. It is much better to use QVERIFY or QCOMPARE. Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- .../qdeclarativedebug/tst_qdeclarativedebug.cpp | 40 +++--- .../tst_qdeclarativedebugclient.cpp | 2 +- .../tst_qdeclarativedebugservice.cpp | 2 +- .../tst_qdeclarativefontloader.cpp | 10 +- tests/auto/modeltest/modeltest.cpp | 139 ++++++++++----------- tests/auto/q3listview/tst_q3listview.cpp | 2 +- tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp | 10 +- tests/auto/qbuffer/tst_qbuffer.cpp | 3 +- tests/auto/qchar/tst_qchar.cpp | 4 +- tests/auto/qcompleter/tst_qcompleter.cpp | 2 - tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp | 2 +- tests/auto/qdbusthreading/tst_qdbusthreading.cpp | 2 +- tests/auto/qdirmodel/tst_qdirmodel.cpp | 6 +- tests/auto/qfiledialog2/tst_qfiledialog2.cpp | 2 +- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 2 +- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 2 +- tests/auto/qinputdialog/tst_qinputdialog.cpp | 18 +-- tests/auto/qlocale/tst_qlocale.cpp | 4 +- tests/auto/qmessagebox/tst_qmessagebox.cpp | 49 ++++---- tests/auto/qpixmap/tst_qpixmap.cpp | 4 +- tests/auto/qprocess/tst_qprocess.cpp | 2 +- .../tst_qscriptvalueiterator.cpp | 4 +- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 22 ++-- tests/auto/qsplitter/tst_qsplitter.cpp | 6 +- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 4 +- tests/auto/qstring/tst_qstring.cpp | 30 ++--- .../tst_qtextboundaryfinder.cpp | 18 +-- tests/auto/qtextcodec/tst_qtextcodec.cpp | 8 +- tests/auto/qwidget/tst_qwidget.cpp | 3 +- tests/auto/xmlpatternsxqts/tst_suitetest.cpp | 2 +- 30 files changed, 197 insertions(+), 207 deletions(-) diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index 6bcb4eb..7237553 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -81,7 +81,7 @@ private: void recursiveCompareObjects(const QDeclarativeDebugObjectReference &a, const QDeclarativeDebugObjectReference &b) const; void recursiveCompareContexts(const QDeclarativeDebugContextReference &a, const QDeclarativeDebugContextReference &b) const; void compareProperties(const QDeclarativeDebugPropertyReference &a, const QDeclarativeDebugPropertyReference &b) const; - + QDeclarativeDebugConnection *m_conn; QDeclarativeEngineDebug *m_dbg; QDeclarativeEngine *m_engine; @@ -123,7 +123,7 @@ QDeclarativeDebugObjectReference tst_QDeclarativeDebug::findRootObject(int conte { QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); waitForQuery(q_engines); - + if (q_engines->engines().count() == 0) return QDeclarativeDebugObjectReference(); QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); @@ -353,7 +353,7 @@ void tst_QDeclarativeDebug::initTestCase() for (int i=0; i(component.create()); } m_rootItem = qobject_cast(m_components.first()); @@ -367,7 +367,7 @@ void tst_QDeclarativeDebug::initTestCase() QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established"); bool ok = m_conn->waitForConnected(); - Q_ASSERT(ok); + QVERIFY(ok); QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); m_dbg = new QDeclarativeEngineDebug(m_conn, this); QTRY_VERIFY(m_dbg->status() == QDeclarativeEngineDebug::Enabled); @@ -424,7 +424,7 @@ void tst_QDeclarativeDebug::watch_property() QDeclarativeDebugPropertyReference prop = findProperty(obj.properties(), "width"); QDeclarativeDebugPropertyWatch *watch; - + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); watch = unconnected->addWatch(prop, this); QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead); @@ -435,7 +435,7 @@ void tst_QDeclarativeDebug::watch_property() QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive); delete watch; - + watch = m_dbg->addWatch(prop, this); QCOMPARE(watch->state(), QDeclarativeDebugWatch::Waiting); QCOMPARE(watch->objectDebugId(), obj.debugId()); @@ -467,12 +467,12 @@ void tst_QDeclarativeDebug::watch_object() { QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); waitForQuery(q_engines); - - Q_ASSERT(q_engines->engines().count() > 0); + + QVERIFY(q_engines->engines().count() > 0); QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); waitForQuery(q_context); - Q_ASSERT(q_context->rootContext().objects().count() > 0); + QVERIFY(q_context->rootContext().objects().count() > 0); QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this); waitForQuery(q_obj); @@ -489,7 +489,7 @@ void tst_QDeclarativeDebug::watch_object() QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead); delete watch; delete unconnected; - + watch = m_dbg->addWatch(QDeclarativeDebugObjectReference(), this); QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive); @@ -543,7 +543,7 @@ void tst_QDeclarativeDebug::watch_expression() QFETCH(int, incrementCount); int origWidth = m_rootItem->property("width").toInt(); - + QDeclarativeDebugObjectReference obj = findRootObject(); QDeclarativeDebugObjectExpressionWatch *watch; @@ -553,12 +553,12 @@ void tst_QDeclarativeDebug::watch_expression() QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead); delete watch; delete unconnected; - + watch = m_dbg->addWatch(QDeclarativeDebugObjectReference(), expr, this); QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive); delete watch; - + watch = m_dbg->addWatch(obj, expr, this); QCOMPARE(watch->state(), QDeclarativeDebugWatch::Waiting); QCOMPARE(watch->objectDebugId(), obj.debugId()); @@ -588,7 +588,7 @@ void tst_QDeclarativeDebug::watch_expression() delete watch; // restore original value and verify spy doesn't get a signal since watch has been removed - m_rootItem->setProperty("width", origWidth); + m_rootItem->setProperty("width", origWidth); QTest::qWait(100); QCOMPARE(spy.count(), expectedSpyCount); @@ -659,7 +659,7 @@ void tst_QDeclarativeDebug::queryRootContexts() int engineId = q_engines->engines()[0].debugId(); QDeclarativeDebugRootContextQuery *q_context; - + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); q_context = unconnected->queryRootContexts(engineId, this); QCOMPARE(q_context->state(), QDeclarativeDebugQuery::Error); @@ -698,7 +698,7 @@ void tst_QDeclarativeDebug::queryObject() QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); waitForQuery(q_engines); - + QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); waitForQuery(q_context); QDeclarativeDebugObjectReference rootObject = q_context->rootContext().objects()[0]; @@ -772,7 +772,7 @@ void tst_QDeclarativeDebug::queryExpressionResult() QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); waitForQuery(q_engines); // check immediate deletion is ok - + QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); waitForQuery(q_context); int objectId = q_context->rootContext().objects()[0].debugId(); @@ -784,7 +784,7 @@ void tst_QDeclarativeDebug::queryExpressionResult() QCOMPARE(q_expr->state(), QDeclarativeDebugQuery::Error); delete q_expr; delete unconnected; - + q_expr = m_dbg->queryExpressionResult(objectId, expr, this); delete q_expr; @@ -923,7 +923,7 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference() QDeclarativeDebugObjectQuery *query = m_dbg->queryObject(rootObject, this); waitForQuery(query); QDeclarativeDebugObjectReference obj = query->object(); - delete query; + delete query; QDeclarativeDebugPropertyReference ref = findProperty(obj.properties(), "scale"); QVERIFY(ref.objectDebugId() > 0); @@ -932,7 +932,7 @@ void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference() QVERIFY(!ref.valueTypeName().isEmpty()); QVERIFY(!ref.binding().isEmpty()); QVERIFY(ref.hasNotifySignal()); - + QDeclarativeDebugPropertyReference copy(ref); QDeclarativeDebugPropertyReference copyAssign; copyAssign = ref; diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp index c182893..59214d1 100644 --- a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -88,7 +88,7 @@ void tst_QDeclarativeDebugClient::initTestCase() QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established"); bool ok = m_conn->waitForConnected(); - Q_ASSERT(ok); + QVERIFY(ok); QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); QTRY_COMPARE(client.status(), QDeclarativeDebugClient::Enabled); diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp index 0911a83..a61f4a8 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -87,7 +87,7 @@ void tst_QDeclarativeDebugService::initTestCase() QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugServer: Connection established"); bool ok = m_conn->waitForConnected(); - Q_ASSERT(ok); + QVERIFY(ok); QTRY_VERIFY(QDeclarativeDebugService::hasDebuggingClient()); } diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index e684bbe..2f0992c 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -55,13 +55,13 @@ #endif class tst_qdeclarativefontloader : public QObject - { Q_OBJECT public: tst_qdeclarativefontloader(); private slots: + void init(); void noFont(); void namedFont(); void localFont(); @@ -71,8 +71,6 @@ private slots: void failWebFont(); void changeFont(); -private slots: - private: QDeclarativeEngine engine; TestHTTPServer server; @@ -82,7 +80,11 @@ tst_qdeclarativefontloader::tst_qdeclarativefontloader() : server(SERVER_PORT) { server.serveDirectory(SRCDIR "/data"); - Q_ASSERT(server.isValid()); +} + +void tst_qdeclarativefontloader::init() +{ + QVERIFY(server.isValid()); } void tst_qdeclarativefontloader::noFont() diff --git a/tests/auto/modeltest/modeltest.cpp b/tests/auto/modeltest/modeltest.cpp index 98d707c..5ef27f9 100644 --- a/tests/auto/modeltest/modeltest.cpp +++ b/tests/auto/modeltest/modeltest.cpp @@ -45,8 +45,6 @@ #include "modeltest.h" #include -#undef Q_ASSERT -#define Q_ASSERT QVERIFY Q_DECLARE_METATYPE ( QModelIndex ) @@ -118,15 +116,15 @@ void ModelTest::runAllTests() */ void ModelTest::nonDestructiveBasicTest() { - Q_ASSERT ( model->buddy ( QModelIndex() ) == QModelIndex() ); + QVERIFY( model->buddy ( QModelIndex() ) == QModelIndex() ); model->canFetchMore ( QModelIndex() ); - Q_ASSERT ( model->columnCount ( QModelIndex() ) >= 0 ); - Q_ASSERT ( model->data ( QModelIndex() ) == QVariant() ); + QVERIFY( model->columnCount ( QModelIndex() ) >= 0 ); + QVERIFY( model->data ( QModelIndex() ) == QVariant() ); fetchingMore = true; model->fetchMore ( QModelIndex() ); fetchingMore = false; Qt::ItemFlags flags = model->flags ( QModelIndex() ); - Q_ASSERT ( flags == Qt::ItemIsDropEnabled || flags == 0 ); + QVERIFY( flags == Qt::ItemIsDropEnabled || flags == 0 ); model->hasChildren ( QModelIndex() ); model->hasIndex ( 0, 0 ); model->headerData ( 0, Qt::Horizontal ); @@ -135,8 +133,8 @@ void ModelTest::nonDestructiveBasicTest() QVariant cache; model->match ( QModelIndex(), -1, cache ); model->mimeTypes(); - Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() ); - Q_ASSERT ( model->rowCount() >= 0 ); + QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() ); + QVERIFY( model->rowCount() >= 0 ); QVariant variant; model->setData ( QModelIndex(), variant, -1 ); model->setHeaderData ( -1, Qt::Horizontal, QVariant() ); @@ -158,17 +156,17 @@ void ModelTest::rowCount() // check top row QModelIndex topIndex = model->index ( 0, 0, QModelIndex() ); int rows = model->rowCount ( topIndex ); - Q_ASSERT ( rows >= 0 ); + QVERIFY( rows >= 0 ); if ( rows > 0 ) - Q_ASSERT ( model->hasChildren ( topIndex ) == true ); + QVERIFY( model->hasChildren ( topIndex ) ); QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex ); if ( secondLevelIndex.isValid() ) { // not the top level // check a row count where parent is valid rows = model->rowCount ( secondLevelIndex ); - Q_ASSERT ( rows >= 0 ); + QVERIFY( rows >= 0 ); if ( rows > 0 ) - Q_ASSERT ( model->hasChildren ( secondLevelIndex ) == true ); + QVERIFY( model->hasChildren ( secondLevelIndex ) ); } // The models rowCount() is tested more extensively in checkChildren(), @@ -182,12 +180,12 @@ void ModelTest::columnCount() { // check top row QModelIndex topIndex = model->index ( 0, 0, QModelIndex() ); - Q_ASSERT ( model->columnCount ( topIndex ) >= 0 ); + QVERIFY( model->columnCount ( topIndex ) >= 0 ); // check a column count where parent is valid QModelIndex childIndex = model->index ( 0, 0, topIndex ); if ( childIndex.isValid() ) - Q_ASSERT ( model->columnCount ( childIndex ) >= 0 ); + QVERIFY( model->columnCount ( childIndex ) >= 0 ); // columnCount() is tested more extensively in checkChildren(), // but this catches the big mistakes @@ -200,19 +198,19 @@ void ModelTest::hasIndex() { // qDebug() << "hi"; // Make sure that invalid values returns an invalid index - Q_ASSERT ( model->hasIndex ( -2, -2 ) == false ); - Q_ASSERT ( model->hasIndex ( -2, 0 ) == false ); - Q_ASSERT ( model->hasIndex ( 0, -2 ) == false ); + QVERIFY( !model->hasIndex ( -2, -2 ) ); + QVERIFY( !model->hasIndex ( -2, 0 ) ); + QVERIFY( !model->hasIndex ( 0, -2 ) ); int rows = model->rowCount(); int columns = model->columnCount(); // check out of bounds - Q_ASSERT ( model->hasIndex ( rows, columns ) == false ); - Q_ASSERT ( model->hasIndex ( rows + 1, columns + 1 ) == false ); + QVERIFY( !model->hasIndex ( rows, columns ) ); + QVERIFY( !model->hasIndex ( rows + 1, columns + 1 ) ); if ( rows > 0 ) - Q_ASSERT ( model->hasIndex ( 0, 0 ) == true ); + QVERIFY( model->hasIndex ( 0, 0 ) ); // hasIndex() is tested more extensively in checkChildren(), // but this catches the big mistakes @@ -225,9 +223,9 @@ void ModelTest::index() { // qDebug() << "i"; // Make sure that invalid values returns an invalid index - Q_ASSERT ( model->index ( -2, -2 ) == QModelIndex() ); - Q_ASSERT ( model->index ( -2, 0 ) == QModelIndex() ); - Q_ASSERT ( model->index ( 0, -2 ) == QModelIndex() ); + QVERIFY( model->index ( -2, -2 ) == QModelIndex() ); + QVERIFY( model->index ( -2, 0 ) == QModelIndex() ); + QVERIFY( model->index ( 0, -2 ) == QModelIndex() ); int rows = model->rowCount(); int columns = model->columnCount(); @@ -236,13 +234,13 @@ void ModelTest::index() return; // Catch off by one errors - Q_ASSERT ( model->index ( rows, columns ) == QModelIndex() ); - Q_ASSERT ( model->index ( 0, 0 ).isValid() == true ); + QVERIFY( model->index ( rows, columns ) == QModelIndex() ); + QVERIFY( model->index ( 0, 0 ).isValid() ); // Make sure that the same index is *always* returned QModelIndex a = model->index ( 0, 0 ); QModelIndex b = model->index ( 0, 0 ); - Q_ASSERT ( a == b ); + QVERIFY( a == b ); // index() is tested more extensively in checkChildren(), // but this catches the big mistakes @@ -256,7 +254,7 @@ void ModelTest::parent() // qDebug() << "p"; // Make sure the model wont crash and will return an invalid QModelIndex // when asked for the parent of an invalid index. - Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() ); + QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() ); if ( model->rowCount() == 0 ) return; @@ -269,13 +267,13 @@ void ModelTest::parent() // Common error test #1, make sure that a top level index has a parent // that is a invalid QModelIndex. QModelIndex topIndex = model->index ( 0, 0, QModelIndex() ); - Q_ASSERT ( model->parent ( topIndex ) == QModelIndex() ); + QVERIFY( model->parent ( topIndex ) == QModelIndex() ); // Common error test #2, make sure that a second level index has a parent // that is the first level index. if ( model->rowCount ( topIndex ) > 0 ) { QModelIndex childIndex = model->index ( 0, 0, topIndex ); - Q_ASSERT ( model->parent ( childIndex ) == topIndex ); + QVERIFY( model->parent ( childIndex ) == topIndex ); } // Common error test #3, the second column should NOT have the same children @@ -285,7 +283,7 @@ void ModelTest::parent() if ( model->rowCount ( topIndex1 ) > 0 ) { QModelIndex childIndex = model->index ( 0, 0, topIndex ); QModelIndex childIndex1 = model->index ( 0, 0, topIndex1 ); - Q_ASSERT ( childIndex != childIndex1 ); + QVERIFY( childIndex != childIndex1 ); } // Full test, walk n levels deep through the model making sure that all @@ -325,47 +323,47 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth ) int columns = model->columnCount ( parent ); if ( rows > 0 ) - Q_ASSERT ( model->hasChildren ( parent ) ); + QVERIFY( model->hasChildren ( parent ) ); // Some further testing against rows(), columns(), and hasChildren() - Q_ASSERT ( rows >= 0 ); - Q_ASSERT ( columns >= 0 ); + QVERIFY( rows >= 0 ); + QVERIFY( columns >= 0 ); if ( rows > 0 ) - Q_ASSERT ( model->hasChildren ( parent ) == true ); + QVERIFY( model->hasChildren ( parent ) ); //qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows // << "columns:" << columns << "parent column:" << parent.column(); - Q_ASSERT ( model->hasIndex ( rows + 1, 0, parent ) == false ); + QVERIFY( !model->hasIndex ( rows + 1, 0, parent ) ); for ( int r = 0; r < rows; ++r ) { if ( model->canFetchMore ( parent ) ) { fetchingMore = true; model->fetchMore ( parent ); fetchingMore = false; } - Q_ASSERT ( model->hasIndex ( r, columns + 1, parent ) == false ); + QVERIFY( !model->hasIndex ( r, columns + 1, parent ) ); for ( int c = 0; c < columns; ++c ) { - Q_ASSERT ( model->hasIndex ( r, c, parent ) == true ); + QVERIFY( model->hasIndex ( r, c, parent ) ); QModelIndex index = model->index ( r, c, parent ); // rowCount() and columnCount() said that it existed... - Q_ASSERT ( index.isValid() == true ); + QVERIFY( index.isValid() ); // index() should always return the same index when called twice in a row QModelIndex modifiedIndex = model->index ( r, c, parent ); - Q_ASSERT ( index == modifiedIndex ); + QVERIFY( index == modifiedIndex ); // Make sure we get the same index if we request it twice in a row QModelIndex a = model->index ( r, c, parent ); QModelIndex b = model->index ( r, c, parent ); - Q_ASSERT ( a == b ); + QVERIFY( a == b ); // Some basic checking on the index that is returned - Q_ASSERT ( index.model() == model ); - Q_ASSERT ( index.row() == r ); - Q_ASSERT ( index.column() == c ); + QVERIFY( index.model() == model ); + QCOMPARE( index.row(), r ); + QCOMPARE( index.column(), c ); // While you can technically return a QVariant usually this is a sign - // of an bug in data() Disable if this really is ok in your model. -// Q_ASSERT ( model->data ( index, Qt::DisplayRole ).isValid() == true ); + // of a bug in data(). Disable if this really is ok in your model. +// QVERIFY( model->data ( index, Qt::DisplayRole ).isValid() ); // If the next test fails here is some somewhat useful debug you play with. @@ -380,8 +378,7 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth ) } // Check that we can get back our real parent. -// qDebug() << model->parent ( index ) << parent ; - Q_ASSERT ( model->parent ( index ) == parent ); + QCOMPARE( model->parent ( index ), parent ); // recursively go down the children if ( model->hasChildren ( index ) && currentDepth < 10 ) { @@ -391,7 +388,7 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth ) // make sure that after testing the children that the index doesn't change. QModelIndex newerIndex = model->index ( r, c, parent ); - Q_ASSERT ( index == newerIndex ); + QVERIFY( index == newerIndex ); } } } @@ -402,68 +399,68 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth ) void ModelTest::data() { // Invalid index should return an invalid qvariant - Q_ASSERT ( !model->data ( QModelIndex() ).isValid() ); + QVERIFY( !model->data ( QModelIndex() ).isValid() ); if ( model->rowCount() == 0 ) return; // A valid index should have a valid QVariant data - Q_ASSERT ( model->index ( 0, 0 ).isValid() ); + QVERIFY( model->index ( 0, 0 ).isValid() ); // shouldn't be able to set data on an invalid index - Q_ASSERT ( model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) == false ); + QVERIFY( !model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) ); // General Purpose roles that should return a QString QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole ); if ( variant.isValid() ) { - Q_ASSERT ( qVariantCanConvert ( variant ) ); + QVERIFY( qVariantCanConvert ( variant ) ); } variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole ); if ( variant.isValid() ) { - Q_ASSERT ( qVariantCanConvert ( variant ) ); + QVERIFY( qVariantCanConvert ( variant ) ); } variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole ); if ( variant.isValid() ) { - Q_ASSERT ( qVariantCanConvert ( variant ) ); + QVERIFY( qVariantCanConvert ( variant ) ); } // General Purpose roles that should return a QSize variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole ); if ( variant.isValid() ) { - Q_ASSERT ( qVariantCanConvert ( variant ) ); + QVERIFY( qVariantCanConvert ( variant ) ); } // General Purpose roles that should return a QFont QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole ); if ( fontVariant.isValid() ) { - Q_ASSERT ( qVariantCanConvert ( fontVariant ) ); + QVERIFY( qVariantCanConvert ( fontVariant ) ); } // Check that the alignment is one we know about QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole ); if ( textAlignmentVariant.isValid() ) { int alignment = textAlignmentVariant.toInt(); - Q_ASSERT ( alignment == ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) ); + QCOMPARE( alignment, ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) ); } // General Purpose roles that should return a QColor QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole ); if ( colorVariant.isValid() ) { - Q_ASSERT ( qVariantCanConvert ( colorVariant ) ); + QVERIFY( qVariantCanConvert ( colorVariant ) ); } colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole ); if ( colorVariant.isValid() ) { - Q_ASSERT ( qVariantCanConvert ( colorVariant ) ); + QVERIFY( qVariantCanConvert ( colorVariant ) ); } // Check that the "check state" is one we know about. QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole ); if ( checkStateVariant.isValid() ) { int state = checkStateVariant.toInt(); - Q_ASSERT ( state == Qt::Unchecked || - state == Qt::PartiallyChecked || - state == Qt::Checked ); + QVERIFY( state == Qt::Unchecked || + state == Qt::PartiallyChecked || + state == Qt::Checked ); } } @@ -494,7 +491,7 @@ void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, in void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) { Changing c = insert.pop(); - Q_ASSERT ( c.parent == parent ); + QVERIFY( c.parent == parent ); // qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize // << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent ); @@ -504,8 +501,8 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) // } // qDebug(); - Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) ); - Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); + QVERIFY( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) ); + QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); if (c.next != model->data(model->index(end + 1, 0, c.parent))) { qDebug() << start << end; @@ -514,7 +511,7 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end ) qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent)); } - Q_ASSERT ( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) ); + QVERIFY( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) ); } void ModelTest::layoutAboutToBeChanged() @@ -527,7 +524,7 @@ void ModelTest::layoutChanged() { for ( int i = 0; i < changing.count(); ++i ) { QPersistentModelIndex p = changing[i]; - Q_ASSERT ( p == model->index ( p.row(), p.column(), p.parent() ) ); + QVERIFY( p == model->index ( p.row(), p.column(), p.parent() ) ); } changing.clear(); } @@ -557,10 +554,10 @@ void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end ) { qDebug() << "rr" << parent << start << end; Changing c = remove.pop(); - Q_ASSERT ( c.parent == parent ); - Q_ASSERT ( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) ); - Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); - Q_ASSERT ( c.next == model->data ( model->index ( start, 0, c.parent ) ) ); + QVERIFY( c.parent == parent ); + QVERIFY( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) ); + QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) ); + QVERIFY( c.next == model->data ( model->index ( start, 0, c.parent ) ) ); } diff --git a/tests/auto/q3listview/tst_q3listview.cpp b/tests/auto/q3listview/tst_q3listview.cpp index 601d74f..c1b3950 100644 --- a/tests/auto/q3listview/tst_q3listview.cpp +++ b/tests/auto/q3listview/tst_q3listview.cpp @@ -678,7 +678,7 @@ void tst_Q3ListView::selections_mouseClick() for (i = 0; i < items.count(); ++i) { Q3ListViewItem *item = items.at(i); - Q_ASSERT(item); + QVERIFY(item); if ( item->isSelected() ) { QVERIFY( selectedItems.contains( i ) ); } else { diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp index 6f3722d..838fd22 100644 --- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp +++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp @@ -251,7 +251,7 @@ void tst_Q3SqlCursor::copyConstructor() } QSqlRecord* rec = cur2.primeUpdate(); - Q_ASSERT( rec ); + QVERIFY( rec ); QCOMPARE( (int)rec->count(), 4 ); int i = 0; @@ -398,7 +398,7 @@ void tst_Q3SqlCursor::batchInsert() int i = 0; for ( ; i < 100; ++i ) { QSqlRecord* irec = cur.primeInsert(); - Q_ASSERT( irec ); + QVERIFY( irec ); irec->setValue( "id", i ); irec->setValue( "t_varchar", "blah" ); irec->setValue( "t_char", "blah" ); @@ -412,7 +412,7 @@ void tst_Q3SqlCursor::batchInsert() for ( ; i < 200; ++i ) { QSqlRecord* irec = cur.primeInsert(); - Q_ASSERT( irec ); + QVERIFY( irec ); irec->setValue( "id", i ); irec->setValue( "t_varchar", "blah" ); irec->setValue( "t_char", "blah" ); @@ -699,7 +699,7 @@ void tst_Q3SqlCursor::updateNoPK() Q3SqlCursor cur(qTableName("qtestPK", __FILE__), true, db); QSqlRecord* rec = cur.primeInsert(); - Q_ASSERT(rec); + QVERIFY(rec); rec->setNull(0); rec->setNull(1); rec->setNull(2); @@ -724,7 +724,7 @@ void tst_Q3SqlCursor::updateNoPK() } rec = cur.primeUpdate(); - Q_ASSERT(rec); + QVERIFY(rec); rec->setValue(0, 1); rec->setNull(1); rec->setNull(2); diff --git a/tests/auto/qbuffer/tst_qbuffer.cpp b/tests/auto/qbuffer/tst_qbuffer.cpp index 3e3cc73..5d6b84f 100644 --- a/tests/auto/qbuffer/tst_qbuffer.cpp +++ b/tests/auto/qbuffer/tst_qbuffer.cpp @@ -309,8 +309,7 @@ void tst_QBuffer::seekTest() // (see Task 184730) { char c; - const int offset = 1; - Q_ASSERT(offset > 0); // any positive integer will do + const int offset = 1; // any positive integer will do const qint64 pos = buf.size() + offset; QVERIFY(buf.seek(pos)); QCOMPARE(buf.pos(), pos); diff --git a/tests/auto/qchar/tst_qchar.cpp b/tests/auto/qchar/tst_qchar.cpp index 45dd7eb..911a30c 100644 --- a/tests/auto/qchar/tst_qchar.cpp +++ b/tests/auto/qchar/tst_qchar.cpp @@ -548,14 +548,14 @@ void tst_QChar::normalization_data() QList l = line.split(';'); - Q_ASSERT(l.size() == 5); + QCOMPARE(l.size(), 5); QStringList columns; for (int i = 0; i < 5; ++i) { columns.append(QString()); QList c = l.at(i).split(' '); - Q_ASSERT(!c.isEmpty()); + QVERIFY(!c.isEmpty()); for (int j = 0; j < c.size(); ++j) { bool ok; diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 932c19e..afcc433 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1248,9 +1248,7 @@ public: void tst_QCompleter::task189564_omitNonSelectableItems() { const QString prefix("a"); - Q_ASSERT(!prefix.isEmpty()); const int n = 5; - Q_ASSERT(n > 0); QStringList strings; for (int i = 0; i < n; ++i) diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp index c8c3b90..98632ae 100644 --- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp @@ -2751,7 +2751,7 @@ void tst_QDateTimeEdit::setCurrentSection() QFETCH(QList, setCurrentSections); QFETCH(QList, expectedCursorPositions); - Q_ASSERT(setCurrentSections.size() == expectedCursorPositions.size()); + QCOMPARE(setCurrentSections.size(), expectedCursorPositions.size()); testWidget->setDisplayFormat(format); testWidget->setDateTime(dateTime); #ifdef Q_WS_MAC diff --git a/tests/auto/qdbusthreading/tst_qdbusthreading.cpp b/tests/auto/qdbusthreading/tst_qdbusthreading.cpp index bfb806b..142b6c2 100644 --- a/tests/auto/qdbusthreading/tst_qdbusthreading.cpp +++ b/tests/auto/qdbusthreading/tst_qdbusthreading.cpp @@ -592,7 +592,7 @@ void tst_QDBusThreading::callbackInAnotherAuxThread() // wait for the event loop sem1.release(); sem2.acquire(); - Q_ASSERT(loop); + QVERIFY(loop); // create the second thread new Thread; diff --git a/tests/auto/qdirmodel/tst_qdirmodel.cpp b/tests/auto/qdirmodel/tst_qdirmodel.cpp index 38a6b8a..a6985a4 100644 --- a/tests/auto/qdirmodel/tst_qdirmodel.cpp +++ b/tests/auto/qdirmodel/tst_qdirmodel.cpp @@ -641,10 +641,10 @@ void tst_QDirModel::filter() QDirModel model; model.setNameFilters(QStringList() << "*.nada"); QModelIndex index = model.index(SRCDIR "test"); - Q_ASSERT(model.rowCount(index) == 0); + QCOMPARE(model.rowCount(index), 0); QModelIndex index2 = model.index(SRCDIR "test/file01.tst"); - Q_ASSERT(!index2.isValid()); - Q_ASSERT(model.rowCount(index) == 0); + QVERIFY(!index2.isValid()); + QCOMPARE(model.rowCount(index), 0); } void tst_QDirModel::task244669_remove() diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp index 5e9f130..dc3ca52 100644 --- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp +++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp @@ -812,7 +812,7 @@ void tst_QFileDialog2::task239706_editableFilterCombo() break; } } - Q_ASSERT(filterCombo); + QVERIFY(filterCombo); filterCombo->setEditable(true); QTest::mouseClick(filterCombo, Qt::LeftButton); QTest::keyPress(filterCombo, Qt::Key_X); diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 168f75e..269b576 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -10655,7 +10655,7 @@ void tst_QGraphicsItem::deviceCoordinateCache_simpleRotations() QTRY_VERIFY(view.repaints > 0); QGraphicsItemCache *itemCache = QGraphicsItemPrivate::get(item)->extraItemCache(); - Q_ASSERT(itemCache); + QVERIFY(itemCache); QPixmapCache::Key currentKey = itemCache->deviceData.value(view.viewport()).key; // Trigger an update and verify that the cache is unchanged. diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 9ff086c..0927577 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -3594,7 +3594,7 @@ void tst_QGraphicsScene::task160653_selectionChanged() item->flags() | QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemIsMovable); item->setSelected(true); } - Q_ASSERT(scene.items().size() > 1); + QVERIFY(scene.items().size() > 1); QCOMPARE(scene.items().size(), scene.selectedItems().size()); QSignalSpy spy(&scene, SIGNAL(selectionChanged())); diff --git a/tests/auto/qinputdialog/tst_qinputdialog.cpp b/tests/auto/qinputdialog/tst_qinputdialog.cpp index 1d13eb6..e0317df 100644 --- a/tests/auto/qinputdialog/tst_qinputdialog.cpp +++ b/tests/auto/qinputdialog/tst_qinputdialog.cpp @@ -193,12 +193,12 @@ void testGetNumeric(QInputDialog *dialog, SpinBoxType * = 0, ValueType * = 0) void testGetText(QInputDialog *dialog) { QLineEdit *ledit = qFindChild(dialog); - Q_ASSERT(ledit); + QVERIFY(ledit); QDialogButtonBox *bbox = qFindChild(dialog); - Q_ASSERT(bbox); + QVERIFY(bbox); QPushButton *okButton = bbox->button(QDialogButtonBox::Ok); - Q_ASSERT(okButton); + QVERIFY(okButton); QVERIFY(ledit->hasAcceptableInput()); QCOMPARE(ledit->selectedText(), ledit->text()); @@ -211,12 +211,12 @@ void testGetText(QInputDialog *dialog) void testGetItem(QInputDialog *dialog) { QComboBox *cbox = qFindChild(dialog); - Q_ASSERT(cbox); + QVERIFY(cbox); QDialogButtonBox *bbox = qFindChild(dialog); - Q_ASSERT(bbox); + QVERIFY(bbox); QPushButton *okButton = bbox->button(QDialogButtonBox::Ok); - Q_ASSERT(okButton); + QVERIFY(okButton); QVERIFY(okButton->isEnabled()); const int origIndex = cbox->currentIndex(); @@ -249,7 +249,7 @@ void tst_QInputDialog::timerEvent(QTimerEvent *event) { killTimer(event->timerId()); QInputDialog *dialog = qFindChild(parent); - Q_ASSERT(dialog); + QVERIFY(dialog); if (testFunc) testFunc(dialog); dialog->done(doneCode); // cause static function call to return @@ -270,7 +270,7 @@ void tst_QInputDialog::getInteger() { QFETCH(int, min); QFETCH(int, max); - Q_ASSERT(min < max); + QVERIFY(min < max); parent = new QWidget; doneCode = QDialog::Accepted; testFunc = &tst_QInputDialog::testFuncGetInteger; @@ -310,7 +310,7 @@ void tst_QInputDialog::getDouble() QFETCH(double, min); QFETCH(double, max); QFETCH(int, decimals); - Q_ASSERT(min < max && decimals >= 0 && decimals <= 13); + QVERIFY(min < max && decimals >= 0 && decimals <= 13); parent = new QWidget; doneCode = QDialog::Accepted; testFunc = &tst_QInputDialog::testFuncGetDouble; diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index 16846de..4f0de4c 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -317,7 +317,7 @@ void tst_QLocale::ctor() TEST_CTOR("en_GB@.bla", English, UnitedKingdom) TEST_CTOR("en_GB@bla", English, UnitedKingdom) - Q_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal); + QVERIFY(QLocale::Norwegian == QLocale::NorwegianBokmal); TEST_CTOR("no", Norwegian, Norway) TEST_CTOR("nb", Norwegian, Norway) TEST_CTOR("nn", NorwegianNynorsk, Norway) @@ -397,7 +397,7 @@ void tst_QLocale::emptyCtor() TEST_CTOR("en_GB@bla", "en_GB") TEST_CTOR("de", "de_DE") - Q_ASSERT(QLocale::Norwegian == QLocale::NorwegianBokmal); + QVERIFY(QLocale::Norwegian == QLocale::NorwegianBokmal); TEST_CTOR("no", "nb_NO") TEST_CTOR("nb", "nb_NO") TEST_CTOR("nn", "nn_NO") diff --git a/tests/auto/qmessagebox/tst_qmessagebox.cpp b/tests/auto/qmessagebox/tst_qmessagebox.cpp index c11e76c..ed121ce 100644 --- a/tests/auto/qmessagebox/tst_qmessagebox.cpp +++ b/tests/auto/qmessagebox/tst_qmessagebox.cpp @@ -609,48 +609,43 @@ void tst_QMessageBox::testSymbols() button = QMessageBox::FlagMask; mb1.setText("Foo"); - QString text = mb1.text(); - Q_ASSERT(text == "Foo"); + QCOMPARE(mb1.text(), "Foo"); icon = mb1.icon(); - Q_ASSERT(icon == QMessageBox::NoIcon); + QVERIFY(icon == QMessageBox::NoIcon); mb1.setIcon(QMessageBox::Question); - Q_ASSERT(mb1.icon() == QMessageBox::Question); + QVERIFY(mb1.icon() == QMessageBox::Question); QPixmap iconPixmap = mb1.iconPixmap(); mb1.setIconPixmap(iconPixmap); - Q_ASSERT(mb1.icon() == QMessageBox::NoIcon); + QVERIFY(mb1.icon() == QMessageBox::NoIcon); - QString bt0 = mb1.buttonText(QMessageBox::Ok); - QString bt1 = mb1.buttonText(QMessageBox::Cancel); - QString bt2 = mb1.buttonText(QMessageBox::Ok | QMessageBox::Default); - - Q_ASSERT(bt0 == "OK"); - Q_ASSERT(bt1.isEmpty()); - Q_ASSERT(bt2.isEmpty()); + QCOMPARE(mb1.buttonText(QMessageBox::Ok), "OK"); + QCOMPARE(mb1.buttonText(QMessageBox::Cancel), QString()); + QCOMPARE(mb1.buttonText(QMessageBox::Ok | QMessageBox::Default), QString()); mb2.setButtonText(QMessageBox::Cancel, "Foo"); mb2.setButtonText(QMessageBox::Ok, "Bar"); mb2.setButtonText(QMessageBox::Ok | QMessageBox::Default, "Baz"); - Q_ASSERT(mb2.buttonText(QMessageBox::Cancel).isEmpty()); - Q_ASSERT(mb2.buttonText(QMessageBox::Ok) == "Bar"); + QCOMPARE(mb2.buttonText(QMessageBox::Cancel), QString()); + QCOMPARE(mb2.buttonText(QMessageBox::Ok), "Bar"); - Q_ASSERT(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes")); - Q_ASSERT(mb3b.buttonText(QMessageBox::YesAll).isEmpty()); - Q_ASSERT(mb3b.buttonText(QMessageBox::Ok).isEmpty()); + QVERIFY(mb3b.buttonText(QMessageBox::Yes).endsWith("Yes")); + QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString()); + QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString()); mb3b.setButtonText(QMessageBox::Yes, "Blah"); mb3b.setButtonText(QMessageBox::YesAll, "Zoo"); mb3b.setButtonText(QMessageBox::Ok, "Zoo"); - Q_ASSERT(mb3b.buttonText(QMessageBox::Yes) == "Blah"); - Q_ASSERT(mb3b.buttonText(QMessageBox::YesAll).isEmpty()); - Q_ASSERT(mb3b.buttonText(QMessageBox::Ok).isEmpty()); + QCOMPARE(mb3b.buttonText(QMessageBox::Yes), "Blah"); + QCOMPARE(mb3b.buttonText(QMessageBox::YesAll), QString()); + QCOMPARE(mb3b.buttonText(QMessageBox::Ok), QString()); - Q_ASSERT(mb1.textFormat() == Qt::AutoText); + QCOMPARE(mb1.textFormat(), Qt::AutoText); mb1.setTextFormat(Qt::PlainText); - Q_ASSERT(mb1.textFormat() == Qt::PlainText); + QCOMPARE(mb1.textFormat(), Qt::PlainText); CONVENIENCE_FUNC_SYMS(information); CONVENIENCE_FUNC_SYMS_EXTRA(information); @@ -660,7 +655,7 @@ void tst_QMessageBox::testSymbols() CONVENIENCE_FUNC_SYMS(critical); QSize sizeHint = mb1.sizeHint(); - Q_ASSERT(sizeHint.width() > 20 && sizeHint.height() > 20); + QVERIFY(sizeHint.width() > 20 && sizeHint.height() > 20); #ifdef QT3_SUPPORT //test QT3_SUPPORT stuff @@ -672,8 +667,8 @@ void tst_QMessageBox::testSymbols() QPixmap pm = QMessageBox::standardIcon(QMessageBox::Question, Qt::GUIStyle(1)); QPixmap pm2 = QMessageBox::standardIcon(QMessageBox::Question); - Q_ASSERT(pm.toImage() == iconPixmap.toImage()); - Q_ASSERT(pm2.toImage() == iconPixmap.toImage()); + QVERIFY(pm.toImage() == iconPixmap.toImage()); + QVERIFY(pm2.toImage() == iconPixmap.toImage()); int ret1 = QMessageBox::message("title", "text"); int ret2 = QMessageBox::message("title", "text", "OK"); @@ -692,10 +687,10 @@ void tst_QMessageBox::testSymbols() Q_UNUSED(ret5); QPixmap pm3 = QMessageBox::standardIcon(QMessageBox::NoIcon); - Q_ASSERT(pm3.isNull()); + QVERIFY(pm3.isNull()); pm3 = QMessageBox::standardIcon(QMessageBox::Information); - Q_ASSERT(!pm3.isNull()); + QVERIFY(!pm3.isNull()); #endif //QT3_SUPPORT QMessageBox::about(&mb1, "title", "text"); diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp index 4d032e8..198a275 100644 --- a/tests/auto/qpixmap/tst_qpixmap.cpp +++ b/tests/auto/qpixmap/tst_qpixmap.cpp @@ -1696,8 +1696,8 @@ void tst_QPixmap::fromImageReaderAnimatedGif() QImageReader referenceReader(path); QImageReader pixmapReader(path); - Q_ASSERT(referenceReader.canRead()); - Q_ASSERT(referenceReader.imageCount() > 1); + QVERIFY(referenceReader.canRead()); + QVERIFY(referenceReader.imageCount() > 1); for (int i = 0; i < referenceReader.imageCount(); ++i) { QImage refImage = referenceReader.read(); diff --git a/tests/auto/qprocess/tst_qprocess.cpp b/tests/auto/qprocess/tst_qprocess.cpp index 2a8874e..3e0c3ff 100644 --- a/tests/auto/qprocess/tst_qprocess.cpp +++ b/tests/auto/qprocess/tst_qprocess.cpp @@ -668,7 +668,7 @@ void tst_QProcess::exitStatus() QSKIP("This test opens a crash dialog on Windows", SkipSingle); #endif - Q_ASSERT(processList.count() == exitStatus.count()); + QCOMPARE(exitStatus.count(), processList.count()); for (int i = 0; i < processList.count(); ++i) { process->start(processList.at(i)); QVERIFY(process->waitForStarted(5000)); diff --git a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp index 03e5c0f..1d4745e 100644 --- a/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp +++ b/tests/auto/qscriptvalueiterator/tst_qscriptvalueiterator.cpp @@ -106,7 +106,7 @@ void tst_QScriptValueIterator::iterateForward() QFETCH(QStringList, propertyNames); QFETCH(QStringList, propertyValues); QMap pmap; - Q_ASSERT(propertyNames.size() == propertyValues.size()); + QVERIFY(propertyNames.size() == propertyValues.size()); QScriptEngine engine; QScriptValue object = engine.newObject(); @@ -165,7 +165,7 @@ void tst_QScriptValueIterator::iterateBackward() QFETCH(QStringList, propertyNames); QFETCH(QStringList, propertyValues); QMap pmap; - Q_ASSERT(propertyNames.size() == propertyValues.size()); + QVERIFY(propertyNames.size() == propertyValues.size()); QScriptEngine engine; QScriptValue object = engine.newObject(); diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index bb04621..f25f8e8 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -283,8 +283,8 @@ void tst_QSharedPointer::operators() QSharedPointer p1; QSharedPointer p2(new char); qptrdiff diff = p2.data() - p1.data(); - Q_ASSERT(p1.data() != p2.data()); - Q_ASSERT(diff != 0); + QVERIFY(p1.data() != p2.data()); + QVERIFY(diff != 0); // operator- QCOMPARE(p2 - p1.data(), diff); @@ -867,8 +867,8 @@ void tst_QSharedPointer::differentPointers() { DiffPtrDerivedData *aData = new DiffPtrDerivedData; Data *aBase = aData; - Q_ASSERT(aData == aBase); - Q_ASSERT(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); + QVERIFY(aData == aBase); + QVERIFY(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); QSharedPointer baseptr = QSharedPointer(aData); QSharedPointer ptr = qSharedPointerCast(baseptr); @@ -885,8 +885,8 @@ void tst_QSharedPointer::differentPointers() { DiffPtrDerivedData *aData = new DiffPtrDerivedData; Data *aBase = aData; - Q_ASSERT(aData == aBase); - Q_ASSERT(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); + QVERIFY(aData == aBase); + QVERIFY(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); QSharedPointer ptr = QSharedPointer(aData); QSharedPointer baseptr = ptr; @@ -908,8 +908,8 @@ void tst_QSharedPointer::virtualBaseDifferentPointers() { VirtualDerived *aData = new VirtualDerived; Data *aBase = aData; - Q_ASSERT(aData == aBase); - Q_ASSERT(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); + QVERIFY(aData == aBase); + QVERIFY(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); QSharedPointer ptr = QSharedPointer(aData); QSharedPointer baseptr = qSharedPointerCast(ptr); @@ -928,8 +928,8 @@ void tst_QSharedPointer::virtualBaseDifferentPointers() { VirtualDerived *aData = new VirtualDerived; Data *aBase = aData; - Q_ASSERT(aData == aBase); - Q_ASSERT(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); + QVERIFY(aData == aBase); + QVERIFY(*reinterpret_cast(&aData) != *reinterpret_cast(&aBase)); QSharedPointer ptr = QSharedPointer(aData); QSharedPointer baseptr = ptr; @@ -1605,7 +1605,7 @@ void hashAndMapTest() QVERIFY(it != c.find(Key())); if (Ordered) { - Q_ASSERT(k0 < k1); + QVERIFY(k0 < k1); it = c.begin(); QCOMPARE(it.key(), k0); diff --git a/tests/auto/qsplitter/tst_qsplitter.cpp b/tests/auto/qsplitter/tst_qsplitter.cpp index 0482661..60be944 100644 --- a/tests/auto/qsplitter/tst_qsplitter.cpp +++ b/tests/auto/qsplitter/tst_qsplitter.cpp @@ -1340,14 +1340,14 @@ void tst_QSplitter::task187373_addAbstractScrollAreas() QFETCH(QString, className); QFETCH(bool, addInConstructor); QFETCH(bool, addOutsideConstructor); - Q_ASSERT(addInConstructor || addOutsideConstructor); + QVERIFY(addInConstructor || addOutsideConstructor); QSplitter *splitter = new QSplitter; splitter->show(); - Q_ASSERT(splitter->isVisible()); + QVERIFY(splitter->isVisible()); QAbstractScrollArea *w = task187373_createScrollArea(splitter, className, addInConstructor); - Q_ASSERT(w); + QVERIFY(w); if (addOutsideConstructor) splitter->addWidget(w); diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 4462659..185e046 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -767,7 +767,7 @@ void tst_QSqlDatabase::checkValues(const FieldDef fieldDefs[], QSqlDatabase db) Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db); QVERIFY_SQL(cur, select()); QSqlRecord* rec = cur.primeInsert(); - Q_ASSERT(rec); + QVERIFY(rec); rec->setValue("id", pkey++); int i = 0; for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) { @@ -828,7 +828,7 @@ void tst_QSqlDatabase::checkNullValues(const FieldDef fieldDefs[], QSqlDatabase Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db); QVERIFY_SQL(cur, select()); QSqlRecord* rec = cur.primeInsert(); - Q_ASSERT(rec); + QVERIFY(rec); rec->setValue("id", pkey++); int i = 0; for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) { diff --git a/tests/auto/qstring/tst_qstring.cpp b/tests/auto/qstring/tst_qstring.cpp index abc8d9a..ad7515b 100644 --- a/tests/auto/qstring/tst_qstring.cpp +++ b/tests/auto/qstring/tst_qstring.cpp @@ -3415,9 +3415,9 @@ void tst_QString::fromLatin1Roundtrip() QFETCH(QString, unicode); // QtTest safety check: - Q_ASSERT(latin1.isNull() == unicode.isNull()); - Q_ASSERT(latin1.isEmpty() == unicode.isEmpty()); - Q_ASSERT(latin1.length() == unicode.length()); + QCOMPARE(latin1.isNull(), unicode.isNull()); + QCOMPARE(latin1.isEmpty(), unicode.isEmpty()); + QCOMPARE(latin1.length(), unicode.length()); if (!latin1.isEmpty()) while (latin1.length() < 128) { @@ -3470,12 +3470,12 @@ void tst_QString::toLatin1Roundtrip() QFETCH(QString, unicodedst); // QtTest safety check: - Q_ASSERT(latin1.isNull() == unicodesrc.isNull()); - Q_ASSERT(latin1.isEmpty() == unicodesrc.isEmpty()); - Q_ASSERT(latin1.length() == unicodesrc.length()); - Q_ASSERT(latin1.isNull() == unicodedst.isNull()); - Q_ASSERT(latin1.isEmpty() == unicodedst.isEmpty()); - Q_ASSERT(latin1.length() == unicodedst.length()); + QCOMPARE(latin1.isNull(), unicodesrc.isNull()); + QCOMPARE(latin1.isEmpty(), unicodesrc.isEmpty()); + QCOMPARE(latin1.length(), unicodesrc.length()); + QCOMPARE(latin1.isNull(), unicodedst.isNull()); + QCOMPARE(latin1.isEmpty(), unicodedst.isEmpty()); + QCOMPARE(latin1.length(), unicodedst.length()); if (!latin1.isEmpty()) while (latin1.length() < 128) { @@ -3505,12 +3505,12 @@ void tst_QString::stringRef_toLatin1Roundtrip() QFETCH(QString, unicodedst); // QtTest safety check: - Q_ASSERT(latin1.isNull() == unicodesrc.isNull()); - Q_ASSERT(latin1.isEmpty() == unicodesrc.isEmpty()); - Q_ASSERT(latin1.length() == unicodesrc.length()); - Q_ASSERT(latin1.isNull() == unicodedst.isNull()); - Q_ASSERT(latin1.isEmpty() == unicodedst.isEmpty()); - Q_ASSERT(latin1.length() == unicodedst.length()); + QCOMPARE(latin1.isNull(), unicodesrc.isNull()); + QCOMPARE(latin1.isEmpty(), unicodesrc.isEmpty()); + QCOMPARE(latin1.length(), unicodesrc.length()); + QCOMPARE(latin1.isNull(), unicodedst.isNull()); + QCOMPARE(latin1.isEmpty(), unicodedst.isEmpty()); + QCOMPARE(latin1.length(), unicodedst.length()); if (!latin1.isEmpty()) while (latin1.length() < 128) { diff --git a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp index 6157004..1da0bde 100644 --- a/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp +++ b/tests/auto/qtextboundaryfinder/tst_qtextboundaryfinder.cpp @@ -123,14 +123,14 @@ void tst_QTextBoundaryFinder::graphemeBoundaries() if (test.at(pos).unicode() == 0xf7) breakPositions.append(strPos); else - Q_ASSERT(test.at(pos).unicode() == 0xd7); + QVERIFY(test.at(pos).unicode() == 0xd7); ++pos; if (pos < test.length()) { - Q_ASSERT(pos < test.length() - 4); + QVERIFY(pos < test.length() - 4); QString hex = test.mid(pos, 4); bool ok = true; testString.append(QChar(hex.toInt(&ok, 16))); - Q_ASSERT(ok); + QVERIFY(ok); pos += 4; } ++strPos; @@ -176,14 +176,14 @@ void tst_QTextBoundaryFinder::wordBoundaries() if (test.at(pos).unicode() == 0xf7) breakPositions.append(strPos); else - Q_ASSERT(test.at(pos).unicode() == 0xd7); + QVERIFY(test.at(pos).unicode() == 0xd7); ++pos; if (pos < test.length()) { - Q_ASSERT(pos < test.length() - 4); + QVERIFY(pos < test.length() - 4); QString hex = test.mid(pos, 4); bool ok = true; testString.append(QChar(hex.toInt(&ok, 16))); - Q_ASSERT(ok); + QVERIFY(ok); pos += 4; } ++strPos; @@ -228,14 +228,14 @@ void tst_QTextBoundaryFinder::sentenceBoundaries() if (test.at(pos).unicode() == 0xf7) breakPositions.append(strPos); else - Q_ASSERT(test.at(pos).unicode() == 0xd7); + QVERIFY(test.at(pos).unicode() == 0xd7); ++pos; if (pos < test.length()) { - Q_ASSERT(pos < test.length() - 4); + QVERIFY(pos < test.length() - 4); QString hex = test.mid(pos, 4); bool ok = true; testString.append(QChar(hex.toInt(&ok, 16))); - Q_ASSERT(ok); + QVERIFY(ok); pos += 4; } ++strPos; diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp index 43656c8..d122b0b 100644 --- a/tests/auto/qtextcodec/tst_qtextcodec.cpp +++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp @@ -428,7 +428,7 @@ void tst_QTextCodec::flagCodepointFFFF() const QString input(ch); QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8 - Q_ASSERT(codec); + QVERIFY(codec); const QByteArray asDecoded(codec->fromUnicode(input)); QCOMPARE(asDecoded, QByteArray("?")); @@ -465,7 +465,7 @@ void tst_QTextCodec::flagF7808080() const QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8 - Q_ASSERT(codec); + QVERIFY(codec); //QVERIFY(!codec->canEncode(QChar(0x1C0000))); @@ -482,7 +482,7 @@ void tst_QTextCodec::flagEFBFBF() const invalidInput[2] = char(0xBF); const QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8 - Q_ASSERT(codec); + QVERIFY(codec); { //QVERIFY(!codec->canEncode(QChar(0xFFFF))); @@ -1627,7 +1627,7 @@ void tst_QTextCodec::utf8bom() QFETCH(QString, result); QTextCodec *const codec = QTextCodec::codecForMib(106); // UTF-8 - Q_ASSERT(codec); + QVERIFY(codec); QCOMPARE(codec->toUnicode(data.constData(), data.length(), 0), result); diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 35014c9..64d543f 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -7220,8 +7220,7 @@ void tst_QWidget::render_systemClip2() QFETCH(bool, usePaintEvent); QFETCH(QColor, expectedColor); - Q_ASSERT_X(expectedColor != QColor(Qt::red), Q_FUNC_INFO, - "Qt::red is the reference color for the image, pick another color"); + QVERIFY2(expectedColor != QColor(Qt::red), "Qt::red is the reference color for the image, pick another color"); class MyWidget : public QWidget { diff --git a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp index 62cc4bb..ff6121f 100644 --- a/tests/auto/xmlpatternsxqts/tst_suitetest.cpp +++ b/tests/auto/xmlpatternsxqts/tst_suitetest.cpp @@ -108,7 +108,7 @@ void tst_SuiteTest::runTestSuite() const /* Run the tests, and serialize the result(as according to XQTSResult.xsd) to standard out. */ TestSuiteResult *const result = ts->runSuite(); - Q_ASSERT(result); + QVERIFY(result); QFile out(m_candidateBaseline); QVERIFY(out.open(QIODevice::WriteOnly)); -- cgit v0.12 From f3092b91a7a2e9e34dfe7eefb3c6b0ed8c3c3786 Mon Sep 17 00:00:00 2001 From: Guoqing Zhang Date: Tue, 12 Apr 2011 10:45:43 +0300 Subject: Fix OpenGL build break on Symbian Task-number: QT-4871 Reviewed-by: Dmitry Trofimov --- src/s60installs/eabi/QtOpenGLu.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index 44f7306..34b5266 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -759,7 +759,7 @@ EXPORTS _ZNK14QGLPaintDevice9isFlippedEv @ 758 NONAME _ZNK16QGLWindowSurface8featuresEv @ 759 NONAME _ZNK26QGLFramebufferObjectFormat6mipmapEv @ 760 NONAME - _ZTI22QGLContextResourceBase @ 761 NONAME + _ZTI22QGLContextResourceBase @ 761 NONAME ABSENT _ZTI27QGLContextGroupResourceBase @ 762 NONAME _ZTV22QGLContextResourceBase @ 763 NONAME _ZTV27QGLContextGroupResourceBase @ 764 NONAME -- cgit v0.12 From efc004a7ad9f1e40fdba6afc06e161052d9fae2f Mon Sep 17 00:00:00 2001 From: Guoqing Zhang Date: Tue, 12 Apr 2011 10:49:08 +0300 Subject: Add focus frame support in style sheet Task-number: QTBUG-16027 Reviewed-by: Olivier Goffart --- src/gui/styles/qstylesheetstyle.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index ecf924c..faa929e 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3323,6 +3323,13 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q } break; + case CE_FocusFrame: + if (!rule.hasNativeBorder()) { + rule.drawBorder(p, opt->rect); + return; + } + break; + case CE_PushButton: if (const QStyleOptionButton *btn = qstyleoption_cast(opt)) { if (rule.hasDrawable() || rule.hasBox() || rule.hasPosition() || rule.hasPalette() || -- cgit v0.12 From 930db5826ff2c02d54f2851494000c5fab97da54 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 12 Apr 2011 15:23:33 +0300 Subject: Fix "make sis" for projects that have empty OBJECTS_DIR Temp directory for packagaging got created to system root if OBJECTS_DIR was empty. Fixed it to use '.' instead in those cases. Reviewed-by: Janne Koskinen --- mkspecs/features/symbian/sis_targets.prf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkspecs/features/symbian/sis_targets.prf b/mkspecs/features/symbian/sis_targets.prf index d0fe881..f3452b7 100644 --- a/mkspecs/features/symbian/sis_targets.prf +++ b/mkspecs/features/symbian/sis_targets.prf @@ -26,7 +26,11 @@ equals(GENERATE_SIS_TARGETS, true) { qtPrepareTool(QMAKE_CREATEPACKAGE, createpackage) - CREATEPACKAGE_DIR = $$OBJECTS_DIR/createpackage_tmp + sis_objects_dir = $$OBJECTS_DIR + isEmpty(sis_objects_dir):sis_objects_dir = . + + CREATEPACKAGE_DIR = $$sis_objects_dir/createpackage_tmp + QMAKE_CLEAN += $$CREATEPACKAGE_DIR/* symbian-abld|symbian-sbsv2 { -- cgit v0.12 From 9632fdefa9012ca11cd1345d66bafd6f417de88e Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 12 Apr 2011 17:58:12 +0100 Subject: Fix some warnings in symbian network tests Ignore warning when the test intentionally sets an invalid socket descriptor. Make sure to set content type on all http post tests in tst_qnetworkreply. Run test with enough capabilities to avoid platsec errors when accessing certificate store. Reviewed-By: Markus Goetz --- tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 2 ++ tests/auto/qtcpserver/tst_qtcpserver.cpp | 3 +++ tests/auto/qtcpsocket/test/test.pro | 2 +- tests/auto/qtcpsocket/tst_qtcpsocket.cpp | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 146d2f3..4317aad 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -4101,6 +4101,7 @@ void tst_QNetworkReply::ioPostToHttpFromMiddleOfQBufferFiveBytes() QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/protected/cgi-bin/md5sum.cgi"; QNetworkRequest request(url); + request.setRawHeader("Content-Type", "application/octet-stream"); QNetworkReplyPtr reply = manager.post(request, &uploadBuffer); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); @@ -4351,6 +4352,7 @@ void tst_QNetworkReply::ioPostToHttpUploadProgress() // create the request QUrl url = QUrl(QString("http://127.0.0.1:%1/").arg(server.serverPort())); QNetworkRequest request(url); + request.setRawHeader("Content-Type", "application/octet-stream"); QNetworkReplyPtr reply = manager.post(request, &sourceFile); QSignalSpy spy(reply, SIGNAL(uploadProgress(qint64,qint64))); connect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); diff --git a/tests/auto/qtcpserver/tst_qtcpserver.cpp b/tests/auto/qtcpserver/tst_qtcpserver.cpp index 9cddc00..2cd870f 100644 --- a/tests/auto/qtcpserver/tst_qtcpserver.cpp +++ b/tests/auto/qtcpserver/tst_qtcpserver.cpp @@ -430,6 +430,9 @@ void tst_QTcpServer::waitForConnectionTest() void tst_QTcpServer::setSocketDescriptor() { QTcpServer server; +#ifdef Q_OS_SYMBIAN + QTest::ignoreMessage(QtWarningMsg, "QSymbianSocketEngine::initialize - socket descriptor not found"); +#endif QVERIFY(!server.setSocketDescriptor(42)); QCOMPARE(server.serverError(), QAbstractSocket::UnsupportedSocketOperationError); #ifndef Q_OS_SYMBIAN diff --git a/tests/auto/qtcpsocket/test/test.pro b/tests/auto/qtcpsocket/test/test.pro index f4207d6..7bf5ba0 100644 --- a/tests/auto/qtcpsocket/test/test.pro +++ b/tests/auto/qtcpsocket/test/test.pro @@ -13,7 +13,7 @@ vxworks:QT -= gui symbian: { TARGET.EPOCHEAPSIZE="0x100 0x3000000" - TARGET.CAPABILITY = NetworkServices + TARGET.CAPABILITY = NetworkServices ReadUserData } TARGET = tst_qtcpsocket diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 623e02b..f83c4cf 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -476,6 +476,9 @@ void tst_QTcpSocket::setInvalidSocketDescriptor() { QTcpSocket *socket = newSocket(); QCOMPARE(socket->socketDescriptor(), -1); +#ifdef Q_OS_SYMBIAN + QTest::ignoreMessage(QtWarningMsg, "QSymbianSocketEngine::initialize - socket descriptor not found"); +#endif QVERIFY(!socket->setSocketDescriptor(-5, QTcpSocket::UnconnectedState)); QCOMPARE(socket->socketDescriptor(), -1); -- cgit v0.12 From 0aa780235c24ed724fcf6a9095a6467e34b9346e Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 12 Apr 2011 18:01:49 +0100 Subject: Remove warnings when disabling notifications on a closed socket The generic layer calls setReadNotificationEnabled(false) on sockets after they are closed. This no longer causes a warning from the symbian socket engine. A warning will only be emitted if trying to enable notifications on a closed socket. Task-number: QTBUG-18713 Reviewed-by: Markus Goetz --- src/network/socket/qsymbiansocketengine.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/network/socket/qsymbiansocketengine.cpp b/src/network/socket/qsymbiansocketengine.cpp index f1b2982..b2b655e 100644 --- a/src/network/socket/qsymbiansocketengine.cpp +++ b/src/network/socket/qsymbiansocketengine.cpp @@ -1440,6 +1440,7 @@ void QSymbianSocketEngine::startNotifications() qDebug() << "QSymbianSocketEngine::startNotifications" << d->readNotificationsEnabled << d->writeNotificationsEnabled << d->exceptNotificationsEnabled; #endif if (!d->asyncSelect && (d->readNotificationsEnabled || d->writeNotificationsEnabled || d->exceptNotificationsEnabled)) { + Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::startNotifications(), Q_VOID); if (d->threadData->eventDispatcher) { d->asyncSelect = q_check_ptr(new QAsyncSelect( static_cast (d->threadData->eventDispatcher), d->nativeSocket, @@ -1456,14 +1457,12 @@ void QSymbianSocketEngine::startNotifications() bool QSymbianSocketEngine::isReadNotificationEnabled() const { Q_D(const QSymbianSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::isReadNotificationEnabled(), false); return d->readNotificationsEnabled; } void QSymbianSocketEngine::setReadNotificationEnabled(bool enable) { Q_D(QSymbianSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::setReadNotificationEnabled(), Q_VOID); #ifdef QNATIVESOCKETENGINE_DEBUG qDebug() << "QSymbianSocketEngine::setReadNotificationEnabled" << enable << "socket" << d->socketDescriptor; #endif @@ -1474,14 +1473,12 @@ void QSymbianSocketEngine::setReadNotificationEnabled(bool enable) bool QSymbianSocketEngine::isWriteNotificationEnabled() const { Q_D(const QSymbianSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::isWriteNotificationEnabled(), false); return d->writeNotificationsEnabled; } void QSymbianSocketEngine::setWriteNotificationEnabled(bool enable) { Q_D(QSymbianSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::setWriteNotificationEnabled(), Q_VOID); #ifdef QNATIVESOCKETENGINE_DEBUG qDebug() << "QSymbianSocketEngine::setWriteNotificationEnabled" << enable << "socket" << d->socketDescriptor; #endif @@ -1492,7 +1489,6 @@ void QSymbianSocketEngine::setWriteNotificationEnabled(bool enable) bool QSymbianSocketEngine::isExceptionNotificationEnabled() const { Q_D(const QSymbianSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::isExceptionNotificationEnabled(), false); return d->exceptNotificationsEnabled; return false; } @@ -1500,7 +1496,6 @@ bool QSymbianSocketEngine::isExceptionNotificationEnabled() const void QSymbianSocketEngine::setExceptionNotificationEnabled(bool enable) { Q_D(QSymbianSocketEngine); - Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::setExceptionNotificationEnabled(), Q_VOID); #ifdef QNATIVESOCKETENGINE_DEBUG qDebug() << "QSymbianSocketEngine::setExceptionNotificationEnabled" << enable << "socket" << d->socketDescriptor; #endif -- cgit v0.12 From 9af8b63fd730bf29179a08ee53dc99b7e7646bda Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Tue, 12 Apr 2011 18:06:17 +0100 Subject: Fix error handling in write for socks socket engine When socks socket engine calls the write function of the native socket engine, it now propagates errors to the abstract socket. Task-number: QTBUG-18713 Reviewed-by: Markus Goetz --- src/network/socket/qsocks5socketengine.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index c365635..88b5aca 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -1540,8 +1540,13 @@ qint64 QSocks5SocketEngine::write(const char *data, qint64 len) // ### Handle this error. } - d->data->controlSocket->write(sealedBuf); + qint64 written = d->data->controlSocket->write(sealedBuf); + if (written <= 0) { + QSOCKS5_Q_DEBUG << "native write returned" << written; + return written; + } d->data->controlSocket->waitForBytesWritten(0); + //NB: returning len rather than written for the OK case, because the "sealing" may increase the length return len; #ifndef QT_NO_UDPSOCKET } else if (d->mode == QSocks5SocketEnginePrivate::UdpAssociateMode) { -- cgit v0.12 From 01477af79d8114b3f8993c3967892538a599dfa6 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 13 Apr 2011 11:58:40 +0300 Subject: Improve logic to find default certificates in createpackage script Original implementation assumed createpackage script was always run from under Qt source tree bin directory, which is not always the case as on some platforms the Qt tools can be found from under EPOCROOT. Fixed it so that if the default directory for default certificates can't be found in the expected location, createpackage will attempt to query qmake in the same directory as the createpackage script for the location of the Qt source tree (QT_INSTALL_PREFIX) and look for default certificates directory from under there. Task-number: QTBUG-18684 Reviewed-by: Janne Koskinen --- bin/createpackage.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/createpackage.pl b/bin/createpackage.pl index b7457e1..aae20ae 100755 --- a/bin/createpackage.pl +++ b/bin/createpackage.pl @@ -238,11 +238,7 @@ if ($templatepkg =~ m/_installer\.pkg$/i && $onlyUnsigned) { my $unsigned_sis_name = $sisoutputbasename."_unsigned.sis"; my $stub_sis_name = $sisoutputbasename.".sis"; -# Store some utility variables -my $scriptpath = dirname(__FILE__); my $certtext = $certificate; -# certificates are one step up in hierarchy -my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60installs/"); # Check some pre-conditions and print error messages if needed. unless (length($templatepkg)) { @@ -265,6 +261,16 @@ if (length($certificate)) { } } else { #If no certificate is given, check default options + my $scriptpath = dirname(__FILE__); + my $certpath = File::Spec->catdir($scriptpath, File::Spec->updir(), "src/s60installs"); + + unless (-e $certpath) { + my $qmakeCmd = File::Spec->catfile($scriptpath, "qmake"); + $certpath = `$qmakeCmd -query QT_INSTALL_PREFIX`; + $certpath =~ s/\s+$//; + $certpath = File::Spec->catdir($certpath, "src/s60installs"); + } + $certtext = "RnD"; $certificate = File::Spec->catfile($certpath, "rd.cer"); $key = File::Spec->catfile($certpath, "rd-key.pem"); -- cgit v0.12 From dd8de4c2437397748daba49569cbc7f89a8bfbee Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 13 Apr 2011 18:04:00 +0100 Subject: Optimisation - buffer packet read in pendingDatagramSize In Symbian, the OS function to get the size of a pending datagram also includes the size of the packet header (which is different for IPv4 and IPv6). We were reading the datagram with the "peek" flag set to implement pendingDatagramSize, then reading again normally when the client called read/readDatagram. This change removes the "peek" flag, and buffers the datagram in the socket engine, returning it and clearing the buffer when read or readDatagram is called. If there is no buffered data, the existing code path is followed - it isn't mandatory to call pendingDatagramSize before reading from the socket. Reviewed-by: Markus Goetz --- src/network/socket/qsymbiansocketengine.cpp | 63 ++++++++++++++++++++++++----- src/network/socket/qsymbiansocketengine_p.h | 2 + 2 files changed, 56 insertions(+), 9 deletions(-) diff --git a/src/network/socket/qsymbiansocketengine.cpp b/src/network/socket/qsymbiansocketengine.cpp index b2b655e..b6d12fe 100644 --- a/src/network/socket/qsymbiansocketengine.cpp +++ b/src/network/socket/qsymbiansocketengine.cpp @@ -251,7 +251,8 @@ QSymbianSocketEnginePrivate::QSymbianSocketEnginePrivate() : readNotificationsEnabled(false), writeNotificationsEnabled(false), exceptNotificationsEnabled(false), - asyncSelect(0) + asyncSelect(0), + hasReceivedBufferedDatagram(false) { } @@ -781,21 +782,34 @@ qint64 QSymbianSocketEngine::pendingDatagramSize() const Q_D(const QSymbianSocketEngine); Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::pendingDatagramSize(), false); Q_CHECK_TYPE(QSymbianSocketEngine::hasPendingDatagrams(), QAbstractSocket::UdpSocket, false); - int nbytes; + //can only buffer one datagram at a time + if (d->hasReceivedBufferedDatagram) + return d->receivedDataBuffer.size(); + int nbytes = 0; TInt err = d->nativeSocket.GetOpt(KSOReadBytesPending,KSOLSocket, nbytes); if (nbytes > 0) { //nbytes includes IP header, which is of variable length (IPv4 with or without options, IPv6...) - QByteArray next(nbytes,0); - TPtr8 buffer((TUint8*)next.data(), next.size()); + //therefore read the datagram into a buffer to find its true size + d->receivedDataBuffer.resize(nbytes); + TPtr8 buffer((TUint8*)d->receivedDataBuffer.data(), nbytes); + //nbytes = size including IP header, buffer is a pointer descriptor backed by the receivedDataBuffer TInetAddr addr; TRequestStatus status; - //TODO: rather than peek, should we save this for next call to readDatagram? - //what if calls don't match though? - d->nativeSocket.RecvFrom(buffer, addr, KSockReadPeek, status); + //RecvFrom copies only the payload (we don't want the header so don't specify the option to retrieve it) + d->nativeSocket.RecvFrom(buffer, addr, 0, status); User::WaitForRequest(status); - if (status.Int()) + if (status != KErrNone) { + d->receivedDataBuffer.clear(); return 0; - return buffer.Length(); + } + nbytes = buffer.Length(); + //nbytes = size of payload, resize the receivedDataBuffer to the final size + d->receivedDataBuffer.resize(nbytes); + d->hasReceivedBufferedDatagram = true; + //now receivedDataBuffer contains one datagram, which has been removed from the socket's internal buffer +#if defined (QNATIVESOCKETENGINE_DEBUG) + qDebug() << "QSymbianSocketEngine::pendingDatagramSize buffering" << nbytes << "bytes"; +#endif } return qint64(nbytes); } @@ -807,6 +821,19 @@ qint64 QSymbianSocketEngine::readDatagram(char *data, qint64 maxSize, Q_D(QSymbianSocketEngine); Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::readDatagram(), -1); Q_CHECK_TYPE(QSymbianSocketEngine::readDatagram(), QAbstractSocket::UdpSocket, false); + + // if a datagram was buffered in pendingDatagramSize(), return it now + if (d->hasReceivedBufferedDatagram) { + qint64 size = qMin(maxSize, (qint64)d->receivedDataBuffer.size()); + memcpy(data, d->receivedDataBuffer.constData(), size); + d->receivedDataBuffer.clear(); + d->hasReceivedBufferedDatagram = false; +#if defined (QNATIVESOCKETENGINE_DEBUG) + qDebug() << "QSymbianSocketEngine::readDatagram returning" << size << "bytes from buffer"; +#endif + return size; + } + TPtr8 buffer((TUint8*)data, (int)maxSize); TInetAddr addr; TRequestStatus status; @@ -985,6 +1012,9 @@ void QSymbianSocketEngine::close() d->localAddress.clear(); d->peerPort = 0; d->peerAddress.clear(); + + d->hasReceivedBufferedDatagram = false; + d->receivedDataBuffer.clear(); } qint64 QSymbianSocketEngine::write(const char *data, qint64 len) @@ -1036,6 +1066,18 @@ qint64 QSymbianSocketEngine::read(char *data, qint64 maxSize) Q_CHECK_VALID_SOCKETLAYER(QSymbianSocketEngine::read(), -1); Q_CHECK_STATES(QSymbianSocketEngine::read(), QAbstractSocket::ConnectedState, QAbstractSocket::BoundState, -1); + // if a datagram was buffered in pendingDatagramSize(), return it now + if (d->hasReceivedBufferedDatagram) { + qint64 size = qMin(maxSize, (qint64)d->receivedDataBuffer.size()); + memcpy(data, d->receivedDataBuffer.constData(), size); + d->receivedDataBuffer.clear(); + d->hasReceivedBufferedDatagram = false; +#if defined (QNATIVESOCKETENGINE_DEBUG) + qDebug() << "QSymbianSocketEngine::read returning" << size << "bytes from buffer"; +#endif + return size; + } + TPtr8 buffer((TUint8*)data, (int)maxSize); TSockXfrLength received = 0; TRequestStatus status; @@ -1655,6 +1697,9 @@ void QAsyncSelect::run() //when event loop disabled socket events, defer until later if (maybeDeferSocketEvent()) return; +#if defined (QNATIVESOCKETENGINE_DEBUG) + qDebug() << "QAsyncSelect::run" << m_selectBuf() << m_selectFlags; +#endif m_inSocketEvent = true; m_selectBuf() &= m_selectFlags; //the select ioctl reports everything, so mask to only what we requested //KSockSelectReadContinuation is for reading datagrams in a mode that doesn't discard when the diff --git a/src/network/socket/qsymbiansocketengine_p.h b/src/network/socket/qsymbiansocketengine_p.h index 85ab54a..2e7c155 100644 --- a/src/network/socket/qsymbiansocketengine_p.h +++ b/src/network/socket/qsymbiansocketengine_p.h @@ -196,6 +196,8 @@ public: bool exceptNotificationsEnabled; QAsyncSelect* asyncSelect; + mutable QByteArray receivedDataBuffer; + mutable bool hasReceivedBufferedDatagram; // FIXME this is duplicated from qnativesocketengine_p.h enum ErrorString { NonBlockingInitFailedErrorString, -- cgit v0.12 From 00b18457d5efb9224f3b066bab9e9f601fbcf543 Mon Sep 17 00:00:00 2001 From: Tomi Vihria Date: Thu, 14 Apr 2011 11:19:24 +0300 Subject: Enablers for the Qt eclipsing in Symbian Remove file listing from the stub package file to ease maintenance, generate stub sis from it and export it to the correct location to be included into ROM. Task-number: QT-4817 Reviewed-by: Guoqing Zhang --- config.profiles/symbian/bld.inf | 6 ++-- config.profiles/symbian/qt_stub.pkg | 53 ------------------------------------ config.profiles/symbian/qt_stub.sis | Bin 0 -> 324 bytes 3 files changed, 4 insertions(+), 55 deletions(-) create mode 100644 config.profiles/symbian/qt_stub.sis diff --git a/config.profiles/symbian/bld.inf b/config.profiles/symbian/bld.inf index ddb5157..16a9e15 100644 --- a/config.profiles/symbian/bld.inf +++ b/config.profiles/symbian/bld.inf @@ -38,10 +38,12 @@ loc.prf /epoc32/tools/qt/mkspecs/features/loc.prf //For UDA image confml/qt.confml CONFML_EXPORT_PATH(qt.confml,uda_content) implml/qt_copy.implml CRML_EXPORT_PATH(qt_copy.implml,uda_content) -content/apps/qt.sisx CRML_EXPORT_PATH(../content/sis/,uda_content) -content/apps/qt_stub.sis /epoc32/data/z/system/install/qt_stub.sis +content/apps/qt.sisx CRML_EXPORT_PATH(../content/sis/,uda_content) #endif +/* export stub sis to enable eclipsing */ +qt_stub.sis /epoc32/data/z/system/install/qt_stub.sis + //tools ../../bin/createpackage.bat /epoc32/tools/createpackage.bat ../../bin/createpackage.pl /epoc32/tools/createpackage.pl diff --git a/config.profiles/symbian/qt_stub.pkg b/config.profiles/symbian/qt_stub.pkg index dadf696..0ac4439 100644 --- a/config.profiles/symbian/qt_stub.pkg +++ b/config.profiles/symbian/qt_stub.pkg @@ -15,56 +15,3 @@ ; Unique Vendor name :"Nokia, Qt" -; Dependencies of Qt libraries - -"" - "z:\sys\bin\QtCore.dll" -"" - "z:\sys\bin\QtXml.dll" -"" - "z:\sys\bin\QtGui.dll" -"" - "z:\sys\bin\QtNetwork.dll" -"" - "z:\sys\bin\QtTest.dll" -"" - "z:\sys\bin\QtSql.dll" -"" - "z:\sys\bin\QtSvg.dll" -"" - "z:\sys\bin\phonon.dll" -"" - "z:\sys\bin\QtScript.dll" -"" - "z:\sys\bin\QtXmlPatterns.dll" -"" - "z:\sys\bin\QtDeclarative.dll" -"" - "z:\sys\bin\QtOpenVG.dll" -"" - "z:\sys\bin\QtOpenGL.dll" -"" - "z:\sys\bin\QtMultimedia.dll" -"" - "z:\private\10202D56\import\packages\2001E61C\backup_registration.xml" -"" - "z:\sys\bin\qjpeg.dll" -"" - "z:\resource\qt\plugins\imageformats\qjpeg.qtplugin" -"" - "z:\sys\bin\qgif.dll" -"" - "z:\resource\qt\plugins\imageformats\qgif.qtplugin" -"" - "z:\sys\bin\qmng.dll" -"" - "z:\resource\qt\plugins\imageformats\qmng.qtplugin" -"" - "z:\sys\bin\qtiff.dll" -"" - "z:\resource\qt\plugins\imageformats\qtiff.qtplugin" -"" - "z:\sys\bin\qico.dll" -"" - "z:\resource\qt\plugins\imageformats\qico.qtplugin" -"" - "z:\sys\bin\qsvg.dll" -"" - "z:\resource\qt\plugins\imageformats\qsvg.qtplugin" -"" - "z:\sys\bin\qcncodecs.dll" -"" - "z:\resource\qt\plugins\codecs\qcncodecs.qtplugin" -"" - "z:\sys\bin\qjpcodecs.dll" -"" - "z:\resource\qt\plugins\codecs\qjpcodecs.qtplugin" -"" - "z:\sys\bin\qtwcodecs.dll" -"" - "z:\resource\qt\plugins\codecs\qtwcodecs.qtplugin" -"" - "z:\sys\bin\qkrcodecs.dll" -"" - "z:\resource\qt\plugins\codecs\qkrcodecs.qtplugin" -"" - "z:\sys\bin\qvggraphicssystem.dll" -"" - "z:\resource\qt\plugins\graphicssystems\qvggraphicssystem.qtplugin" -"" - "z:\sys\bin\qglgraphicssystem.dll" -"" - "z:\resource\qt\plugins\graphicssystems\qglgraphicssystem.qtplugin" -"" - "z:\sys\bin\qsvgicon.dll" -"" - "z:\resource\qt\plugins\iconengines\qsvgicon.qtplugin" -"" - "z:\sys\bin\qmlfolderlistmodelplugin.dll" -"" - "z:\resource\qt\imports\Qt\labs\folderlistmodel\qmlfolderlistmodelplugin.qtplugin" -"" - "z:\resource\qt\imports\Qt\labs\folderlistmodel\qmldir" -"" - "z:\sys\bin\qmlgesturesplugin.dll" -"" - "z:\resource\qt\imports\Qt\labs\gestures\qmlgesturesplugin.qtplugin" -"" - "z:\resource\qt\imports\Qt\labs\gestures\qmldir" -"" - "z:\sys\bin\qmlparticlesplugin.dll" -"" - "z:\resource\qt\imports\Qt\labs\particles\qmlparticlesplugin.qtplugin" -"" - "z:\resource\qt\imports\Qt\labs\particles\qmldir" - diff --git a/config.profiles/symbian/qt_stub.sis b/config.profiles/symbian/qt_stub.sis new file mode 100644 index 0000000..30d91a9 Binary files /dev/null and b/config.profiles/symbian/qt_stub.sis differ -- cgit v0.12 From 6dcb0028e44cba2a00c2fb867fb1757ad5b1a254 Mon Sep 17 00:00:00 2001 From: Tomi Vihria Date: Thu, 14 Apr 2011 15:39:08 +0300 Subject: Fixed Qt UDA creation for Symbian Added a dummy Qt sis file and fixed paths in bld.inf. Otherwise build would fail when FF_QT_IN_UDA is defined. Dummy Qt sis file needs to replaced with a real one when actual UDA image is created. Task-number: QT-4888 Reviewed-by: Guoqing Zhang --- config.profiles/symbian/bld.inf | 2 +- config.profiles/symbian/qt.sisx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 config.profiles/symbian/qt.sisx diff --git a/config.profiles/symbian/bld.inf b/config.profiles/symbian/bld.inf index 16a9e15..6ccb11c 100644 --- a/config.profiles/symbian/bld.inf +++ b/config.profiles/symbian/bld.inf @@ -38,7 +38,7 @@ loc.prf /epoc32/tools/qt/mkspecs/features/loc.prf //For UDA image confml/qt.confml CONFML_EXPORT_PATH(qt.confml,uda_content) implml/qt_copy.implml CRML_EXPORT_PATH(qt_copy.implml,uda_content) -content/apps/qt.sisx CRML_EXPORT_PATH(../content/sis/,uda_content) +qt.sisx CRML_EXPORT_PATH(../content/sis/,uda_content) #endif /* export stub sis to enable eclipsing */ diff --git a/config.profiles/symbian/qt.sisx b/config.profiles/symbian/qt.sisx new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/config.profiles/symbian/qt.sisx @@ -0,0 +1 @@ +1 \ No newline at end of file -- cgit v0.12 From 1750a4351a8125756bf38a53d6d8312993c7d85e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 Apr 2011 14:15:49 +1000 Subject: Remove Q_ASSERT calls that wrap side-effecting code. In release mode builds, code inside Q_ASSERT macros is not executed, so putting code with side-effects inside Q_ASSERT is not a good idea. Task-number: QTBUG-17582 Change-Id: I1a5d8ccce666ee7b7f120bf9cbb49e30dac9add4 Reviewed-by: Rohan McGovern --- tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 2dbed3b..50c634f 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -185,16 +185,22 @@ QString tst_qmlvisual::toTestScript(const QString &file, Mode mode) if (platformsuffix && (mode == UpdatePlatformVisuals || QFile::exists(testdata+QLatin1String(platformsuffix)+QDir::separator()+testname+".qml"))) { QString platformdir = testdata + QLatin1String(platformsuffix); if (mode == UpdatePlatformVisuals) { - Q_ASSERT(QDir().mkpath(platformdir)); + if (!QDir().mkpath(platformdir)) { + qFatal("Cannot make path %s", qPrintable(platformdir)); + } // Copy from base QDir dir(testdata,testname+".*"); dir.setFilter(QDir::Files); QFileInfoList list = dir.entryInfoList(); for (int i = 0; i < list.size(); ++i) { QFile in(list.at(i).filePath()); - Q_ASSERT(in.open(QIODevice::ReadOnly)); + if (!in.open(QIODevice::ReadOnly)) { + qFatal("Cannot open file %s: %s", qPrintable(in.fileName()), qPrintable(in.errorString())); + } QFile out(platformdir + QDir::separator() + list.at(i).fileName()); - Q_ASSERT(out.open(QIODevice::WriteOnly)); + if (!out.open(QIODevice::WriteOnly)) { + qFatal("Cannot open file %s: %s", qPrintable(out.fileName()), qPrintable(out.errorString())); + } out.write(in.readAll()); } } -- cgit v0.12 From d6bd4db2db6dbefec327e226bf54a69a20690a45 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 Apr 2011 15:25:45 +1000 Subject: Remove redundant Q_ASSERT from qmlvisual autotest. Change-Id: I5c413793ee6322b5be1ae52658362803dc4c2010 Task-number: QTBUG-17582 Reviewed-by: Alan Alpert --- tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 50c634f..61e1883 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -240,8 +240,6 @@ QStringList tst_qmlvisual::findQmlFiles(const QDir &d) void action(Mode mode, const QString &file) { - Q_ASSERT(mode != Test); - QString testdata = tst_qmlvisual::toTestScript(file,mode); QStringList arguments; -- cgit v0.12 From 59a6e6200984ccbb862b8758436a5e88b8c40bbc Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 Apr 2011 16:15:39 +1000 Subject: Remove Q_ASSERT from QDeclarativeListModel autotest. Change-Id: Ic15b747fa50bcec54df748b173b299058f69c681 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- .../declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 45072f3..14af19c 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -114,7 +114,6 @@ int tst_qdeclarativelistmodel::roleFromName(const QDeclarativeListModel *model, if (model->toString(roles[i]) == roleName) return roles[i]; } - Q_ASSERT(false); return -1; } @@ -740,6 +739,7 @@ void tst_qdeclarativelistmodel::get() "}", QUrl()); QDeclarativeListModel *model = qobject_cast(component.create()); int role = roleFromName(model, roleName); + QVERIFY(role >= 0); QSignalSpy spy(model, SIGNAL(itemsChanged(int, int, QList))); QDeclarativeExpression expr(eng.rootContext(), model, expression); @@ -801,6 +801,7 @@ void tst_qdeclarativelistmodel::get_worker() model.append(sv); model.append(sv); int role = roleFromName(&model, roleName); + QVERIFY(role >= 0); const char *warning = ": QML ListModel: Cannot add list-type data when modifying or after modification from a worker script"; if (roleValue.type() == QVariant::List || roleValue.type() == QVariant::Map) @@ -892,6 +893,7 @@ void tst_qdeclarativelistmodel::get_nested() int outerListIndex = testData[i].first; QString outerListRoleName = testData[i].second; int outerListRole = roleFromName(model, outerListRoleName); + QVERIFY(outerListRole >= 0); childModel = qobject_cast(model->data(outerListIndex, outerListRole).value()); QVERIFY(childModel); @@ -904,6 +906,7 @@ void tst_qdeclarativelistmodel::get_nested() QVERIFY(!expr.hasError()); int role = roleFromName(childModel, roleName); + QVERIFY(role >= 0); QCOMPARE(childModel->data(index, role), roleValue); QCOMPARE(spy.count(), 1); -- cgit v0.12 From ee55dec1efe9c67518bf3e27f81b0696075f7153 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Fri, 15 Apr 2011 17:35:13 +1000 Subject: Make tst_exceptionsafety_objects part of the test set. Re-enable this test, with the two test functions that fail on Linux disabled until the failures can be diagnosed. Change-Id: I915e1a0d675cb71a80086e89f9799a4f9f6b600c Reviewed-by: Rohan McGovern --- tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp | 2 ++ tests/auto/other.pro | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index e7e516e..3e4ccf5 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -352,6 +352,7 @@ void tst_ExceptionSafetyObjects::cleanupTestCase() void tst_ExceptionSafetyObjects::objects() { + QSKIP("This test currently crashes", SkipAll); QFETCH(AbstractTester *, objectCreator); doOOMTest(*objectCreator, 0); @@ -457,6 +458,7 @@ void tst_ExceptionSafetyObjects::widgets_data() void tst_ExceptionSafetyObjects::widgets() { + QSKIP("This test currently crashes", SkipAll); QFETCH(AbstractTester *, widgetCreator); doOOMTest(*widgetCreator, 0, 00000); diff --git a/tests/auto/other.pro b/tests/auto/other.pro index 8819879..4d8ff4e 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -3,7 +3,7 @@ TEMPLATE=subdirs SUBDIRS=\ -# exceptionsafety_objects \ shouldn't enable it + exceptionsafety_objects \ # baselineexample \ Just an example demonstrating qbaselinetest usage lancelot \ qaccessibility \ -- cgit v0.12 From 069e4441f2e14a82b4ae39601734acb71c909bd9 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 11:11:47 +1000 Subject: Rename test class. Fixes warning from tst_maketestselftest about test class name not matching TARGET. Change-Id: I7a81d87bb64d2902e842d097248e33eacb388746 Reviewed-by: Rohan McGovern --- .../tst_exceptionsafety_objects.cpp | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index 3e4ccf5..c78782e 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -60,7 +60,7 @@ QT_USE_NAMESPACE #include "3rdparty/memcheck.h" #endif -class tst_ExceptionSafetyObjects: public QObject +class tst_ExceptionSafety_Objects: public QObject { Q_OBJECT @@ -156,7 +156,7 @@ struct DirCreator : public AbstractTester } }; -void tst_ExceptionSafetyObjects::objects_data() +void tst_ExceptionSafety_Objects::objects_data() { QTest::addColumn("objectCreator"); @@ -274,9 +274,9 @@ public: } }; -QtMsgHandler tst_ExceptionSafetyObjects::testMessageHandler; +QtMsgHandler tst_ExceptionSafety_Objects::testMessageHandler; -void tst_ExceptionSafetyObjects::safeMessageHandler(QtMsgType type, const char *msg) +void tst_ExceptionSafety_Objects::safeMessageHandler(QtMsgType type, const char *msg) { // this temporarily suspends OOM testing while handling a message int currentIndex = mallocFailIndex; @@ -301,7 +301,7 @@ void debugUnexpected() (*defaultUnexpected)(); } -void tst_ExceptionSafetyObjects::initTestCase() +void tst_ExceptionSafety_Objects::initTestCase() { // set handlers for bad exception cases, you might want to step in and breakpoint the default handlers too defaultTerminate = std::set_terminate(&debugTerminate); @@ -345,12 +345,12 @@ void tst_ExceptionSafetyObjects::initTestCase() QCOMPARE(malloc2Failed, 1); } -void tst_ExceptionSafetyObjects::cleanupTestCase() +void tst_ExceptionSafety_Objects::cleanupTestCase() { qInstallMsgHandler(testMessageHandler); } -void tst_ExceptionSafetyObjects::objects() +void tst_ExceptionSafety_Objects::objects() { QSKIP("This test currently crashes", SkipAll); QFETCH(AbstractTester *, objectCreator); @@ -389,7 +389,7 @@ template <> struct WidgetCreator : public AbstractTester QScopedPointer ptr(new QDesktopWidget()); } }; -void tst_ExceptionSafetyObjects::widgets_data() +void tst_ExceptionSafety_Objects::widgets_data() { #ifdef Q_OS_SYMBIAN // Initialise the S60 rasteriser, which crashes if started while out of memory @@ -456,7 +456,7 @@ void tst_ExceptionSafetyObjects::widgets_data() NEWROW(QTreeWidget); } -void tst_ExceptionSafetyObjects::widgets() +void tst_ExceptionSafety_Objects::widgets() { QSKIP("This test currently crashes", SkipAll); QFETCH(AbstractTester *, widgetCreator); @@ -722,12 +722,12 @@ static void containerData() QTest::newRow("erase moveable") << static_cast(containerEraseTest); } -void tst_ExceptionSafetyObjects::vector_data() +void tst_ExceptionSafety_Objects::vector_data() { containerData(); } -void tst_ExceptionSafetyObjects::vector() +void tst_ExceptionSafety_Objects::vector() { QFETCH(TestFunction, testFunction); @@ -738,30 +738,30 @@ void tst_ExceptionSafetyObjects::vector() doOOMTest(testFunction, 0); } -void tst_ExceptionSafetyObjects::list_data() +void tst_ExceptionSafety_Objects::list_data() { containerData(); } -void tst_ExceptionSafetyObjects::list() +void tst_ExceptionSafety_Objects::list() { QFETCH(TestFunction, testFunction); doOOMTest(testFunction, 0); } -void tst_ExceptionSafetyObjects::linkedList_data() +void tst_ExceptionSafety_Objects::linkedList_data() { containerData(); } -void tst_ExceptionSafetyObjects::linkedList() +void tst_ExceptionSafety_Objects::linkedList() { QFETCH(TestFunction, testFunction); doOOMTest(testFunction, 0); } -QTEST_MAIN(tst_ExceptionSafetyObjects) +QTEST_MAIN(tst_ExceptionSafety_Objects) #include "tst_exceptionsafety_objects.moc" #endif // QT_NO_EXCEPTIONS -- cgit v0.12 From ced0a98b5274be6a62ae7e4a0f9fc3161d0e40cb Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 14:27:44 +1000 Subject: Make test compile in namespaced build. Change-Id: I824864b8db755a8dc731e3c9de39e3dd7b16224a Reviewed-by: Rohan McGovern --- tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index c78782e..ab589ed 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -549,7 +549,9 @@ struct IntegerMoveable }; int IntegerMoveable::instanceCount = 0; +QT_BEGIN_NAMESPACE Q_DECLARE_TYPEINFO(IntegerMoveable, Q_MOVABLE_TYPE); +QT_END_NAMESPACE template class Container> void containerInsertTest(QObject*) -- cgit v0.12 From 3788a90338e9328710b9d3335a63fb85ab7d97fc Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 15:38:38 +1000 Subject: Partially re-enable exception safety test Re-enabling for object types that don't crash the test. Change-Id: I8c2f0d02171c973bf1ede227d4139b52cac5939f Reviewed-by: Rohan McGovern --- .../tst_exceptionsafety_objects.cpp | 46 +++++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index ab589ed..cb37049 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -352,7 +352,14 @@ void tst_ExceptionSafety_Objects::cleanupTestCase() void tst_ExceptionSafety_Objects::objects() { - QSKIP("This test currently crashes", SkipAll); + QLatin1String tag = QLatin1String(QTest::currentDataTag()); + if (tag == QLatin1String("QFile") + || tag == QLatin1String("QProcess") + || tag == QLatin1String("QSettings") + || tag == QLatin1String("QThread") + || tag == QLatin1String("QThreadPool")) + QSKIP("This type of object is not currently strongly exception safe", SkipSingle); + QFETCH(AbstractTester *, objectCreator); doOOMTest(*objectCreator, 0); @@ -458,7 +465,42 @@ void tst_ExceptionSafety_Objects::widgets_data() void tst_ExceptionSafety_Objects::widgets() { - QSKIP("This test currently crashes", SkipAll); + QLatin1String tag = QLatin1String(QTest::currentDataTag()); + if (tag == QLatin1String("QColumnView") + || tag == QLatin1String("QComboBox") + || tag == QLatin1String("QCommandLinkButton") + || tag == QLatin1String("QDateEdit") + || tag == QLatin1String("QDateTimeEdit") + || tag == QLatin1String("QDesktopWidget") + || tag == QLatin1String("QDoubleSpinBox") + || tag == QLatin1String("QFontComboBox") + || tag == QLatin1String("QGroupBox") + || tag == QLatin1String("QLineEdit") + || tag == QLatin1String("QListView") + || tag == QLatin1String("QListWidget") + || tag == QLatin1String("QMainWindow") + || tag == QLatin1String("QMenu") + || tag == QLatin1String("QMenuBar") + || tag == QLatin1String("QPlainTextEdit") + || tag == QLatin1String("QProgressBar") + || tag == QLatin1String("QPushButton") + || tag == QLatin1String("QScrollArea") + || tag == QLatin1String("QSpinBox") + || tag == QLatin1String("QStackedWidget") + || tag == QLatin1String("QStatusBar") + || tag == QLatin1String("QTableView") + || tag == QLatin1String("QTableWidget") + || tag == QLatin1String("QTabWidget") + || tag == QLatin1String("QTextBrowser") + || tag == QLatin1String("QTextEdit") + || tag == QLatin1String("QTimeEdit") + || tag == QLatin1String("QToolBar") + || tag == QLatin1String("QToolBox") + || tag == QLatin1String("QTreeView") + || tag == QLatin1String("QTreeWidget") + || tag == QLatin1String("QWorkspace")) + QSKIP("This type of widget is not currently strongly exception safe", SkipSingle); + QFETCH(AbstractTester *, widgetCreator); doOOMTest(*widgetCreator, 0, 00000); -- cgit v0.12 From 01dfb9ca25bfaec5784f404dcd4bf41bbc2b6fcb Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 17:21:03 +1000 Subject: Don't try to run exceptionsafety_objects test by default on windows. This test relies on some API specific to MSVC's debug runtime, which is not always guaranteed to be available. Change-Id: Ib0ae4694ad51f59198dadfce802f0dfdf0522002 Reviewed-by: Rohan McGovern --- tests/auto/other.pro | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/other.pro b/tests/auto/other.pro index 4d8ff4e..89f9e53 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -3,7 +3,6 @@ TEMPLATE=subdirs SUBDIRS=\ - exceptionsafety_objects \ # baselineexample \ Just an example demonstrating qbaselinetest usage lancelot \ qaccessibility \ @@ -56,6 +55,8 @@ symbian { qs60mainapplication } +!win32-msvc*:!wince*:SUBDIRS += exceptionsafety_objects + # Following tests depends on private API !contains(QT_CONFIG, private_tests): SUBDIRS -= \ qcssparser \ -- cgit v0.12 From 10f3f270c8a319205590ae13bdeab063d5216441 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Mon, 18 Apr 2011 18:21:03 +1000 Subject: Cosmetic changes to exceptionsafety_objects test Sort test data alphabetically and remove excess whitespace. Change-Id: I0e244efca9e9adbe747a375a28a63f70992ef4f8 Reviewed-by: Trust Me --- .../tst_exceptionsafety_objects.cpp | 33 ++++++++++------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp index cb37049..2f094f3 100644 --- a/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp +++ b/tests/auto/exceptionsafety_objects/tst_exceptionsafety_objects.cpp @@ -164,12 +164,12 @@ void tst_ExceptionSafety_Objects::objects_data() NEWROW(QObject); NEWROW(QBuffer); NEWROW(QFile); + NEWROW(QFSFileEngine); NEWROW(QProcess); NEWROW(QSettings); NEWROW(QThread); NEWROW(QThreadPool); NEWROW(QTranslator); - NEWROW(QFSFileEngine); #define NEWROW2(T, CREATOR) QTest::newRow(#T) << static_cast(new CREATOR) NEWROW2(QBitArray, BitArrayCreator); @@ -177,7 +177,6 @@ void tst_ExceptionSafety_Objects::objects_data() NEWROW2(QCryptographicHash, CryptographicHashCreator); NEWROW2(QDataStream, DataStreamCreator); NEWROW2(QDir, DirCreator); - } // create and destructs an object, and lets each and every allocation @@ -363,7 +362,7 @@ void tst_ExceptionSafety_Objects::objects() QFETCH(AbstractTester *, objectCreator); doOOMTest(*objectCreator, 0); - + delete objectCreator; } @@ -400,9 +399,9 @@ void tst_ExceptionSafety_Objects::widgets_data() { #ifdef Q_OS_SYMBIAN // Initialise the S60 rasteriser, which crashes if started while out of memory - QImage image(20, 20, QImage::Format_RGB32); - QPainter p(&image); - p.drawText(0, 15, "foo"); + QImage image(20, 20, QImage::Format_RGB32); + QPainter p(&image); + p.drawText(0, 15, "foo"); #endif QTest::addColumn("widgetCreator"); @@ -413,23 +412,27 @@ void tst_ExceptionSafety_Objects::widgets_data() NEWROW(QWidget); NEWROW(QButtonGroup); - NEWROW(QDesktopWidget); NEWROW(QCheckBox); + NEWROW(QColumnView); NEWROW(QComboBox); NEWROW(QCommandLinkButton); NEWROW(QDateEdit); NEWROW(QDateTimeEdit); + NEWROW(QDesktopWidget); NEWROW(QDial); NEWROW(QDoubleSpinBox); NEWROW(QFocusFrame); NEWROW(QFontComboBox); NEWROW(QFrame); NEWROW(QGroupBox); - NEWROW(QLCDNumber); NEWROW(QLabel); NEWROW(QLCDNumber); NEWROW(QLineEdit); + NEWROW(QListView); + NEWROW(QListWidget); + NEWROW(QMainWindow); NEWROW(QMenu); + NEWROW(QMenuBar); NEWROW(QPlainTextEdit); NEWROW(QProgressBar); NEWROW(QPushButton); @@ -443,24 +446,18 @@ void tst_ExceptionSafety_Objects::widgets_data() NEWROW(QStackedWidget); NEWROW(QStatusBar); NEWROW(QTabBar); + NEWROW(QTableView); + NEWROW(QTableWidget); NEWROW(QTabWidget); NEWROW(QTextBrowser); NEWROW(QTextEdit); NEWROW(QTimeEdit); + NEWROW(QToolBar); NEWROW(QToolBox); NEWROW(QToolButton); - NEWROW(QStatusBar); - NEWROW(QToolBar); - NEWROW(QMenuBar); - NEWROW(QMainWindow); - NEWROW(QWorkspace); - NEWROW(QColumnView); - NEWROW(QListView); - NEWROW(QListWidget); - NEWROW(QTableView); - NEWROW(QTableWidget); NEWROW(QTreeView); NEWROW(QTreeWidget); + NEWROW(QWorkspace); } void tst_ExceptionSafety_Objects::widgets() -- cgit v0.12 From da8f333cfe17a53d475208efa36fa369a9ee4638 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 18 Apr 2011 15:40:26 +0300 Subject: Do not modify window size for fullscreen windows in setGeometry_sys Minimum sizes of widgets can cause windows to expand beyond screen limits in QWidgetPrivate::setGeometry_sys. Normally this is not noticeable as the window size is forced in various places to the clientRect, but there are certain sequences where the size set in setGeometry_sys is the final one, resulting in too large windows. Removed the modification of window size in setGeometry_sys for fullscreen windows for which the correct size is already requested. Task-number: QTBUG-18749 Reviewed-by: Sami Merila --- src/gui/kernel/qwidget_s60.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 83e46e5..96b0776 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -239,7 +239,16 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) if (w != oldSize.width() || h != oldSize.height()) data.window_state &= ~Qt::WindowMaximized; - if (extra) { // any size restrictions? + bool checkExtra = true; + if (q->isWindow() && (data.window_state & Qt::WindowFullScreen)) { + // Do not modity window size for fullscreen windows, if requested + // size is already equal to clientRect. + TRect r = static_cast(S60->appUi())->ClientRect(); + if (w == r.Width() && h == r.Height()) + checkExtra = false; + } + + if (checkExtra && extra) { // any size restrictions? w = qMin(w,extra->maxw); h = qMin(h,extra->maxh); w = qMax(w,extra->minw); -- cgit v0.12 From 41aa023ef6019ac9745b780c953f48b8bbc42a42 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 18 Apr 2011 17:05:38 +0200 Subject: Create a cleanup stack for each new thread on Symbian. The native thread implementation in Qt 4.8 did not call CTrapCleanup::New() which resulted in E32USER-CBASE 69 panics in applications when they tried to use the cleanup stack in a thread's run() function. In 4.7 this was working because OpenC's pthread implementation created a CTrapCleanup automatically. Now we do it also in the native Symbian thread implementation. Trask-number: QTBUG-18822 Reviewed-by: Murray Read --- src/corelib/thread/qthread_symbian.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/thread/qthread_symbian.cpp b/src/corelib/thread/qthread_symbian.cpp index 1474b36..436c105 100644 --- a/src/corelib/thread/qthread_symbian.cpp +++ b/src/corelib/thread/qthread_symbian.cpp @@ -319,6 +319,8 @@ void *QThreadPrivate::start(void *arg) data->quitNow = thr->d_func()->exited; } + CTrapCleanup *cleanup = CTrapCleanup::New(); + // ### TODO: allow the user to create a custom event dispatcher createEventDispatcher(data); @@ -327,6 +329,8 @@ void *QThreadPrivate::start(void *arg) QThreadPrivate::finish(arg); + delete cleanup; + return 0; } -- cgit v0.12 From 6d35b8078607e648a19d863f3437edb7e238f0f4 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Fri, 15 Apr 2011 14:09:43 +0100 Subject: Allow a network configuration to be included in a proxy query When Qt is compiled with bearer management support, the network configuration can be included as a parameter in QNetworkProxyQuery. This allows QNetworkProxyFactory::systemProxyForQuery to get the right proxy setting for a specific network. For example a mobile phone could have network configurations for home WLAN, work WLAN and 3G data access points, each with different proxy configurations. Task-number: QTBUG-18618 Reviewed-by: Peter Hartmann --- src/network/kernel/qnetworkproxy.cpp | 98 ++++++++++++++++++++++++++++ src/network/kernel/qnetworkproxy.h | 16 +++++ src/network/kernel/qnetworkproxy_symbian.cpp | 13 ++-- 3 files changed, 123 insertions(+), 4 deletions(-) diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 68ff955..14db913 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -228,6 +228,10 @@ #include "qmutex.h" #include "qurl.h" +#ifndef QT_NO_BEARERMANAGEMENT +#include +#endif + QT_BEGIN_NAMESPACE class QSocks5SocketEngineHandler; @@ -716,6 +720,9 @@ public: QUrl remote; int localPort; QNetworkProxyQuery::QueryType type; +#ifndef QT_NO_BEARERMANAGEMENT + QNetworkConfiguration config; +#endif }; template<> void QSharedDataPointer::detach() @@ -777,6 +784,11 @@ template<> void QSharedDataPointer::detach() like choosing an caching HTTP proxy for HTTP-based connections, but a more powerful SOCKSv5 proxy for all others. + The network configuration specifies which configuration to use, + when bearer management is used. For example on a mobile phone + the proxy settings are likely to be different for the cellular + network vs WLAN. + Some of the criteria may not make sense in all of the types of query. The following table lists the criteria that are most commonly used, according to the type of query. @@ -902,6 +914,68 @@ QNetworkProxyQuery::QNetworkProxyQuery(quint16 bindPort, const QString &protocol d->type = queryType; } +#ifndef QT_NO_BEARERMANAGEMENT +/*! + Constructs a QNetworkProxyQuery with the URL \a requestUrl and + sets the query type to \a queryType. The specified \a networkConfiguration + is used to resolve the proxy settings. + + \sa protocolTag(), peerHostName(), peerPort(), networkConfiguration() +*/ +QNetworkProxyQuery::QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration, + const QUrl &requestUrl, QueryType queryType) +{ + d->config = networkConfiguration; + d->remote = requestUrl; + d->type = queryType; +} + +/*! + Constructs a QNetworkProxyQuery of type \a queryType and sets the + protocol tag to be \a protocolTag. This constructor is suitable + for QNetworkProxyQuery::TcpSocket queries, because it sets the + peer hostname to \a hostname and the peer's port number to \a + port. The specified \a networkConfiguration + is used to resolve the proxy settings. + + \sa networkConfiguration() +*/ +QNetworkProxyQuery::QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration, + const QString &hostname, int port, + const QString &protocolTag, + QueryType queryType) +{ + d->config = networkConfiguration; + d->remote.setScheme(protocolTag); + d->remote.setHost(hostname); + d->remote.setPort(port); + d->type = queryType; +} + +/*! + Constructs a QNetworkProxyQuery of type \a queryType and sets the + protocol tag to be \a protocolTag. This constructor is suitable + for QNetworkProxyQuery::TcpSocket queries because it sets the + local port number to \a bindPort. The specified \a networkConfiguration + is used to resolve the proxy settings. + + Note that \a bindPort is of type quint16 to indicate the exact + port number that is requested. The value of -1 (unknown) is not + allowed in this context. + + \sa localPort(), networkConfiguration() +*/ +QNetworkProxyQuery::QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration, + quint16 bindPort, const QString &protocolTag, + QueryType queryType) +{ + d->config = networkConfiguration; + d->remote.setScheme(protocolTag); + d->localPort = bindPort; + d->type = queryType; +} +#endif + /*! Constructs a QNetworkProxyQuery object that is a copy of \a other. */ @@ -1116,6 +1190,30 @@ void QNetworkProxyQuery::setUrl(const QUrl &url) d->remote = url; } +#ifndef QT_NO_BEARERMANAGEMENT +QNetworkConfiguration QNetworkProxyQuery::networkConfiguration() const +{ + return d ? d->config : QNetworkConfiguration(); +} + +/*! + Sets the network configuration component of this QNetworkProxyQuery + object to be \a networkConfiguration. The network configuration can + be used to return different proxy settings based on the network in + use, for example WLAN vs cellular networks on a mobile phone. + + In the case of "user choice" or "service network" configurations, + you should first start the QNetworkSession and obtain the active + configuration from its properties. + + \sa networkConfiguration +*/ +void QNetworkProxyQuery::setNetworkConfiguration(const QNetworkConfiguration &networkConfiguration) +{ + d->config = networkConfiguration; +} +#endif + /*! \class QNetworkProxyFactory \brief The QNetworkProxyFactory class provides fine-grained proxy selection. diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h index 26562d5..e16b29e 100644 --- a/src/network/kernel/qnetworkproxy.h +++ b/src/network/kernel/qnetworkproxy.h @@ -54,6 +54,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Network) class QUrl; +class QNetworkConfiguration; class QNetworkProxyQueryPrivate; class Q_NETWORK_EXPORT QNetworkProxyQuery @@ -73,6 +74,16 @@ public: QNetworkProxyQuery(quint16 bindPort, const QString &protocolTag = QString(), QueryType queryType = TcpServer); QNetworkProxyQuery(const QNetworkProxyQuery &other); +#ifndef QT_NO_BEARERMANAGEMENT + QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration, + const QUrl &requestUrl, QueryType queryType = UrlRequest); + QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration, + const QString &hostname, int port, const QString &protocolTag = QString(), + QueryType queryType = TcpSocket); + QNetworkProxyQuery(const QNetworkConfiguration &networkConfiguration, + quint16 bindPort, const QString &protocolTag = QString(), + QueryType queryType = TcpServer); +#endif ~QNetworkProxyQuery(); QNetworkProxyQuery &operator=(const QNetworkProxyQuery &other); bool operator==(const QNetworkProxyQuery &other) const; @@ -97,6 +108,11 @@ public: QUrl url() const; void setUrl(const QUrl &url); +#ifndef QT_NO_BEARERMANAGEMENT + QNetworkConfiguration networkConfiguration() const; + void setNetworkConfiguration(const QNetworkConfiguration &networkConfiguration); +#endif + private: QSharedDataPointer d; }; diff --git a/src/network/kernel/qnetworkproxy_symbian.cpp b/src/network/kernel/qnetworkproxy_symbian.cpp index 79dfb27..4ba14c0 100644 --- a/src/network/kernel/qnetworkproxy_symbian.cpp +++ b/src/network/kernel/qnetworkproxy_symbian.cpp @@ -58,6 +58,7 @@ #include // CCDIAPRecord, CCDProxiesRecord #include // KCDTIdIAPRecord, KCDTIdProxiesRecord #include +#include #include using namespace CommsDat; @@ -88,7 +89,7 @@ class SymbianProxyQuery { public: static QNetworkConfiguration findCurrentConfiguration(QNetworkConfigurationManager& configurationManager); - static SymbianIapId getIapId(QNetworkConfigurationManager& configurationManager); + static SymbianIapId getIapId(QNetworkConfigurationManager &configurationManager, const QNetworkProxyQuery &query); static CCDIAPRecord *getIapRecordLC(TUint32 aIAPId, CMDBSession &aDb); static CMDBRecordSet *prepareQueryLC(TUint32 serviceId, TDesC& serviceType); static QList proxyQueryL(TUint32 aIAPId, const QNetworkProxyQuery &query); @@ -137,11 +138,15 @@ QNetworkConfiguration SymbianProxyQuery::findCurrentConfiguration(QNetworkConfig return currentConfig; } -SymbianIapId SymbianProxyQuery::getIapId(QNetworkConfigurationManager& configurationManager) +SymbianIapId SymbianProxyQuery::getIapId(QNetworkConfigurationManager& configurationManager, const QNetworkProxyQuery &query) { SymbianIapId iapId; - QNetworkConfiguration currentConfig = findCurrentConfiguration(configurationManager); + QNetworkConfiguration currentConfig = query.networkConfiguration(); + if (!currentConfig.isValid()) { + //If config is not specified, then try to find out an active or default one + currentConfig = findCurrentConfiguration(configurationManager); + } if (currentConfig.isValid()) { // Note: the following code assumes that the identifier is in format // I_xxxx where xxxx is the identifier of IAP. This is meant as a @@ -249,7 +254,7 @@ QList QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro SymbianIapId iapId; TInt error; QNetworkConfigurationManager manager; - iapId = SymbianProxyQuery::getIapId(manager); + iapId = SymbianProxyQuery::getIapId(manager, query); if (iapId.isValid()) { TRAP(error, proxies = SymbianProxyQuery::proxyQueryL(iapId.iapId(), query)) if (error != KErrNone) { -- cgit v0.12 From c3ee4c09dc90d09b729ec70b2ebc27136bd2da2e Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 18 Apr 2011 15:23:33 +0100 Subject: Enable per network configuration proxy settings in QNetworkAccessManager Delayed the resolving of the proxy until the backend is being started. This is because the proxy settings are not known until after QNetworkAccessManager has brought the network online using QNetworkSession. On Nokia's symbian3 phones, the default network configuration is a service network containing a list of access points in priority order. For a typical user, this will include one or more WLAN networks and a cellular network - each of which can have different proxy settings. Task-number: QTBUG-18618 Reviewed-by: Peter Hartmann --- src/network/access/qnetworkaccessbackend.cpp | 76 +++++++++++++++++++--------- src/network/access/qnetworkaccessmanager.cpp | 4 -- 2 files changed, 53 insertions(+), 27 deletions(-) diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 6220abe..2aea350 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -41,6 +41,7 @@ #include "qnetworkaccessbackend_p.h" #include "qnetworkaccessmanager_p.h" +#include "qnetworkconfigmanager.h" #include "qnetworkrequest.h" #include "qnetworkreply.h" #include "qnetworkreply_p.h" @@ -343,8 +344,6 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) #endif } -#ifndef QT_NO_BEARERMANAGEMENT - /*! Starts the backend. Returns true if the backend is started. Returns false if the backend could not be started due to an unopened or roaming session. The caller should recall this @@ -352,31 +351,62 @@ void QNetworkAccessBackend::sslErrors(const QList &errors) */ bool QNetworkAccessBackend::start() { - if (!manager->networkSession) { - open(); - return true; - } - - // This is not ideal. - const QString host = reply->url.host(); - if (host == QLatin1String("localhost") || - QHostAddress(host) == QHostAddress::LocalHost || - QHostAddress(host) == QHostAddress::LocalHostIPv6) { - // Don't need an open session for localhost access. - open(); - return true; +#ifndef QT_NO_BEARERMANAGEMENT + // For bearer, check if session start is required + if (manager->networkSession) { + // session required + if (manager->networkSession->isOpen() && + manager->networkSession->state() == QNetworkSession::Connected) { + // Session is already open and ready to use. + // copy network session down to the backend + setProperty("_q_networksession", QVariant::fromValue(manager->networkSession)); + } else { + // Session not ready, but can skip for loopback connections + + // This is not ideal. + const QString host = reply->url.host(); + + if (host == QLatin1String("localhost") || + QHostAddress(host) == QHostAddress::LocalHost || + QHostAddress(host) == QHostAddress::LocalHostIPv6) { + // Don't need an open session for localhost access. + } else { + // need to wait for session to be opened + return false; + } + } } +#endif - if (manager->networkSession->isOpen() && - manager->networkSession->state() == QNetworkSession::Connected) { - //copy network session down to the backend - setProperty("_q_networksession", QVariant::fromValue(manager->networkSession)); - open(); - return true; +#ifndef QT_NO_NETWORKPROXY +#ifndef QT_NO_BEARERMANAGEMENT + // Get the proxy settings from the network session (in the case of service networks, + // the proxy settings change depending which AP was activated) + QNetworkSession *session = manager->networkSession.data(); + QNetworkConfiguration config; + if (session) { + QNetworkConfigurationManager configManager; + // The active configuration tells us what IAP is in use + QVariant v = session->sessionProperty(QLatin1String("ActiveConfiguration")); + if (v.isValid()) + config = configManager.configurationFromIdentifier(qvariant_cast(v)); + // Fallback to using the configuration if no active configuration + if (!config.isValid()) + config = session->configuration(); + // or unspecified configuration if that is no good either + if (!config.isValid()) + config = QNetworkConfiguration(); } + reply->proxyList = manager->queryProxy(QNetworkProxyQuery(config, url())); +#else // QT_NO_BEARERMANAGEMENT + // Without bearer management, the proxy depends only on the url + reply->proxyList = manager->queryProxy(QNetworkProxyQuery(url())); +#endif +#endif - return false; + // now start the request + open(); + return true; } -#endif QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 5a7521e..ba0fe7b 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -986,10 +986,6 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // third step: find a backend priv->backend = d->findBackend(op, request); -#ifndef QT_NO_NETWORKPROXY - QList proxyList = d->queryProxy(QNetworkProxyQuery(request.url())); - priv->proxyList = proxyList; -#endif if (priv->backend) { priv->backend->setParent(reply); priv->backend->reply = priv; -- cgit v0.12 From 445e70499dde512b5c957721b53ac22f0df72ee7 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 18 Apr 2011 15:30:39 +0100 Subject: Fix QNetworkReplyImpl error handling The backend was never started when compiled without bearer management, now it is. Now emits the error signal in case of startup errors which would leave the state machine hanging. Previously it just printed a warning. Reviewed-by: Peter Hartmann --- src/network/access/qnetworkreplyimpl.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 9eb505d..34fd7a7 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -90,10 +90,10 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } + if (!backend->start()) { #ifndef QT_NO_BEARERMANAGEMENT - if (!backend->start()) { // ### we should call that method even if bearer is not used // backend failed to start because the session state is not Connected. - // QNetworkAccessManager will call reply->backend->start() again for us when the session + // QNetworkAccessManager will call _q_startOperation again for us when the session // state changes. state = WaitingForSession; @@ -109,11 +109,20 @@ void QNetworkReplyImplPrivate::_q_startOperation() session->open(); } else { qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); + state = Working; + error(QNetworkReplyImpl::UnknownNetworkError, + QCoreApplication::translate("QNetworkReply", "Network session error.")); + finished(); } - +#else + qWarning("Backend start failed"); + state = Working; + error(QNetworkReplyImpl::UnknownNetworkError, + QCoreApplication::translate("QNetworkReply", "backend start error.")); + finished(); +#endif return; } -#endif if (backend && backend->isSynchronous()) { state = Finished; -- cgit v0.12 From 06c3a3a34ab908c517cfcb6900a79f68f1f31ae2 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Mon, 18 Apr 2011 15:46:19 +0100 Subject: Add autotests for configuration dependent network proxies 1. test that systemProxyForQuery returns something for all configs 2. test that QNetworkAccessManager uses the settings for the configuration it was started with. Task-number: QTBUG-18618 Reviewed-by: Peter Hartmann --- .../qnetworkproxyfactory/qnetworkproxyfactory.pro | 2 +- .../tst_qnetworkproxyfactory.cpp | 144 +++++++++++++++++++++ 2 files changed, 145 insertions(+), 1 deletion(-) diff --git a/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro b/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro index f05c423..17ad403 100644 --- a/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro +++ b/tests/auto/qnetworkproxyfactory/qnetworkproxyfactory.pro @@ -7,5 +7,5 @@ QT = core network SOURCES += tst_qnetworkproxyfactory.cpp -symbian: TARGET.CAPABILITY = NetworkServices +symbian: TARGET.CAPABILITY = NetworkServices ReadUserData diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp index 2baee27..82a4193 100644 --- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp +++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp @@ -41,20 +41,60 @@ #include +#include #include #include #include +#include +#include +#include +#include +#include +#include +#include + +Q_DECLARE_METATYPE(QNetworkConfiguration); +Q_DECLARE_METATYPE(QList); class tst_QNetworkProxyFactory : public QObject { Q_OBJECT + +public: + tst_QNetworkProxyFactory(); + + class QDebugProxyFactory : public QNetworkProxyFactory + { + public: + virtual QList queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) + { + returnedList = QNetworkProxyFactory::systemProxyForQuery(query); + requestCounter++; + return returnedList; + } + QList returnedList; + int requestCounter; + }; + private slots: void systemProxyForQuery() const; +#ifndef QT_NO_BEARERMANAGEMENT + void fromConfigurations(); + void inNetworkAccessManager_data(); + void inNetworkAccessManager(); +#endif private: QString formatProxyName(const QNetworkProxy & proxy) const; + QDebugProxyFactory *factory; }; +tst_QNetworkProxyFactory::tst_QNetworkProxyFactory() +{ + factory = new QDebugProxyFactory; + QNetworkProxyFactory::setApplicationProxyFactory(factory); +} + QString tst_QNetworkProxyFactory::formatProxyName(const QNetworkProxy & proxy) const { QString proxyName; @@ -96,5 +136,109 @@ void tst_QNetworkProxyFactory::systemProxyForQuery() const QFAIL("One or more system proxy lookup failures occurred."); } +#ifndef QT_NO_BEARERMANAGEMENT + +//Purpose of this test is just to check systemProxyForQuery doesn't hang or crash +//with any given configuration including no configuration. +//We can't test it returns the right proxies without implementing the native proxy code +//again here, which would be testing our implementation against itself. +//Therefore it's just testing that something valid is returned (at least a NoProxy entry) +void tst_QNetworkProxyFactory::fromConfigurations() +{ + QNetworkConfigurationManager manager; + QList proxies; + QUrl url(QLatin1String("http://qt.nokia.com")); + //get from known configurations + foreach (QNetworkConfiguration config, manager.allConfigurations()) { + QNetworkProxyQuery query(config, url, QNetworkProxyQuery::UrlRequest); + proxies = QNetworkProxyFactory::systemProxyForQuery(query); + QVERIFY(!proxies.isEmpty()); + foreach (QNetworkProxy proxy, proxies) { + qDebug() << config.name() << " - " << config.identifier() << " - " << formatProxyName(proxy); + } + } + + //get from default configuration + QNetworkProxyQuery defaultquery(url, QNetworkProxyQuery::UrlRequest); + proxies = QNetworkProxyFactory::systemProxyForQuery(defaultquery); + QVERIFY(!proxies.isEmpty()); + foreach (QNetworkProxy proxy, proxies) { + qDebug() << "default - " << formatProxyName(proxy); + } + + //get from active configuration + QNetworkSession session(manager.defaultConfiguration()); + session.open(); + QVERIFY(session.waitForOpened(30000)); + proxies = QNetworkProxyFactory::systemProxyForQuery(defaultquery); + QVERIFY(!proxies.isEmpty()); + foreach (QNetworkProxy proxy, proxies) { + qDebug() << "active - " << formatProxyName(proxy); + } + + //get from known configurations while there is one active + foreach (QNetworkConfiguration config, manager.allConfigurations()) { + QNetworkProxyQuery query(config, url, QNetworkProxyQuery::UrlRequest); + proxies = QNetworkProxyFactory::systemProxyForQuery(query); + QVERIFY(!proxies.isEmpty()); + foreach (QNetworkProxy proxy, proxies) { + qDebug() << config.name() << " - " << config.identifier() << " - " << formatProxyName(proxy); + } + } +} + +void tst_QNetworkProxyFactory::inNetworkAccessManager_data() +{ + QTest::addColumn("config"); + QTest::addColumn >("proxies"); + QNetworkConfigurationManager manager; + //get from known configurations + foreach (QNetworkConfiguration config, manager.allConfigurations()) { + QNetworkProxyQuery query(config, QUrl(QString("http://qt.nokia.com")), QNetworkProxyQuery::UrlRequest); + QList proxies = QNetworkProxyFactory::systemProxyForQuery(query); + QTest::newRow(config.name().toUtf8()) << config << proxies; + } +} + +//Purpose of this test is to check that QNetworkAccessManager uses the proxy from the configuration it +//has been given. Needs two or more working configurations to be a good test. +void tst_QNetworkProxyFactory::inNetworkAccessManager() +{ + QFETCH(QNetworkConfiguration, config); + QFETCH(QList, proxies); + + int count = factory->requestCounter; + + QNetworkAccessManager manager; + manager.setConfiguration(config); + + //using an internet server, because cellular APs won't have a route to the test server. + QNetworkRequest req(QUrl(QString("http://qt.nokia.com"))); + QNetworkReply *reply = manager.get(req); + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(30); + delete reply; + + if (count == factory->requestCounter) { + //RND phones are preconfigured with several test access points which won't work without a matching SIM + //If the network fails to start, QNAM won't ask the factory for proxies so we can't test. + QSKIP("network configuration didn't start", SkipSingle); + } + + qDebug() << "testing network configuration for" << config.name(); + foreach (QNetworkProxy proxy, factory->returnedList) { + qDebug() << formatProxyName(proxy); + } + qDebug() << " "; + foreach (QNetworkProxy proxy, proxies) { + qDebug() << formatProxyName(proxy); + } + if (config.type() != QNetworkConfiguration::InternetAccessPoint) + QEXPECT_FAIL("","QNetworkProxyFactory::systemProxyForQuery doesn't work for service networks yet", Continue); + QCOMPARE(factory->returnedList, proxies); +} + +#endif //QT_NO_BEARERMANAGEMENT + QTEST_MAIN(tst_QNetworkProxyFactory) #include "tst_qnetworkproxyfactory.moc" -- cgit v0.12 From ed5dd84582881bc30a5ce85902b37aae9c243978 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 12:05:59 +1000 Subject: Remove Q_ASSERT calls from gestures autotest Make the test report a useful warning, rather than terminating with an unintelligible assertion failure, if the GestureState enum is ever extended. Change-Id: Ib876a5f2986cbea4e181678a83a72e0d1444f1ee Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/gestures/tst_gestures.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 7327a49..bff8a04 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -280,7 +280,7 @@ protected: eventsPtr->canceled << g->gestureType(); break; default: - Q_ASSERT(false); + qWarning() << "Unknown GestureState enum value:" << static_cast(g->state()); } } } else if (event->type() == CustomEvent::EventType) { @@ -823,7 +823,7 @@ public: emit gestureCanceled(e->type(), g); break; default: - Q_ASSERT(false); + qWarning() << "Unknown GestureState enum value:" << static_cast(g->state()); } } } else if (event->type() == CustomEvent::EventType) { -- cgit v0.12 From 1191dc0c278ddd22556d6c8e5ea5a898fa7b35f6 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 13:39:35 +1000 Subject: Remove unused functions. Change-Id: I8cae0550c58238bd99bc759c21b022c54fe2de8b Reviewed-by: Trust Me --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 8d9603b..8e68363 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -374,18 +374,6 @@ QAccessible::State state(QWidget * const widget) return state; } -void printState(QWidget * const widget) -{ - qDebug() << "State for" << widget->metaObject()->className() << stateNames(state(widget)); -} - -void printState(QAccessibleInterface * const iface, const int child = 0) -{ - qDebug() << "State for" << iface->object()->metaObject()->className() << "child" << child - << iface->text(QAccessible::Name, child) << stateNames(iface->state(child)); -} - - class QtTestAccessibleWidget: public QWidget { Q_OBJECT -- cgit v0.12 From d8dc5bfdff25d72e8276c6e80080d72315abe7e0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 13:55:05 +1000 Subject: Remove Q_ASSERT from accessibility autotest Instead of crashing when we can't get a QAccessibleInterface for a widget, output a useful warning and return a value that makes the test fail gracefully. Change-Id: I0b292cdd8f5a59e26bdc9b0b67cea2b58591df7d Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 8e68363..fe0200a 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -368,8 +368,9 @@ static QString stateNames(int state) QAccessible::State state(QWidget * const widget) { QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); - Q_ASSERT(iface); - QAccessible::State state = iface->state(0); + if (!iface) + qWarning() << "Cannot get QAccessibleInterface for widget"; + QAccessible::State state = (iface ? iface->state(0) : static_cast(0)); delete iface; return state; } -- cgit v0.12 From 1a98c473fbcbb6a9edf1b7e42babbad7d901edb4 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 14:09:44 +1000 Subject: Remove unused function. Change-Id: I197ca88e04a68dca0ea819d6e335a02607e597aa Reviewed-by: Trust Me --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 42 ------------------------ 1 file changed, 42 deletions(-) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index fe0200a..35c9e4d 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -323,48 +323,6 @@ QString eventName(const int ev) } } -static QString stateNames(int state) -{ - QString stateString; - if (state == 0x00000000) stateString += " Normal"; - if (state & 0x00000001) stateString += " Unavailable"; - if (state & 0x00000002) stateString += " Selected"; - if (state & 0x00000004) stateString += " Focused"; - if (state & 0x00000008) stateString += " Pressed"; - if (state & 0x00000010) stateString += " Checked"; - if (state & 0x00000020) stateString += " Mixed"; - if (state & 0x00000040) stateString += " ReadOnly"; - if (state & 0x00000080) stateString += " HotTracked"; - if (state & 0x00000100) stateString += " DefaultButton"; - if (state & 0x00000200) stateString += " Expanded"; - if (state & 0x00000400) stateString += " Collapsed"; - if (state & 0x00000800) stateString += " Busy"; - if (state & 0x00001000) stateString += " Floating"; - if (state & 0x00002000) stateString += " Marqueed"; - if (state & 0x00004000) stateString += " Animated"; - if (state & 0x00008000) stateString += " Invisible"; - if (state & 0x00010000) stateString += " Offscreen"; - if (state & 0x00020000) stateString += " Sizeable"; - if (state & 0x00040000) stateString += " Moveable"; - if (state & 0x00080000) stateString += " SelfVoicing"; - if (state & 0x00100000) stateString += " Focusable"; - if (state & 0x00200000) stateString += " Selectable"; - if (state & 0x00400000) stateString += " Linked"; - if (state & 0x00800000) stateString += " Traversed"; - if (state & 0x01000000) stateString += " MultiSelectable"; - if (state & 0x02000000) stateString += " ExtSelectable"; - if (state & 0x04000000) stateString += " AlertLow"; - if (state & 0x08000000) stateString += " AlertMedium"; - if (state & 0x10000000) stateString += " AlertHigh"; - if (state & 0x20000000) stateString += " Protected"; - if (state & 0x3fffffff) stateString += " Valid"; - - if (stateString.isEmpty()) - stateString = "Unknown state " + QString::number(state); - - return stateString; -} - QAccessible::State state(QWidget * const widget) { QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); -- cgit v0.12 From cf911bc0d297ed30e615fd115b0d3ae574cb2412 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 15:31:09 +1000 Subject: If accessibility isn't built, don't try to test it Only build the autotest when the feature to be tested is in the Qt build. This is better than building and running an empty test. Change-Id: I67721f5f48296afcca64f761d12325f8e040f2d8 Reviewed-by: Rohan McGovern --- tests/auto/other.pro | 3 +- tests/auto/qaccessibility/qaccessibility.pro | 3 +- tests/auto/qaccessibility/tst_qaccessibility.cpp | 219 +---------------------- 3 files changed, 8 insertions(+), 217 deletions(-) diff --git a/tests/auto/other.pro b/tests/auto/other.pro index 89f9e53..655d666 100644 --- a/tests/auto/other.pro +++ b/tests/auto/other.pro @@ -5,7 +5,6 @@ TEMPLATE=subdirs SUBDIRS=\ # baselineexample \ Just an example demonstrating qbaselinetest usage lancelot \ - qaccessibility \ qalgorithms \ qcombobox \ qcssparser \ @@ -36,6 +35,8 @@ SUBDIRS=\ windowsmobile \ nativeimagehandleprovider +contains(QT_CONFIG, accessibility):SUBDIRS += qaccessibility + contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter mac: { SUBDIRS += macgui \ diff --git a/tests/auto/qaccessibility/qaccessibility.pro b/tests/auto/qaccessibility/qaccessibility.pro index a4f606c..71d6f95 100644 --- a/tests/auto/qaccessibility/qaccessibility.pro +++ b/tests/auto/qaccessibility/qaccessibility.pro @@ -1,4 +1,5 @@ load(qttest_p4) +requires(contains(QT_CONFIG,accessibility)) SOURCES += tst_qaccessibility.cpp unix:!mac:LIBS+=-lm @@ -8,4 +9,4 @@ wince*: { accessneeded.files = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll accessneeded.path = accessible DEPLOYMENT += accessneeded -} \ No newline at end of file +} diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 35c9e4d..888f449 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -347,7 +347,6 @@ public: } }; -#ifdef QTEST_ACCESSIBILITY class QtTestAccessibleWidgetIface: public QAccessibleWidget { public: @@ -365,7 +364,6 @@ public: return 0; } }; -#endif tst_QAccessibility::tst_QAccessibility() { @@ -377,17 +375,13 @@ tst_QAccessibility::~tst_QAccessibility() void tst_QAccessibility::initTestCase() { -#ifdef QTEST_ACCESSIBILITY QTestAccessibility::initialize(); QAccessible::installFactory(QtTestAccessibleWidgetIface::ifaceFactory); -#endif } void tst_QAccessibility::cleanupTestCase() { -#ifdef QTEST_ACCESSIBILITY QTestAccessibility::cleanup(); -#endif } void tst_QAccessibility::init() @@ -397,7 +391,6 @@ void tst_QAccessibility::init() void tst_QAccessibility::cleanup() { -#ifdef QTEST_ACCESSIBILITY const EventList list = QTestAccessibility::events(); if (!list.isEmpty()) { qWarning("%d accessibility event(s) were not handled in testfunction '%s':", list.count(), @@ -407,14 +400,10 @@ void tst_QAccessibility::cleanup() eventName(list.at(i).event).toAscii().constData(), list.at(i).event, list.at(i).child); } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::eventTest() { -#ifdef QTEST_ACCESSIBILITY QPushButton* button = new QPushButton(0); button->setObjectName(QString("Olaf")); @@ -430,14 +419,10 @@ void tst_QAccessibility::eventTest() QVERIFY_EVENT(button, 0, QAccessible::ObjectHide); delete button; -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::customWidget() { -#ifdef QTEST_ACCESSIBILITY QtTestAccessibleWidget* widget = new QtTestAccessibleWidget(0, "Heinz"); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); @@ -449,14 +434,10 @@ void tst_QAccessibility::customWidget() delete iface; delete widget; -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::deletedWidget() { -#ifdef QTEST_ACCESSIBILITY QtTestAccessibleWidget *widget = new QtTestAccessibleWidget(0, "Ralf"); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(widget); QVERIFY(iface != 0); @@ -467,9 +448,6 @@ void tst_QAccessibility::deletedWidget() widget = 0; QVERIFY(!iface->isValid()); delete iface; -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } QWidget *tst_QAccessibility::createGUI() @@ -478,7 +456,6 @@ QWidget *tst_QAccessibility::createGUI() qWarning( "Should never get here without Qt3Support"); return 0; #else -# ifdef QTEST_ACCESSIBILITY QWidget *toplevel = new QWidget(0, Qt::X11BypassWindowManagerHint); QGridLayout *grid = new QGridLayout(toplevel, 2, 2); @@ -550,10 +527,6 @@ QWidget *tst_QAccessibility::createGUI() radioAM->setFocus(); QTestAccessibility::clearEvents(); return toplevel; -# else - Q_ASSERT(0); // this function cannot be called without accessibility support - return 0; -# endif #endif // !QT3_SUPPORT } @@ -562,7 +535,6 @@ void tst_QAccessibility::childAt() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); QAccessibleInterface *acc_toplevel = QAccessible::queryAccessibleInterface(toplevel); QVERIFY(acc_toplevel); @@ -594,9 +566,6 @@ void tst_QAccessibility::childAt() delete acc_toplevel; delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -605,7 +574,6 @@ void tst_QAccessibility::childCount() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); QObject *topLeft = toplevel->child("topLeft"); QObject *topRight = toplevel->child("topRight"); @@ -638,9 +606,6 @@ void tst_QAccessibility::childCount() delete acc_bottomRight; delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -649,7 +614,6 @@ void tst_QAccessibility::relationTo() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); toplevel->resize(400,300); QObject *topLeft = toplevel->child("topLeft"); @@ -855,15 +819,11 @@ void tst_QAccessibility::relationTo() delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } void tst_QAccessibility::navigateGeometric() { -#ifdef QTEST_ACCESSIBILITY { static const int skip = 20; //speed the test up significantly static const double step = Q_PI / 180; @@ -959,14 +919,10 @@ void tst_QAccessibility::navigateGeometric() delete w; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::navigateSlider() { -#ifdef QTEST_ACCESSIBILITY { QSlider *slider = new QSlider(0); slider->setObjectName(QString("Slidy")); @@ -993,14 +949,10 @@ void tst_QAccessibility::navigateSlider() delete slider; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::navigateCovered() { -#ifdef QTEST_ACCESSIBILITY { QWidget *w = new QWidget(0); w->setObjectName(QString("Harry")); @@ -1103,14 +1055,10 @@ void tst_QAccessibility::navigateCovered() delete w; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::navigateHierarchy() { -#ifdef QTEST_ACCESSIBILITY { QWidget *w = new QWidget(0); w->setObjectName(QString("Hans")); @@ -1206,9 +1154,6 @@ void tst_QAccessibility::navigateHierarchy() delete w; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } #define QSETCOMPARE(thetypename, elements, otherelements) \ @@ -1219,7 +1164,6 @@ void tst_QAccessibility::navigateControllers() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY { Q3VBox vbox; QSlider slider(&vbox); @@ -1302,9 +1246,6 @@ void tst_QAccessibility::navigateControllers() delete acc_slider; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -1313,7 +1254,6 @@ void tst_QAccessibility::navigateLabels() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY { Q3VBox vbox; Q3HBox hbox(&vbox); @@ -1435,9 +1375,6 @@ void tst_QAccessibility::navigateLabels() delete acc_lineedit3; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -1489,7 +1426,6 @@ static QWidget *createWidgets() void tst_QAccessibility::accessibleName() { -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createWidgets(); toplevel->show(); #if defined(Q_WS_X11) @@ -1514,9 +1450,6 @@ void tst_QAccessibility::accessibleName() delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::text() @@ -1524,7 +1457,6 @@ void tst_QAccessibility::text() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); toplevel->show(); #if defined(Q_WS_X11) @@ -1620,10 +1552,6 @@ void tst_QAccessibility::text() delete toplevel; QTestAccessibility::clearEvents(); - -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // !QT3_SUPPORT } @@ -1632,7 +1560,6 @@ void tst_QAccessibility::setText() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QWidget *toplevel = createGUI(); toplevel->show(); QObject *bottomLeft = toplevel->findChild("bottomLeft"); @@ -1656,16 +1583,11 @@ void tst_QAccessibility::setText() delete acc_lineedit; delete toplevel; QTestAccessibility::clearEvents(); - -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif //QT3_SUPPORT } void tst_QAccessibility::hideShowTest() { -#ifdef QTEST_ACCESSIBILITY QWidget * const window = new QWidget(); QWidget * const child = new QWidget(window); @@ -1692,14 +1614,10 @@ void tst_QAccessibility::hideShowTest() delete window; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::userActionCount() { -#ifdef QTEST_ACCESSIBILITY QWidget widget; QAccessibleInterface *test = QAccessible::queryAccessibleInterface(&widget); @@ -1729,14 +1647,10 @@ void tst_QAccessibility::userActionCount() QCOMPARE(test->userActionCount(1), 0); QCOMPARE(test->userActionCount(-1), 0); delete test; test = 0; -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::actionText() { -#ifdef QTEST_ACCESSIBILITY QWidget widget; widget.show(); @@ -1753,24 +1667,15 @@ void tst_QAccessibility::actionText() QCOMPARE(test->actionText(QAccessible::SetFocus, QAccessible::Name, 0), QString("SetFocus")); delete test; test = 0; - -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::doAction() { -#ifdef QTEST_ACCESSIBILITY QSKIP("TODO: Implement me", SkipAll); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::buttonTest() { -//#ifdef QTEST_ACCESSIBILITY #if 0 QAccessibleInterface *test = 0; Q3VBox vbox; @@ -1949,9 +1854,7 @@ void tst_QAccessibility::buttonTest() test->release(); QTestAccessibility::clearEvents(); - #else -// QSKIP("Test needs accessibility support.", SkipAll); QSKIP("No action interface in Qt 4 yet.", SkipAll); #endif } @@ -1961,7 +1864,6 @@ void tst_QAccessibility::sliderTest() #if !defined(QT3_SUPPORT) QSKIP("This test needs Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY QAccessibleInterface *test = 0; Q3VBox vbox; QLabel labelHorizontal("Horizontal", &vbox); @@ -1990,7 +1892,7 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->text(QAccessible::Value, 1), QString()); QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal.value())); QCOMPARE(test->text(QAccessible::Value, 3), QString()); -// Skip acton tests. +// Skip action tests. #if 0 QCOMPARE(test->defaultAction(0), QAccessible::SetFocus); QCOMPARE(test->defaultAction(1), QAccessible::Press); @@ -2037,7 +1939,7 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->text(QAccessible::Value, 1), QString()); QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical.value())); QCOMPARE(test->text(QAccessible::Value, 3), QString()); -// Skip acton tests. +// Skip action tests. #if 0 QCOMPARE(test->defaultAction(0), QAccessible::SetFocus); QCOMPARE(test->defaultAction(1), QAccessible::Press); @@ -2148,17 +2050,12 @@ void tst_QAccessibility::sliderTest() delete sliderInterface; } - QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif //!QT3_SUPPORT } void tst_QAccessibility::scrollBarTest() { -#ifdef QTEST_ACCESSIBILITY // Test that when we hide() a slider, the PageLeft, Indicator, and PageRight also gets the // Invisible state bit set. enum SubControls { LineUp = 1, @@ -2166,7 +2063,7 @@ void tst_QAccessibility::scrollBarTest() Position = 3, PageDown = 4, LineDown = 5 - }; + }; QScrollBar *scrollBar = new QScrollBar(); QAccessibleInterface * const scrollBarInterface = QAccessible::queryAccessibleInterface(scrollBar); @@ -2248,15 +2145,10 @@ void tst_QAccessibility::scrollBarTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif - } void tst_QAccessibility::tabTest() { -#ifdef QTEST_ACCESSIBILITY QTabBar *tabBar = new QTabBar(); tabBar->show(); @@ -2292,14 +2184,10 @@ void tst_QAccessibility::tabTest() delete tabBar; delete interface; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::menuTest() { -#ifdef QTEST_ACCESSIBILITY { QMainWindow mw; mw.resize(300, 200); @@ -2545,14 +2433,10 @@ void tst_QAccessibility::menuTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); -#endif } void tst_QAccessibility::spinBoxTest() { -#ifdef QTEST_ACCESSIBILITY QSpinBox * const spinBox = new QSpinBox(); spinBox->show(); @@ -2579,14 +2463,10 @@ void tst_QAccessibility::spinBoxTest() QVERIFY(events.contains(expectedEvent)); delete spinBox; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::doubleSpinBoxTest() { -#ifdef QTEST_ACCESSIBILITY QDoubleSpinBox *doubleSpinBox = new QDoubleSpinBox; doubleSpinBox->show(); @@ -2606,14 +2486,10 @@ void tst_QAccessibility::doubleSpinBoxTest() delete doubleSpinBox; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::textEditTest() { -#ifdef QTEST_ACCESSIBILITY { QTextEdit edit; QString text = "hello world\nhow are you today?\n"; @@ -2628,14 +2504,10 @@ void tst_QAccessibility::textEditTest() QCOMPARE(iface->text(QAccessible::Value, 6), QString()); } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::textBrowserTest() { -#ifdef QTEST_ACCESSIBILITY { QTextBrowser textBrowser; QString text = QLatin1String("Hello world\nhow are you today?\n"); @@ -2652,14 +2524,10 @@ void tst_QAccessibility::textBrowserTest() QCOMPARE(interface->text(QAccessible::Value, 6), QString()); } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::listViewTest() { -#if 1 //def QTEST_ACCESSIBILITY { QListView listView; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&listView); @@ -2725,15 +2593,11 @@ void tst_QAccessibility::listViewTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::mdiAreaTest() { -#ifdef QTEST_ACCESSIBILITY { QMdiArea mdiArea; mdiArea.resize(400,300); @@ -2782,14 +2646,10 @@ void tst_QAccessibility::mdiAreaTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::mdiSubWindowTest() { -#ifdef QTEST_ACCESSIBILITY { QMdiArea mdiArea; mdiArea.show(); @@ -2912,14 +2772,10 @@ void tst_QAccessibility::mdiSubWindowTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::lineEditTest() { -#ifdef QTEST_ACCESSIBILITY QLineEdit *le = new QLineEdit; QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(le); QVERIFY(iface); @@ -2977,14 +2833,10 @@ void tst_QAccessibility::lineEditTest() delete le2; delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::workspaceTest() { -#ifdef QTEST_ACCESSIBILITY { QWorkspace workspace; workspace.resize(400,300); @@ -3038,14 +2890,10 @@ void tst_QAccessibility::workspaceTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::dialogButtonBoxTest() { -#ifdef QTEST_ACCESSIBILITY { QDialogButtonBox box(QDialogButtonBox::Reset | QDialogButtonBox::Help | @@ -3158,14 +3006,10 @@ void tst_QAccessibility::dialogButtonBoxTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::dialTest() { -#ifdef QTEST_ACCESSIBILITY { QDial dial; dial.setValue(20); @@ -3207,28 +3051,20 @@ void tst_QAccessibility::dialTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::rubberBandTest() { -#ifdef QTEST_ACCESSIBILITY QRubberBand rubberBand(QRubberBand::Rectangle); QAccessibleInterface *interface = QAccessible::queryAccessibleInterface(&rubberBand); QVERIFY(interface); QCOMPARE(interface->role(0), QAccessible::Border); delete interface; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::abstractScrollAreaTest() { -#ifdef QTEST_ACCESSIBILITY { QAbstractScrollArea abstractScrollArea; @@ -3386,14 +3222,10 @@ void tst_QAccessibility::abstractScrollAreaTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::scrollAreaTest() { -#ifdef QTEST_ACCESSIBILITY { QScrollArea scrollArea; scrollArea.show(); @@ -3407,14 +3239,10 @@ void tst_QAccessibility::scrollAreaTest() delete interface; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::tableWidgetTest() { -#ifdef QTEST_ACCESSIBILITY { QWidget *topLevel = new QWidget; QTableWidget *w = new QTableWidget(8,4,topLevel); @@ -3454,10 +3282,6 @@ void tst_QAccessibility::tableWidgetTest() delete topLevel; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif - } class QtTestTableModel: public QAbstractTableModel @@ -3540,7 +3364,6 @@ public: void tst_QAccessibility::tableViewTest() { -#ifdef QTEST_ACCESSIBILITY { QtTestTableModel *model = new QtTestTableModel(3, 4); QTableView *w = new QTableView(); @@ -3620,15 +3443,11 @@ void tst_QAccessibility::tableViewTest() delete model; } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::calendarWidgetTest() { #ifndef QT_NO_CALENDARWIDGET -#ifdef QTEST_ACCESSIBILITY { QCalendarWidget calendarWidget; @@ -3721,17 +3540,12 @@ void tst_QAccessibility::calendarWidgetTest() } QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // QT_NO_CALENDARWIDGET } void tst_QAccessibility::dockWidgetTest() { #ifndef QT_NO_DOCKWIDGET - -#ifdef QTEST_ACCESSIBILITY // Set up a proper main window with two dock widgets QMainWindow *mw = new QMainWindow(); QFrame *central = new QFrame(mw); @@ -3799,19 +3613,14 @@ void tst_QAccessibility::dockWidgetTest() delete dock2; delete mw; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif // QT_NO_DOCKWIDGET } void tst_QAccessibility::pushButtonTest() { #if !defined(QT3_SUPPORT) - qWarning( "Should never get here without Qt3Support"); - return ; + QSKIP( "Should never get here without Qt3Support", SkipAll); #else -#ifdef QTEST_ACCESSIBILITY // Set up a proper main window with two dock widgets QWidget *toplevel = createGUI(); QObject *topRight = toplevel->findChild("topRight"); @@ -3845,15 +3654,11 @@ void tst_QAccessibility::pushButtonTest() delete accToplevel; delete toplevel; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif #endif //QT3_SUPPORT } void tst_QAccessibility::comboBoxTest() { -#ifdef QTEST_ACCESSIBILITY #if defined(Q_OS_WINCE) if (!IsValidCEPlatform()) { QSKIP("Test skipped on Windows Mobile test hardware", SkipAll); @@ -3891,15 +3696,10 @@ void tst_QAccessibility::comboBoxTest() delete w; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif - } void tst_QAccessibility::treeWidgetTest() { -#ifdef QTEST_ACCESSIBILITY QWidget *w = new QWidget; QTreeWidget *tree = new QTreeWidget(w); QHBoxLayout *l = new QHBoxLayout(w); @@ -3957,14 +3757,10 @@ void tst_QAccessibility::treeWidgetTest() delete w; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::labelTest() { -#ifdef QTEST_ACCESSIBILITY QString text = "Hello World"; QLabel *label = new QLabel(text); label->show(); @@ -4003,14 +3799,10 @@ void tst_QAccessibility::labelTest() delete acc_label; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs accessibility support.", SkipAll); -#endif } void tst_QAccessibility::accelerators() { -#ifdef QTEST_ACCESSIBILITY QWidget *window = new QWidget; QHBoxLayout *lay = new QHBoxLayout(window); QLabel *label = new QLabel(tr("&Line edit"), window); @@ -4043,9 +3835,6 @@ void tst_QAccessibility::accelerators() QTest::qWait(100); delete window; QTestAccessibility::clearEvents(); -#else - QSKIP("Test needs Qt >= 0x040000 and accessibility support.", SkipAll); -#endif } -- cgit v0.12 From 3ca51d87296bcb3098d7de14294fef9294fd5ed4 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 16:15:57 +1000 Subject: Ignore expected warning in accessibility autotest Change-Id: I4b614766d2451dde51ab1207267301a2fe7dd0f6 Reviewed-by: Rohan McGovern --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 888f449..ebd01bb 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3826,6 +3826,8 @@ void tst_QAccessibility::accelerators() QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("A")); label->setText(tr("Q &&A")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); + + QTest::ignoreMessage(QtWarningMsg, "QKeySequence::mnemonic: \"Q &A&B\" contains multiple occurrences of '&'"); label->setText(tr("Q &A&B")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("A")); -- cgit v0.12 From bf1d860143ff40330c6e8f3e2872f2ae812adaa7 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 17:15:24 +1000 Subject: Fix remaining warnings in accessibility autotest Prevent warnings about unhandled accessibility events by managing object lifetimes appropriately. Change-Id: If72a2a6a76527ff746b99634c2d0895354570724 Reviewed-by: Rohan McGovern --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 72 +++++++++++++----------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index ebd01bb..e5e3e77 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -1651,10 +1651,10 @@ void tst_QAccessibility::userActionCount() void tst_QAccessibility::actionText() { - QWidget widget; - widget.show(); + QWidget *widget = new QWidget; + widget->show(); - QAccessibleInterface *test = QAccessible::queryAccessibleInterface(&widget); + QAccessibleInterface *test = QAccessible::queryAccessibleInterface(widget); QVERIFY(test); QVERIFY(test->isValid()); @@ -1666,7 +1666,10 @@ void tst_QAccessibility::actionText() QCOMPARE(test->actionText(QAccessible::DefaultAction, QAccessible::Name, 0), QString("SetFocus")); QCOMPARE(test->actionText(QAccessible::SetFocus, QAccessible::Name, 0), QString("SetFocus")); - delete test; test = 0; + delete test; + delete widget; + + QTestAccessibility::clearEvents(); } void tst_QAccessibility::doAction() @@ -1865,18 +1868,18 @@ void tst_QAccessibility::sliderTest() QSKIP("This test needs Qt3Support", SkipAll); #else QAccessibleInterface *test = 0; - Q3VBox vbox; - QLabel labelHorizontal("Horizontal", &vbox); - QSlider sliderHorizontal(Qt::Horizontal, &vbox); - labelHorizontal.setBuddy(&sliderHorizontal); + Q3VBox *vbox = new Q3VBox; + QLabel *labelHorizontal = new QLabel("Horizontal", vbox); + QSlider *sliderHorizontal = new QSlider(Qt::Horizontal, vbox); + labelHorizontal->setBuddy(sliderHorizontal); - QLabel labelVertical("Vertical", &vbox); - QSlider sliderVertical(Qt::Vertical, &vbox); - labelVertical.setBuddy(&sliderVertical); - vbox.show(); + QLabel *labelVertical = new QLabel("Vertical", vbox); + QSlider *sliderVertical = new QSlider(Qt::Vertical, vbox); + labelVertical->setBuddy(sliderVertical); + vbox->show(); // test horizontal slider - test = QAccessible::queryAccessibleInterface(&sliderHorizontal); + test = QAccessible::queryAccessibleInterface(sliderHorizontal); QVERIFY(test); QCOMPARE(test->childCount(), 3); QCOMPARE(test->role(0), QAccessible::Slider); @@ -1884,13 +1887,13 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->role(2), QAccessible::Indicator); QCOMPARE(test->role(3), QAccessible::PushButton); - QCOMPARE(test->text(QAccessible::Name, 0), labelHorizontal.text()); + QCOMPARE(test->text(QAccessible::Name, 0), labelHorizontal->text()); QCOMPARE(test->text(QAccessible::Name, 1), QSlider::tr("Page left")); QCOMPARE(test->text(QAccessible::Name, 2), QSlider::tr("Position")); QCOMPARE(test->text(QAccessible::Name, 3), QSlider::tr("Page right")); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.value())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->value())); QCOMPARE(test->text(QAccessible::Value, 1), QString()); - QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal.value())); + QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderHorizontal->value())); QCOMPARE(test->text(QAccessible::Value, 3), QString()); // Skip action tests. #if 0 @@ -1904,26 +1907,26 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->actionText(QAccessible::Decrease, QAccessible::Name, 2), QSlider::tr("Decrease")); QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 3), QSlider::tr("Press")); QVERIFY(test->doAction(QAccessible::Press, 3)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 3)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 1)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 1)); QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0)); QVERIFY(test->doAction(QAccessible::Increase, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->lineStep())); QVERIFY(test->doAction(QAccessible::Increase, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderHorizontal->lineStep())); QVERIFY(test->doAction(QAccessible::Decrease, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderHorizontal->lineStep())); QVERIFY(test->doAction(QAccessible::Decrease, 2)); QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0)); #endif delete test; // test vertical slider - test = QAccessible::queryAccessibleInterface(&sliderVertical); + test = QAccessible::queryAccessibleInterface(sliderVertical); QVERIFY(test); QCOMPARE(test->childCount(), 3); QCOMPARE(test->role(0), QAccessible::Slider); @@ -1931,13 +1934,13 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->role(2), QAccessible::Indicator); QCOMPARE(test->role(3), QAccessible::PushButton); - QCOMPARE(test->text(QAccessible::Name, 0), labelVertical.text()); + QCOMPARE(test->text(QAccessible::Name, 0), labelVertical->text()); QCOMPARE(test->text(QAccessible::Name, 1), QSlider::tr("Page up")); QCOMPARE(test->text(QAccessible::Name, 2), QSlider::tr("Position")); QCOMPARE(test->text(QAccessible::Name, 3), QSlider::tr("Page down")); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.value())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->value())); QCOMPARE(test->text(QAccessible::Value, 1), QString()); - QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical.value())); + QCOMPARE(test->text(QAccessible::Value, 2), QString::number(sliderVertical->value())); QCOMPARE(test->text(QAccessible::Value, 3), QString()); // Skip action tests. #if 0 @@ -1951,23 +1954,28 @@ void tst_QAccessibility::sliderTest() QCOMPARE(test->actionText(QAccessible::Decrease, QAccessible::Name, 2), QSlider::tr("Decrease")); QCOMPARE(test->actionText(QAccessible::Press, QAccessible::Name, 3), QSlider::tr("Press")); QVERIFY(test->doAction(QAccessible::Press, 3)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 3)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 1)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.pageStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->pageStep())); QVERIFY(test->doAction(QAccessible::Press, 1)); QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0)); QVERIFY(test->doAction(QAccessible::Increase, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->lineStep())); QVERIFY(test->doAction(QAccessible::Increase, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(2*sliderVertical->lineStep())); QVERIFY(test->doAction(QAccessible::Decrease, 2)); - QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical.lineStep())); + QCOMPARE(test->text(QAccessible::Value, 0), QString::number(sliderVertical->lineStep())); QVERIFY(test->doAction(QAccessible::Decrease, 2)); QCOMPARE(test->text(QAccessible::Value, 0), QString::number(0)); #endif delete test; + delete sliderHorizontal; + delete sliderVertical; + delete labelHorizontal; + delete labelVertical; + delete vbox; // Test that when we hide() a slider, the PageLeft, Indicator, and PageRight also gets the // Invisible state bit set. -- cgit v0.12 From 39202973e3fb7ff37033290b29efa1b9edc674fb Mon Sep 17 00:00:00 2001 From: mread Date: Tue, 19 Apr 2011 13:12:24 +0100 Subject: Symbian's QElapsedTimer::restart() fixed to return ms rather than us Symbian's QElapsedTimer::restart() had accidently been changed to return a microsecond count rather than milliseconds, when the elapsed timer resolution was increased. This fixes it back to milliseconds. Reviewed-by: Shane Kearns --- src/corelib/tools/qelapsedtimer_symbian.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qelapsedtimer_symbian.cpp b/src/corelib/tools/qelapsedtimer_symbian.cpp index b831e03..3667b05 100644 --- a/src/corelib/tools/qelapsedtimer_symbian.cpp +++ b/src/corelib/tools/qelapsedtimer_symbian.cpp @@ -95,7 +95,7 @@ qint64 QElapsedTimer::restart() qint64 oldt1 = t1; t1 = getMicrosecondFromTick(); t2 = 0; - return t1 - oldt1; + return (t1 - oldt1) / 1000; } qint64 QElapsedTimer::nsecsElapsed() const -- cgit v0.12 From 986ab48f1128bdd56fa408fca8f4a564e874dd4d Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Tue, 19 Apr 2011 17:29:27 +0300 Subject: Fix memory leak bugs in XmlPatterns In XmlPatterns implementation, QExplicitlySharedDataPointer and QSharedData classes are widely used. The over use of these classes has cuased couple of cyclic references. Some codes are refactored to use plain C++ pointer to break the reference loop. Task-number: QTBUG-15191 Reviewed-by: Laszlo Agocs and Sami Merila --- src/xmlpatterns/data/qitem_p.h | 4 ++++ src/xmlpatterns/expr/qdynamiccontextstore.cpp | 8 ++++---- src/xmlpatterns/expr/qdynamiccontextstore_p.h | 2 +- src/xmlpatterns/expr/qevaluationcache.cpp | 2 +- src/xmlpatterns/expr/qevaluationcache_p.h | 2 +- src/xmlpatterns/expr/qletclause.cpp | 2 +- tests/auto/qxmlquery/tst_qxmlquery.cpp | 4 ++-- tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro | 2 ++ tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro | 2 ++ tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro | 2 ++ 10 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/xmlpatterns/data/qitem_p.h b/src/xmlpatterns/data/qitem_p.h index 8184b25..fb3866e 100644 --- a/src/xmlpatterns/data/qitem_p.h +++ b/src/xmlpatterns/data/qitem_p.h @@ -408,6 +408,10 @@ namespace QPatternist inline void reset() { + /* Delete the atomicValue if necessary*/ + if(isAtomicValue() && !atomicValue->ref.deref()) + delete atomicValue; + /* Note that this function should be equal to the default * constructor. */ node.model = 0; diff --git a/src/xmlpatterns/expr/qdynamiccontextstore.cpp b/src/xmlpatterns/expr/qdynamiccontextstore.cpp index 762b7d6..7e7ead7 100644 --- a/src/xmlpatterns/expr/qdynamiccontextstore.cpp +++ b/src/xmlpatterns/expr/qdynamiccontextstore.cpp @@ -51,24 +51,24 @@ using namespace QPatternist; DynamicContextStore::DynamicContextStore(const Expression::Ptr &operand, const DynamicContext::Ptr &context) : SingleContainer(operand), - m_context(context) + m_context(context.data()) { Q_ASSERT(context); } bool DynamicContextStore::evaluateEBV(const DynamicContext::Ptr &) const { - return m_operand->evaluateEBV(m_context); + return m_operand->evaluateEBV(DynamicContext::Ptr(m_context)); } Item::Iterator::Ptr DynamicContextStore::evaluateSequence(const DynamicContext::Ptr &) const { - return m_operand->evaluateSequence(m_context); + return m_operand->evaluateSequence(DynamicContext::Ptr(m_context)); } Item DynamicContextStore::evaluateSingleton(const DynamicContext::Ptr &) const { - return m_operand->evaluateSingleton(m_context); + return m_operand->evaluateSingleton(DynamicContext::Ptr(m_context)); } SequenceType::Ptr DynamicContextStore::staticType() const diff --git a/src/xmlpatterns/expr/qdynamiccontextstore_p.h b/src/xmlpatterns/expr/qdynamiccontextstore_p.h index 1d5d035..40bfcd1 100644 --- a/src/xmlpatterns/expr/qdynamiccontextstore_p.h +++ b/src/xmlpatterns/expr/qdynamiccontextstore_p.h @@ -86,7 +86,7 @@ namespace QPatternist virtual const SourceLocationReflection *actualReflection() const; private: - const DynamicContext::Ptr m_context; + DynamicContext *m_context; }; } diff --git a/src/xmlpatterns/expr/qevaluationcache.cpp b/src/xmlpatterns/expr/qevaluationcache.cpp index 2d1bb56..cb95af6 100644 --- a/src/xmlpatterns/expr/qevaluationcache.cpp +++ b/src/xmlpatterns/expr/qevaluationcache.cpp @@ -49,7 +49,7 @@ template EvaluationCache::EvaluationCache(const Expression::Ptr &op, const VariableDeclaration::Ptr &varDecl, const VariableSlotID aSlot) : SingleContainer(op) - , m_declaration(varDecl) + , m_declaration(varDecl.constData()) , m_varSlot(aSlot) { Q_ASSERT(m_declaration); diff --git a/src/xmlpatterns/expr/qevaluationcache_p.h b/src/xmlpatterns/expr/qevaluationcache_p.h index 86aeaf8..af4cfa0 100644 --- a/src/xmlpatterns/expr/qevaluationcache_p.h +++ b/src/xmlpatterns/expr/qevaluationcache_p.h @@ -124,7 +124,7 @@ namespace QPatternist private: static DynamicContext::Ptr topFocusContext(const DynamicContext::Ptr &context); - const VariableDeclaration::Ptr m_declaration; + const VariableDeclaration* m_declaration; /** * This variable must not be called m_slot. If it so, a compiler bug on * HP-UX-aCC-64 is triggered in the constructor initializor. See the diff --git a/src/xmlpatterns/expr/qletclause.cpp b/src/xmlpatterns/expr/qletclause.cpp index d3e939b..b789b48 100644 --- a/src/xmlpatterns/expr/qletclause.cpp +++ b/src/xmlpatterns/expr/qletclause.cpp @@ -60,7 +60,7 @@ LetClause::LetClause(const Expression::Ptr &operand1, DynamicContext::Ptr LetClause::bindVariable(const DynamicContext::Ptr &context) const { - context->setExpressionVariable(m_varDecl->slot, Expression::Ptr(new DynamicContextStore(m_operand1, context))); + context->setExpressionVariable(m_varDecl->slot, m_operand1); return context; } diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index e3c97d2..2e0d1aa 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -3301,8 +3301,8 @@ void tst_QXmlQuery::bindVariableQXmlQueryInvalidate() const QXmlQuery query2; query2.setQuery("'query2'"); - query.bindVariable(QLatin1String("name"), query); - QVERIFY(!query.isValid()); + query2.bindVariable(QLatin1String("name"), query); + QVERIFY(!query2.isValid()); } void tst_QXmlQuery::unknownSourceLocation() const diff --git a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro index 3e252f6..48c79d5 100644 --- a/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro +++ b/tests/auto/xmlpatternsdiagnosticsts/xmlpatternsdiagnosticsts.pro @@ -25,3 +25,5 @@ wince*|symbian { catalog.path = . DEPLOYMENT += catalog } + +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro index f36211e..0fb5fef 100644 --- a/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro +++ b/tests/auto/xmlpatternsschemats/xmlpatternsschemats.pro @@ -25,3 +25,5 @@ INCLUDEPATH += $$QT_SOURCE_TREE/tests/auto/xmlpatternssdk/ \ $$QT_SOURCE_TREE/tests/auto/xmlpatternsxqts \ ../xmlpatternsxqts \ ../xmlpatternssdk + +requires(contains(QT_CONFIG,private_tests)) diff --git a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro index e81888a..0ced633 100644 --- a/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro +++ b/tests/auto/xmlpatternsxqts/xmlpatternsxqts.pro @@ -19,3 +19,5 @@ INCLUDEPATH += $$(QTDIR)/include/QtXmlPatterns/private \ CONFIG += testlib QT += xml TARGET = tst_xmlpatternsxqts + +requires(contains(QT_CONFIG,private_tests)) -- cgit v0.12 From 70f42ced8e01ddf0098b143e5804c22d55ebf16f Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 19 Apr 2011 18:02:33 +1000 Subject: Remove Q_ASSERT from qatomicint/pointer autotests Some code in these tests is not intended to be executed, but rather to detect compiler warnings. Instead of having an obscure fatal error if this code is run in a debug build, it now has a clear fatal error if run in any build. Change-Id: I1c9d27bb14ebf3313865b68e3e57668ba1d14e25 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qatomicint/tst_qatomicint.cpp | 3 +-- tests/auto/qatomicpointer/tst_qatomicpointer.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/qatomicint/tst_qatomicint.cpp b/tests/auto/qatomicint/tst_qatomicint.cpp index 717187a..5ccb997 100644 --- a/tests/auto/qatomicint/tst_qatomicint.cpp +++ b/tests/auto/qatomicint/tst_qatomicint.cpp @@ -116,8 +116,7 @@ tst_QAtomicInt::~tst_QAtomicInt() void tst_QAtomicInt::warningFreeHelper() { - Q_ASSERT(false); - // The code below is bogus, and shouldn't be run. We're looking for warnings, only. + qFatal("This code is bogus, and shouldn't be run. We're looking for compiler warnings only."); QBasicAtomicInt i = Q_BASIC_ATOMIC_INITIALIZER(0); diff --git a/tests/auto/qatomicpointer/tst_qatomicpointer.cpp b/tests/auto/qatomicpointer/tst_qatomicpointer.cpp index af8fabc..05f8294 100644 --- a/tests/auto/qatomicpointer/tst_qatomicpointer.cpp +++ b/tests/auto/qatomicpointer/tst_qatomicpointer.cpp @@ -98,8 +98,7 @@ struct WFHC void tst_QAtomicPointer::warningFreeHelper() { - Q_ASSERT(false); - // The code below is bogus, and shouldn't be run. We're looking for warnings, only. + qFatal("This code is bogus, and shouldn't be run. We're looking for compiler warnings only."); QBasicAtomicPointer p = Q_BASIC_ATOMIC_INITIALIZER(0); -- cgit v0.12 From 34c077faae538adc12d4aa28113640570dfc8728 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 11:05:55 +1000 Subject: Remove Q_ASSERT from qcompleter autotest. Replace obscure failure on bad test data in debug builds with an informative warning in all builds. Change-Id: I9001820f34de2f78bf296a2f0e095ce73d9ac4bd Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qcompleter/tst_qcompleter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index afcc433..9cb2468 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -277,7 +277,9 @@ retry: case 'L': row = completer->completionCount() - 1; break; case 'F': row = 0; break; default: - Q_ASSERT(false); + QFAIL(qPrintable(QString( + "Problem with 'step' value in test data: %1 (only P, N, L and F are allowed)." + ).arg(step[i]))); } completer->setCurrentRow(row); } -- cgit v0.12 From 67bc4990f7541cca089882a8c3be1b2b8d98cd4c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 11:39:14 +1000 Subject: Only ignore warning when it can actually be produced. Fix regression introduced in 3ca51d87296bcb3098d7de14294fef9294fd5ed4. The warning is only generated in builds where QT_NO_DEBUG is not defined. Change-Id: I9aa3db369094f4046062b5dc1dc694342208ee45 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index e5e3e77..2645090 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3835,7 +3835,9 @@ void tst_QAccessibility::accelerators() label->setText(tr("Q &&A")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); +#ifndef QT_NO_DEBUG QTest::ignoreMessage(QtWarningMsg, "QKeySequence::mnemonic: \"Q &A&B\" contains multiple occurrences of '&'"); +#endif label->setText(tr("Q &A&B")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QKeySequence(Qt::ALT).toString(QKeySequence::NativeText) + QLatin1String("A")); -- cgit v0.12 From a5bd4abed834ce3670b2f28d4f932d612a033b36 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 12:16:58 +1000 Subject: Remove Q_ASSERT from QCompleter autotest If a combobox had no completer, this test would assert in a debug build and crash in a release build. This commit makes the test report a test failure and avoid terminating in all builds. Change-Id: Ib2924412e3d55f10875675cb65079259cd4ef552 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qcompleter/tst_qcompleter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp index 9cb2468..b0d40d0 100644 --- a/tests/auto/qcompleter/tst_qcompleter.cpp +++ b/tests/auto/qcompleter/tst_qcompleter.cpp @@ -1278,10 +1278,11 @@ public: { setEditable(true); setInsertPolicy(NoInsert); - Q_ASSERT(completer()); - completer()->setCompletionMode(QCompleter::PopupCompletion); - completer()->setCompletionRole(Qt::DisplayRole); - connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix())); + if (completer()) { + completer()->setCompletionMode(QCompleter::PopupCompletion); + completer()->setCompletionRole(Qt::DisplayRole); + connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix())); + } } private slots: void setCompletionPrefix() { completer()->setCompletionPrefix(lineEdit()->text()); } @@ -1290,6 +1291,7 @@ private slots: void tst_QCompleter::task246056_setCompletionPrefix() { task246056_ComboBox *comboBox = new task246056_ComboBox; + QVERIFY(comboBox->completer()); comboBox->addItem(""); comboBox->addItem("a1"); comboBox->addItem("a2"); -- cgit v0.12 From 5a530f6171a9569d1a35cd8cd1015ec796b048cc Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 15:11:23 +1000 Subject: Remove Q_ASSERT from qcopchannel autotest This code would assert in a debug build and potentially crash in a release build. (The behaviour of QStringList::at() with an out-of-bounds index is undefined.) This commit makes the program exit with a useful error message in all builds. Change-Id: Ia57a2e5693eb25d3eb0b9ba701ed485dfbc1e846 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qcopchannel/testSend/main.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/qcopchannel/testSend/main.cpp b/tests/auto/qcopchannel/testSend/main.cpp index 91628e5..a56883b 100644 --- a/tests/auto/qcopchannel/testSend/main.cpp +++ b/tests/auto/qcopchannel/testSend/main.cpp @@ -49,7 +49,11 @@ int main(int argc, char** argv) #ifdef Q_WS_QWS QApplication app(argc, argv); QStringList args = app.arguments(); - Q_ASSERT(args.count() == 3 || args.count() == 4); + if (args.count() != 3 && args.count() != 4) { + fprintf(stdout,qPrintable(QString("Usage: %1 channel message [data]").arg(args.at(0)))); + fflush(stdout); + return 1; + } QString channelName = args.at(1); QString msg = args.at(2); QByteArray data; -- cgit v0.12 From e754832eff8e1a35fc2681ae69b6e3b1ad666ddb Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 16:03:42 +1000 Subject: Remove Q_ASSERT from datetimeedit autotest The assert and the last four parameters of makeList() are not needed. The function is always used to make lists of three integers and the data are all >= 0. Change-Id: I93ae5a5f541cde2ff61bd9dd21164ed4a9b57403 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp index 98632ae..abbf00d 100644 --- a/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/qdatetimeedit/tst_qdatetimeedit.cpp @@ -2699,17 +2699,10 @@ void tst_QDateTimeEdit::task98554() QCOMPARE(testWidget->time(), QTime(0, 0, 10, 0)); } -static QList makeList(int val1, int val2 = -1, int val3 = -1, int val4 = -1, int val5 = -1, int val6 = -1, int val7 = -1) +static QList makeList(int val1, int val2, int val3) { QList ret; - Q_ASSERT(val1 >= 0); - ret << val1; - if (val2 < 0) {return ret;} else {ret << val2;} - if (val3 < 0) {return ret;} else {ret << val3;} - if (val4 < 0) {return ret;} else {ret << val4;} - if (val5 < 0) {return ret;} else {ret << val5;} - if (val6 < 0) {return ret;} else {ret << val6;} - if (val7 >= 0) {ret << val2;} + ret << val1 << val2 << val3; return ret; } -- cgit v0.12 From 0061f7e015b10ccaa45dc35b68cac467ebad424a Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Wed, 20 Apr 2011 09:44:29 +0300 Subject: Fix autotest failure in XmlPattern qxmlquery The bug fix for the memory leak in qxmlquery tried to fix a memory leak in autotest test driver. The fix broke the autotest logic and causes failure. This one fix the commit 986ab48f112... Task-number: QTBUG-15191 Reviewed-by: Sami Merila --- tests/auto/qxmlquery/tst_qxmlquery.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp index 2e0d1aa..5828367 100644 --- a/tests/auto/qxmlquery/tst_qxmlquery.cpp +++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp @@ -3301,8 +3301,8 @@ void tst_QXmlQuery::bindVariableQXmlQueryInvalidate() const QXmlQuery query2; query2.setQuery("'query2'"); - query2.bindVariable(QLatin1String("name"), query); - QVERIFY(!query2.isValid()); + query.bindVariable(QLatin1String("name"), query2); + QVERIFY(!query.isValid()); } void tst_QXmlQuery::unknownSourceLocation() const -- cgit v0.12 From 6181805f9ea66b37ee164bd67bdac2ac9d53fb65 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 20 Apr 2011 16:27:07 +1000 Subject: Remove Q_ASSERT from QDom autotest The Q_ASSERT here should really be a QVERIFY. Expanded the trivial helper function to make it more obvious what the test does. Change-Id: Ia6017fe820a83b4d6101e5edcfcb68993eef233a Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qdom/tst_qdom.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index 18aa84a..f3b3e00 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -137,7 +137,6 @@ private slots: private: static QDomDocument generateRequest(); - static QDomDocument doc(const QString &title, const QByteArray &ba); static int hasAttributesHelper( const QDomNode& node ); static bool compareDocuments( const QDomDocument &doc1, const QDomDocument &doc2 ); static bool compareNodes( const QDomNode &node1, const QDomNode &node2, bool deep ); @@ -1591,14 +1590,6 @@ void tst_QDom::reportDuplicateAttributes() const QVERIFY2(!isSuccess, "Duplicate attributes are well-formedness errors, and should be reported as such."); } -QDomDocument tst_QDom::doc(const QString &title, const QByteArray &ba) -{ - QDomDocument doc(title); - const bool ret = doc.setContent(ba, true); - Q_ASSERT(ret); - return doc; -} - void tst_QDom::namespacedAttributes() const { static const char *const xml = @@ -1611,8 +1602,13 @@ void tst_QDom::namespacedAttributes() const " >>> SIMPLE BASIC OP - SEND - DUT AS SINK\n" "\n"; - QDomDocument one = doc("document", xml); - QDomDocument two = doc("document2", one.toByteArray(2)); + QDomDocument one("document"); + QString error; + bool docParsed = one.setContent(QByteArray(xml), true, &error); + QVERIFY2(docParsed, qPrintable(error)); + QDomDocument two("document2"); + docParsed = two.setContent(one.toByteArray(2), true, &error); + QVERIFY2(docParsed, qPrintable(error)); QVERIFY(isDeepEqual(one, two)); } -- cgit v0.12 From b1eb564830ff1b754de14919ce5c1547e9758f7c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 11:15:35 +1000 Subject: Fix logic error in large file autotest The function generating data blocks was filling the block to 16 bytes short of the blockSize, then appending three 8 byte values, causing the block to grow 8 bytes beyond blockSize and then truncating it back to blockSize. This commit makes the code fill the block to 24 bytes short of the blockSize, so that the block will always end up at the correct size and truncation is not needed. Change-Id: I9fe6e6d6cf7bc445513b53e0a910d205c4c8002f Reviewed-by: Rohan McGovern --- tests/auto/qfile/largefile/tst_largefile.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/auto/qfile/largefile/tst_largefile.cpp b/tests/auto/qfile/largefile/tst_largefile.cpp index a9ad017..47f2e73 100644 --- a/tests/auto/qfile/largefile/tst_largefile.cpp +++ b/tests/auto/qfile/largefile/tst_largefile.cpp @@ -206,14 +206,13 @@ static inline QByteArray generateDataBlock(int blockSize, QString text, qint64 u QByteArray filler("0123456789"); block.append(filler.right(10 - block.size() % 10)); - topUpWith(block, filler, blockSize - 2 * sizeof(qint64)); + topUpWith(block, filler, blockSize - 3 * sizeof(qint64)); appendRaw(block, counter); appendRaw(block, userBits); appendRaw(block, randomBits); - Q_ASSERT( block.size() >= blockSize ); - block.resize(blockSize); + Q_ASSERT( block.size() == blockSize ); ++counter; return block; -- cgit v0.12 From 59634e825f1efa6f32befc8767cafedfeb9b7d59 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 13:00:06 +1000 Subject: Use meaningful variable names Make the meaning of the code more obvious and avoid a compiler warning about the variable "w" being overridden. Change-Id: Ib76d3aa1cae46e263b2ab61b675d9ef74032aacc Reviewed-by: Rohan McGovern --- .../tst_qgraphicsanchorlayout.cpp | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index e7c63d5..67e9b0a 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -132,33 +132,33 @@ static void setAnchor(QGraphicsAnchorLayout *l, anchor->setSpacing(spacing); } -static bool checkReverseDirection(QGraphicsWidget *w) +static bool checkReverseDirection(QGraphicsWidget *widget) { - QGraphicsLayout *l = w->layout(); - Q_ASSERT(l); + QGraphicsLayout *layout = widget->layout(); + Q_ASSERT(layout); qreal left, top, right, bottom; - l->getContentsMargins(&left, &top, &right, &bottom); - w->setLayoutDirection(Qt::LeftToRight); + layout->getContentsMargins(&left, &top, &right, &bottom); + widget->setLayoutDirection(Qt::LeftToRight); QApplication::processEvents(); - const QRectF lg = l->geometry(); + const QRectF layoutGeometry = layout->geometry(); QMap geometries; - for (int i = 0; i < l->count(); ++i) { - QGraphicsLayoutItem *w = l->itemAt(i); - geometries.insert(w, w->geometry()); + for (int i = 0; i < layout->count(); ++i) { + QGraphicsLayoutItem *item = layout->itemAt(i); + geometries.insert(item, item->geometry()); } - w->setLayoutDirection(Qt::RightToLeft); + widget->setLayoutDirection(Qt::RightToLeft); QApplication::processEvents(); - lg.adjusted(+right, +top, -left, -bottom); - for (int i = 0; i < l->count(); ++i) { - QGraphicsLayoutItem *w = l->itemAt(i); - const QRectF rtlGeom = w->geometry(); - const QRectF ltrGeom = geometries.value(w); - QRectF expectedGeom = ltrGeom; - expectedGeom.moveRight(lg.right() - (0 + ltrGeom.left())); - if (expectedGeom != rtlGeom) { - qDebug() << "layout->geometry():" << lg - << "expected:" << expectedGeom - << "actual:" << rtlGeom; + layoutGeometry.adjusted(+right, +top, -left, -bottom); + for (int i = 0; i < layout->count(); ++i) { + QGraphicsLayoutItem *item = layout->itemAt(i); + const QRectF rightToLeftGeometry = item->geometry(); + const QRectF leftToRightGeometry = geometries.value(item); + QRectF expectedGeometry = leftToRightGeometry; + expectedGeometry.moveRight(layoutGeometry.right() - leftToRightGeometry.left()); + if (expectedGeometry != rightToLeftGeometry) { + qDebug() << "layout->geometry():" << layoutGeometry + << "expected:" << expectedGeometry + << "actual:" << rightToLeftGeometry; return false; } } -- cgit v0.12 From 60e5ed805af1e11aaec426b823df209b4c895c29 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 14:49:41 +1000 Subject: Only ignore warning when it can actually be produced. Fix regression introduced in 3ca51d87296bcb3098d7de14294fef9294fd5ed4. The warning is only generated in builds where QT_NO_DEBUG is not defined *and* the target is not Mac OS X. Change-Id: I7245f2eab8ea47ab7495fef874b2f8a29186b659 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 2645090..254fdf7 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3835,7 +3835,7 @@ void tst_QAccessibility::accelerators() label->setText(tr("Q &&A")); QCOMPARE(accLineEdit->text(QAccessible::Accelerator, 0), QString()); -#ifndef QT_NO_DEBUG +#if !defined(QT_NO_DEBUG) && !defined(Q_WS_MAC) QTest::ignoreMessage(QtWarningMsg, "QKeySequence::mnemonic: \"Q &A&B\" contains multiple occurrences of '&'"); #endif label->setText(tr("Q &A&B")); -- cgit v0.12 From 8a9a6afcf02f089f932bc81431ab46a60af32134 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 20 Apr 2011 16:21:36 +0100 Subject: Fix crash when QSocketNotifier used with an invalid descriptor select code for open C file/socket descriptors was crashing in FD_SET if a QSocketNotifier was created with an invalid descriptor. Added two autotests to QSocketNotifier, one to check notifiers with bogus socket descriptors don't crash, the other to check that notifiers with posix socket descriptors do work. (symbian socket engine doesn't use them so they are not implicitly tested) Reviewed-by: mread Task-Number: QTBUG-18138 --- src/corelib/kernel/qeventdispatcher_symbian.cpp | 6 ++ tests/auto/qsocketnotifier/qsocketnotifier.pro | 2 +- tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp | 109 +++++++++++++++++++++ 3 files changed, 116 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp index 79f2596..7166e7d 100644 --- a/src/corelib/kernel/qeventdispatcher_symbian.cpp +++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp @@ -1084,6 +1084,12 @@ bool QEventDispatcherSymbian::hasPendingEvents() void QEventDispatcherSymbian::registerSocketNotifier ( QSocketNotifier * notifier ) { + //check socket descriptor is usable + if (notifier->socket() >= FD_SETSIZE || notifier->socket() < 0) { + //same warning message as the unix event dispatcher for easy testing + qWarning("QSocketNotifier: Internal error"); + return; + } //note - this is only for "open C" file descriptors //for native sockets, an active object in the symbian socket engine handles this QSocketActiveObject *socketAO = new QSocketActiveObject(this, notifier); diff --git a/tests/auto/qsocketnotifier/qsocketnotifier.pro b/tests/auto/qsocketnotifier/qsocketnotifier.pro index c43c96a..27484c8 100644 --- a/tests/auto/qsocketnotifier/qsocketnotifier.pro +++ b/tests/auto/qsocketnotifier/qsocketnotifier.pro @@ -4,7 +4,7 @@ QT = core network requires(contains(QT_CONFIG,private_tests)) -include(../qnativesocketengine/qsocketengine.pri) +include(../platformsocketengine/platformsocketengine.pri) symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp index 5594dc3..b31a6e6 100644 --- a/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp +++ b/tests/auto/qsocketnotifier/tst_qsocketnotifier.cpp @@ -53,6 +53,11 @@ #include #define NATIVESOCKETENGINE QNativeSocketEngine #endif +#ifdef Q_OS_UNIX +#include +#endif +#include +#include class tst_QSocketNotifier : public QObject { @@ -64,6 +69,8 @@ public: private slots: void unexpectedDisconnection(); void mixingWithTimers(); + void posixSockets(); + void bogusFds(); }; tst_QSocketNotifier::tst_QSocketNotifier() @@ -114,6 +121,9 @@ signals: void tst_QSocketNotifier::unexpectedDisconnection() { +#ifdef Q_OS_SYMBIAN + QSKIP("Symbian socket engine psuedo descriptors can't be used for QSocketNotifier", SkipAll); +#else /* Given two sockets and two QSocketNotifiers registered on each their socket. If both sockets receive data, and the first slot @@ -163,10 +173,14 @@ void tst_QSocketNotifier::unexpectedDisconnection() UnexpectedDisconnectTester tester(&readEnd1, &readEnd2); + QTimer timer; + timer.setSingleShot(true); + timer.start(30000); do { // we have to wait until sequence value changes // as any event can make us jump out processing QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); + QVERIFY(timer.isActive); //escape if test would hang } while(tester.sequence <= 0); QVERIFY(readEnd1.state() == QAbstractSocket::ConnectedState); @@ -179,6 +193,7 @@ void tst_QSocketNotifier::unexpectedDisconnection() writeEnd1->close(); writeEnd2->close(); server.close(); +#endif } class MixingWithTimersHelper : public QObject @@ -243,5 +258,99 @@ void tst_QSocketNotifier::mixingWithTimers() QCOMPARE(helper.socketActivated, true); } +void tst_QSocketNotifier::posixSockets() +{ +#ifndef Q_OS_UNIX + QSKIP("test only for posix", SkipAll); +#else + + QTcpServer server; + QVERIFY(server.listen(QHostAddress::LocalHost, 0)); + + int posixSocket = qt_safe_socket(AF_INET, SOCK_STREAM, 0); + sockaddr_in addr; + addr.sin_addr.s_addr = htonl(0x7f000001); + addr.sin_family = AF_INET; + addr.sin_port = htons(server.serverPort()); + qt_safe_connect(posixSocket, (const struct sockaddr*)&addr, sizeof(sockaddr_in)); + QVERIFY(server.waitForNewConnection(5000)); + QScopedPointer passive(server.nextPendingConnection()); + + ::fcntl(posixSocket, F_SETFL, ::fcntl(posixSocket, F_GETFL) | O_NONBLOCK); + + { + QSocketNotifier rn(posixSocket, QSocketNotifier::Read); + connect(&rn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop())); + QSignalSpy readSpy(&rn, SIGNAL(activated(int))); + QSocketNotifier wn(posixSocket, QSocketNotifier::Write); + connect(&wn, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop())); + QSignalSpy writeSpy(&wn, SIGNAL(activated(int))); + QSocketNotifier en(posixSocket, QSocketNotifier::Exception); + connect(&en, SIGNAL(activated(int)), &QTestEventLoop::instance(), SLOT(exitLoop())); + QSignalSpy errorSpy(&en, SIGNAL(activated(int))); + + passive->write("hello",6); + passive->waitForBytesWritten(5000); + + QTestEventLoop::instance().enterLoop(3); + QCOMPARE(readSpy.count(), 1); + QCOMPARE(writeSpy.count(), 0); + QCOMPARE(errorSpy.count(), 0); + + char buffer[100]; + qt_safe_read(posixSocket, buffer, 100); + QCOMPARE(buffer, "hello"); + + qt_safe_write(posixSocket, "goodbye", 8); + + QTestEventLoop::instance().enterLoop(3); + QCOMPARE(readSpy.count(), 1); + QCOMPARE(writeSpy.count(), 1); + QCOMPARE(errorSpy.count(), 0); + QCOMPARE(passive->readAll(), QByteArray("goodbye",8)); + } + qt_safe_close(posixSocket); +#endif +} + +void tst_QSocketNotifier::bogusFds() +{ +#ifndef Q_OS_WIN + QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); +#endif + QSocketNotifier max(std::numeric_limits::max(), QSocketNotifier::Read); + QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Invalid socket specified"); +#ifndef Q_OS_WIN + QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); +#endif + QSocketNotifier min(std::numeric_limits::min(), QSocketNotifier::Write); +#ifndef Q_OS_WIN + QTest::ignoreMessage(QtWarningMsg, "QSocketNotifier: Internal error"); +#endif + //bogus magic number is the first pseudo socket descriptor from symbian socket engine. + QSocketNotifier bogus(0x40000000, QSocketNotifier::Exception); + QSocketNotifier largestlegal(FD_SETSIZE - 1, QSocketNotifier::Read); + + QSignalSpy maxspy(&max, SIGNAL(activated(int))); + QSignalSpy minspy(&min, SIGNAL(activated(int))); + QSignalSpy bogspy(&bogus, SIGNAL(activated(int))); + QSignalSpy llspy(&largestlegal, SIGNAL(activated(int))); + + //generate some unrelated socket activity + QTcpServer server; + QVERIFY(server.listen(QHostAddress::LocalHost)); + connect(&server, SIGNAL(newConnection()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTcpSocket client; + client.connectToHost(QHostAddress::LocalHost, server.serverPort()); + QTestEventLoop::instance().enterLoop(5); + QVERIFY(server.hasPendingConnections()); + + //check no activity on bogus notifiers + QCOMPARE(maxspy.count(), 0); + QCOMPARE(minspy.count(), 0); + QCOMPARE(bogspy.count(), 0); + QCOMPARE(llspy.count(), 0); +} + QTEST_MAIN(tst_QSocketNotifier) #include -- cgit v0.12 From 2c2026df66f237b7313397dd74f6bc3212b94596 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 26 Apr 2011 12:34:00 +0200 Subject: Set the default graphics system to raster. This change is specific to Mac OS X/Cocoa. Reviewed-by: Lars Knoll --- src/gui/painting/qgraphicssystemfactory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp index 62a60d7..6212674 100644 --- a/src/gui/painting/qgraphicssystemfactory.cpp +++ b/src/gui/painting/qgraphicssystemfactory.cpp @@ -74,7 +74,7 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key) if (system.isEmpty()) { system = QLatin1String("runtime"); } -#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11) +#elif defined (QT_GRAPHICSSYSTEM_RASTER) && !defined(Q_WS_WIN) && !defined(Q_OS_SYMBIAN) || defined(Q_WS_X11) || (defined (Q_WS_MAC) && defined(QT_MAC_USE_COCOA)) if (system.isEmpty()) { system = QLatin1String("raster"); } -- cgit v0.12 From 0c62e02b80570bf8b92eff7acceb9018df61c89e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 26 Apr 2011 15:35:51 +0200 Subject: Make text rendering working outside the gui thread on Symbian. It was previously not possible to render text (QPainter::drawText) in a secondary thread on Symbian, it always resulted in some kind of panic. This patch corrects it. For S60 5.0 and earlier the behavior is not changed, threaded text rendering is only supported on Symbian^3 and newer. This also means QFontDatabase::supportsThreadedFontRendering() will return true from now on, but only on Symbian^3 and higher. Task-number: QTBUG-18516 Reviewed-by: mread --- src/gui/kernel/qapplication_s60.cpp | 3 +++ src/gui/kernel/qt_s60_p.h | 26 ++++++++++++++++++++++++++ src/gui/text/qfontdatabase_s60.cpp | 30 +++++++++++++++++++----------- 3 files changed, 48 insertions(+), 11 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 0688061..937f485 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -2606,6 +2606,9 @@ QS60ThreadLocalData::QS60ThreadLocalData() QS60ThreadLocalData::~QS60ThreadLocalData() { + for (int i = 0; i < releaseFuncs.count(); ++i) + releaseFuncs[i](); + releaseFuncs.clear(); if (!usingCONEinstances) { delete screenDevice; wsSession.Close(); diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index ee0b862..288ee99 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -90,6 +90,10 @@ static const int qt_symbian_max_screens = 4; //this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2 #define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13) +class QSymbianTypeFaceExtras; +typedef QHash QSymbianTypeFaceExtrasHash; +typedef void (*QThreadLocalReleaseFunc)(); + class Q_AUTOTEST_EXPORT QS60ThreadLocalData { public: @@ -98,6 +102,8 @@ public: bool usingCONEinstances; RWsSession wsSession; CWsScreenDevice *screenDevice; + QSymbianTypeFaceExtrasHash fontData; + QVector releaseFuncs; }; class QS60Data @@ -168,6 +174,8 @@ public: inline CWsScreenDevice* screenDevice(const QWidget *widget); inline CWsScreenDevice* screenDevice(int screenNumber); static inline int screenNumberForWidget(const QWidget *widget); + inline QSymbianTypeFaceExtrasHash& fontData(); + inline void addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func); static inline CCoeAppUi* appUi(); static inline CEikMenuBar* menuBar(); #ifdef Q_WS_S60 @@ -454,6 +462,24 @@ inline int QS60Data::screenNumberForWidget(const QWidget *widget) return qt_widget_private(const_cast(w))->symbianScreenNumber; } +inline QSymbianTypeFaceExtrasHash& QS60Data::fontData() +{ + if (!tls.hasLocalData()) { + tls.setLocalData(new QS60ThreadLocalData); + } + return tls.localData()->fontData; +} + +inline void QS60Data::addThreadLocalReleaseFunc(QThreadLocalReleaseFunc func) +{ + if (!tls.hasLocalData()) { + tls.setLocalData(new QS60ThreadLocalData); + } + QS60ThreadLocalData *data = tls.localData(); + if (!data->releaseFuncs.contains(func)) + data->releaseFuncs.append(func); +} + inline CCoeAppUi* QS60Data::appUi() { return CCoeEnv::Static()-> AppUi(); diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 6d3970e..3c7255b 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -152,7 +152,6 @@ public: COpenFontRasterizer *m_rasterizer; mutable QList m_extras; - mutable QHash m_extrasHash; mutable QSet m_applicationFontFamilies; }; @@ -255,8 +254,9 @@ void QSymbianFontDatabaseExtrasImplementation::clear() static_cast(db->symbianExtras); if (!dbExtras) return; // initializeDb() has never been called + QSymbianTypeFaceExtrasHash &extrasHash = S60->fontData(); if (QSymbianTypeFaceExtras::symbianFontTableApiAvailable()) { - qDeleteAll(dbExtras->m_extrasHash); + qDeleteAll(extrasHash); } else { typedef QList::iterator iterator; for (iterator p = dbExtras->m_extras.begin(); p != dbExtras->m_extras.end(); ++p) { @@ -265,11 +265,16 @@ void QSymbianFontDatabaseExtrasImplementation::clear() } dbExtras->m_extras.clear(); } - dbExtras->m_extrasHash.clear(); + extrasHash.clear(); } void qt_cleanup_symbianFontDatabase() { + static bool cleanupDone = false; + if (cleanupDone) + return; + cleanupDone = true; + QFontDatabasePrivate *db = privateDb(); if (!db) return; @@ -320,9 +325,12 @@ COpenFont* OpenFontFromBitmapFont(const CBitmapFont* aBitmapFont) const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(const QString &aTypeface, bool bold, bool italic) const { + QSymbianTypeFaceExtrasHash &extrasHash = S60->fontData(); + if (extrasHash.isEmpty() && QThread::currentThread() != QApplication::instance()->thread()) + S60->addThreadLocalReleaseFunc(clear); const QString typeface = qt_symbian_fontNameWithAppFontMarker(aTypeface); const QString searchKey = typeface + QString::number(int(bold)) + QString::number(int(italic)); - if (!m_extrasHash.contains(searchKey)) { + if (!extrasHash.contains(searchKey)) { TFontSpec searchSpec(qt_QString2TPtrC(typeface), 1); if (bold) searchSpec.iFontStyle.SetStrokeWeight(EStrokeWeightBold); @@ -336,7 +344,7 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c QScopedPointer sFont(font); QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font); sFont.take(); - m_extrasHash.insert(searchKey, extras); + extrasHash.insert(searchKey, extras); } else { const TInt err = m_store->GetNearestFontToDesignHeightInPixels(font, searchSpec); Q_ASSERT(err == KErrNone && font); @@ -350,20 +358,20 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c const TOpenFontFaceAttrib* const attrib = openFont->FaceAttrib(); const QString foundKey = QString((const QChar*)attrib->FullName().Ptr(), attrib->FullName().Length()); - if (!m_extrasHash.contains(foundKey)) { + if (!extrasHash.contains(foundKey)) { QScopedPointer sFont(font); QSymbianTypeFaceExtras *extras = new QSymbianTypeFaceExtras(font, openFont); sFont.take(); m_extras.append(extras); - m_extrasHash.insert(searchKey, extras); - m_extrasHash.insert(foundKey, extras); + extrasHash.insert(searchKey, extras); + extrasHash.insert(foundKey, extras); } else { m_store->ReleaseFont(font); - m_extrasHash.insert(searchKey, m_extrasHash.value(foundKey)); + extrasHash.insert(searchKey, extrasHash.value(foundKey)); } } } - return m_extrasHash.value(searchKey); + return extrasHash.value(searchKey); } void QSymbianFontDatabaseExtrasImplementation::removeAppFontData( @@ -956,7 +964,7 @@ bool QFontDatabase::removeAllApplicationFonts() bool QFontDatabase::supportsThreadedFontRendering() { - return false; + return QSymbianTypeFaceExtras::symbianFontTableApiAvailable(); } static -- cgit v0.12 From b4b4e3311f06ef79e307f90eb216b05ed2990358 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 11 Apr 2011 14:42:04 +0300 Subject: Implement support for enable_backup CONFIG value. The enable_backup CONFIG value can be used to generate deployment for backup registration file for an application. BACKUP_REGISTRATION_FILE_SYMBIAN and BACKUP_REGISTRATION_FILE_MAEMO variables can be used to specify a custom backup registration files. Only works on Symbian and Maemo platforms. Task-number: QTBUG-17214 Reviewed-by: Oswald Buddenhagen --- doc/src/development/qmake-manual.qdoc | 49 ++++++++++++++++++++++++++ mkspecs/common/symbian/backup_registration.xml | 8 +++++ mkspecs/features/enable_backup.prf | 43 ++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 mkspecs/common/symbian/backup_registration.xml create mode 100644 mkspecs/features/enable_backup.prf diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 2bc8a34..0149da2 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1120,6 +1120,44 @@ \tableofcontents{3} + + \target BACKUP_REGISTRATION_FILE_MAEMO + \section1 BACKUP_REGISTRATION_FILE_MAEMO + + \e {This is only used on the Maemo platform.} + + This variable is used to specify the backup registration file to use with + \c enable_backup \c CONFIG value for Maemo platform. The default value is: + \c{$$_PRO_FILE_PWD_/backup_registration/maemo/$$basename(TARGET).conf}. + + Unfortunately it is not possible to have a common registration file for Maemo like there is + for Symbian, so the developer must always provide one if the platform default backup support is + not sufficient. + + For documentation about how to create backup registration files and how the device + backup works in general, see: + (\l{http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Generic_Platform_Components/Using_Backup_Application}{Using Backup Application}) + + \target BACKUP_REGISTRATION_FILE_SYMBIAN + \section1 BACKUP_REGISTRATION_FILE_SYMBIAN + + \e {This is only used on the Symbian platform.} + + This variable is used to specify the backup registration file to use with + \c enable_backup \c CONFIG value for Symbian platform. The default value is + determined as follows: + + If a custom registration file \c{$$_PRO_FILE_PWD_/backup_registration/symbian/backup_registration.xml} + exists, it is used. Otherwise, the common registration file \c{$$[QT_INSTALL_DATA]/mkspecs/common/symbian/backup_registration.xml} + is used. This common registration file will define backing up of application binaries, + resources, and all files under application private directory. Also note that \c{C:/Data} + contents are backed up by default on Symbian devices, so no registration is needed for any + files found there. + + For documentation about how to create backup registration files and how the device + backup works in general, see: + (\l{http://library.forum.nokia.com/index.jsp?topic=/S60_5th_Edition_Cpp_Developers_Library/GUID-35228542-8C95-4849-A73F-2B4F082F0C44/sdk/doc_source/guide/Connectivity-subsystem-guide/Connectivity/PC_Connectivity_How-To_Write_Backup_Aware_Software.html}{How-To Write Backup-aware Software}) + \target BLD_INF_RULES \section1 BLD_INF_RULES @@ -1341,6 +1379,17 @@ so some \c{.ts} files may be ignored by qmake. \endtable + These options only have an effect on Symbian and Maemo platforms: + + \table 95% + \header \o Option \o Description + \row \o enable_backup \o Generates deployment for backup registration file + to enable backing up the application during device backup. + See \l{#BACKUP_REGISTRATION_FILE_MAEMO}{BACKUP_REGISTRATION_FILE_MAEMO} + and \l{#BACKUP_REGISTRATION_FILE_SYMBIAN}{BACKUP_REGISTRATION_FILE_SYMBIAN} + for more information about backup. + \endtable + These options have an effect on Linux/Unix platforms: \table 95% diff --git a/mkspecs/common/symbian/backup_registration.xml b/mkspecs/common/symbian/backup_registration.xml new file mode 100644 index 0000000..794e11d --- /dev/null +++ b/mkspecs/common/symbian/backup_registration.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mkspecs/features/enable_backup.prf b/mkspecs/features/enable_backup.prf new file mode 100644 index 0000000..7700ca2 --- /dev/null +++ b/mkspecs/features/enable_backup.prf @@ -0,0 +1,43 @@ +# Generate deployment for backup registration file for mobile devices +symbian|maemo5|linux-g++-maemo { + symbian { + isEmpty(BACKUP_REGISTRATION_FILE_SYMBIAN) { + # Do not require a custom registration file in Symbian builds as the + # default file can be used as is in vast majority of projects. + # However, if the custom file exists in the default location, use that. + + CUSTOM_BACKUP_REG_FILE = $$_PRO_FILE_PWD_/backup_registration/symbian/backup_registration.xml + + exists($$CUSTOM_BACKUP_REG_FILE) { + BACKUP_REGISTRATION_FILE = $$CUSTOM_BACKUP_REG_FILE + } else { + BACKUP_REGISTRATION_FILE = $$[QT_INSTALL_DATA]/mkspecs/common/symbian/backup_registration.xml + } + } else { + BACKUP_REGISTRATION_FILE = $$BACKUP_REGISTRATION_FILE_SYMBIAN + } + + contains(TEMPLATE, app) { + enable_backup_deployment.path = /private/$$replace(TARGET.UID3, 0x,) + } else { + enable_backup_deployment.path = /private/10202D56/import/packages/$$replace(TARGET.UID3, 0x,) + } + DEPLOYMENT += enable_backup_deployment + } else { + isEmpty(BACKUP_REGISTRATION_FILE_MAEMO) { + BACKUP_REGISTRATION_FILE = $$_PRO_FILE_PWD_/backup_registration/maemo/$$basename(TARGET).conf + } else { + BACKUP_REGISTRATION_FILE = $$BACKUP_REGISTRATION_FILE_MAEMO + } + + enable_backup_deployment.path = /etc/osso-backup/applications + INSTALLS += enable_backup_deployment + } + + # Make sure that BACKUP_REGISTRATION_FILE has absolute path, otherwise the following exists check will not work. + !contains(BACKUP_REGISTRATION_FILE, "(^/|^\\\\|^.:).*"): BACKUP_REGISTRATION_FILE = $$_PRO_FILE_PWD_/$$BACKUP_REGISTRATION_FILE + + !exists($$BACKUP_REGISTRATION_FILE): warning(The backup registration file \'$$BACKUP_REGISTRATION_FILE\' was not found. Please provide a valid backup registration file.) + + enable_backup_deployment.files = $$BACKUP_REGISTRATION_FILE +} -- cgit v0.12 From 903d4dc2196df2775255c24c707bfeb571992bb7 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 26 Apr 2011 16:01:08 +0200 Subject: Added autotest for threaded text rendering. Task-number: QTBUG-18516 Reviewed-by: TRUSTME --- tests/auto/qpainter/tst_qpainter.cpp | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index c21514b..33e4c49 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -72,6 +72,7 @@ #include #include #include +#include #if defined(Q_OS_SYMBIAN) # define SRCDIR "." @@ -264,6 +265,8 @@ private slots: void QTBUG17053_zeroDashPattern(); + void drawTextOutsideGuiThread(); + private: void fillData(); void setPenColor(QPainter& p); @@ -4706,6 +4709,44 @@ void tst_QPainter::QTBUG17053_zeroDashPattern() QCOMPARE(image, original); } +class TextDrawerThread : public QThread +{ +public: + void run(); + QImage rendering; +}; + +void TextDrawerThread::run() +{ + rendering = QImage(100, 100, QImage::Format_ARGB32_Premultiplied); + rendering.fill(0); + QPainter p(&rendering); + p.fillRect(10, 10, 100, 100, Qt::blue); + p.setPen(Qt::green); + p.drawText(20, 20, "some text"); + p.end(); +} + +void tst_QPainter::drawTextOutsideGuiThread() +{ + if (!QFontDatabase::supportsThreadedFontRendering()) + QSKIP("No threaded font rendering", SkipAll); + + QImage referenceRendering(100, 100, QImage::Format_ARGB32_Premultiplied); + referenceRendering.fill(0); + QPainter p(&referenceRendering); + p.fillRect(10, 10, 100, 100, Qt::blue); + p.setPen(Qt::green); + p.drawText(20, 20, "some text"); + p.end(); + + TextDrawerThread t; + t.start(); + t.wait(); + + QCOMPARE(referenceRendering, t.rendering); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" -- cgit v0.12 From 27a24f1d009741b6e712300e7bc58b7e7e7d4c0b Mon Sep 17 00:00:00 2001 From: Honglei Zhang Date: Wed, 27 Apr 2011 09:19:57 +0300 Subject: Fix memory leak in XSD component of XmlPatterns There are couple of memory leaks in XmlPatterns when parsing XSD files. The reason is that the module over uses the shared data pointer and generates many cyclic reference loop. Some part of the code is refactored. Instead of using shared data pointer, normal C++ pointer is used to break the ownership loop. This is bug fix for QTBUG-8948. Task-number: QTBUG-8948 Reviewed-by: Sami Merila and Laszlo Agocs --- src/xmlpatterns/schema/qxsdattribute.cpp | 4 ++-- src/xmlpatterns/schema/qxsdattribute_p.h | 2 +- src/xmlpatterns/schema/qxsdcomplextype.cpp | 4 ++-- src/xmlpatterns/schema/qxsdcomplextype_p.h | 2 +- src/xmlpatterns/schema/qxsdelement.cpp | 8 ++++---- src/xmlpatterns/schema/qxsdelement_p.h | 8 ++++---- src/xmlpatterns/schema/qxsdparticlechecker.cpp | 6 +++--- src/xmlpatterns/schema/qxsdsimpletype.cpp | 4 ++-- src/xmlpatterns/schema/qxsdsimpletype_p.h | 2 +- src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp | 10 +++++----- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/xmlpatterns/schema/qxsdattribute.cpp b/src/xmlpatterns/schema/qxsdattribute.cpp index 68f9e3d..fb768d4 100644 --- a/src/xmlpatterns/schema/qxsdattribute.cpp +++ b/src/xmlpatterns/schema/qxsdattribute.cpp @@ -59,12 +59,12 @@ XsdAttribute::Scope::Variety XsdAttribute::Scope::variety() const void XsdAttribute::Scope::setParent(const NamedSchemaComponent::Ptr &parent) { - m_parent = parent; + m_parent = parent.data(); } NamedSchemaComponent::Ptr XsdAttribute::Scope::parent() const { - return m_parent; + return NamedSchemaComponent::Ptr(m_parent); } void XsdAttribute::ValueConstraint::setVariety(Variety variety) diff --git a/src/xmlpatterns/schema/qxsdattribute_p.h b/src/xmlpatterns/schema/qxsdattribute_p.h index d64d335..a21fe70 100644 --- a/src/xmlpatterns/schema/qxsdattribute_p.h +++ b/src/xmlpatterns/schema/qxsdattribute_p.h @@ -131,7 +131,7 @@ namespace QPatternist private: Variety m_variety; - NamedSchemaComponent::Ptr m_parent; + NamedSchemaComponent *m_parent; }; diff --git a/src/xmlpatterns/schema/qxsdcomplextype.cpp b/src/xmlpatterns/schema/qxsdcomplextype.cpp index 42aeb60..0932060 100644 --- a/src/xmlpatterns/schema/qxsdcomplextype.cpp +++ b/src/xmlpatterns/schema/qxsdcomplextype.cpp @@ -140,12 +140,12 @@ SchemaType::Ptr XsdComplexType::wxsSuperType() const void XsdComplexType::setContext(const NamedSchemaComponent::Ptr &component) { - m_context = component; + m_context = component.data(); } NamedSchemaComponent::Ptr XsdComplexType::context() const { - return m_context; + return NamedSchemaComponent::Ptr(m_context); } void XsdComplexType::setContentType(const ContentType::Ptr &type) diff --git a/src/xmlpatterns/schema/qxsdcomplextype_p.h b/src/xmlpatterns/schema/qxsdcomplextype_p.h index d28d2fc..d02583c 100644 --- a/src/xmlpatterns/schema/qxsdcomplextype_p.h +++ b/src/xmlpatterns/schema/qxsdcomplextype_p.h @@ -386,7 +386,7 @@ namespace QPatternist private: SchemaType::Ptr m_superType; - NamedSchemaComponent::Ptr m_context; + NamedSchemaComponent *m_context; DerivationMethod m_derivationMethod; bool m_isAbstract; XsdAttributeUse::List m_attributeUses; diff --git a/src/xmlpatterns/schema/qxsdelement.cpp b/src/xmlpatterns/schema/qxsdelement.cpp index 1ebec06..b0c5661 100644 --- a/src/xmlpatterns/schema/qxsdelement.cpp +++ b/src/xmlpatterns/schema/qxsdelement.cpp @@ -57,12 +57,12 @@ XsdElement::Scope::Variety XsdElement::Scope::variety() const void XsdElement::Scope::setParent(const NamedSchemaComponent::Ptr &parent) { - m_parent = parent; + m_parent = parent.data(); } NamedSchemaComponent::Ptr XsdElement::Scope::parent() const { - return m_parent; + return NamedSchemaComponent::Ptr(m_parent); } void XsdElement::ValueConstraint::setVariety(Variety variety) @@ -233,10 +233,10 @@ XsdElement::List XsdElement::substitutionGroupAffiliations() const void XsdElement::addSubstitutionGroup(const XsdElement::Ptr &element) { - m_substitutionGroups.insert(element); + m_substitutionGroups.insert(element.data()); } -XsdElement::List XsdElement::substitutionGroups() const +XsdElement::WeakList XsdElement::substitutionGroups() const { return m_substitutionGroups.toList(); } diff --git a/src/xmlpatterns/schema/qxsdelement_p.h b/src/xmlpatterns/schema/qxsdelement_p.h index 93c5983..3794c96 100644 --- a/src/xmlpatterns/schema/qxsdelement_p.h +++ b/src/xmlpatterns/schema/qxsdelement_p.h @@ -85,7 +85,7 @@ namespace QPatternist public: typedef QExplicitlySharedDataPointer Ptr; typedef QList List; - + typedef QList WeakList; /** * Describes the constraint type of the element. @@ -138,7 +138,7 @@ namespace QPatternist private: Variety m_variety; - NamedSchemaComponent::Ptr m_parent; + NamedSchemaComponent *m_parent; }; /** @@ -379,7 +379,7 @@ namespace QPatternist /** * Returns the substitution groups of the element. */ - XsdElement::List substitutionGroups() const; + XsdElement::WeakList substitutionGroups() const; private: SchemaType::Ptr m_type; @@ -392,7 +392,7 @@ namespace QPatternist SchemaType::DerivationConstraints m_substitutionGroupExclusions; XsdIdentityConstraint::List m_identityConstraints; XsdElement::List m_substitutionGroupAffiliations; - QSet m_substitutionGroups; + QSet m_substitutionGroups; }; } diff --git a/src/xmlpatterns/schema/qxsdparticlechecker.cpp b/src/xmlpatterns/schema/qxsdparticlechecker.cpp index 15c2afe..d4beae7 100644 --- a/src/xmlpatterns/schema/qxsdparticlechecker.cpp +++ b/src/xmlpatterns/schema/qxsdparticlechecker.cpp @@ -309,12 +309,12 @@ static bool hasDuplicatedElementsInternal(const XsdParticle::Ptr &particle, cons const XsdTerm::Ptr term = particle->term(); if (term->isElement()) { const XsdElement::Ptr mainElement(term); - XsdElement::List substGroups = mainElement->substitutionGroups(); + XsdElement::WeakList substGroups = mainElement->substitutionGroups(); if (substGroups.isEmpty()) - substGroups << mainElement; + substGroups << mainElement.data(); for (int i = 0; i < substGroups.count(); ++i) { - const XsdElement::Ptr element = substGroups.at(i); + const XsdElement::Ptr element(substGroups.at(i)); if (hash.contains(element->name(namePool))) { if (element->type()->name(namePool) != hash.value(element->name(namePool))->type()->name(namePool)) { conflictingElement = element; diff --git a/src/xmlpatterns/schema/qxsdsimpletype.cpp b/src/xmlpatterns/schema/qxsdsimpletype.cpp index 6fd5658..3e77aca 100644 --- a/src/xmlpatterns/schema/qxsdsimpletype.cpp +++ b/src/xmlpatterns/schema/qxsdsimpletype.cpp @@ -72,12 +72,12 @@ SchemaType::Ptr XsdSimpleType::wxsSuperType() const void XsdSimpleType::setContext(const NamedSchemaComponent::Ptr &component) { - m_context = component; + m_context = component.data(); } NamedSchemaComponent::Ptr XsdSimpleType::context() const { - return m_context; + return NamedSchemaComponent::Ptr(m_context); } void XsdSimpleType::setPrimitiveType(const AnySimpleType::Ptr &type) diff --git a/src/xmlpatterns/schema/qxsdsimpletype_p.h b/src/xmlpatterns/schema/qxsdsimpletype_p.h index 6305fc7..a5b72a7 100644 --- a/src/xmlpatterns/schema/qxsdsimpletype_p.h +++ b/src/xmlpatterns/schema/qxsdsimpletype_p.h @@ -202,7 +202,7 @@ namespace QPatternist private: SchemaType::Ptr m_superType; - NamedSchemaComponent::Ptr m_context; + NamedSchemaComponent* m_context; AnySimpleType::Ptr m_primitiveType; AnySimpleType::Ptr m_itemType; AnySimpleType::List m_memberTypes; diff --git a/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp index fed8a41..b6c8704 100644 --- a/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp +++ b/src/xmlpatterns/schema/qxsdstatemachinebuilder.cpp @@ -166,14 +166,14 @@ XsdStateMachine::StateId XsdStateMachineBuilder::buildTerm(const X const XsdElement::Ptr element(term); if (m_mode == CheckingMode) { - const XsdElement::List substGroups = element->substitutionGroups(); + const XsdElement::WeakList substGroups = element->substitutionGroups(); for (int i = 0; i < substGroups.count(); ++i) - m_stateMachine->addTransition(b, substGroups.at(i), endState); + m_stateMachine->addTransition(b, XsdElement::Ptr(substGroups.at(i)), endState); } else if (m_mode == ValidatingMode) { - const XsdElement::List substGroups = element->substitutionGroups(); + const XsdElement::WeakList substGroups = element->substitutionGroups(); for (int i = 0; i < substGroups.count(); ++i) { - if (XsdSchemaHelper::substitutionGroupOkTransitive(element, substGroups.at(i), m_namePool)) - m_stateMachine->addTransition(b, substGroups.at(i), endState); + if (XsdSchemaHelper::substitutionGroupOkTransitive(element, XsdElement::Ptr(substGroups.at(i)), m_namePool)) + m_stateMachine->addTransition(b, XsdElement::Ptr(substGroups.at(i)), endState); } } -- cgit v0.12 From 02bb8e4c5f4584f3c0a7ed16bcba20c7f43456cd Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Wed, 27 Apr 2011 13:58:50 +0300 Subject: Fix BlendBench::unalignedBlendArgb32 test case The test case freed the wrong pointer, causing crash in Symbian devices. Task-number: QTBUG-17489 Reviewed-by: Janne Koskinen --- tests/benchmarks/gui/image/blendbench/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/benchmarks/gui/image/blendbench/main.cpp b/tests/benchmarks/gui/image/blendbench/main.cpp index a16fd5a..06c36e7 100644 --- a/tests/benchmarks/gui/image/blendbench/main.cpp +++ b/tests/benchmarks/gui/image/blendbench/main.cpp @@ -208,9 +208,9 @@ void BlendBench::unalignedBlendArgb32() uchar *srcMemory = static_cast(qMallocAligned((dimension * dimension * sizeof(quint32)) + 16, 16)); QFETCH(int, offset); - srcMemory += (offset * sizeof(quint32)); + uchar *imageSrcMemory = srcMemory + (offset * sizeof(quint32)); - QImage src(srcMemory, dimension, dimension, QImage::Format_ARGB32_Premultiplied); + QImage src(imageSrcMemory, dimension, dimension, QImage::Format_ARGB32_Premultiplied); src.fill(0x87654321); QPainter painter(&destination); -- cgit v0.12 From 3a10cfc583f30be4dd98e1fcc3463c3d8bc14f31 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 28 Apr 2011 15:32:46 +0200 Subject: Changelog: Qt Designer 4.8 --- dist/changes-4.8.0 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/changes-4.8.0 b/dist/changes-4.8.0 index fa50f24..b8cc626 100644 --- a/dist/changes-4.8.0 +++ b/dist/changes-4.8.0 @@ -97,9 +97,17 @@ Qt for Windows CE - Assistant - - Designer - + * [QTBUG-18631] Enabled the use of promoted QWidgets in the buddy editor. + * [QTBUG-18120] Fixed saving of the Z-order. + * [QTBUG-13683] Fixed saving of QGridLayout and QFormLayout + by QFormBuilder. + * [QTBUG-10890] Added a filter to the rich text editor dialog. + that simplifies the HTML markup generated. + * [QTBUG-7777] Added support for QIcon::fromTheme. + * [QTBUG-7169] Fixed QtUiTools to be built with the correct + lib-infix. + * [QTBUG-3120] Added support for alignment of box layout items. - Linguist - Linguist GUI -- cgit v0.12 From 18fcbf7ae41504324cd453ba9b9655f3e94f6495 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 29 Apr 2011 09:58:30 +0200 Subject: Fix glyph position issue with fallback fonts Task-number: QTBUG-18933 Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 122382f..cb5ba0e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2149,6 +2149,9 @@ QList QTextLine::glyphs(int from, int length) const QGlyphLayout subLayout = glyphLayout.mid(start, end - start); glyphLayoutHash.insertMulti(multiFontEngine->engine(which), GlyphInfo(subLayout, pos, flags)); + for (int i = 0; i < subLayout.numGlyphs; i++) + pos += QPointF(subLayout.advances_x[i].toReal(), + subLayout.advances_y[i].toReal()); start = end; which = e; -- cgit v0.12 From cb5e526c6023237c36aac3446a0a18288f39f3a9 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 29 Apr 2011 10:07:12 +0200 Subject: Make sure QFont's resolve mask is copied on compilers with C++0x support The QFont consists of a d pointer and a resolve mask, and they should both be copied in the assignment operator. Task-number: QTBUG-18921 Done-by: Friedemann Kleint --- src/gui/text/qfont.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 8dbc746..0c7b6f8 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -239,7 +239,7 @@ public: bool isCopyOf(const QFont &) const; #ifdef Q_COMPILER_RVALUE_REFS inline QFont &operator=(QFont &&other) - { qSwap(d, other.d); return *this; } + { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; } #endif #ifdef Q_WS_WIN -- cgit v0.12 From c7407b389cc3b5583e1e0e3dff62d3fcdbcf4251 Mon Sep 17 00:00:00 2001 From: Eckhart Koppen Date: Fri, 29 Apr 2011 12:00:03 +0300 Subject: Updated DEF files for QtGui and QtOpenGL Marked functions absent for WINSCW and ARMV5 Reviewed-by: TrustMe --- src/s60installs/bwins/QtGuiu.def | 48 ++++++++++++++++----------------- src/s60installs/bwins/QtOpenGLu.def | 2 +- src/s60installs/eabi/QtGuiu.def | 54 ++++++++++++++++++------------------- src/s60installs/eabi/QtOpenGLu.def | 4 +-- 4 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 813bbf8..64a1617 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12855,7 +12855,7 @@ EXPORTS ?populate@QTextureGlyphCache@@QAEXPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12854 NONAME ABSENT ; void QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) ?hasPartialUpdateSupport@QWindowSurface@@UBE_NXZ @ 12855 NONAME ABSENT ; bool QWindowSurface::hasPartialUpdateSupport(void) const ?scroll@QRuntimePixmapData@@UAE_NHHABVQRect@@@Z @ 12856 NONAME ; bool QRuntimePixmapData::scroll(int, int, class QRect const &) - ?qt_draw_glyphs@@YAXPAVQPainter@@PBIPBVQPointF@@H@Z @ 12857 NONAME ; void qt_draw_glyphs(class QPainter *, unsigned int const *, class QPointF const *, int) + ?qt_draw_glyphs@@YAXPAVQPainter@@PBIPBVQPointF@@H@Z @ 12857 NONAME ABSENT ; void qt_draw_glyphs(class QPainter *, unsigned int const *, class QPointF const *, int) ?nativeDisplay@QEgl@@YAHXZ @ 12858 NONAME ; int QEgl::nativeDisplay(void) ?PreDocConstructL@QS60MainApplication@@UAEXXZ @ 12859 NONAME ; void QS60MainApplication::PreDocConstructL(void) ?detach@QStaticText@@AAEXXZ @ 12860 NONAME ; void QStaticText::detach(void) @@ -13213,7 +13213,7 @@ EXPORTS ??0QRasterWindowSurface@@QAE@PAVQWidget@@_N@Z @ 13212 NONAME ; QRasterWindowSurface::QRasterWindowSurface(class QWidget *, bool) ?brushChanged@QBlitterPaintEngine@@UAEXXZ @ 13213 NONAME ; void QBlitterPaintEngine::brushChanged(void) ?clip@QBlitterPaintEngine@@UAEXABVQRect@@W4ClipOperation@Qt@@@Z @ 13214 NONAME ; void QBlitterPaintEngine::clip(class QRect const &, enum Qt::ClipOperation) - ?detach@QGlyphs@@AAEXXZ @ 13215 NONAME ; void QGlyphs::detach(void) + ?detach@QGlyphs@@AAEXXZ @ 13215 NONAME ABSENT ; void QGlyphs::detach(void) ?trUtf8@QInternalMimeData@@SA?AVQString@@PBD0@Z @ 13216 NONAME ; class QString QInternalMimeData::trUtf8(char const *, char const *) ??0QShowEvent@@QAE@ABV0@@Z @ 13217 NONAME ABSENT ; QShowEvent::QShowEvent(class QShowEvent const &) ??0QMouseEvent@@QAE@ABV0@@Z @ 13218 NONAME ABSENT ; QMouseEvent::QMouseEvent(class QMouseEvent const &) @@ -13260,7 +13260,7 @@ EXPORTS ?trUtf8@QFlickGesture@@SA?AVQString@@PBD0@Z @ 13259 NONAME ; class QString QFlickGesture::trUtf8(char const *, char const *) ?stop@QScroller@@QAEXXZ @ 13260 NONAME ; void QScroller::stop(void) ?retrieveData@QInternalMimeData@@MBE?AVQVariant@@ABVQString@@W4Type@2@@Z @ 13261 NONAME ; class QVariant QInternalMimeData::retrieveData(class QString const &, enum QVariant::Type) const - ??8QGlyphs@@QBE_NABV0@@Z @ 13262 NONAME ; bool QGlyphs::operator==(class QGlyphs const &) const + ??8QGlyphs@@QBE_NABV0@@Z @ 13262 NONAME ABSENT ; bool QGlyphs::operator==(class QGlyphs const &) const ?drawImage@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQImage@@0V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 13263 NONAME ; void QBlitterPaintEngine::drawImage(class QRectF const &, class QImage const &, class QRectF const &, class QFlags) ?contentPos@QScrollEvent@@QBE?AVQPointF@@XZ @ 13264 NONAME ; class QPointF QScrollEvent::contentPos(void) const ?mimeTypes@QAbstractProxyModel@@UBE?AVQStringList@@XZ @ 13265 NONAME ; class QStringList QAbstractProxyModel::mimeTypes(void) const @@ -13286,7 +13286,7 @@ EXPORTS ?canFetchMore@QAbstractProxyModel@@UBE_NABVQModelIndex@@@Z @ 13285 NONAME ; bool QAbstractProxyModel::canFetchMore(class QModelIndex const &) const ??4QStyleOptionProgressBarV2@@QAEAAV0@ABV0@@Z @ 13286 NONAME ABSENT ; class QStyleOptionProgressBarV2 & QStyleOptionProgressBarV2::operator=(class QStyleOptionProgressBarV2 const &) ??1QScroller@@EAE@XZ @ 13287 NONAME ; QScroller::~QScroller(void) - ?setFont@QGlyphs@@QAEXABVQFont@@@Z @ 13288 NONAME ; void QGlyphs::setFont(class QFont const &) + ?setFont@QGlyphs@@QAEXABVQFont@@@Z @ 13288 NONAME ABSENT ; void QGlyphs::setFont(class QFont const &) ?startPos@QScrollPrepareEvent@@QBE?AVQPointF@@XZ @ 13289 NONAME ; class QPointF QScrollPrepareEvent::startPos(void) const ?resize@QBlittablePixmapData@@UAEXHH@Z @ 13290 NONAME ; void QBlittablePixmapData::resize(int, int) ?setTabsClosable@QMdiArea@@QAEX_N@Z @ 13291 NONAME ; void QMdiArea::setTabsClosable(bool) @@ -13304,14 +13304,14 @@ EXPORTS ?opacityChanged@QBlitterPaintEngine@@UAEXXZ @ 13303 NONAME ; void QBlitterPaintEngine::opacityChanged(void) ?tr@QFlickGesture@@SA?AVQString@@PBD0H@Z @ 13304 NONAME ; class QString QFlickGesture::tr(char const *, char const *, int) ??_EQTextCursor@@QAE@I@Z @ 13305 NONAME ABSENT ; QTextCursor::~QTextCursor(unsigned int) - ?createExplicitFontWithName@QFontEngine@@IBE?AVQFont@@ABVQString@@@Z @ 13306 NONAME ; class QFont QFontEngine::createExplicitFontWithName(class QString const &) const + ?createExplicitFontWithName@QFontEngine@@IBE?AVQFont@@ABVQString@@@Z @ 13306 NONAME ABSENT ; class QFont QFontEngine::createExplicitFontWithName(class QString const &) const ?setState@QBlitterPaintEngine@@UAEXPAVQPainterState@@@Z @ 13307 NONAME ; void QBlitterPaintEngine::setState(class QPainterState *) ?clip@QBlitterPaintEngine@@UAEXABVQRegion@@W4ClipOperation@Qt@@@Z @ 13308 NONAME ; void QBlitterPaintEngine::clip(class QRegion const &, enum Qt::ClipOperation) ?subPixelPositionForX@QTextureGlyphCache@@QBE?AUQFixed@@U2@@Z @ 13309 NONAME ; struct QFixed QTextureGlyphCache::subPixelPositionForX(struct QFixed) const ?hasAlphaChannel@QBlittablePixmapData@@UBE_NXZ @ 13310 NONAME ; bool QBlittablePixmapData::hasAlphaChannel(void) const ?setSnapPositionsX@QScroller@@QAEXABV?$QList@M@@@Z @ 13311 NONAME ; void QScroller::setSnapPositionsX(class QList const &) ?numberSuffix@QTextListFormat@@QBE?AVQString@@XZ @ 13312 NONAME ; class QString QTextListFormat::numberSuffix(void) const - ??HQGlyphs@@ABE?AV0@ABV0@@Z @ 13313 NONAME ; class QGlyphs QGlyphs::operator+(class QGlyphs const &) const + ??HQGlyphs@@ABE?AV0@ABV0@@Z @ 13313 NONAME ABSENT ; class QGlyphs QGlyphs::operator+(class QGlyphs const &) const ??0QGradient@@QAE@ABV0@@Z @ 13314 NONAME ABSENT ; QGradient::QGradient(class QGradient const &) ?tabsMovable@QMdiArea@@QBE_NXZ @ 13315 NONAME ; bool QMdiArea::tabsMovable(void) const ??4QInputMethodEvent@@QAEAAV0@ABV0@@Z @ 13316 NONAME ABSENT ; class QInputMethodEvent & QInputMethodEvent::operator=(class QInputMethodEvent const &) @@ -13329,7 +13329,7 @@ EXPORTS ??_EQKeySequence@@QAE@I@Z @ 13328 NONAME ABSENT ; QKeySequence::~QKeySequence(unsigned int) ?tr@QInternalMimeData@@SA?AVQString@@PBD0H@Z @ 13329 NONAME ; class QString QInternalMimeData::tr(char const *, char const *, int) ?velocity@QScroller@@QBE?AVQPointF@@XZ @ 13330 NONAME ; class QPointF QScroller::velocity(void) const - ?glyphIndexes@QGlyphs@@QBE?AV?$QVector@I@@XZ @ 13331 NONAME ; class QVector QGlyphs::glyphIndexes(void) const + ?glyphIndexes@QGlyphs@@QBE?AV?$QVector@I@@XZ @ 13331 NONAME ABSENT ; class QVector QGlyphs::glyphIndexes(void) const ?get@QFontPrivate@@SAPAV1@ABVQFont@@@Z @ 13332 NONAME ; class QFontPrivate * QFontPrivate::get(class QFont const &) ?setScrollMetric@QScrollerProperties@@QAEXW4ScrollMetric@1@ABVQVariant@@@Z @ 13333 NONAME ; void QScrollerProperties::setScrollMetric(enum QScrollerProperties::ScrollMetric, class QVariant const &) ??4QGradient@@QAEAAV0@ABV0@@Z @ 13334 NONAME ABSENT ; class QGradient & QGradient::operator=(class QGradient const &) @@ -13339,7 +13339,7 @@ EXPORTS ??0QTextTableFormat@@QAE@ABV0@@Z @ 13338 NONAME ABSENT ; QTextTableFormat::QTextTableFormat(class QTextTableFormat const &) ??_EQImagePixmapCleanupHooks@@QAE@I@Z @ 13339 NONAME ABSENT ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(unsigned int) ?fetchMore@QAbstractProxyModel@@UAEXABVQModelIndex@@@Z @ 13340 NONAME ; void QAbstractProxyModel::fetchMore(class QModelIndex const &) - ?glyphs@QTextLine@@ABE?AV?$QList@VQGlyphs@@@@HH@Z @ 13341 NONAME ; class QList QTextLine::glyphs(int, int) const + ?glyphs@QTextLine@@ABE?AV?$QList@VQGlyphs@@@@HH@Z @ 13341 NONAME ABSENT ; class QList QTextLine::glyphs(int, int) const ?getStaticMetaObject@QFlickGesture@@SAABUQMetaObject@@XZ @ 13342 NONAME ; struct QMetaObject const & QFlickGesture::getStaticMetaObject(void) ?setViewportSize@QScrollPrepareEvent@@QAEXABVQSizeF@@@Z @ 13343 NONAME ; void QScrollPrepareEvent::setViewportSize(class QSizeF const &) ??0QStatusTipEvent@@QAE@ABV0@@Z @ 13344 NONAME ABSENT ; QStatusTipEvent::QStatusTipEvent(class QStatusTipEvent const &) @@ -13374,7 +13374,7 @@ EXPORTS ??4QStyleOptionQ3DockWindow@@QAEAAV0@ABV0@@Z @ 13373 NONAME ABSENT ; class QStyleOptionQ3DockWindow & QStyleOptionQ3DockWindow::operator=(class QStyleOptionQ3DockWindow const &) ?qt_metacast@QFlickGesture@@UAEPAXPBD@Z @ 13374 NONAME ; void * QFlickGesture::qt_metacast(char const *) ??_EQFont@@QAE@I@Z @ 13375 NONAME ABSENT ; QFont::~QFont(unsigned int) - ?setPositions@QGlyphs@@QAEXABV?$QVector@VQPointF@@@@@Z @ 13376 NONAME ; void QGlyphs::setPositions(class QVector const &) + ?setPositions@QGlyphs@@QAEXABV?$QVector@VQPointF@@@@@Z @ 13376 NONAME ABSENT ; void QGlyphs::setPositions(class QVector const &) ??4QStyleOptionDockWidget@@QAEAAV0@ABV0@@Z @ 13377 NONAME ABSENT ; class QStyleOptionDockWidget & QStyleOptionDockWidget::operator=(class QStyleOptionDockWidget const &) ??0QPainterState@@QAE@ABV0@@Z @ 13378 NONAME ABSENT ; QPainterState::QPainterState(class QPainterState const &) ??4QStyleOptionFrame@@QAEAAV0@ABV0@@Z @ 13379 NONAME ABSENT ; class QStyleOptionFrame & QStyleOptionFrame::operator=(class QStyleOptionFrame const &) @@ -13384,7 +13384,7 @@ EXPORTS ?renderHintsChanged@QBlitterPaintEngine@@UAEXXZ @ 13383 NONAME ; void QBlitterPaintEngine::renderHintsChanged(void) ?supportedDropActions@QAbstractProxyModel@@UBE?AV?$QFlags@W4DropAction@Qt@@@@XZ @ 13384 NONAME ; class QFlags QAbstractProxyModel::supportedDropActions(void) const ?fillRect@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQBrush@@@Z @ 13385 NONAME ; void QBlitterPaintEngine::fillRect(class QRectF const &, class QBrush const &) - ?setGlyphIndexes@QGlyphs@@QAEXABV?$QVector@I@@@Z @ 13386 NONAME ; void QGlyphs::setGlyphIndexes(class QVector const &) + ?setGlyphIndexes@QGlyphs@@QAEXABV?$QVector@I@@@Z @ 13386 NONAME ABSENT ; void QGlyphs::setGlyphIndexes(class QVector const &) ?alphaMapBoundingBox@QFontEngine@@UAE?AUglyph_metrics_t@@IABVQTransform@@W4GlyphFormat@1@@Z @ 13387 NONAME ABSENT ; struct glyph_metrics_t QFontEngine::alphaMapBoundingBox(unsigned int, class QTransform const &, enum QFontEngine::GlyphFormat) ?resendPrepareEvent@QScroller@@QAEXXZ @ 13388 NONAME ; void QScroller::resendPrepareEvent(void) ??4QTextLength@@QAEAAV0@ABV0@@Z @ 13389 NONAME ABSENT ; class QTextLength & QTextLength::operator=(class QTextLength const &) @@ -13399,12 +13399,12 @@ EXPORTS ?scrollTo@QScroller@@QAEXABVQPointF@@H@Z @ 13398 NONAME ; void QScroller::scrollTo(class QPointF const &, int) ?ungrabGesture@QScroller@@SAXPAVQObject@@@Z @ 13399 NONAME ; void QScroller::ungrabGesture(class QObject *) ??4QItemSelectionRange@@QAEAAV0@ABV0@@Z @ 13400 NONAME ABSENT ; class QItemSelectionRange & QItemSelectionRange::operator=(class QItemSelectionRange const &) - ?clear@QGlyphs@@QAEXXZ @ 13401 NONAME ; void QGlyphs::clear(void) + ?clear@QGlyphs@@QAEXXZ @ 13401 NONAME ABSENT ; void QGlyphs::clear(void) ??_EQStyleOptionViewItemV4@@QAE@I@Z @ 13402 NONAME ABSENT ; QStyleOptionViewItemV4::~QStyleOptionViewItemV4(unsigned int) ??1QBlittablePixmapData@@UAE@XZ @ 13403 NONAME ; QBlittablePixmapData::~QBlittablePixmapData(void) ?formatsHelper@QInternalMimeData@@SA?AVQStringList@@PBVQMimeData@@@Z @ 13404 NONAME ; class QStringList QInternalMimeData::formatsHelper(class QMimeData const *) ?qt_metacast@QInternalMimeData@@UAEPAXPBD@Z @ 13405 NONAME ; void * QInternalMimeData::qt_metacast(char const *) - ?font@QGlyphs@@QBE?AVQFont@@XZ @ 13406 NONAME ; class QFont QGlyphs::font(void) const + ?font@QGlyphs@@QBE?AVQFont@@XZ @ 13406 NONAME ABSENT ; class QFont QGlyphs::font(void) const ?paintEngine@QBlittablePixmapData@@UBEPAVQPaintEngine@@XZ @ 13407 NONAME ; class QPaintEngine * QBlittablePixmapData::paintEngine(void) const ?unsetDefaultScrollerProperties@QScrollerProperties@@SAXXZ @ 13408 NONAME ; void QScrollerProperties::unsetDefaultScrollerProperties(void) ?hasChildren@QAbstractProxyModel@@UBE_NABVQModelIndex@@@Z @ 13409 NONAME ; bool QAbstractProxyModel::hasChildren(class QModelIndex const &) const @@ -13422,7 +13422,7 @@ EXPORTS ?qt_metacall@QInternalMimeData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13421 NONAME ; int QInternalMimeData::qt_metacall(enum QMetaObject::Call, int, void * *) ?lineHeightType@QTextBlockFormat@@QBEHXZ @ 13422 NONAME ; int QTextBlockFormat::lineHeightType(void) const ?hintingPreference@QFont@@QBE?AW4HintingPreference@1@XZ @ 13423 NONAME ; enum QFont::HintingPreference QFont::hintingPreference(void) const - ??0QGlyphs@@QAE@XZ @ 13424 NONAME ; QGlyphs::QGlyphs(void) + ??0QGlyphs@@QAE@XZ @ 13424 NONAME ABSENT ; QGlyphs::QGlyphs(void) ?trUtf8@QInternalMimeData@@SA?AVQString@@PBD0H@Z @ 13425 NONAME ; class QString QInternalMimeData::trUtf8(char const *, char const *, int) ??0QImageIOHandlerFactoryInterface@@QAE@XZ @ 13426 NONAME ABSENT ; QImageIOHandlerFactoryInterface::QImageIOHandlerFactoryInterface(void) ??_EQRegion@@QAE@I@Z @ 13427 NONAME ABSENT ; QRegion::~QRegion(unsigned int) @@ -13442,10 +13442,10 @@ EXPORTS ?clip@QBlitterPaintEngine@@UAEXABVQVectorPath@@W4ClipOperation@Qt@@@Z @ 13441 NONAME ; void QBlitterPaintEngine::clip(class QVectorPath const &, enum Qt::ClipOperation) ??1QScrollEvent@@UAE@XZ @ 13442 NONAME ; QScrollEvent::~QScrollEvent(void) ?state@QScroller@@QBE?AW4State@1@XZ @ 13443 NONAME ; enum QScroller::State QScroller::state(void) const - ?positions@QGlyphs@@QBE?AV?$QVector@VQPointF@@@@XZ @ 13444 NONAME ; class QVector QGlyphs::positions(void) const + ?positions@QGlyphs@@QBE?AV?$QVector@VQPointF@@@@XZ @ 13444 NONAME ABSENT ; class QVector QGlyphs::positions(void) const ?tr@QScroller@@SA?AVQString@@PBD0@Z @ 13445 NONAME ; class QString QScroller::tr(char const *, char const *) ?canReadData@QInternalMimeData@@SA_NABVQString@@@Z @ 13446 NONAME ; bool QInternalMimeData::canReadData(class QString const &) - ?glyphs@QTextLayout@@QBE?AV?$QList@VQGlyphs@@@@XZ @ 13447 NONAME ; class QList QTextLayout::glyphs(void) const + ?glyphs@QTextLayout@@QBE?AV?$QList@VQGlyphs@@@@XZ @ 13447 NONAME ABSENT ; class QList QTextLayout::glyphs(void) const ?leadingSpaceWidth@QTextEngine@@QAE?AUQFixed@@ABUQScriptLine@@@Z @ 13448 NONAME ; struct QFixed QTextEngine::leadingSpaceWidth(struct QScriptLine const &) ??_EQTextFormat@@QAE@I@Z @ 13449 NONAME ABSENT ; QTextFormat::~QTextFormat(unsigned int) ??4QStyleOptionTabWidgetFrame@@QAEAAV0@ABV0@@Z @ 13450 NONAME ABSENT ; class QStyleOptionTabWidgetFrame & QStyleOptionTabWidgetFrame::operator=(class QStyleOptionTabWidgetFrame const &) @@ -13463,7 +13463,7 @@ EXPORTS ??0QInternalMimeData@@QAE@XZ @ 13462 NONAME ; QInternalMimeData::QInternalMimeData(void) ??_EQScrollEvent@@UAE@I@Z @ 13463 NONAME ; QScrollEvent::~QScrollEvent(unsigned int) ?features@QRasterWindowSurface@@UBE?AV?$QFlags@W4WindowSurfaceFeature@QWindowSurface@@@@XZ @ 13464 NONAME ; class QFlags QRasterWindowSurface::features(void) const - ??4QGlyphs@@QAEAAV0@ABV0@@Z @ 13465 NONAME ; class QGlyphs & QGlyphs::operator=(class QGlyphs const &) + ??4QGlyphs@@QAEAAV0@ABV0@@Z @ 13465 NONAME ABSENT ; class QGlyphs & QGlyphs::operator=(class QGlyphs const &) ??4QQuaternion@@QAEAAV0@ABV0@@Z @ 13466 NONAME ABSENT ; class QQuaternion & QQuaternion::operator=(class QQuaternion const &) ??4Symbol@QCss@@QAEAAU01@ABU01@@Z @ 13467 NONAME ABSENT ; struct QCss::Symbol & QCss::Symbol::operator=(struct QCss::Symbol const &) ??0QBlittable@@QAE@ABVQSize@@V?$QFlags@W4Capability@QBlittable@@@@@Z @ 13468 NONAME ; QBlittable::QBlittable(class QSize const &, class QFlags) @@ -13480,10 +13480,10 @@ EXPORTS ?calculateSubPixelPositionCount@QTextureGlyphCache@@IBEHI@Z @ 13479 NONAME ; int QTextureGlyphCache::calculateSubPixelPositionCount(unsigned int) const ??0QTextImageFormat@@QAE@ABV0@@Z @ 13480 NONAME ABSENT ; QTextImageFormat::QTextImageFormat(class QTextImageFormat const &) ??0QMoveEvent@@QAE@ABV0@@Z @ 13481 NONAME ABSENT ; QMoveEvent::QMoveEvent(class QMoveEvent const &) - ?glyphs@QTextFragment@@QBE?AV?$QList@VQGlyphs@@@@XZ @ 13482 NONAME ; class QList QTextFragment::glyphs(void) const + ?glyphs@QTextFragment@@QBE?AV?$QList@VQGlyphs@@@@XZ @ 13482 NONAME ABSENT ; class QList QTextFragment::glyphs(void) const ??0QInputContextFactoryInterface@@QAE@XZ @ 13483 NONAME ABSENT ; QInputContextFactoryInterface::QInputContextFactoryInterface(void) ??0QTextFrameFormat@@QAE@ABV0@@Z @ 13484 NONAME ABSENT ; QTextFrameFormat::QTextFrameFormat(class QTextFrameFormat const &) - ?resetInternalData@QAbstractProxyModel@@IAEXXZ @ 13485 NONAME ; void QAbstractProxyModel::resetInternalData(void) + ?resetInternalData@QAbstractProxyModel@@IAEXXZ @ 13485 NONAME ABSENT ; void QAbstractProxyModel::resetInternalData(void) ??0Symbol@QCss@@QAE@ABU01@@Z @ 13486 NONAME ABSENT ; QCss::Symbol::Symbol(struct QCss::Symbol const &) ?features@QWindowSurface@@UBE?AV?$QFlags@W4WindowSurfaceFeature@QWindowSurface@@@@XZ @ 13487 NONAME ; class QFlags QWindowSurface::features(void) const ?markRasterOverlay@QBlittablePixmapData@@QAEXABVQVectorPath@@@Z @ 13488 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QVectorPath const &) @@ -13499,7 +13499,7 @@ EXPORTS ?swap@QPainterPath@@QAEXAAV1@@Z @ 13498 NONAME ; void QPainterPath::swap(class QPainterPath &) ??4QStyleOptionRubberBand@@QAEAAV0@ABV0@@Z @ 13499 NONAME ABSENT ; class QStyleOptionRubberBand & QStyleOptionRubberBand::operator=(class QStyleOptionRubberBand const &) ?minimumSizeHint@QCheckBox@@UBE?AVQSize@@XZ @ 13500 NONAME ; class QSize QCheckBox::minimumSizeHint(void) const - ?createExplicitFont@QFontEngine@@UBE?AVQFont@@XZ @ 13501 NONAME ; class QFont QFontEngine::createExplicitFont(void) const + ?createExplicitFont@QFontEngine@@UBE?AVQFont@@XZ @ 13501 NONAME ABSENT ; class QFont QFontEngine::createExplicitFont(void) const ?alphaMapForGlyph@QFontEngine@@UAE?AVQImage@@IUQFixed@@@Z @ 13502 NONAME ; class QImage QFontEngine::alphaMapForGlyph(unsigned int, struct QFixed) ?fillTexture@QImageTextureGlyphCache@@UAEXABUCoord@QTextureGlyphCache@@IUQFixed@@@Z @ 13503 NONAME ; void QImageTextureGlyphCache::fillTexture(struct QTextureGlyphCache::Coord const &, unsigned int, struct QFixed) ?swap@QIcon@@QAEXAAV1@@Z @ 13504 NONAME ; void QIcon::swap(class QIcon &) @@ -13532,11 +13532,11 @@ EXPORTS ?pixelPerMeter@QScroller@@QBE?AVQPointF@@XZ @ 13531 NONAME ; class QPointF QScroller::pixelPerMeter(void) const ?target@QScroller@@QBEPAVQObject@@XZ @ 13532 NONAME ; class QObject * QScroller::target(void) const ?swap@QKeySequence@@QAEXAAV1@@Z @ 13533 NONAME ; void QKeySequence::swap(class QKeySequence &) - ??1QGlyphs@@QAE@XZ @ 13534 NONAME ; QGlyphs::~QGlyphs(void) + ??1QGlyphs@@QAE@XZ @ 13534 NONAME ABSENT ; QGlyphs::~QGlyphs(void) ?lineHeight@QTextBlockFormat@@QBEMXZ @ 13535 NONAME ; float QTextBlockFormat::lineHeight(void) const ?stroke@QBlitterPaintEngine@@UAEXABVQVectorPath@@ABVQPen@@@Z @ 13536 NONAME ; void QBlitterPaintEngine::stroke(class QVectorPath const &, class QPen const &) ?tr@QInternalMimeData@@SA?AVQString@@PBD0@Z @ 13537 NONAME ; class QString QInternalMimeData::tr(char const *, char const *) - ??9QGlyphs@@QBE_NABV0@@Z @ 13538 NONAME ; bool QGlyphs::operator!=(class QGlyphs const &) const + ??9QGlyphs@@QBE_NABV0@@Z @ 13538 NONAME ABSENT ; bool QGlyphs::operator!=(class QGlyphs const &) const ??1QBlittable@@UAE@XZ @ 13539 NONAME ; QBlittable::~QBlittable(void) ??_EQBlitterPaintEngine@@UAE@I@Z @ 13540 NONAME ; QBlitterPaintEngine::~QBlitterPaintEngine(unsigned int) ??0QCloseEvent@@QAE@ABV0@@Z @ 13541 NONAME ABSENT ; QCloseEvent::QCloseEvent(class QCloseEvent const &) @@ -13547,7 +13547,7 @@ EXPORTS ?finalPosition@QScroller@@QBE?AVQPointF@@XZ @ 13546 NONAME ; class QPointF QScroller::finalPosition(void) const ??4QStyleOptionTabWidgetFrameV2@@QAEAAV0@ABV0@@Z @ 13547 NONAME ABSENT ; class QStyleOptionTabWidgetFrameV2 & QStyleOptionTabWidgetFrameV2::operator=(class QStyleOptionTabWidgetFrameV2 const &) ?drawStaticTextItem@QBlitterPaintEngine@@UAEXPAVQStaticTextItem@@@Z @ 13548 NONAME ; void QBlitterPaintEngine::drawStaticTextItem(class QStaticTextItem *) - ??0QGlyphs@@QAE@ABV0@@Z @ 13549 NONAME ; QGlyphs::QGlyphs(class QGlyphs const &) + ??0QGlyphs@@QAE@ABV0@@Z @ 13549 NONAME ABSENT ; QGlyphs::QGlyphs(class QGlyphs const &) ?lock@QBlittable@@QAEPAVQImage@@XZ @ 13550 NONAME ; class QImage * QBlittable::lock(void) ?setFontHintingPreference@QTextCharFormat@@QAEXW4HintingPreference@QFont@@@Z @ 13551 NONAME ; void QTextCharFormat::setFontHintingPreference(enum QFont::HintingPreference) ??4QStyleOptionTabV2@@QAEAAV0@ABV0@@Z @ 13552 NONAME ABSENT ; class QStyleOptionTabV2 & QStyleOptionTabV2::operator=(class QStyleOptionTabV2 const &) @@ -13559,7 +13559,7 @@ EXPORTS ?markRasterOverlay@QBlittablePixmapData@@QAEXABVQPointF@@ABVQTextItem@@@Z @ 13558 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QPointF const &, class QTextItem const &) ?trUtf8@QScroller@@SA?AVQString@@PBD0@Z @ 13559 NONAME ; class QString QScroller::trUtf8(char const *, char const *) ??_EQIcon@@QAE@I@Z @ 13560 NONAME ABSENT ; QIcon::~QIcon(unsigned int) - ??YQGlyphs@@AAEAAV0@ABV0@@Z @ 13561 NONAME ; class QGlyphs & QGlyphs::operator+=(class QGlyphs const &) + ??YQGlyphs@@AAEAAV0@ABV0@@Z @ 13561 NONAME ABSENT ; class QGlyphs & QGlyphs::operator+=(class QGlyphs const &) ??9QScrollerProperties@@QBE_NABV0@@Z @ 13562 NONAME ; bool QScrollerProperties::operator!=(class QScrollerProperties const &) const ??0QTextListFormat@@QAE@ABV0@@Z @ 13563 NONAME ABSENT ; QTextListFormat::QTextListFormat(class QTextListFormat const &) ?drawEllipse@QBlitterPaintEngine@@UAEXABVQRectF@@@Z @ 13564 NONAME ; void QBlitterPaintEngine::drawEllipse(class QRectF const &) @@ -13590,7 +13590,7 @@ EXPORTS ?qt_addBitmapToPath@@YAXMMPBEHHHPAVQPainterPath@@@Z @ 13589 NONAME ; void qt_addBitmapToPath(float, float, unsigned char const *, int, int, int, class QPainterPath *) ?staticMetaObject@QInternalMimeData@@2UQMetaObject@@B @ 13590 NONAME ; struct QMetaObject const QInternalMimeData::staticMetaObject ?activeScrollers@QScroller@@SA?AV?$QList@PAVQScroller@@@@XZ @ 13591 NONAME ; class QList QScroller::activeScrollers(void) - ?drawGlyphs@QPainter@@QAEXABVQPointF@@ABVQGlyphs@@@Z @ 13592 NONAME ; void QPainter::drawGlyphs(class QPointF const &, class QGlyphs const &) + ?drawGlyphs@QPainter@@QAEXABVQPointF@@ABVQGlyphs@@@Z @ 13592 NONAME ABSENT ; void QPainter::drawGlyphs(class QPointF const &, class QGlyphs const &) ??4QTextFrameFormat@@QAEAAV0@ABV0@@Z @ 13593 NONAME ABSENT ; class QTextFrameFormat & QTextFrameFormat::operator=(class QTextFrameFormat const &) ?staticMetaObjectExtraData@QStylePlugin@@0UQMetaObjectExtraData@@B @ 13594 NONAME ; struct QMetaObjectExtraData const QStylePlugin::staticMetaObjectExtraData ?staticMetaObjectExtraData@QToolBar@@0UQMetaObjectExtraData@@B @ 13595 NONAME ; struct QMetaObjectExtraData const QToolBar::staticMetaObjectExtraData diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def index f1db022..27aed05 100644 --- a/src/s60installs/bwins/QtOpenGLu.def +++ b/src/s60installs/bwins/QtOpenGLu.def @@ -818,7 +818,7 @@ EXPORTS ?glGenFramebuffers@QGLFunctions@@QAEXHPAI@Z @ 817 NONAME ; void QGLFunctions::glGenFramebuffers(int, unsigned int *) ?glVertexAttrib3fv@QGLFunctions@@QAEXIPBM@Z @ 818 NONAME ; void QGLFunctions::glVertexAttrib3fv(unsigned int, float const *) ?glGetVertexAttribPointerv@QGLFunctions@@QAEXIIPAPAX@Z @ 819 NONAME ; void QGLFunctions::glGetVertexAttribPointerv(unsigned int, unsigned int, void * *) - ?snippetNameStr@QGLEngineSharedShaders@@SA?AVQByteArray@@W4SnippetName@1@@Z @ 820 NONAME ; class QByteArray QGLEngineSharedShaders::snippetNameStr(enum QGLEngineSharedShaders::SnippetName) + ?snippetNameStr@QGLEngineSharedShaders@@SA?AVQByteArray@@W4SnippetName@1@@Z @ 820 NONAME ABSENT ; class QByteArray QGLEngineSharedShaders::snippetNameStr(enum QGLEngineSharedShaders::SnippetName) ?glUniformMatrix4fv@QGLFunctions@@QAEXHHEPBM@Z @ 821 NONAME ; void QGLFunctions::glUniformMatrix4fv(int, int, unsigned char, float const *) ?setContext@QGLTextureGlyphCache@@QAEXPBVQGLContext@@@Z @ 822 NONAME ; void QGLTextureGlyphCache::setContext(class QGLContext const *) ?glDeleteBuffers@QGLFunctions@@QAEXHPBI@Z @ 823 NONAME ; void QGLFunctions::glDeleteBuffers(int, unsigned int const *) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 6646401..d3fdc0c 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11820,7 +11820,7 @@ EXPORTS _ZN20QGraphicsItemPrivate16clearFocusHelperEb @ 11819 NONAME _ZN24QImagePixmapCleanupHooks13isImageCachedERK6QImage @ 11820 NONAME _ZN24QImagePixmapCleanupHooks14isPixmapCachedERK7QPixmap @ 11821 NONAME - _Z14qt_draw_glyphsP8QPainterPKjPK7QPointFi @ 11822 NONAME + _Z14qt_draw_glyphsP8QPainterPKjPK7QPointFi @ 11822 NONAME ABSENT _ZN10QImageData14convertInPlaceEN6QImage6FormatE6QFlagsIN2Qt19ImageConversionFlagEE @ 11823 NONAME _ZN10QZipReader5closeEv @ 11824 NONAME _ZN10QZipReader8FileInfoC1ERKS0_ @ 11825 NONAME @@ -12230,7 +12230,7 @@ EXPORTS _ZN17QInternalMimeDataD2Ev @ 12229 NONAME _ZN18QTextureGlyphCache19fillInPendingGlyphsEv @ 12230 NONAME _ZN19QAbstractProxyModel11setItemDataERK11QModelIndexRK4QMapIi8QVariantE @ 12231 NONAME - _ZN19QAbstractProxyModel17resetInternalDataEv @ 12232 NONAME + _ZN19QAbstractProxyModel17resetInternalDataEv @ 12232 NONAME ABSENT _ZN19QAbstractProxyModel4sortEiN2Qt9SortOrderE @ 12233 NONAME _ZN19QAbstractProxyModel9fetchMoreERK11QModelIndex @ 12234 NONAME _ZN19QApplicationPrivateC1ERiPPcN12QApplication4TypeEi @ 12235 NONAME @@ -12302,22 +12302,22 @@ EXPORTS _ZN5QFont20setHintingPreferenceENS_17HintingPreferenceE @ 12301 NONAME _ZN6QImage4fillEN2Qt11GlobalColorE @ 12302 NONAME _ZN6QImage4fillERK6QColor @ 12303 NONAME - _ZN7QGlyphs12setPositionsERK7QVectorI7QPointFE @ 12304 NONAME - _ZN7QGlyphs15setGlyphIndexesERK7QVectorIjE @ 12305 NONAME - _ZN7QGlyphs5clearEv @ 12306 NONAME - _ZN7QGlyphs6detachEv @ 12307 NONAME - _ZN7QGlyphs7setFontERK5QFont @ 12308 NONAME - _ZN7QGlyphsC1ERKS_ @ 12309 NONAME - _ZN7QGlyphsC1Ev @ 12310 NONAME - _ZN7QGlyphsC2ERKS_ @ 12311 NONAME - _ZN7QGlyphsC2Ev @ 12312 NONAME - _ZN7QGlyphsD1Ev @ 12313 NONAME - _ZN7QGlyphsD2Ev @ 12314 NONAME - _ZN7QGlyphsaSERKS_ @ 12315 NONAME - _ZN7QGlyphspLERKS_ @ 12316 NONAME + _ZN7QGlyphs12setPositionsERK7QVectorI7QPointFE @ 12304 NONAME ABSENT + _ZN7QGlyphs15setGlyphIndexesERK7QVectorIjE @ 12305 NONAME ABSENT + _ZN7QGlyphs5clearEv @ 12306 NONAME ABSENT + _ZN7QGlyphs6detachEv @ 12307 NONAME ABSENT + _ZN7QGlyphs7setFontERK5QFont @ 12308 NONAME ABSENT + _ZN7QGlyphsC1ERKS_ @ 12309 NONAME ABSENT + _ZN7QGlyphsC1Ev @ 12310 NONAME ABSENT + _ZN7QGlyphsC2ERKS_ @ 12311 NONAME ABSENT + _ZN7QGlyphsC2Ev @ 12312 NONAME ABSENT + _ZN7QGlyphsD1Ev @ 12313 NONAME ABSENT + _ZN7QGlyphsD2Ev @ 12314 NONAME ABSENT + _ZN7QGlyphsaSERKS_ @ 12315 NONAME ABSENT + _ZN7QGlyphspLERKS_ @ 12316 NONAME ABSENT _ZN8QMdiArea14setTabsMovableEb @ 12317 NONAME _ZN8QMdiArea15setTabsClosableEb @ 12318 NONAME - _ZN8QPainter10drawGlyphsERK7QPointFRK7QGlyphs @ 12319 NONAME + _ZN8QPainter10drawGlyphsERK7QPointFRK7QGlyphs @ 12319 NONAME ABSENT _ZN9QScroller11grabGestureEP7QObjectNS_19ScrollerGestureTypeE @ 12320 NONAME _ZN9QScroller11handleInputENS_5InputERK7QPointFx @ 12321 NONAME _ZN9QScroller11hasScrollerEP7QObject @ 12322 NONAME @@ -12351,9 +12351,9 @@ EXPORTS _ZNK10QBlittable12capabilitiesEv @ 12350 NONAME _ZNK10QBlittable4sizeEv @ 12351 NONAME _ZNK10QTabWidget14heightForWidthEi @ 12352 NONAME - _ZNK11QFontEngine18createExplicitFontEv @ 12353 NONAME - _ZNK11QFontEngine26createExplicitFontWithNameERK7QString @ 12354 NONAME - _ZNK11QTextLayout6glyphsEv @ 12355 NONAME + _ZNK11QFontEngine18createExplicitFontEv @ 12353 NONAME ABSENT + _ZNK11QFontEngine26createExplicitFontWithNameERK7QString @ 12354 NONAME ABSENT + _ZNK11QTextLayout6glyphsEv @ 12355 NONAME ABSENT _ZNK12QFontMetrics10inFontUcs4Ej @ 12356 NONAME _ZNK12QRadioButton15minimumSizeHintEv @ 12357 NONAME _ZNK12QScrollEvent10contentPosEv @ 12358 NONAME @@ -12362,7 +12362,7 @@ EXPORTS _ZNK12QScrollEvent6d_funcEv @ 12361 NONAME _ZNK13QFlickGesture10metaObjectEv @ 12362 NONAME _ZNK13QFontMetricsF10inFontUcs4Ej @ 12363 NONAME - _ZNK13QTextFragment6glyphsEv @ 12364 NONAME + _ZNK13QTextFragment6glyphsEv @ 12364 NONAME ABSENT _ZNK14QFileOpenEvent8openFileER5QFile6QFlagsIN9QIODevice12OpenModeFlagEE @ 12365 NONAME _ZNK14QWidgetPrivate17hasHeightForWidthEv @ 12366 NONAME _ZNK16QFileSystemModel5rmdirERK11QModelIndex @ 12367 NONAME @@ -12396,12 +12396,12 @@ EXPORTS _ZNK20QBlittablePixmapData9blittableEv @ 12395 NONAME _ZNK20QRasterWindowSurface24hasStaticContentsSupportEv @ 12396 NONAME ABSENT _ZNK5QFont17hintingPreferenceEv @ 12397 NONAME - _ZNK7QGlyphs12glyphIndexesEv @ 12398 NONAME - _ZNK7QGlyphs4fontEv @ 12399 NONAME - _ZNK7QGlyphs9positionsEv @ 12400 NONAME - _ZNK7QGlyphseqERKS_ @ 12401 NONAME - _ZNK7QGlyphsneERKS_ @ 12402 NONAME - _ZNK7QGlyphsplERKS_ @ 12403 NONAME + _ZNK7QGlyphs12glyphIndexesEv @ 12398 NONAME ABSENT + _ZNK7QGlyphs4fontEv @ 12399 NONAME ABSENT + _ZNK7QGlyphs9positionsEv @ 12400 NONAME ABSENT + _ZNK7QGlyphseqERKS_ @ 12401 NONAME ABSENT + _ZNK7QGlyphsneERKS_ @ 12402 NONAME ABSENT + _ZNK7QGlyphsplERKS_ @ 12403 NONAME ABSENT _ZNK8QMdiArea11tabsMovableEv @ 12404 NONAME _ZNK8QMdiArea12tabsClosableEv @ 12405 NONAME _ZNK8QPainter16clipBoundingRectEv @ 12406 NONAME @@ -12413,7 +12413,7 @@ EXPORTS _ZNK9QScroller5stateEv @ 12412 NONAME _ZNK9QScroller6targetEv @ 12413 NONAME _ZNK9QScroller8velocityEv @ 12414 NONAME - _ZNK9QTextLine6glyphsEii @ 12415 NONAME + _ZNK9QTextLine6glyphsEii @ 12415 NONAME ABSENT _ZTI10QBlittable @ 12416 NONAME _ZTI12QScrollEvent @ 12417 NONAME _ZTI13QFlickGesture @ 12418 NONAME diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index 44f7306..75763c5 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -759,9 +759,9 @@ EXPORTS _ZNK14QGLPaintDevice9isFlippedEv @ 758 NONAME _ZNK16QGLWindowSurface8featuresEv @ 759 NONAME _ZNK26QGLFramebufferObjectFormat6mipmapEv @ 760 NONAME - _ZTI22QGLContextResourceBase @ 761 NONAME + _ZTI22QGLContextResourceBase @ 761 NONAME ABSENT _ZTI27QGLContextGroupResourceBase @ 762 NONAME - _ZTV22QGLContextResourceBase @ 763 NONAME + _ZTV22QGLContextResourceBase @ 763 NONAME ABSENT _ZTV27QGLContextGroupResourceBase @ 764 NONAME _ZThn104_N20QGLTextureGlyphCacheD0Ev @ 765 NONAME _ZThn104_N20QGLTextureGlyphCacheD1Ev @ 766 NONAME -- cgit v0.12 From 244fedd484b022881b906b1bc794d5af19d02843 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 29 Apr 2011 12:26:08 +0200 Subject: Change the repaint() to an update(). Forcing to repaint might cause a recursive repaint. Since there is no apparent reason to directly repaint, we just call update(). Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_mac.mm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 354f05b..8dc9d2e 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2733,7 +2733,7 @@ QWidget::macCGHandle() const return handle(); } -void qt_mac_repaintParentUnderAlienWidget(QWidget *alienWidget) +void qt_mac_updateParentUnderAlienWidget(QWidget *alienWidget) { QWidget *nativeParent = alienWidget->nativeParentWidget(); if (!nativeParent) @@ -2741,7 +2741,7 @@ void qt_mac_repaintParentUnderAlienWidget(QWidget *alienWidget) QPoint globalPos = alienWidget->mapToGlobal(QPoint(0, 0)); QRect dirtyRect = QRect(nativeParent->mapFromGlobal(globalPos), alienWidget->size()); - nativeParent->repaint(dirtyRect); + nativeParent->update(dirtyRect); } void QWidget::destroy(bool destroyWindow, bool destroySubWindows) @@ -2752,7 +2752,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows) if (!isWindow() && parentWidget()) parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry())); if (!internalWinId()) - qt_mac_repaintParentUnderAlienWidget(this); + qt_mac_updateParentUnderAlienWidget(this); d->deactivateWidgetCleanup(); qt_mac_event_release(this); if(testAttribute(Qt::WA_WState_Created)) { @@ -3683,7 +3683,7 @@ void QWidgetPrivate::hide_sys() [view setHidden:YES]; } else { // INVARIANT: q is alien. Repaint where q is placed instead: - qt_mac_repaintParentUnderAlienWidget(q); + qt_mac_updateParentUnderAlienWidget(q); } #endif } -- cgit v0.12 From 10fd0d3e5c88c7b0265db3acdd75cb3d6f35ee63 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2011 17:22:13 +0200 Subject: use the Hash typedef Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess.cpp | 12 ++++++------ src/corelib/io/qprocess_unix.cpp | 6 +++--- src/corelib/io/qprocess_win.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a45225f..d18571c 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -190,8 +190,8 @@ template<> void QSharedDataPointer::detach() QStringList QProcessEnvironmentPrivate::toList() const { QStringList result; - QHash::ConstIterator it = hash.constBegin(), - end = hash.constEnd(); + Hash::ConstIterator it = hash.constBegin(), + end = hash.constEnd(); for ( ; it != end; ++it) { QString data = nameToString(it.key()); QString value = valueToString(it.value()); @@ -224,8 +224,8 @@ QProcessEnvironment QProcessEnvironmentPrivate::fromList(const QStringList &list QStringList QProcessEnvironmentPrivate::keys() const { QStringList result; - QHash::ConstIterator it = hash.constBegin(), - end = hash.constEnd(); + Hash::ConstIterator it = hash.constBegin(), + end = hash.constEnd(); for ( ; it != end; ++it) result << nameToString(it.key()); return result; @@ -233,8 +233,8 @@ QStringList QProcessEnvironmentPrivate::keys() const void QProcessEnvironmentPrivate::insert(const Hash &h) { - QHash::ConstIterator it = h.constBegin(), - end = h.constEnd(); + Hash::ConstIterator it = h.constBegin(), + end = h.constEnd(); for ( ; it != end; ++it) hash.insert(it.key(), it.value()); } diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 3af9b46..47b4963 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -453,7 +453,7 @@ bool QProcessPrivate::createChannel(Channel &channel) } } -static char **_q_dupEnvironment(const QHash &environment, int *envc) +static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environment, int *envc) { *envc = 0; if (environment.isEmpty()) @@ -475,8 +475,8 @@ static char **_q_dupEnvironment(const QHash &environment envp[environment.count()] = 0; envp[environment.count() + 1] = 0; - QHash::ConstIterator it = environment.constBegin(); - const QHash::ConstIterator end = environment.constEnd(); + QProcessEnvironmentPrivate::Hash::ConstIterator it = environment.constBegin(); + const QProcessEnvironmentPrivate::Hash::ConstIterator end = environment.constEnd(); for ( ; it != end; ++it) { QByteArray key = it.key(); QByteArray value = it.value(); diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 625ed98..74d8926 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -278,11 +278,11 @@ static QString qt_create_commandline(const QString &program, const QStringList & return args; } -static QByteArray qt_create_environment(const QHash &environment) +static QByteArray qt_create_environment(const QProcessEnvironmentPrivate::Hash &environment) { QByteArray envlist; if (!environment.isEmpty()) { - QHash copy = environment; + QProcessEnvironmentPrivate::Hash copy = environment; // add PATH if necessary (for DLL loading) if (!copy.contains(QLatin1String("PATH"))) { @@ -299,8 +299,8 @@ static QByteArray qt_create_environment(const QHash &environme } int pos = 0; - QHash::ConstIterator it = copy.constBegin(), - end = copy.constEnd(); + QProcessEnvironmentPrivate::Hash::ConstIterator it = copy.constBegin(), + end = copy.constEnd(); static const wchar_t equal = L'='; static const wchar_t nul = L'\0'; -- cgit v0.12 From 6a53f17c7039f1a5405912a4a645572e215410bb Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2011 17:31:06 +0200 Subject: minor optimization: use QList::reserve() Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index d18571c..868c86d 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -190,6 +190,7 @@ template<> void QSharedDataPointer::detach() QStringList QProcessEnvironmentPrivate::toList() const { QStringList result; + result.reserve(hash.size()); Hash::ConstIterator it = hash.constBegin(), end = hash.constEnd(); for ( ; it != end; ++it) { @@ -224,6 +225,7 @@ QProcessEnvironment QProcessEnvironmentPrivate::fromList(const QStringList &list QStringList QProcessEnvironmentPrivate::keys() const { QStringList result; + result.reserve(hash.size()); Hash::ConstIterator it = hash.constBegin(), end = hash.constEnd(); for ( ; it != end; ++it) -- cgit v0.12 From e989a4d375b279b3ea61139cb07596e0e4b79e28 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2011 17:30:13 +0200 Subject: remove unused functions Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 868c86d..f82a872 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -146,33 +146,21 @@ QT_BEGIN_NAMESPACE #ifdef Q_OS_WIN static inline QProcessEnvironmentPrivate::Unit prepareName(const QString &name) { return name.toUpper(); } -static inline QProcessEnvironmentPrivate::Unit prepareName(const QByteArray &name) -{ return QString::fromLocal8Bit(name).toUpper(); } static inline QString nameToString(const QProcessEnvironmentPrivate::Unit &name) { return name; } static inline QProcessEnvironmentPrivate::Unit prepareValue(const QString &value) { return value; } -static inline QProcessEnvironmentPrivate::Unit prepareValue(const QByteArray &value) -{ return QString::fromLocal8Bit(value); } static inline QString valueToString(const QProcessEnvironmentPrivate::Unit &value) { return value; } -static inline QByteArray valueToByteArray(const QProcessEnvironmentPrivate::Unit &value) -{ return value.toLocal8Bit(); } #else -static inline QProcessEnvironmentPrivate::Unit prepareName(const QByteArray &name) -{ return name; } static inline QProcessEnvironmentPrivate::Unit prepareName(const QString &name) { return name.toLocal8Bit(); } static inline QString nameToString(const QProcessEnvironmentPrivate::Unit &name) { return QString::fromLocal8Bit(name); } -static inline QProcessEnvironmentPrivate::Unit prepareValue(const QByteArray &value) -{ return value; } static inline QProcessEnvironmentPrivate::Unit prepareValue(const QString &value) { return value.toLocal8Bit(); } static inline QString valueToString(const QProcessEnvironmentPrivate::Unit &value) { return QString::fromLocal8Bit(value); } -static inline QByteArray valueToByteArray(const QProcessEnvironmentPrivate::Unit &value) -{ return value; } #endif template<> void QSharedDataPointer::detach() -- cgit v0.12 From 11a79c65ea992be0e2ede7dc8f60660c9190291f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2011 17:50:40 +0200 Subject: split QProcessEnvironmentPrivate::Unit into Key and Value Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess.cpp | 16 ++++++++-------- src/corelib/io/qprocess_p.h | 9 ++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index f82a872..ecad92c 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -144,22 +144,22 @@ QT_BEGIN_NAMESPACE \sa QProcess, QProcess::systemEnvironment(), QProcess::setProcessEnvironment() */ #ifdef Q_OS_WIN -static inline QProcessEnvironmentPrivate::Unit prepareName(const QString &name) +static inline QProcessEnvironmentPrivate::Key prepareName(const QString &name) { return name.toUpper(); } -static inline QString nameToString(const QProcessEnvironmentPrivate::Unit &name) +static inline QString nameToString(const QProcessEnvironmentPrivate::Key &name) { return name; } -static inline QProcessEnvironmentPrivate::Unit prepareValue(const QString &value) +static inline QProcessEnvironmentPrivate::Value prepareValue(const QString &value) { return value; } -static inline QString valueToString(const QProcessEnvironmentPrivate::Unit &value) +static inline QString valueToString(const QProcessEnvironmentPrivate::Value &value) { return value; } #else -static inline QProcessEnvironmentPrivate::Unit prepareName(const QString &name) +static inline QProcessEnvironmentPrivate::Key prepareName(const QString &name) { return name.toLocal8Bit(); } -static inline QString nameToString(const QProcessEnvironmentPrivate::Unit &name) +static inline QString nameToString(const QProcessEnvironmentPrivate::Key &name) { return QString::fromLocal8Bit(name); } -static inline QProcessEnvironmentPrivate::Unit prepareValue(const QString &value) +static inline QProcessEnvironmentPrivate::Value prepareValue(const QString &value) { return value.toLocal8Bit(); } -static inline QString valueToString(const QProcessEnvironmentPrivate::Unit &value) +static inline QString valueToString(const QProcessEnvironmentPrivate::Value &value) { return QString::fromLocal8Bit(value); } #endif diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 7bfcb31..b2a69ef 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -85,11 +85,14 @@ class QProcessEnvironmentPrivate: public QSharedData { public: #ifdef Q_OS_WIN - typedef QString Unit; + typedef QString Key; + typedef QString Value; #else - typedef QByteArray Unit; + typedef QByteArray Key; + typedef QByteArray Value; #endif - typedef QHash Hash; + + typedef QHash Hash; Hash hash; static QProcessEnvironment fromList(const QStringList &list); -- cgit v0.12 From f3db5603871928ebed43a085a496397e65952b39 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2011 18:32:36 +0200 Subject: make QProcessEnvironment on Windows preserve variable name case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit while windows itself does not care which case the variable names are in, they may be passed to unix tools which *do* care. note that this uses true case folding for string comparisons while windows uses uppercasing. this means that "ess" and "eß" will be considered the same by us, while not by windows. this is not expected to have real-world impact, particularly because non-ascii variable names are not used much. Task-number: QTCREATORBUG-3110 Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess.cpp | 2 +- src/corelib/io/qprocess_p.h | 14 +++++++++++++- src/corelib/io/qprocess_win.cpp | 12 +++++++----- tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp | 13 +++++++------ 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index ecad92c..20efeae 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -145,7 +145,7 @@ QT_BEGIN_NAMESPACE */ #ifdef Q_OS_WIN static inline QProcessEnvironmentPrivate::Key prepareName(const QString &name) -{ return name.toUpper(); } +{ return QProcessEnvironmentPrivate::Key(name); } static inline QString nameToString(const QProcessEnvironmentPrivate::Key &name) { return name; } static inline QProcessEnvironmentPrivate::Value prepareValue(const QString &value) diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index b2a69ef..2d4c556 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -85,7 +85,15 @@ class QProcessEnvironmentPrivate: public QSharedData { public: #ifdef Q_OS_WIN - typedef QString Key; + class Key : public QString + { + public: + Key() {} + explicit Key(const QString &other) : QString(other) {} + Key(const Key &other) : QString(other) {} + bool operator==(const Key &other) const { return !compare(other, Qt::CaseInsensitive); } + }; + typedef QString Value; #else typedef QByteArray Key; @@ -100,6 +108,10 @@ public: QStringList keys() const; void insert(const Hash &hash); }; +#ifdef Q_OS_WIN +Q_DECLARE_TYPEINFO(QProcessEnvironmentPrivate::Key, Q_MOVABLE_TYPE); +inline uint qHash(const QProcessEnvironmentPrivate::Key &key) { return qHash(key.toCaseFolded()); } +#endif class QProcessPrivate : public QIODevicePrivate { diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 74d8926..82043a5 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -285,17 +285,19 @@ static QByteArray qt_create_environment(const QProcessEnvironmentPrivate::Hash & QProcessEnvironmentPrivate::Hash copy = environment; // add PATH if necessary (for DLL loading) - if (!copy.contains(QLatin1String("PATH"))) { + QProcessEnvironmentPrivate::Key pathKey(QLatin1String("PATH")); + if (!copy.contains(pathKey)) { QByteArray path = qgetenv("PATH"); if (!path.isEmpty()) - copy.insert(QLatin1String("PATH"), QString::fromLocal8Bit(path)); + copy.insert(pathKey, QString::fromLocal8Bit(path)); } // add systemroot if needed - if (!copy.contains(QLatin1String("SYSTEMROOT"))) { - QByteArray systemRoot = qgetenv("SYSTEMROOT"); + QProcessEnvironmentPrivate::Key rootKey(QLatin1String("SystemRoot")); + if (!copy.contains(rootKey)) { + QByteArray systemRoot = qgetenv("SystemRoot"); if (!systemRoot.isEmpty()) - copy.insert(QLatin1String("SYSTEMROOT"), QString::fromLocal8Bit(systemRoot)); + copy.insert(rootKey, QString::fromLocal8Bit(systemRoot)); } int pos = 0; diff --git a/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp b/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp index 1c26343..98d4890 100644 --- a/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp +++ b/tests/auto/qprocessenvironment/tst_qprocessenvironment.cpp @@ -43,10 +43,6 @@ #include #include -// Note: -// in cross-platform tests, ALWAYS use UPPERCASE variable names -// That's because on Windows, the variables are uppercased - class tst_QProcessEnvironment: public QObject { Q_OBJECT @@ -214,7 +210,7 @@ void tst_QProcessEnvironment::caseSensitivity() e.insert("foo", "bar"); #ifdef Q_OS_WIN - // on Windows, it's uppercased + // Windows is case-insensitive, but case-preserving QVERIFY(e.contains("foo")); QVERIFY(e.contains("FOO")); QVERIFY(e.contains("FoO")); @@ -223,8 +219,12 @@ void tst_QProcessEnvironment::caseSensitivity() QCOMPARE(e.value("FOO"), QString("bar")); QCOMPARE(e.value("FoO"), QString("bar")); + // Per Windows, this overwrites the value, but keeps the name's original capitalization + e.insert("Foo", "Bar"); + QStringList list = e.toStringList(); - QCOMPARE(list.at(0), QString("FOO=bar")); + QCOMPARE(list.length(), 1); + QCOMPARE(list.at(0), QString("foo=Bar")); #else // otherwise, it's case sensitive QVERIFY(e.contains("foo")); @@ -236,6 +236,7 @@ void tst_QProcessEnvironment::caseSensitivity() QCOMPARE(e.value("foo"), QString("bar")); QStringList list = e.toStringList(); + QCOMPARE(list.length(), 2); QVERIFY(list.contains("foo=bar")); QVERIFY(list.contains("FOO=baz")); #endif -- cgit v0.12 From a2d70d71c8c7652ded41d5d603672c3927df44e6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2011 19:04:02 +0200 Subject: move key/value converters to the private class this will enable them to access other members later Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess.cpp | 29 +++++------------------------ src/corelib/io/qprocess_p.h | 10 ++++++++++ 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 20efeae..ffd5ff0 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -143,25 +143,6 @@ QT_BEGIN_NAMESPACE \sa QProcess, QProcess::systemEnvironment(), QProcess::setProcessEnvironment() */ -#ifdef Q_OS_WIN -static inline QProcessEnvironmentPrivate::Key prepareName(const QString &name) -{ return QProcessEnvironmentPrivate::Key(name); } -static inline QString nameToString(const QProcessEnvironmentPrivate::Key &name) -{ return name; } -static inline QProcessEnvironmentPrivate::Value prepareValue(const QString &value) -{ return value; } -static inline QString valueToString(const QProcessEnvironmentPrivate::Value &value) -{ return value; } -#else -static inline QProcessEnvironmentPrivate::Key prepareName(const QString &name) -{ return name.toLocal8Bit(); } -static inline QString nameToString(const QProcessEnvironmentPrivate::Key &name) -{ return QString::fromLocal8Bit(name); } -static inline QProcessEnvironmentPrivate::Value prepareValue(const QString &value) -{ return value.toLocal8Bit(); } -static inline QString valueToString(const QProcessEnvironmentPrivate::Value &value) -{ return QString::fromLocal8Bit(value); } -#endif template<> void QSharedDataPointer::detach() { @@ -321,7 +302,7 @@ void QProcessEnvironment::clear() */ bool QProcessEnvironment::contains(const QString &name) const { - return d ? d->hash.contains(prepareName(name)) : false; + return d ? d->hash.contains(d->prepareName(name)) : false; } /*! @@ -343,7 +324,7 @@ bool QProcessEnvironment::contains(const QString &name) const void QProcessEnvironment::insert(const QString &name, const QString &value) { // d detaches from null - d->hash.insert(prepareName(name), prepareValue(value)); + d->hash.insert(d->prepareName(name), d->prepareValue(value)); } /*! @@ -360,7 +341,7 @@ void QProcessEnvironment::insert(const QString &name, const QString &value) void QProcessEnvironment::remove(const QString &name) { if (d) - d->hash.remove(prepareName(name)); + d->hash.remove(d->prepareName(name)); } /*! @@ -379,11 +360,11 @@ QString QProcessEnvironment::value(const QString &name, const QString &defaultVa if (!d) return defaultValue; - QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(prepareName(name)); + QProcessEnvironmentPrivate::Hash::ConstIterator it = d->hash.constFind(d->prepareName(name)); if (it == d->hash.constEnd()) return defaultValue; - return valueToString(it.value()); + return d->valueToString(it.value()); } /*! diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 2d4c556..14fc9f3 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -95,9 +95,19 @@ public: }; typedef QString Value; + + inline Key prepareName(const QString &name) const { return Key(name); } + inline QString nameToString(const Key &name) const { return name; } + inline Value prepareValue(const QString &value) const { return value; } + inline QString valueToString(const Value &value) const { return value; } #else typedef QByteArray Key; typedef QByteArray Value; + + inline Key prepareName(const QString &name) const { return name.toLocal8Bit(); } + inline QString nameToString(const Key &name) const { return QString::fromLocal8Bit(name); } + inline Value prepareValue(const QString &value) const { return value.toLocal8Bit(); } + inline QString valueToString(const Value &value) const { return QString::fromLocal8Bit(value); } #endif typedef QHash Hash; -- cgit v0.12 From 18f1613aa8ece72d24ac10e28f06e3db1d8ce400 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 28 Apr 2011 10:53:14 +0200 Subject: make QProcessEnvironment on Unix cache converted variable names the converted keys also cache their hash, as they are used only for the purpose of looking up in a qhash. Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess.cpp | 17 +++++++++++++---- src/corelib/io/qprocess_p.h | 40 +++++++++++++++++++++++++++++++++++----- src/corelib/io/qprocess_unix.cpp | 4 ++-- 3 files changed, 50 insertions(+), 11 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index ffd5ff0..80e0b0f 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -202,12 +202,19 @@ QStringList QProcessEnvironmentPrivate::keys() const return result; } -void QProcessEnvironmentPrivate::insert(const Hash &h) +void QProcessEnvironmentPrivate::insert(const QProcessEnvironmentPrivate &other) { - Hash::ConstIterator it = h.constBegin(), - end = h.constEnd(); + Hash::ConstIterator it = other.hash.constBegin(), + end = other.hash.constEnd(); for ( ; it != end; ++it) hash.insert(it.key(), it.value()); + +#ifdef Q_OS_UNIX + QHash::ConstIterator nit = other.nameMap.constBegin(), + nend = other.nameMap.constEnd(); + for ( ; nit != nend; ++nit) + nameMap.insert(nit.key(), nit.value()); +#endif } /*! @@ -288,6 +295,8 @@ void QProcessEnvironment::clear() { if (d) d->hash.clear(); + // Unix: Don't clear d->nameMap, as the environment is likely to be + // re-populated with the same keys again. } /*! @@ -409,7 +418,7 @@ void QProcessEnvironment::insert(const QProcessEnvironment &e) return; // d detaches from null - d->insert(e.d->hash); + d->insert(*e.d); } void QProcessPrivate::Channel::clear() diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 14fc9f3..9a9981e 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -101,11 +101,33 @@ public: inline Value prepareValue(const QString &value) const { return value; } inline QString valueToString(const Value &value) const { return value; } #else - typedef QByteArray Key; + class Key + { + public: + Key() : hash(0) {} + explicit Key(const QByteArray &other) : key(other), hash(qHash(key)) {} + Key(const Key &other) { *this = other; } + bool operator==(const Key &other) const { return key == other.key; } + + QByteArray key; + uint hash; + }; + typedef QByteArray Value; - inline Key prepareName(const QString &name) const { return name.toLocal8Bit(); } - inline QString nameToString(const Key &name) const { return QString::fromLocal8Bit(name); } + inline Key prepareName(const QString &name) const + { + Key &ent = nameMap[name]; + if (ent.key.isEmpty()) + ent = Key(name.toLocal8Bit()); + return ent; + } + inline QString nameToString(const Key &name) const + { + const QString sname = QString::fromLocal8Bit(name.key); + nameMap[sname] = name; + return sname; + } inline Value prepareValue(const QString &value) const { return value.toLocal8Bit(); } inline QString valueToString(const Value &value) const { return QString::fromLocal8Bit(value); } #endif @@ -113,14 +135,22 @@ public: typedef QHash Hash; Hash hash; +#ifdef Q_OS_UNIX + typedef QHash NameHash; + mutable NameHash nameMap; +#endif + static QProcessEnvironment fromList(const QStringList &list); QStringList toList() const; QStringList keys() const; - void insert(const Hash &hash); + void insert(const QProcessEnvironmentPrivate &other); }; -#ifdef Q_OS_WIN Q_DECLARE_TYPEINFO(QProcessEnvironmentPrivate::Key, Q_MOVABLE_TYPE); + +#ifdef Q_OS_WIN inline uint qHash(const QProcessEnvironmentPrivate::Key &key) { return qHash(key.toCaseFolded()); } +#else +inline uint qHash(const QProcessEnvironmentPrivate::Key &key) { return key.hash; } #endif class QProcessPrivate : public QIODevicePrivate diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 47b4963..b79054a 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -469,7 +469,7 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environm #endif const QByteArray envLibraryPath = qgetenv(libraryPath); bool needToAddLibraryPath = !envLibraryPath.isEmpty() && - !environment.contains(libraryPath); + !environment.contains(QProcessEnvironmentPrivate::Key(QByteArray(libraryPath))); char **envp = new char *[environment.count() + 2]; envp[environment.count()] = 0; @@ -478,7 +478,7 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environm QProcessEnvironmentPrivate::Hash::ConstIterator it = environment.constBegin(); const QProcessEnvironmentPrivate::Hash::ConstIterator end = environment.constEnd(); for ( ; it != end; ++it) { - QByteArray key = it.key(); + QByteArray key = it.key().key; QByteArray value = it.value(); key.reserve(key.length() + 1 + value.length()); key.append('='); -- cgit v0.12 From 60194ad0ea68d7c82b4729119d122dcfeb909842 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2011 21:30:34 +0200 Subject: make QProcessEnvironment::systemEnvironment() encoding-safe on unix, don't do the roundtrip over unicode. on windows, use the WinAPI unicode environment instead of the 8-bit CRT environment. Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess.cpp | 17 ++--------------- src/corelib/io/qprocess_unix.cpp | 17 +++++++++++++++++ src/corelib/io/qprocess_win.cpp | 20 ++++++++++++++++++++ 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 80e0b0f..9ce9fd8 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2301,6 +2301,8 @@ QStringList QProcess::systemEnvironment() } /*! + \fn QProcessEnvironment QProcessEnvironment::systemEnvironment() + \since 4.6 \brief The systemEnvironment function returns the environment of @@ -2316,21 +2318,6 @@ QStringList QProcess::systemEnvironment() \sa QProcess::systemEnvironment() */ -QProcessEnvironment QProcessEnvironment::systemEnvironment() -{ - QProcessEnvironment env; - const char *entry; - for (int count = 0; (entry = environ[count]); ++count) { - const char *equal = strchr(entry, '='); - if (!equal) - continue; - - QByteArray name(entry, equal - entry); - QByteArray value(equal + 1); - env.insert(QString::fromLocal8Bit(name), QString::fromLocal8Bit(value)); - } - return env; -} /*! \typedef Q_PID diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index b79054a..451bf61 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -453,6 +453,23 @@ bool QProcessPrivate::createChannel(Channel &channel) } } +QProcessEnvironment QProcessEnvironment::systemEnvironment() +{ + QProcessEnvironment env; + const char *entry; + for (int count = 0; (entry = environ[count]); ++count) { + const char *equal = strchr(entry, '='); + if (!equal) + continue; + + QByteArray name(entry, equal - entry); + QByteArray value(equal + 1); + env.d->hash.insert(QProcessEnvironmentPrivate::Key(name), + QProcessEnvironmentPrivate::Value(value)); + } + return env; +} + static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environment, int *envc) { *envc = 0; diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 82043a5..7739bbd 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -278,6 +278,26 @@ static QString qt_create_commandline(const QString &program, const QStringList & return args; } +QProcessEnvironment QProcessEnvironment::systemEnvironment() +{ + QProcessEnvironment env; + // Calls to setenv() affect the low-level environment as well. + // This is not the case the other way round. + wchar_t *envStrings = GetEnvironmentStringsW(); + for (const wchar_t *entry = envStrings; *entry; ) { + int entryLen = wcslen(entry); + if (const wchar_t *equal = wcschr(entry, L'=')) { + int nameLen = equal - entry; + QString name = QString::fromWCharArray(entry, nameLen); + QString value = QString::fromWCharArray(equal + 1, entryLen - nameLen - 1); + env.d->hash.insert(QProcessEnvironmentPrivate::Key(name), value); + } + entry += entryLen + 1; + } + FreeEnvironmentStrings(envStrings); + return env; +} + static QByteArray qt_create_environment(const QProcessEnvironmentPrivate::Hash &environment) { QByteArray envlist; -- cgit v0.12 From 7aa4ecdedba60ac4cbc07a774ae9d834677002e9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 21 Apr 2011 21:34:59 +0200 Subject: make QProcessEnvironment on Unix cache converted values values are converted between byte arrays and qstrings on demand. this makes it feasible to use the class as a generic environment container with fast reading and writing access. Reviewed-by: thiago Reviewed-by: dt --- src/corelib/io/qprocess_p.h | 37 ++++++++++++++++++++++++++++++++++--- src/corelib/io/qprocess_unix.cpp | 2 +- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 9a9981e..251f8bc 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -113,7 +113,35 @@ public: uint hash; }; - typedef QByteArray Value; + class Value + { + public: + Value() {} + Value(const Value &other) { *this = other; } + explicit Value(const QString &value) : stringValue(value) {} + explicit Value(const QByteArray &value) : byteValue(value) {} + bool operator==(const Value &other) const + { + return byteValue.isEmpty() && other.byteValue.isEmpty() + ? stringValue == other.stringValue + : bytes() == other.bytes(); + } + QByteArray bytes() const + { + if (byteValue.isEmpty() && !stringValue.isEmpty()) + byteValue = stringValue.toLocal8Bit(); + return byteValue; + } + QString string() const + { + if (stringValue.isEmpty() && !byteValue.isEmpty()) + stringValue = QString::fromLocal8Bit(byteValue); + return stringValue; + } + + mutable QByteArray byteValue; + mutable QString stringValue; + }; inline Key prepareName(const QString &name) const { @@ -128,8 +156,8 @@ public: nameMap[sname] = name; return sname; } - inline Value prepareValue(const QString &value) const { return value.toLocal8Bit(); } - inline QString valueToString(const Value &value) const { return QString::fromLocal8Bit(value); } + inline Value prepareValue(const QString &value) const { return Value(value); } + inline QString valueToString(const Value &value) const { return value.string(); } #endif typedef QHash Hash; @@ -146,6 +174,9 @@ public: void insert(const QProcessEnvironmentPrivate &other); }; Q_DECLARE_TYPEINFO(QProcessEnvironmentPrivate::Key, Q_MOVABLE_TYPE); +#ifdef Q_OS_UNIX +Q_DECLARE_TYPEINFO(QProcessEnvironmentPrivate::Value, Q_MOVABLE_TYPE); +#endif #ifdef Q_OS_WIN inline uint qHash(const QProcessEnvironmentPrivate::Key &key) { return qHash(key.toCaseFolded()); } diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 451bf61..47f3e69 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -496,7 +496,7 @@ static char **_q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environm const QProcessEnvironmentPrivate::Hash::ConstIterator end = environment.constEnd(); for ( ; it != end; ++it) { QByteArray key = it.key().key; - QByteArray value = it.value(); + QByteArray value = it.value().bytes(); key.reserve(key.length() + 1 + value.length()); key.append('='); key.append(value); -- cgit v0.12 From 7254566109b4798411e7b162ca39ffc107095ab0 Mon Sep 17 00:00:00 2001 From: Eckhart Koppen Date: Fri, 29 Apr 2011 16:35:06 +0300 Subject: Updated DEF files for QtGui and QtOpenGl Added new functions Reviewed-by: TrustMe --- src/s60installs/bwins/QtGuiu.def | 63 +++++++++++++++++++++++++++++++++++++ src/s60installs/bwins/QtOpenGLu.def | 14 +++++++++ src/s60installs/eabi/QtGuiu.def | 60 +++++++++++++++++++++++++++++++++++ src/s60installs/eabi/QtOpenGLu.def | 14 +++++++++ 4 files changed, 151 insertions(+) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 64a1617..89f1537 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -13953,4 +13953,67 @@ EXPORTS ?staticMetaObjectExtraData@QWorkspace@@0UQMetaObjectExtraData@@B @ 13952 NONAME ; struct QMetaObjectExtraData const QWorkspace::staticMetaObjectExtraData ?staticMetaObjectExtraData@QSessionManager@@0UQMetaObjectExtraData@@B @ 13953 NONAME ; struct QMetaObjectExtraData const QSessionManager::staticMetaObjectExtraData ?qt_static_metacall@QGraphicsItemAnimation@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13954 NONAME ; void QGraphicsItemAnimation::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?setCursorMoveStyle@QLineControl@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13955 NONAME ; void QLineControl::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?staticMetaObjectExtraData@QIdentityProxyModel@@0UQMetaObjectExtraData@@B @ 13956 NONAME ; struct QMetaObjectExtraData const QIdentityProxyModel::staticMetaObjectExtraData + ?defaultCursorMoveStyle@QTextDocument@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13957 NONAME ; enum QTextCursor::MoveStyle QTextDocument::defaultCursorMoveStyle(void) const + ?offsetInLigature@QTextEngine@@QAE?AUQFixed@@PBUQScriptItem@@HHH@Z @ 13958 NONAME ; struct QFixed QTextEngine::offsetInLigature(struct QScriptItem const *, int, int, int) + ?qt_metacall@QIdentityProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13959 NONAME ; int QIdentityProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *) + ?mapSelectionFromSource@QIdentityProxyModel@@UBE?AVQItemSelection@@ABV2@@Z @ 13960 NONAME ; class QItemSelection QIdentityProxyModel::mapSelectionFromSource(class QItemSelection const &) const + ?qt_static_metacall@QIdentityProxyModel@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 13961 NONAME ; void QIdentityProxyModel::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?mapSelectionToSource@QIdentityProxyModel@@UBE?AVQItemSelection@@ABV2@@Z @ 13962 NONAME ; class QItemSelection QIdentityProxyModel::mapSelectionToSource(class QItemSelection const &) const + ??1QIdentityProxyModel@@UAE@XZ @ 13963 NONAME ; QIdentityProxyModel::~QIdentityProxyModel(void) + ??_EQIdentityProxyModel@@UAE@I@Z @ 13964 NONAME ; QIdentityProxyModel::~QIdentityProxyModel(unsigned int) + ?removeRows@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13965 NONAME ; bool QIdentityProxyModel::removeRows(int, int, class QModelIndex const &) + ?previousLogicalPosition@QTextEngine@@QBEHH@Z @ 13966 NONAME ; int QTextEngine::previousLogicalPosition(int) const + ?metaObject@QIdentityProxyModel@@UBEPBUQMetaObject@@XZ @ 13967 NONAME ; struct QMetaObject const * QIdentityProxyModel::metaObject(void) const + ?cursorMoveStyle@QLineControl@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 13968 NONAME ; enum QTextCursor::MoveStyle QLineControl::cursorMoveStyle(void) const + ?removeColumns@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13969 NONAME ; bool QIdentityProxyModel::removeColumns(int, int, class QModelIndex const &) + ?alignLine@QTextEngine@@QAE?AUQFixed@@ABUQScriptLine@@@Z @ 13970 NONAME ; struct QFixed QTextEngine::alignLine(struct QScriptLine const &) + ?parent@QIdentityProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 13971 NONAME ; class QModelIndex QIdentityProxyModel::parent(class QModelIndex const &) const + ?insertColumns@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13972 NONAME ; bool QIdentityProxyModel::insertColumns(int, int, class QModelIndex const &) + ?dropMimeData@QIdentityProxyModel@@UAE_NPBVQMimeData@@W4DropAction@Qt@@HHABVQModelIndex@@@Z @ 13973 NONAME ; bool QIdentityProxyModel::dropMimeData(class QMimeData const *, enum Qt::DropAction, int, int, class QModelIndex const &) + ?visualCursorMovement@QTextEngine@@QBE_NXZ @ 13974 NONAME ; bool QTextEngine::visualCursorMovement(void) const + ??0QRadialGradient@@QAE@MMMMMM@Z @ 13975 NONAME ; QRadialGradient::QRadialGradient(float, float, float, float, float, float) + ?setSourceModel@QIdentityProxyModel@@UAEXPAVQAbstractItemModel@@@Z @ 13976 NONAME ; void QIdentityProxyModel::setSourceModel(class QAbstractItemModel *) + ?getStaticMetaObject@QIdentityProxyModel@@SAABUQMetaObject@@XZ @ 13977 NONAME ; struct QMetaObject const & QIdentityProxyModel::getStaticMetaObject(void) + ?index@QIdentityProxyModel@@UBE?AVQModelIndex@@HHABV2@@Z @ 13978 NONAME ; class QModelIndex QIdentityProxyModel::index(int, int, class QModelIndex const &) const + ?insertRows@QIdentityProxyModel@@UAE_NHHABVQModelIndex@@@Z @ 13979 NONAME ; bool QIdentityProxyModel::insertRows(int, int, class QModelIndex const &) + ?positionAfterVisualMovement@QTextEngine@@QAEHHW4MoveOperation@QTextCursor@@@Z @ 13980 NONAME ; int QTextEngine::positionAfterVisualMovement(int, enum QTextCursor::MoveOperation) + ?setCenterRadius@QRadialGradient@@QAEXM@Z @ 13981 NONAME ; void QRadialGradient::setCenterRadius(float) + ?leftCursorPosition@QTextLayout@@QBEHH@Z @ 13982 NONAME ; int QTextLayout::leftCursorPosition(int) const + ?focalRadius@QRadialGradient@@QBEMXZ @ 13983 NONAME ; float QRadialGradient::focalRadius(void) const + ?qt_metacast@QIdentityProxyModel@@UAEPAXPBD@Z @ 13984 NONAME ; void * QIdentityProxyModel::qt_metacast(char const *) + ?qt_draw_decoration_for_glyphs@@YAXPAVQPainter@@PBIPBUQFixedPoint@@HPAVQFontEngine@@ABVQFont@@ABVQTextCharFormat@@@Z @ 13985 NONAME ; void qt_draw_decoration_for_glyphs(class QPainter *, unsigned int const *, struct QFixedPoint const *, int, class QFontEngine *, class QFont const &, class QTextCharFormat const &) + ??0QRadialGradient@@QAE@ABVQPointF@@M0M@Z @ 13986 NONAME ; QRadialGradient::QRadialGradient(class QPointF const &, float, class QPointF const &, float) + ?centerRadius@QRadialGradient@@QBEMXZ @ 13987 NONAME ; float QRadialGradient::centerRadius(void) const + ?qt_isExtendedRadialGradient@@YA_NABVQBrush@@@Z @ 13988 NONAME ; bool qt_isExtendedRadialGradient(class QBrush const &) + ?mapToSource@QIdentityProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 13989 NONAME ; class QModelIndex QIdentityProxyModel::mapToSource(class QModelIndex const &) const + ?d_func@QIdentityProxyModel@@AAEPAVQIdentityProxyModelPrivate@@XZ @ 13990 NONAME ; class QIdentityProxyModelPrivate * QIdentityProxyModel::d_func(void) + ?insertionPointsForLine@QTextEngine@@QAEXHAAV?$QVector@H@@@Z @ 13991 NONAME ; void QTextEngine::insertionPointsForLine(int, class QVector &) + ?cloneWithSize@QFontEngine@@UBEPAV1@M@Z @ 13992 NONAME ; class QFontEngine * QFontEngine::cloneWithSize(float) const + ?setCursorMoveStyle@QLineEdit@@QAEXW4MoveStyle@QTextCursor@@@Z @ 13993 NONAME ; void QLineEdit::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ??0QIdentityProxyModel@@IAE@AAVQIdentityProxyModelPrivate@@PAVQObject@@@Z @ 13994 NONAME ; QIdentityProxyModel::QIdentityProxyModel(class QIdentityProxyModelPrivate &, class QObject *) + ?lineNumberForTextPosition@QTextEngine@@QAEHH@Z @ 13995 NONAME ; int QTextEngine::lineNumberForTextPosition(int) + ?beginningOfLine@QTextEngine@@AAEHH@Z @ 13996 NONAME ; int QTextEngine::beginningOfLine(int) + ??0QIdentityProxyModel@@QAE@PAVQObject@@@Z @ 13997 NONAME ; QIdentityProxyModel::QIdentityProxyModel(class QObject *) + ?rightCursorPosition@QTextLayout@@QBEHH@Z @ 13998 NONAME ; int QTextLayout::rightCursorPosition(int) const + ?d_func@QIdentityProxyModel@@ABEPBVQIdentityProxyModelPrivate@@XZ @ 13999 NONAME ; class QIdentityProxyModelPrivate const * QIdentityProxyModel::d_func(void) const + ?columnCount@QIdentityProxyModel@@UBEHABVQModelIndex@@@Z @ 14000 NONAME ; int QIdentityProxyModel::columnCount(class QModelIndex const &) const + ?cursorMoveStyle@QLineEdit@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 14001 NONAME ; enum QTextCursor::MoveStyle QLineEdit::cursorMoveStyle(void) const + ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0H@Z @ 14002 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *, int) + ?setDefaultCursorMoveStyle@QTextDocument@@QAEXW4MoveStyle@QTextCursor@@@Z @ 14003 NONAME ; void QTextDocument::setDefaultCursorMoveStyle(enum QTextCursor::MoveStyle) + ?tr@QIdentityProxyModel@@SA?AVQString@@PBD0H@Z @ 14004 NONAME ; class QString QIdentityProxyModel::tr(char const *, char const *, int) + ?mapFromSource@QIdentityProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 14005 NONAME ; class QModelIndex QIdentityProxyModel::mapFromSource(class QModelIndex const &) const + ?nextLogicalPosition@QTextEngine@@QBEHH@Z @ 14006 NONAME ; int QTextEngine::nextLogicalPosition(int) const + ?setCursorMoveStyle@QTextLayout@@QAEXW4MoveStyle@QTextCursor@@@Z @ 14007 NONAME ; void QTextLayout::setCursorMoveStyle(enum QTextCursor::MoveStyle) + ?doItemsLayout@QTableView@@UAEXXZ @ 14008 NONAME ; void QTableView::doItemsLayout(void) + ?setFocalRadius@QRadialGradient@@QAEXM@Z @ 14009 NONAME ; void QRadialGradient::setFocalRadius(float) + ?qt_painterPathFromVectorPath@@YA?AVQPainterPath@@ABVQVectorPath@@@Z @ 14010 NONAME ; class QPainterPath qt_painterPathFromVectorPath(class QVectorPath const &) + ?tr@QIdentityProxyModel@@SA?AVQString@@PBD0@Z @ 14011 NONAME ; class QString QIdentityProxyModel::tr(char const *, char const *) + ?match@QIdentityProxyModel@@UBE?AV?$QList@VQModelIndex@@@@ABVQModelIndex@@HABVQVariant@@HV?$QFlags@W4MatchFlag@Qt@@@@@Z @ 14012 NONAME ; class QList QIdentityProxyModel::match(class QModelIndex const &, int, class QVariant const &, int, class QFlags) const + ?staticMetaObject@QIdentityProxyModel@@2UQMetaObject@@B @ 14013 NONAME ; struct QMetaObject const QIdentityProxyModel::staticMetaObject + ?rowCount@QIdentityProxyModel@@UBEHABVQModelIndex@@@Z @ 14014 NONAME ; int QIdentityProxyModel::rowCount(class QModelIndex const &) const + ?trUtf8@QIdentityProxyModel@@SA?AVQString@@PBD0@Z @ 14015 NONAME ; class QString QIdentityProxyModel::trUtf8(char const *, char const *) + ?cursorMoveStyle@QTextLayout@@QBE?AW4MoveStyle@QTextCursor@@XZ @ 14016 NONAME ; enum QTextCursor::MoveStyle QTextLayout::cursorMoveStyle(void) const + ?endOfLine@QTextEngine@@AAEHH@Z @ 14017 NONAME ; int QTextEngine::endOfLine(int) diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def index 27aed05..b4dcf4f 100644 --- a/src/s60installs/bwins/QtOpenGLu.def +++ b/src/s60installs/bwins/QtOpenGLu.def @@ -860,4 +860,18 @@ EXPORTS ?glShaderSource@QGLFunctions@@QAEXIHPAPBDPBH@Z @ 859 NONAME ; void QGLFunctions::glShaderSource(unsigned int, int, char const * *, int const *) ?glGetShaderPrecisionFormat@QGLFunctions@@QAEXIIPAH0@Z @ 860 NONAME ; void QGLFunctions::glGetShaderPrecisionFormat(unsigned int, unsigned int, int *, int *) ?insert@QGLContextGroupResourceBase@@QAEXPBVQGLContext@@PAX@Z @ 861 NONAME ; void QGLContextGroupResourceBase::insert(class QGLContext const *, void *) + ?staticMetaObjectExtraData@QGLWindowSurface@@0UQMetaObjectExtraData@@B @ 862 NONAME ; struct QMetaObjectExtraData const QGLWindowSurface::staticMetaObjectExtraData + ?qt_static_metacall@QGLSignalProxy@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 863 NONAME ; void QGLSignalProxy::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?staticMetaObjectExtraData@QGLSignalProxy@@0UQMetaObjectExtraData@@B @ 864 NONAME ; struct QMetaObjectExtraData const QGLSignalProxy::staticMetaObjectExtraData + ?qt_static_metacall@QGLWindowSurface@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 865 NONAME ; void QGLWindowSurface::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?staticMetaObjectExtraData@QGLWidget@@0UQMetaObjectExtraData@@B @ 866 NONAME ; struct QMetaObjectExtraData const QGLWidget::staticMetaObjectExtraData + ?qt_static_metacall@QGraphicsShaderEffect@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 867 NONAME ; void QGraphicsShaderEffect::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?qt_static_metacall@QGLEngineShaderManager@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 868 NONAME ; void QGLEngineShaderManager::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?staticMetaObjectExtraData@QGLShader@@0UQMetaObjectExtraData@@B @ 869 NONAME ; struct QMetaObjectExtraData const QGLShader::staticMetaObjectExtraData + ?staticMetaObjectExtraData@QGLShaderProgram@@0UQMetaObjectExtraData@@B @ 870 NONAME ; struct QMetaObjectExtraData const QGLShaderProgram::staticMetaObjectExtraData + ?qt_static_metacall@QGLWidget@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 871 NONAME ; void QGLWidget::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?qt_static_metacall@QGLShader@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 872 NONAME ; void QGLShader::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) + ?staticMetaObjectExtraData@QGraphicsShaderEffect@@0UQMetaObjectExtraData@@B @ 873 NONAME ; struct QMetaObjectExtraData const QGraphicsShaderEffect::staticMetaObjectExtraData + ?staticMetaObjectExtraData@QGLEngineShaderManager@@0UQMetaObjectExtraData@@B @ 874 NONAME ; struct QMetaObjectExtraData const QGLEngineShaderManager::staticMetaObjectExtraData + ?qt_static_metacall@QGLShaderProgram@@CAXPAVQObject@@W4Call@QMetaObject@@HPAPAX@Z @ 875 NONAME ; void QGLShaderProgram::qt_static_metacall(class QObject *, enum QMetaObject::Call, int, void * *) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index d3fdc0c..418d839 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12799,4 +12799,64 @@ EXPORTS _ZNK10QZipWriter6deviceEv @ 12798 NONAME _ZNK10QZipWriter6existsEv @ 12799 NONAME _ZNK10QZipWriter6statusEv @ 12800 NONAME + _Z28qt_painterPathFromVectorPathRK11QVectorPath @ 12801 NONAME + _Z29qt_draw_decoration_for_glyphsP8QPainterPKjPK11QFixedPointiP11QFontEngineRK5QFontRK15QTextCharFormat @ 12802 NONAME + _ZN10QTableView13doItemsLayoutEv @ 12803 NONAME + _ZN11QTextEngine15beginningOfLineEi @ 12804 NONAME + _ZN11QTextEngine16offsetInLigatureEPK11QScriptItemiii @ 12805 NONAME + _ZN11QTextEngine22insertionPointsForLineEiR7QVectorIiE @ 12806 NONAME + _ZN11QTextEngine25lineNumberForTextPositionEi @ 12807 NONAME + _ZN11QTextEngine27positionAfterVisualMovementEiN11QTextCursor13MoveOperationE @ 12808 NONAME + _ZN11QTextEngine9alignLineERK11QScriptLine @ 12809 NONAME + _ZN11QTextEngine9endOfLineEi @ 12810 NONAME + _ZN11QTextLayout18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12811 NONAME + _ZN13QTextDocument25setDefaultCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12812 NONAME + _ZN15QRadialGradient14setFocalRadiusEf @ 12813 NONAME + _ZN15QRadialGradient15setCenterRadiusEf @ 12814 NONAME + _ZN15QRadialGradientC1ERK7QPointFfS2_f @ 12815 NONAME + _ZN15QRadialGradientC1Effffff @ 12816 NONAME + _ZN15QRadialGradientC2ERK7QPointFfS2_f @ 12817 NONAME + _ZN15QRadialGradientC2Effffff @ 12818 NONAME + _ZN19QIdentityProxyModel10insertRowsEiiRK11QModelIndex @ 12819 NONAME + _ZN19QIdentityProxyModel10removeRowsEiiRK11QModelIndex @ 12820 NONAME + _ZN19QIdentityProxyModel11qt_metacallEN11QMetaObject4CallEiPPv @ 12821 NONAME + _ZN19QIdentityProxyModel11qt_metacastEPKc @ 12822 NONAME + _ZN19QIdentityProxyModel12dropMimeDataEPK9QMimeDataN2Qt10DropActionEiiRK11QModelIndex @ 12823 NONAME + _ZN19QIdentityProxyModel13insertColumnsEiiRK11QModelIndex @ 12824 NONAME + _ZN19QIdentityProxyModel13removeColumnsEiiRK11QModelIndex @ 12825 NONAME + _ZN19QIdentityProxyModel14setSourceModelEP18QAbstractItemModel @ 12826 NONAME + _ZN19QIdentityProxyModel16staticMetaObjectE @ 12827 NONAME DATA 16 + _ZN19QIdentityProxyModel18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 12828 NONAME + _ZN19QIdentityProxyModel19getStaticMetaObjectEv @ 12829 NONAME + _ZN19QIdentityProxyModel25staticMetaObjectExtraDataE @ 12830 NONAME DATA 8 + _ZN19QIdentityProxyModelC1EP7QObject @ 12831 NONAME + _ZN19QIdentityProxyModelC1ER26QIdentityProxyModelPrivateP7QObject @ 12832 NONAME + _ZN19QIdentityProxyModelC2EP7QObject @ 12833 NONAME + _ZN19QIdentityProxyModelC2ER26QIdentityProxyModelPrivateP7QObject @ 12834 NONAME + _ZN19QIdentityProxyModelD0Ev @ 12835 NONAME + _ZN19QIdentityProxyModelD1Ev @ 12836 NONAME + _ZN19QIdentityProxyModelD2Ev @ 12837 NONAME + _ZN9QLineEdit18setCursorMoveStyleEN11QTextCursor9MoveStyleE @ 12838 NONAME + _ZNK10QTextBlock7isValidEv @ 12839 NONAME + _ZNK11QTextEngine19nextLogicalPositionEi @ 12840 NONAME + _ZNK11QTextEngine23previousLogicalPositionEi @ 12841 NONAME + _ZNK11QTextLayout15cursorMoveStyleEv @ 12842 NONAME + _ZNK11QTextLayout18leftCursorPositionEi @ 12843 NONAME + _ZNK11QTextLayout19rightCursorPositionEi @ 12844 NONAME + _ZNK13QTextDocument22defaultCursorMoveStyleEv @ 12845 NONAME + _ZNK15QRadialGradient11focalRadiusEv @ 12846 NONAME + _ZNK15QRadialGradient12centerRadiusEv @ 12847 NONAME + _ZNK19QIdentityProxyModel10metaObjectEv @ 12848 NONAME + _ZNK19QIdentityProxyModel11columnCountERK11QModelIndex @ 12849 NONAME + _ZNK19QIdentityProxyModel11mapToSourceERK11QModelIndex @ 12850 NONAME + _ZNK19QIdentityProxyModel13mapFromSourceERK11QModelIndex @ 12851 NONAME + _ZNK19QIdentityProxyModel20mapSelectionToSourceERK14QItemSelection @ 12852 NONAME + _ZNK19QIdentityProxyModel22mapSelectionFromSourceERK14QItemSelection @ 12853 NONAME + _ZNK19QIdentityProxyModel5indexEiiRK11QModelIndex @ 12854 NONAME + _ZNK19QIdentityProxyModel5matchERK11QModelIndexiRK8QVarianti6QFlagsIN2Qt9MatchFlagEE @ 12855 NONAME + _ZNK19QIdentityProxyModel6parentERK11QModelIndex @ 12856 NONAME + _ZNK19QIdentityProxyModel8rowCountERK11QModelIndex @ 12857 NONAME + _ZNK9QLineEdit15cursorMoveStyleEv @ 12858 NONAME + _ZTI19QIdentityProxyModel @ 12859 NONAME + _ZTV19QIdentityProxyModel @ 12860 NONAME diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def index 75763c5..171d0657 100644 --- a/src/s60installs/eabi/QtOpenGLu.def +++ b/src/s60installs/eabi/QtOpenGLu.def @@ -766,4 +766,18 @@ EXPORTS _ZThn104_N20QGLTextureGlyphCacheD0Ev @ 765 NONAME _ZThn104_N20QGLTextureGlyphCacheD1Ev @ 766 NONAME _ZThn8_NK16QGLWindowSurface8featuresEv @ 767 NONAME + _ZN14QGLSignalProxy18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 768 NONAME + _ZN14QGLSignalProxy25staticMetaObjectExtraDataE @ 769 NONAME DATA 8 + _ZN16QGLShaderProgram18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 770 NONAME + _ZN16QGLShaderProgram25staticMetaObjectExtraDataE @ 771 NONAME DATA 8 + _ZN16QGLWindowSurface18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 772 NONAME + _ZN16QGLWindowSurface25staticMetaObjectExtraDataE @ 773 NONAME DATA 8 + _ZN21QGraphicsShaderEffect18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 774 NONAME + _ZN21QGraphicsShaderEffect25staticMetaObjectExtraDataE @ 775 NONAME DATA 8 + _ZN22QGLEngineShaderManager18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 776 NONAME + _ZN22QGLEngineShaderManager25staticMetaObjectExtraDataE @ 777 NONAME DATA 8 + _ZN9QGLShader18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 778 NONAME + _ZN9QGLShader25staticMetaObjectExtraDataE @ 779 NONAME DATA 8 + _ZN9QGLWidget18qt_static_metacallEP7QObjectN11QMetaObject4CallEiPPv @ 780 NONAME + _ZN9QGLWidget25staticMetaObjectExtraDataE @ 781 NONAME DATA 8 -- cgit v0.12 From 78821cd51c69757a7b4e711c495e702adf97d682 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 29 Apr 2011 16:46:33 +0200 Subject: Revert symbol addition in b033bb9 Because it breaks forward compatibility. We will use the original fix in 4.8. In 4.7 we just make sure it doesn't crash in QTextBlock::next(). Reviewed-by: Thiago Macieira --- src/gui/text/qtextobject.cpp | 7 +------ src/gui/text/qtextobject.h | 2 +- src/s60installs/eabi/QtGuiu.def | 1 - tests/auto/qtextblock/tst_qtextblock.cpp | 12 ------------ 4 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index a403cc5..2a93f67 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -891,11 +891,6 @@ QTextBlockUserData::~QTextBlockUserData() Returns true if this text block is valid; otherwise returns false. */ -bool QTextBlock::isValid() const -{ - return p != 0 && p->blockMap().isValid(n); -} - /*! \fn QTextBlock &QTextBlock::operator=(const QTextBlock &other) @@ -1493,7 +1488,7 @@ QTextBlock::iterator QTextBlock::end() const */ QTextBlock QTextBlock::next() const { - if (!isValid()) + if (!isValid() || !p->blockMap().isValid(n)) return QTextBlock(); return QTextBlock(p, p->blockMap().next(n)); diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index 73aed79..d5c1e8d 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -204,7 +204,7 @@ public: inline QTextBlock(const QTextBlock &o) : p(o.p), n(o.n) {} inline QTextBlock &operator=(const QTextBlock &o) { p = o.p; n = o.n; return *this; } - bool isValid() const; + inline bool isValid() const { return p != 0 && n != 0; } inline bool operator==(const QTextBlock &o) const { return p == o.p && n == o.n; } inline bool operator!=(const QTextBlock &o) const { return p != o.p || n != o.n; } diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 799ac43..fafa07b 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -12183,5 +12183,4 @@ EXPORTS _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME _Z32qt_s60_setPartialScreenInputModeb @ 12183 NONAME _Z29qt_draw_decoration_for_glyphsP8QPainterPKjPK11QFixedPointiP11QFontEngineRK5QFontRK15QTextCharFormat @ 12184 NONAME - _ZNK10QTextBlock7isValidEv @ 12185 NONAME diff --git a/tests/auto/qtextblock/tst_qtextblock.cpp b/tests/auto/qtextblock/tst_qtextblock.cpp index 748d921..cec3a6a 100644 --- a/tests/auto/qtextblock/tst_qtextblock.cpp +++ b/tests/auto/qtextblock/tst_qtextblock.cpp @@ -76,7 +76,6 @@ private slots: void excludeParagraphSeparatorFragment(); void backwardsBlockIterator(); void previousBlock_qtbug18026(); - void removedBlock_qtbug18500(); private: QTextDocument *doc; @@ -182,16 +181,5 @@ void tst_QTextBlock::previousBlock_qtbug18026() QVERIFY(last.isValid()); } -void tst_QTextBlock::removedBlock_qtbug18500() -{ - cursor.insertText("line 1\nline 2\nline 3 \nline 4\n"); - cursor.setPosition(7); - QTextBlock block = cursor.block(); - cursor.setPosition(21, QTextCursor::KeepAnchor); - - cursor.removeSelectedText(); - QVERIFY(!block.isValid()); -} - QTEST_MAIN(tst_QTextBlock) #include "tst_qtextblock.moc" -- cgit v0.12 From 49d2906a9566c8b44df48f51ca137b9ba2feb671 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Fri, 8 Apr 2011 17:34:51 +0200 Subject: Make sure removed QTextBlock is invalid If the block is removed from document block map, we will mark the right node to the current head->freelist index, but it shouldn't be accessed directly, otherwise it can cause crash because of uninitialized node. Hence we need to check if a node index is equal to current freelist index. If so, it cannot be a valid block. Task-number: QTBUG-18500 Reviewed-by: Eskil --- src/gui/text/qfragmentmap_p.h | 5 +++++ src/gui/text/qtextobject.cpp | 5 +++++ src/gui/text/qtextobject.h | 2 +- tests/auto/qtextblock/tst_qtextblock.cpp | 12 ++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qfragmentmap_p.h b/src/gui/text/qfragmentmap_p.h index 501bfff..4057142 100644 --- a/src/gui/text/qfragmentmap_p.h +++ b/src/gui/text/qfragmentmap_p.h @@ -195,6 +195,10 @@ public: head->root = new_root; } + inline bool isValid(uint n) const { + return n > 0 && n != head->freelist; + } + union { Header *head; Fragment *fragments; @@ -854,6 +858,7 @@ public: return data.fragment(index); } inline uint position(uint node, uint field = 0) const { return data.position(node, field); } + inline bool isValid(uint n) const { return data.isValid(n); } inline uint next(uint n) const { return data.next(n); } inline uint previous(uint n) const { return data.previous(n); } inline uint size(uint node, uint field = 0) const { return data.size(node, field); } diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 0a9dff8..5c1c8b9 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -891,6 +891,11 @@ QTextBlockUserData::~QTextBlockUserData() Returns true if this text block is valid; otherwise returns false. */ +bool QTextBlock::isValid() const +{ + return p != 0 && p->blockMap().isValid(n); +} + /*! \fn QTextBlock &QTextBlock::operator=(const QTextBlock &other) diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index 2e588c2..ad8e657 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -205,7 +205,7 @@ public: inline QTextBlock(const QTextBlock &o) : p(o.p), n(o.n) {} inline QTextBlock &operator=(const QTextBlock &o) { p = o.p; n = o.n; return *this; } - inline bool isValid() const { return p != 0 && n != 0; } + bool isValid() const; inline bool operator==(const QTextBlock &o) const { return p == o.p && n == o.n; } inline bool operator!=(const QTextBlock &o) const { return p != o.p || n != o.n; } diff --git a/tests/auto/qtextblock/tst_qtextblock.cpp b/tests/auto/qtextblock/tst_qtextblock.cpp index cec3a6a..748d921 100644 --- a/tests/auto/qtextblock/tst_qtextblock.cpp +++ b/tests/auto/qtextblock/tst_qtextblock.cpp @@ -76,6 +76,7 @@ private slots: void excludeParagraphSeparatorFragment(); void backwardsBlockIterator(); void previousBlock_qtbug18026(); + void removedBlock_qtbug18500(); private: QTextDocument *doc; @@ -181,5 +182,16 @@ void tst_QTextBlock::previousBlock_qtbug18026() QVERIFY(last.isValid()); } +void tst_QTextBlock::removedBlock_qtbug18500() +{ + cursor.insertText("line 1\nline 2\nline 3 \nline 4\n"); + cursor.setPosition(7); + QTextBlock block = cursor.block(); + cursor.setPosition(21, QTextCursor::KeepAnchor); + + cursor.removeSelectedText(); + QVERIFY(!block.isValid()); +} + QTEST_MAIN(tst_QTextBlock) #include "tst_qtextblock.moc" -- cgit v0.12 From aae6ef391d2ee2fa5b91c834ea65f14fd61e5af6 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 May 2011 09:38:40 +0200 Subject: fix build on mac environ needs to be declared properly --- src/corelib/io/qprocess_unix.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 47f3e69..a3c589f 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -453,6 +453,18 @@ bool QProcessPrivate::createChannel(Channel &channel) } } +QT_BEGIN_INCLUDE_NAMESPACE +#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES) +# include +# define environ (*_NSGetEnviron()) +#elif defined(Q_OS_SYMBIAN) || (defined(Q_OS_MAC) && defined(QT_NO_CORESERVICES)) + static char *qt_empty_environ[] = { 0 }; +#define environ qt_empty_environ +#else + extern char **environ; +#endif +QT_END_INCLUDE_NAMESPACE + QProcessEnvironment QProcessEnvironment::systemEnvironment() { QProcessEnvironment env; -- cgit v0.12 From ac9e63b58533a3215106ed9da82cff3a3e3dda3a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 2 May 2011 10:06:44 +0200 Subject: Make pixel size a qreal in QRawFont The pixel size in the font engines is already a floating point value. For maximum flexibility, we should expose this in the public API. Task-number: QTBUG-18817 Reviewed-by: Jiang Jiang --- src/gui/text/qrawfont.cpp | 6 +++--- src/gui/text/qrawfont.h | 4 ++-- tests/auto/qrawfont/tst_qrawfont.cpp | 32 ++++++++++++++++---------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 6ac2677..1bce909 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -308,10 +308,10 @@ qreal QRawFont::descent() const \sa setPixelSize() */ -int QRawFont::pixelSize() const +qreal QRawFont::pixelSize() const { if (!isValid()) - return -1; + return 0.0; return d->fontEngine->fontDef.pixelSize; } @@ -577,7 +577,7 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ /*! Sets the pixel size with which this font should be rendered to \a pixelSize. */ -void QRawFont::setPixelSize(int pixelSize) +void QRawFont::setPixelSize(qreal pixelSize) { if (d->fontEngine == 0) return; diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index 96dc838..56aeefc 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -96,8 +96,8 @@ public: const QTransform &transform = QTransform()) const; QPainterPath pathForGlyph(quint32 glyphIndex) const; - void setPixelSize(int pixelSize); - int pixelSize() const; + void setPixelSize(qreal pixelSize); + qreal pixelSize() const; QFont::HintingPreference hintingPreference() const; diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp index 3aa4006..4b42c74 100644 --- a/tests/auto/qrawfont/tst_qrawfont.cpp +++ b/tests/auto/qrawfont/tst_qrawfont.cpp @@ -104,7 +104,7 @@ void tst_QRawFont::invalidRawFont() { QRawFont font; QVERIFY(!font.isValid()); - QCOMPARE(font.pixelSize(), -1); + QCOMPARE(font.pixelSize(), 0.0); QVERIFY(font.familyName().isEmpty()); QCOMPARE(font.style(), QFont::StyleNormal); QCOMPARE(font.weight(), -1); @@ -165,7 +165,7 @@ void tst_QRawFont::correctFontData_data() QTest::addColumn("weight"); QTest::addColumn("hintingPreference"); QTest::addColumn("unitsPerEm"); - QTest::addColumn("pixelSize"); + QTest::addColumn("pixelSize"); int hintingPreferences[] = { int(QFont::PreferDefaultHinting), @@ -189,7 +189,7 @@ void tst_QRawFont::correctFontData_data() << QFont::Normal << QFont::HintingPreference(*hintingPreference) << 1000.0 - << 10; + << 10.0; fileName = QLatin1String(SRCDIR "testfont_bold_italic.ttf"); title = fileName @@ -203,7 +203,7 @@ void tst_QRawFont::correctFontData_data() << QFont::Bold << QFont::HintingPreference(*hintingPreference) << 1000.0 - << 10; + << 10.0; ++hintingPreference; } @@ -217,7 +217,7 @@ void tst_QRawFont::correctFontData() QFETCH(QFont::Weight, weight); QFETCH(QFont::HintingPreference, hintingPreference); QFETCH(qreal, unitsPerEm); - QFETCH(int, pixelSize); + QFETCH(qreal, pixelSize); QRawFont font(fileName, 10, hintingPreference); QVERIFY(font.isValid()); @@ -284,7 +284,7 @@ void tst_QRawFont::textLayout() QString familyName = QString::fromLatin1("QtBidiTestFont"); QFont font(familyName); - font.setPixelSize(18); + font.setPixelSize(18.0); QCOMPARE(QFontInfo(font).family(), familyName); QTextLayout layout(QLatin1String("Foobar")); @@ -301,7 +301,7 @@ void tst_QRawFont::textLayout() QRawFont rawFont = glyphs.font(); QVERIFY(rawFont.isValid()); QCOMPARE(rawFont.familyName(), familyName); - QCOMPARE(rawFont.pixelSize(), 18); + QCOMPARE(rawFont.pixelSize(), 18.0); QVector expectedGlyphIndices; expectedGlyphIndices << 44 << 83 << 83 << 70 << 69 << 86; @@ -597,12 +597,12 @@ void tst_QRawFont::fromFont() QFont font(familyName); font.setHintingPreference(hintingPreference); - font.setPixelSize(26); + font.setPixelSize(26.0); QRawFont rawFont = QRawFont::fromFont(font, writingSystem); QVERIFY(rawFont.isValid()); QCOMPARE(rawFont.familyName(), familyName); - QCOMPARE(rawFont.pixelSize(), 26); + QCOMPARE(rawFont.pixelSize(), 26.0); QVERIFY(fontDatabase.removeApplicationFont(id)); } @@ -623,7 +623,7 @@ void tst_QRawFont::copyConstructor() { QString rawFontFamilyName; - int rawFontPixelSize; + qreal rawFontPixelSize; qreal rawFontAscent; qreal rawFontDescent; int rawFontTableSize; @@ -691,7 +691,7 @@ void tst_QRawFont::detach() { QString rawFontFamilyName; - int rawFontPixelSize; + qreal rawFontPixelSize; qreal rawFontAscent; qreal rawFontDescent; int rawFontTableSize; @@ -773,15 +773,15 @@ void tst_QRawFont::unsupportedWritingSystem() QFont font("QtBidiTestFont"); font.setHintingPreference(hintingPreference); - font.setPixelSize(12); + font.setPixelSize(12.0); QRawFont rawFont = QRawFont::fromFont(font, QFontDatabase::Any); QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont")); - QCOMPARE(rawFont.pixelSize(), 12); + QCOMPARE(rawFont.pixelSize(), 12.0); rawFont = QRawFont::fromFont(font, QFontDatabase::Hebrew); QCOMPARE(rawFont.familyName(), QString::fromLatin1("QtBidiTestFont")); - QCOMPARE(rawFont.pixelSize(), 12); + QCOMPARE(rawFont.pixelSize(), 12.0); QString arabicText = QFontDatabase::writingSystemSample(QFontDatabase::Arabic); @@ -798,11 +798,11 @@ void tst_QRawFont::unsupportedWritingSystem() QGlyphs glyphs = glyphss.at(0); QRawFont layoutFont = glyphs.font(); QVERIFY(layoutFont.familyName() != QString::fromLatin1("QtBidiTestFont")); - QCOMPARE(layoutFont.pixelSize(), 12); + QCOMPARE(layoutFont.pixelSize(), 12.0); rawFont = QRawFont::fromFont(font, QFontDatabase::Arabic); QCOMPARE(rawFont.familyName(), layoutFont.familyName()); - QCOMPARE(rawFont.pixelSize(), 12); + QCOMPARE(rawFont.pixelSize(), 12.0); fontDatabase.removeApplicationFont(id); } -- cgit v0.12 From 75d2387fbf005b022437855ab6433790372639f8 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Mon, 2 May 2011 10:52:25 +0200 Subject: Fix the update() autotest for raster. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the CoreGraphics engine, we expect the test to fail with update(), but with the raster engine the behavior is the same across platforms. Hence we don't need a special case for Mac OS X with the raster engine. Reviewed-by: Samuel Rødal --- tests/auto/qwidget/tst_qwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 35014c9..9c2f6ea 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -4738,7 +4738,8 @@ void tst_QWidget::update() QCOMPARE(w.visibleRegion(), expectedVisible); QCOMPARE(w.paintedRegion, expectedVisible); #ifdef QT_MAC_USE_COCOA - QEXPECT_FAIL(0, "Cocoa compositor says to paint this.", Continue); + if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) + QEXPECT_FAIL(0, "Cocoa compositor says to paint this.", Continue); #endif QCOMPARE(child.numPaintEvents, 0); -- cgit v0.12 From c08151e01cdf466ac659c469c7ebceb46c10c2b2 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Mon, 2 May 2011 11:03:07 +0200 Subject: skip widget when its focusPolicy is Qt::ClickFocus in TabOrderEditor TabOrderEditor should allow user to set tab order for widget that focusPolicy contains Qt::TabFocus. Reviewed-by: Friedemann Kleint --- tools/designer/src/components/tabordereditor/tabordereditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/designer/src/components/tabordereditor/tabordereditor.cpp b/tools/designer/src/components/tabordereditor/tabordereditor.cpp index e372bdc..2932adc 100644 --- a/tools/designer/src/components/tabordereditor/tabordereditor.cpp +++ b/tools/designer/src/components/tabordereditor/tabordereditor.cpp @@ -208,7 +208,7 @@ bool TabOrderEditor::skipWidget(QWidget *w) const if (index != -1) { bool ok = false; Qt::FocusPolicy q = (Qt::FocusPolicy) Utils::valueOf(sheet->property(index), &ok); - return !ok || q == Qt::NoFocus; + return !ok || !(q & Qt::TabFocus); } } -- cgit v0.12 From 167044693cc1d16684a5732b05e3926d0af61960 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 May 2011 11:06:27 +0200 Subject: fix build on symbian Error: #793: explicit specialization of class "QTypeInfo" must precede its first use just un-nest QProcessEnvironmentPrivate::{Key,Value} Reviewed-by: thiago --- src/corelib/io/qprocess_p.h | 122 ++++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 62 deletions(-) diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h index 251f8bc..f70579b 100644 --- a/src/corelib/io/qprocess_p.h +++ b/src/corelib/io/qprocess_p.h @@ -81,68 +81,76 @@ class QTimer; class RProcess; #endif -class QProcessEnvironmentPrivate: public QSharedData +#ifdef Q_OS_WIN +class QProcEnvKey : public QString { public: -#ifdef Q_OS_WIN - class Key : public QString + QProcEnvKey() {} + explicit QProcEnvKey(const QString &other) : QString(other) {} + QProcEnvKey(const QProcEnvKey &other) : QString(other) {} + bool operator==(const QProcEnvKey &other) const { return !compare(other, Qt::CaseInsensitive); } +}; +inline uint qHash(const QProcEnvKey &key) { return qHash(key.toCaseFolded()); } + +typedef QString QProcEnvValue; +#else +class QProcEnvKey +{ +public: + QProcEnvKey() : hash(0) {} + explicit QProcEnvKey(const QByteArray &other) : key(other), hash(qHash(key)) {} + QProcEnvKey(const QProcEnvKey &other) { *this = other; } + bool operator==(const QProcEnvKey &other) const { return key == other.key; } + + QByteArray key; + uint hash; +}; +inline uint qHash(const QProcEnvKey &key) { return key.hash; } + +class QProcEnvValue +{ +public: + QProcEnvValue() {} + QProcEnvValue(const QProcEnvValue &other) { *this = other; } + explicit QProcEnvValue(const QString &value) : stringValue(value) {} + explicit QProcEnvValue(const QByteArray &value) : byteValue(value) {} + bool operator==(const QProcEnvValue &other) const { - public: - Key() {} - explicit Key(const QString &other) : QString(other) {} - Key(const Key &other) : QString(other) {} - bool operator==(const Key &other) const { return !compare(other, Qt::CaseInsensitive); } - }; + return byteValue.isEmpty() && other.byteValue.isEmpty() + ? stringValue == other.stringValue + : bytes() == other.bytes(); + } + QByteArray bytes() const + { + if (byteValue.isEmpty() && !stringValue.isEmpty()) + byteValue = stringValue.toLocal8Bit(); + return byteValue; + } + QString string() const + { + if (stringValue.isEmpty() && !byteValue.isEmpty()) + stringValue = QString::fromLocal8Bit(byteValue); + return stringValue; + } - typedef QString Value; + mutable QByteArray byteValue; + mutable QString stringValue; +}; +Q_DECLARE_TYPEINFO(QProcEnvValue, Q_MOVABLE_TYPE); +#endif +Q_DECLARE_TYPEINFO(QProcEnvKey, Q_MOVABLE_TYPE); +class QProcessEnvironmentPrivate: public QSharedData +{ +public: + typedef QProcEnvKey Key; + typedef QProcEnvValue Value; +#ifdef Q_OS_WIN inline Key prepareName(const QString &name) const { return Key(name); } inline QString nameToString(const Key &name) const { return name; } inline Value prepareValue(const QString &value) const { return value; } inline QString valueToString(const Value &value) const { return value; } #else - class Key - { - public: - Key() : hash(0) {} - explicit Key(const QByteArray &other) : key(other), hash(qHash(key)) {} - Key(const Key &other) { *this = other; } - bool operator==(const Key &other) const { return key == other.key; } - - QByteArray key; - uint hash; - }; - - class Value - { - public: - Value() {} - Value(const Value &other) { *this = other; } - explicit Value(const QString &value) : stringValue(value) {} - explicit Value(const QByteArray &value) : byteValue(value) {} - bool operator==(const Value &other) const - { - return byteValue.isEmpty() && other.byteValue.isEmpty() - ? stringValue == other.stringValue - : bytes() == other.bytes(); - } - QByteArray bytes() const - { - if (byteValue.isEmpty() && !stringValue.isEmpty()) - byteValue = stringValue.toLocal8Bit(); - return byteValue; - } - QString string() const - { - if (stringValue.isEmpty() && !byteValue.isEmpty()) - stringValue = QString::fromLocal8Bit(byteValue); - return stringValue; - } - - mutable QByteArray byteValue; - mutable QString stringValue; - }; - inline Key prepareName(const QString &name) const { Key &ent = nameMap[name]; @@ -173,16 +181,6 @@ public: QStringList keys() const; void insert(const QProcessEnvironmentPrivate &other); }; -Q_DECLARE_TYPEINFO(QProcessEnvironmentPrivate::Key, Q_MOVABLE_TYPE); -#ifdef Q_OS_UNIX -Q_DECLARE_TYPEINFO(QProcessEnvironmentPrivate::Value, Q_MOVABLE_TYPE); -#endif - -#ifdef Q_OS_WIN -inline uint qHash(const QProcessEnvironmentPrivate::Key &key) { return qHash(key.toCaseFolded()); } -#else -inline uint qHash(const QProcessEnvironmentPrivate::Key &key) { return key.hash; } -#endif class QProcessPrivate : public QIODevicePrivate { -- cgit v0.12 From eb61f612fea1b76fe01ee237e5bd160f66aeca3d Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Mon, 2 May 2011 11:23:47 +0200 Subject: Fix compilation with QT_NO_* Merge-request: 1206 Reviewed-by: Oswald Buddenhagen --- src/declarative/debugger/qdeclarativedebugserver.cpp | 2 ++ src/network/access/qhttpthreaddelegate.cpp | 3 +++ src/network/access/qhttpthreaddelegate_p.h | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index c7bdcb6..5112af0 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -116,6 +116,7 @@ void QDeclarativeDebugServerPrivate::advertisePlugins() QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectionPlugin( const QString &pluginName) { +#ifndef QT_NO_LIBRARY QStringList pluginCandidates; const QStringList paths = QCoreApplication::libraryPaths(); foreach (const QString &libPath, paths) { @@ -142,6 +143,7 @@ QDeclarativeDebugServerConnection *QDeclarativeDebugServerPrivate::loadConnectio return connection; loader.unload(); } +#endif return 0; } diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp index 99f9376..0364dac 100644 --- a/src/network/access/qhttpthreaddelegate.cpp +++ b/src/network/access/qhttpthreaddelegate.cpp @@ -51,6 +51,7 @@ #include "private/qnetworkaccesscache_p.h" #include "private/qnoncontiguousbytedevice_p.h" +#ifndef QT_NO_HTTP QT_BEGIN_NAMESPACE @@ -576,4 +577,6 @@ void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNet #endif +#endif // QT_NO_HTTP + QT_END_NAMESPACE diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h index 752bc09..c0f2077 100644 --- a/src/network/access/qhttpthreaddelegate_p.h +++ b/src/network/access/qhttpthreaddelegate_p.h @@ -68,6 +68,8 @@ #include "private/qnoncontiguousbytedevice_p.h" #include "qnetworkaccessauthenticationmanager_p.h" +#ifndef QT_NO_HTTP + QT_BEGIN_NAMESPACE class QAuthenticator; @@ -285,4 +287,6 @@ signals: QT_END_NAMESPACE +#endif // QT_NO_HTTP + #endif // QHTTPTHREADDELEGATE_H -- cgit v0.12 From 18122b473ecbd85ba953f70743b1756358bf7c0c Mon Sep 17 00:00:00 2001 From: Matthew Cattell Date: Mon, 2 May 2011 11:26:05 +0200 Subject: Fixed bug in QPdfEngine::addImage causing mono images to be made 32 bit Regression from 4.5 causing performance and size degradation. Task-number: QTBUG-18997 Reviewed-by: Samuel --- src/gui/painting/qprintengine_pdf.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qprintengine_pdf.cpp b/src/gui/painting/qprintengine_pdf.cpp index b7f5160..353869f 100644 --- a/src/gui/painting/qprintengine_pdf.cpp +++ b/src/gui/painting/qprintengine_pdf.cpp @@ -534,7 +534,10 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n QImage image = img; QImage::Format format = image.format(); - if (image.depth() == 1 && *bitmap && img.colorTable().size() == 0) { + if (image.depth() == 1 && *bitmap && img.colorTable().size() == 2 + && img.colorTable().at(0) == QColor(Qt::black).rgba() + && img.colorTable().at(1) == QColor(Qt::white).rgba()) + { if (format == QImage::Format_MonoLSB) image = image.convertToFormat(QImage::Format_Mono); format = QImage::Format_Mono; -- cgit v0.12 From 6db0153cd7e35e4a919a76ae2aadbf2d2510bfb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Mon, 2 May 2011 12:39:45 +0200 Subject: Fixes crash in QWidget::effectiveWinId. Widgets are left in a transitional (and incosistent) state while being re-parented, which caused QWidget::effectiveWinId() to crash in certain circumstances. See patch for more details. Auto test included. Reviewed-by: ogoffart --- src/gui/kernel/qwidget.cpp | 20 ++++++++++++++++++++ src/gui/kernel/qwidget_p.h | 1 + tests/auto/qwidget/tst_qwidget.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index ac35d42..fcb098f 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -292,6 +292,7 @@ QWidgetPrivate::QWidgetPrivate(int version) #ifndef QT_NO_IM , inheritsInputMethodHints(0) #endif + , inSetParent(0) #if defined(Q_WS_X11) , picture(0) #elif defined(Q_WS_WIN) @@ -2563,6 +2564,22 @@ WId QWidget::effectiveWinId() const if (id || !testAttribute(Qt::WA_WState_Created)) return id; QWidget *realParent = nativeParentWidget(); + if (!realParent && d_func()->inSetParent) { + // In transitional state. This is really just a workaround. The real problem + // is that QWidgetPrivate::setParent_sys (platform specific code) first sets + // the window id to 0 (setWinId(0)) before it sets the Qt::WA_WState_Created + // attribute to false. The correct way is to do it the other way around, and + // in that case the Qt::WA_WState_Created logic above will kick in and + // return 0 whenever the widget is in a transitional state. However, changing + // the original logic for all platforms is far more intrusive and might + // break existing applications. + // Note: The widget can only be in a transitional state when changing its + // parent -- everything else is an internal error -- hence explicitly checking + // against 'inSetParent' rather than doing an unconditional return whenever + // 'realParent' is 0 (which may cause strange artifacts and headache later). + return 0; + } + // This widget *must* have a native parent widget. Q_ASSERT(realParent); Q_ASSERT(realParent->internalWinId()); return realParent->internalWinId(); @@ -10041,6 +10058,7 @@ void QWidget::setParent(QWidget *parent) void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) { Q_D(QWidget); + d->inSetParent = true; bool resized = testAttribute(Qt::WA_Resized); bool wasCreated = testAttribute(Qt::WA_WState_Created); QWidget *oldtlw = window(); @@ -10195,6 +10213,8 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) ancestorProxy->d_func()->embedSubWindow(this); } #endif + + d->inSetParent = false; } /*! diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 377e3a7..c9dba29 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -759,6 +759,7 @@ public: #ifndef QT_NO_IM uint inheritsInputMethodHints : 1; #endif + uint inSetParent : 1; // *************************** Platform specific ************************************ #if defined(Q_WS_X11) // <----------------------------------------------------------- X11 diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index bb8b8b4..a851d03 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -345,6 +345,7 @@ private slots: void immediateRepaintAfterInvalidateBuffer(); #endif void effectiveWinId(); + void effectiveWinId2(); void customDpi(); void customDpiProperty(); @@ -8522,6 +8523,30 @@ void tst_QWidget::effectiveWinId() QVERIFY(child.effectiveWinId()); } +void tst_QWidget::effectiveWinId2() +{ + QWidget parent; + + class MyWidget : public QWidget { + bool event(QEvent *e) + { + if (e->type() == QEvent::WinIdChange) { + // Shouldn't crash. + effectiveWinId(); + } + + return QWidget::event(e); + } + }; + + MyWidget child; + child.setParent(&parent); + parent.show(); + + child.setParent(0); + child.setParent(&parent); +} + class CustomWidget : public QWidget { public: -- cgit v0.12 From 0b877b48dc990ca6bb806be668d60f6ced470de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 6 Apr 2011 14:45:11 +0200 Subject: Removed some superfluous semicolons Reviewed-by: Kai Koehne --- src/script/api/qscriptengineagent_p.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/script/api/qscriptengineagent_p.h b/src/script/api/qscriptengineagent_p.h index abe4e9e..b96d19d 100644 --- a/src/script/api/qscriptengineagent_p.h +++ b/src/script/api/qscriptengineagent_p.h @@ -57,22 +57,22 @@ public: static QScriptEngineAgentPrivate* get(QScriptEngineAgent* p) {return p->d_func();} QScriptEngineAgentPrivate(){} - virtual ~QScriptEngineAgentPrivate(){}; + virtual ~QScriptEngineAgentPrivate(){} void attach(); void detach(); //scripts - virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int /*errorLine*/, const JSC::UString& /*errorMsg*/) {}; + virtual void sourceParsed(JSC::ExecState*, const JSC::SourceCode&, int /*errorLine*/, const JSC::UString& /*errorMsg*/) {} virtual void scriptUnload(qint64 id) { q_ptr->scriptUnload(id); - }; + } virtual void scriptLoad(qint64 id, const JSC::UString &program, const JSC::UString &fileName, int baseLineNumber) { q_ptr->scriptLoad(id,program, fileName, baseLineNumber); - }; + } //exceptions virtual void exception(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno, bool hasHandler) @@ -81,7 +81,7 @@ public: Q_UNUSED(sourceID); Q_UNUSED(lineno); Q_UNUSED(hasHandler); - }; + } virtual void exceptionThrow(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, bool hasHandler); virtual void exceptionCatch(const JSC::DebuggerCallFrame& frame, intptr_t sourceID); @@ -92,20 +92,20 @@ public: Q_UNUSED(lineno); q_ptr->contextPush(); q_ptr->functionEntry(sourceID); - }; + } virtual void returnEvent(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno); virtual void willExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) { Q_UNUSED(frame); Q_UNUSED(sourceID); Q_UNUSED(lineno); - }; + } virtual void didExecuteProgram(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno) { Q_UNUSED(frame); - Q_UNUSED(sourceID); + Q_UNUSED(sourceID); Q_UNUSED(lineno); - }; + } virtual void functionExit(const JSC::JSValue& returnValue, intptr_t sourceID); //others virtual void didReachBreakpoint(const JSC::DebuggerCallFrame& frame, intptr_t sourceID, int lineno/*, int column*/); -- cgit v0.12 From 9fa0a9319ee0f178d03f9bdc4afbabb8563b4c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Wed, 6 Apr 2011 16:31:09 +0200 Subject: QDeclarativeDebugServer: Send hello answer before any service messages This is necessary since some services may like to send a message back immediately when its state changes to enabled. Reviewed-by: Kai Koehne --- src/declarative/debugger/qdeclarativedebugserver.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp index e43b90d..f76c747 100644 --- a/src/declarative/debugger/qdeclarativedebugserver.cpp +++ b/src/declarative/debugger/qdeclarativedebugserver.cpp @@ -242,6 +242,17 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) int version; in >> version >> d->clientPlugins; + // Send the hello answer immediately, since it needs to arrive before + // the plugins below start sending messages. + QByteArray helloAnswer; + { + QDataStream out(&helloAnswer, QIODevice::WriteOnly); + out << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); + } + d->connection->send(helloAnswer); + + d->gotHello = true; + QHash::Iterator iter = d->plugins.begin(); for (; iter != d->plugins.end(); ++iter) { QDeclarativeDebugService::Status newStatus = QDeclarativeDebugService::Unavailable; @@ -251,14 +262,6 @@ void QDeclarativeDebugServer::receiveMessage(const QByteArray &message) iter.value()->statusChanged(newStatus); } - QByteArray helloAnswer; - { - QDataStream out(&helloAnswer, QIODevice::WriteOnly); - out << QString(QLatin1String("QDeclarativeDebugClient")) << 0 << protocolVersion << d->plugins.keys(); - } - d->connection->send(helloAnswer); - - d->gotHello = true; qWarning("QDeclarativeDebugServer: Connection established"); } else { -- cgit v0.12 From 2c8df8bfb679885c3cbd2ee02f5e4053fdd554c2 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Mon, 2 May 2011 14:13:06 +0200 Subject: Add required font metrics functions to QRawFont Reviewed-by: Eskil --- src/gui/text/qrawfont.cpp | 52 +++++++++++++++++++++++++++++++++++++++++++++++ src/gui/text/qrawfont.h | 4 ++++ 2 files changed, 56 insertions(+) diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 1bce909..46c892c 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -302,6 +302,58 @@ qreal QRawFont::descent() const } /*! + Returns the xHeight of this QRawFont in pixel units. + + \sa QFontMetricsF::xHeight() +*/ +qreal QRawFont::xHeight() const +{ + if (!isValid()) + return 0.0; + + return d->fontEngine->xHeight().toReal(); +} + +/*! + Returns the leading of this QRawFont in pixel units. + + \sa QFontMetricsF::leading() +*/ +qreal QRawFont::leading() const +{ + if (!isValid()) + return 0.0; + + return d->fontEngine->leading().toReal(); +} + +/*! + Returns the average character width of this QRawFont in pixel units. + + \sa QFontMetricsF::averageCharWidth() +*/ +qreal QRawFont::averageCharWidth() const +{ + if (!isValid()) + return 0.0; + + return d->fontEngine->averageCharWidth().toReal(); +} + +/*! + Returns the width of the widest character in the font. + + \sa QFontMetricsF::maxWidth() +*/ +qreal QRawFont::maxCharWidth() const +{ + if (!isValid()) + return 0.0; + + return d->fontEngine->maxCharWidth(); +} + +/*! Returns the pixel size set for this QRawFont. The pixel size affects how glyphs are rasterized, the size of glyphs returned by pathForGlyph(), and is used to convert internal metrics from design units to logical pixel units. diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h index 56aeefc..900c07a 100644 --- a/src/gui/text/qrawfont.h +++ b/src/gui/text/qrawfont.h @@ -103,6 +103,10 @@ public: qreal ascent() const; qreal descent() const; + qreal leading() const; + qreal xHeight() const; + qreal averageCharWidth() const; + qreal maxCharWidth() const; qreal unitsPerEm() const; -- cgit v0.12 From 8680d831fb7066feae07690a4a6bc8e908a84e5a Mon Sep 17 00:00:00 2001 From: Armin Berres Date: Mon, 2 May 2011 15:17:39 +0200 Subject: Only cleanup share widget if it has been created. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Without this change a not yet created share widget is created once qt_destroy_gl_share_widget() is called. As creating the widget also triggers a call to qt_cleanup_gl_share_widget() once QApplication is destroyed a QApplication created afterwards cannot use a share widget anymore. This functionality is needed for Harmattan. Merge-request: 2609 Reviewed-by: Samuel Rødal --- src/opengl/qwindowsurface_gl.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 56e2c3b..4a4718b 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -184,7 +184,9 @@ QGLGraphicsSystem::QGLGraphicsSystem(bool useX11GL) class QGLGlobalShareWidget { public: - QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) {} + QGLGlobalShareWidget() : firstPixmap(0), widgetRefCount(0), widget(0), initializing(false) { + created = true; + } QGLWidget *shareWidget() { if (!initializing && !widget && !cleanedUp) { @@ -223,6 +225,7 @@ public: } static bool cleanedUp; + static bool created; QGLPixmapData *firstPixmap; int widgetRefCount; @@ -233,6 +236,7 @@ private: }; bool QGLGlobalShareWidget::cleanedUp = false; +bool QGLGlobalShareWidget::created = false; static void qt_cleanup_gl_share_widget(); Q_GLOBAL_STATIC_WITH_INITIALIZER(QGLGlobalShareWidget, _qt_gl_share_widget, @@ -242,7 +246,8 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QGLGlobalShareWidget, _qt_gl_share_widget, static void qt_cleanup_gl_share_widget() { - _qt_gl_share_widget()->cleanup(); + if (QGLGlobalShareWidget::created) + _qt_gl_share_widget()->cleanup(); } QGLWidget* qt_gl_share_widget() @@ -254,7 +259,8 @@ QGLWidget* qt_gl_share_widget() void qt_destroy_gl_share_widget() { - _qt_gl_share_widget()->destroy(); + if (QGLGlobalShareWidget::created) + _qt_gl_share_widget()->destroy(); } const QGLContext *qt_gl_share_context() -- cgit v0.12 From 443608952d7df9a5146317be992320ba232d2cf9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 May 2011 15:37:33 +0200 Subject: fix potential crash in QProcessEnvironment::systemEnvironment() on windows GetEnvironmentStrings() can theoretically return null --- src/corelib/io/qprocess_win.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 7739bbd..0c8becc 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -283,18 +283,19 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() QProcessEnvironment env; // Calls to setenv() affect the low-level environment as well. // This is not the case the other way round. - wchar_t *envStrings = GetEnvironmentStringsW(); - for (const wchar_t *entry = envStrings; *entry; ) { - int entryLen = wcslen(entry); - if (const wchar_t *equal = wcschr(entry, L'=')) { - int nameLen = equal - entry; - QString name = QString::fromWCharArray(entry, nameLen); - QString value = QString::fromWCharArray(equal + 1, entryLen - nameLen - 1); - env.d->hash.insert(QProcessEnvironmentPrivate::Key(name), value); + if (wchar_t *envStrings = GetEnvironmentStringsW()) { + for (const wchar_t *entry = envStrings; *entry; ) { + int entryLen = wcslen(entry); + if (const wchar_t *equal = wcschr(entry, L'=')) { + int nameLen = equal - entry; + QString name = QString::fromWCharArray(entry, nameLen); + QString value = QString::fromWCharArray(equal + 1, entryLen - nameLen - 1); + env.d->hash.insert(QProcessEnvironmentPrivate::Key(name), value); + } + entry += entryLen + 1; } - entry += entryLen + 1; + FreeEnvironmentStrings(envStrings); } - FreeEnvironmentStrings(envStrings); return env; } -- cgit v0.12 From 4dcb4a41022085aa82f25f7e0a2ce9e92510f4ae Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 May 2011 15:40:13 +0200 Subject: fix Widestring vs. Ansi mixup --- src/corelib/io/qprocess_win.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index 0c8becc..c9b1ba4 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -294,7 +294,7 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() } entry += entryLen + 1; } - FreeEnvironmentStrings(envStrings); + FreeEnvironmentStringsW(envStrings); } return env; } -- cgit v0.12 From 62e73a463cb7035192acdce6538c5b0248e643d4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 2 May 2011 16:20:15 +0200 Subject: no environment on WinCE --- src/corelib/io/qprocess_win.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index c9b1ba4..bb23954 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -281,6 +281,7 @@ static QString qt_create_commandline(const QString &program, const QStringList & QProcessEnvironment QProcessEnvironment::systemEnvironment() { QProcessEnvironment env; +#if !defined(Q_OS_WINCE) // Calls to setenv() affect the low-level environment as well. // This is not the case the other way round. if (wchar_t *envStrings = GetEnvironmentStringsW()) { @@ -296,9 +297,11 @@ QProcessEnvironment QProcessEnvironment::systemEnvironment() } FreeEnvironmentStringsW(envStrings); } +#endif return env; } +#if !defined(Q_OS_WINCE) static QByteArray qt_create_environment(const QProcessEnvironmentPrivate::Hash &environment) { QByteArray envlist; @@ -358,6 +361,7 @@ static QByteArray qt_create_environment(const QProcessEnvironmentPrivate::Hash & } return envlist; } +#endif void QProcessPrivate::startProcess() { -- cgit v0.12 From 2c64404e2edd3b792b8a1d04c773860d40c04c4c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Thu, 21 Apr 2011 15:33:01 +1000 Subject: Remove Q_ASSERTs from qgraphicsanchorlayout1 test Sanity-check the test data when using it rather than when creating it. Change-Id: Ie5d5e1ff3fc439d196096f17cb6f97680927a90c Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- .../tst_qgraphicsanchorlayout1.cpp | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index a03f7bc..ee25291 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -2585,15 +2585,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 30 ); sizeHints1.insert( Qt::PreferredSize, 35 ); sizeHints1.insert( Qt::MaximumSize, 40 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 5 ); sizeHints2.insert( Qt::PreferredSize, 35 ); sizeHints2.insert( Qt::MaximumSize, 300 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 35; const qreal width2 = 100-10-10-10-width1; @@ -2605,15 +2601,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 20 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 50 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 20; const qreal width2 = 100-10-10-10-width1; @@ -2625,15 +2617,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 40 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 60 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 28; // got from manual calculation const qreal width2 = 100-10-10-10-width1; @@ -2645,15 +2633,11 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution_data() sizeHints1.insert( Qt::MinimumSize, 0 ); sizeHints1.insert( Qt::PreferredSize, 10 ); sizeHints1.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); SizeHintArray sizeHints2; sizeHints2.insert( Qt::MinimumSize, 0 ); sizeHints2.insert( Qt::PreferredSize, 40 ); sizeHints2.insert( Qt::MaximumSize, 100 ); - Q_ASSERT( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); - Q_ASSERT( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); const qreal width1 = 22; // got from manual calculation const qreal width2 = 100-10-10-10-width1; @@ -2669,6 +2653,12 @@ void tst_QGraphicsAnchorLayout1::testSizeDistribution() QFETCH(qreal, width1); QFETCH(qreal, width2); + // sanity-check the test data - MinimumSize <= PreferredSize <= MaximumSize + QVERIFY( sizeHints1.value( Qt::MinimumSize ) <= sizeHints1.value( Qt::PreferredSize ) ); + QVERIFY( sizeHints1.value( Qt::PreferredSize ) <= sizeHints1.value( Qt::MaximumSize ) ); + QVERIFY( sizeHints2.value( Qt::MinimumSize ) <= sizeHints2.value( Qt::PreferredSize ) ); + QVERIFY( sizeHints2.value( Qt::PreferredSize ) <= sizeHints2.value( Qt::MaximumSize ) ); + // create objects QGraphicsWidget widget; TheAnchorLayout *layout = new TheAnchorLayout; -- cgit v0.12 From 4b5a7eeacee997f0129354c9669b8e0d66ca4efa Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 27 Apr 2011 16:41:16 +1000 Subject: Remove dead code from qscriptenginedebugger test Remove code made obsolete by 2d1839e850ac632a13ff0ac3096d8419bff5082d. Change-Id: Ic889c81f0507eb91028fa6b6c4cbf6ae71a728b0 Reviewed-by: Rohan McGovern --- .../qscriptenginedebugger/tst_qscriptenginedebugger.cpp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp index 70adb58..1a3ad2c 100644 --- a/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp +++ b/tests/auto/qscriptenginedebugger/tst_qscriptenginedebugger.cpp @@ -76,9 +76,6 @@ public: tst_QScriptEngineDebugger(); virtual ~tst_QScriptEngineDebugger(); -protected slots: - void recordDebuggerStateAndContinue(); - private slots: void attachAndDetach(); void action(); @@ -89,9 +86,6 @@ private slots: void multithreadedDebugging(); void autoShowStandardWindow(); void standardWindowOwnership(); - -private: - QScriptEngineDebugger::DebuggerState m_recordedDebuggerState; }; tst_QScriptEngineDebugger::tst_QScriptEngineDebugger() @@ -102,14 +96,6 @@ tst_QScriptEngineDebugger::~tst_QScriptEngineDebugger() { } -void tst_QScriptEngineDebugger::recordDebuggerStateAndContinue() -{ - QScriptEngineDebugger *debugger = qobject_cast(sender()); - Q_ASSERT(debugger != 0); - m_recordedDebuggerState = debugger->state(); - debugger->action(QScriptEngineDebugger::ContinueAction)->trigger(); -} - void tst_QScriptEngineDebugger::attachAndDetach() { #if defined(Q_OS_WINCE) && _WIN32_WCE < 0x600 -- cgit v0.12 From 5a834d7141cc7d29d022911ccec16e628d94acf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 3 May 2011 12:36:08 +0200 Subject: Fixed bug in X11 backend when creating translucent windows. We forgot to send the ParentAboutToChange event, which meant QGLWidget didn't destroy the old EGL surface. This could cause two EGL surfaces to be created for the same QGLWidget, which leads to undefined behaviour on some platforms. --- src/gui/kernel/qwidget_x11.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 5ece7d6..a49a607 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -954,8 +954,13 @@ static void qt_x11_recreateWidget(QWidget *widget) // recreate their GL context, which in turn causes them to choose // their visual again. Now that WA_TranslucentBackground is set, // QGLContext::chooseVisual will select an ARGB visual. - QEvent e(QEvent::ParentChange); - QApplication::sendEvent(widget, &e); + + // QGLWidget expects a ParentAboutToChange to be sent first + QEvent aboutToChangeEvent(QEvent::ParentAboutToChange); + QApplication::sendEvent(widget, &aboutToChangeEvent); + + QEvent parentChangeEvent(QEvent::ParentChange); + QApplication::sendEvent(widget, &parentChangeEvent); } else { // For regular widgets, reparent them with their parent which // also triggers a recreation of the native window -- cgit v0.12 From 9d75ff6fa8f8844ff6599b68618821cd8c501757 Mon Sep 17 00:00:00 2001 From: aavit Date: Mon, 11 Apr 2011 15:34:06 +0200 Subject: Improve error reporting on failure to connect to baseline server --- tests/arthur/baselineserver/src/baselineserver.cpp | 1 + tests/arthur/common/baselineprotocol.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 0c0871a..c22d1f8 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -162,6 +162,7 @@ bool BaselineHandler::establishConnection() { if (!proto.acceptConnection(&plat)) { qWarning() << runId << logtime() << "Accepting new connection from" << proto.socket.peerAddress().toString() << "failed." << proto.errorMessage(); + proto.sendBlock(BaselineProtocol::Abort, proto.errorMessage().toLatin1()); // In case the client can hear us, tell it what's wrong. proto.socket.disconnectFromHost(); return false; } diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index 88cea36..d5e533a 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -374,7 +374,7 @@ bool BaselineProtocol::connect(const QString &testCase, bool *dryrun) Command cmd = UnknownError; if (!receiveBlock(&cmd, &block)) { - errMsg += QLS("Failed to get response from server."); + errMsg.prepend(QLS("Failed to get response from server. ")); return false; } -- cgit v0.12 From d499f7ca995e40f7a75f913ff0f07d9a73fa3559 Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 27 Apr 2011 12:37:19 +0200 Subject: Lancelot: Add configurable client filtering to baseline server --- tests/arthur/baselineserver/src/baselineserver.cpp | 38 ++++++++++++++++------ tests/arthur/baselineserver/src/baselineserver.h | 4 +++ 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index c22d1f8..9c30638 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -60,6 +60,7 @@ const QString PI_CreationDate(QLS("CreationDate")); QString BaselineServer::storage; QString BaselineServer::url; +QString BaselineServer::settingsFile; BaselineServer::BaselineServer(QObject *parent) : QTcpServer(parent), lastRunIdIdx(0) @@ -91,6 +92,15 @@ QString BaselineServer::baseUrl() return url; } +QString BaselineServer::settingsFilePath() +{ + if (settingsFile.isEmpty()) { + QString exeName = QCoreApplication::applicationFilePath().section(QLC('/'), -1); + settingsFile = storagePath() + QLC('/') + exeName + QLS(".ini"); + } + return settingsFile; +} + void BaselineServer::incomingConnection(int socketDescriptor) { QString runId = QDateTime::currentDateTime().toString(QLS("MMMdd-hhmmss")); @@ -144,6 +154,8 @@ void BaselineThread::run() BaselineHandler::BaselineHandler(const QString &runId, int socketDescriptor) : QObject(), runId(runId), connectionEstablished(false) { + settings = new QSettings(BaselineServer::settingsFilePath(), QSettings::IniFormat, this); + if (socketDescriptor == -1) return; @@ -174,17 +186,23 @@ bool BaselineHandler::establishConnection() qDebug() << runId << logtime() << "Connection established with" << plat.value(PI_HostName) << "[" << qPrintable(plat.value(PI_HostAddress)) << "]" << logMsg; - // Filter on branch - QString branch = plat.value(PI_PulseGitBranch); - if (branch.isEmpty()) { - // Not run by Pulse, i.e. ad hoc run: Ok. - } - else if (branch != QLS("master-integration") || !plat.value(PI_GitCommit).contains(QLS("Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-fire-staging into master-integration"))) { - qDebug() << runId << logtime() << "Did not pass branch/staging repo filter, disconnecting."; - proto.sendBlock(BaselineProtocol::Abort, QByteArray("This branch/staging repo is not assigned to be tested.")); - proto.socket.disconnectFromHost(); - return false; + settings->beginGroup("ClientFilters"); + if (!settings->childKeys().isEmpty()) { + // Abort if client does not match the filters + foreach(QString filterKey, settings->childKeys()) { + QString filter = settings->value(filterKey).toString(); + QString platVal = plat.value(filterKey); + if (filter.isEmpty() || platVal.isEmpty()) + continue; // tbd: add a syntax for specifying a "value-must-be-present" filter + if (!platVal.contains(filter)) { + qDebug() << runId << logtime() << "Did not pass client filter on" << filterKey << "; disconnecting."; + proto.sendBlock(BaselineProtocol::Abort, QByteArray("Configured to not do testing for this client or repo, ref. ") + BaselineServer::settingsFilePath().toLatin1()); + proto.socket.disconnectFromHost(); + return false; + } + } } + settings->endGroup(); proto.sendBlock(BaselineProtocol::Ack, QByteArray()); diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h index cae490f..0dcd4ea 100644 --- a/tests/arthur/baselineserver/src/baselineserver.h +++ b/tests/arthur/baselineserver/src/baselineserver.h @@ -48,6 +48,7 @@ #include #include #include +#include #include "baselineprotocol.h" #include "report.h" @@ -65,6 +66,7 @@ public: static QString storagePath(); static QString baseUrl(); + static QString settingsFilePath(); protected: void incomingConnection(int socketDescriptor); @@ -79,6 +81,7 @@ private: int lastRunIdIdx; static QString storage; static QString url; + static QString settingsFile; }; @@ -132,6 +135,7 @@ private: QString runId; bool connectionEstablished; Report report; + QSettings *settings; }; #endif // BASELINESERVER_H -- cgit v0.12 From 4fe5307af44a76b99cc8c70aa330180c1985eabc Mon Sep 17 00:00:00 2001 From: aavit Date: Wed, 27 Apr 2011 13:01:47 +0200 Subject: Do not filter adhoc clients --- tests/arthur/baselineserver/src/baselineserver.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp index 9c30638..97ee80c 100644 --- a/tests/arthur/baselineserver/src/baselineserver.cpp +++ b/tests/arthur/baselineserver/src/baselineserver.cpp @@ -187,9 +187,9 @@ bool BaselineHandler::establishConnection() << "[" << qPrintable(plat.value(PI_HostAddress)) << "]" << logMsg; settings->beginGroup("ClientFilters"); - if (!settings->childKeys().isEmpty()) { + if (!settings->childKeys().isEmpty() && !plat.value(PI_PulseGitBranch).isEmpty()) { // i.e. not adhoc client // Abort if client does not match the filters - foreach(QString filterKey, settings->childKeys()) { + foreach (QString filterKey, settings->childKeys()) { QString filter = settings->value(filterKey).toString(); QString platVal = plat.value(filterKey); if (filter.isEmpty() || platVal.isEmpty()) -- cgit v0.12 From 50be38737507f5c23b4d050e635a200024164a13 Mon Sep 17 00:00:00 2001 From: aavit Date: Tue, 3 May 2011 13:32:23 +0200 Subject: Make autotest more resilient against network timeout --- tests/arthur/common/baselineprotocol.cpp | 10 ++++++---- tests/arthur/common/baselineprotocol.h | 2 +- tests/auto/lancelot/tst_lancelot.cpp | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/arthur/common/baselineprotocol.cpp b/tests/arthur/common/baselineprotocol.cpp index d5e533a..8879b78 100644 --- a/tests/arthur/common/baselineprotocol.cpp +++ b/tests/arthur/common/baselineprotocol.cpp @@ -424,15 +424,17 @@ bool BaselineProtocol::requestBaselineChecksums(const QString &testFunction, Ima it->testFunction = testFunction; QByteArray block; - QDataStream ds(&block, QIODevice::ReadWrite); + QDataStream ds(&block, QIODevice::WriteOnly); ds << *itemList; if (!sendBlock(RequestBaselineChecksums, block)) return false; + Command cmd; - if (!receiveBlock(&cmd, &block)) + QByteArray rcvBlock; + if (!receiveBlock(&cmd, &rcvBlock) || cmd != BaselineProtocol::Ack) return false; - ds.device()->seek(0); - ds >> *itemList; + QDataStream rds(&rcvBlock, QIODevice::ReadOnly); + rds >> *itemList; return true; } diff --git a/tests/arthur/common/baselineprotocol.h b/tests/arthur/common/baselineprotocol.h index 8a99ace..bc1a3eb 100644 --- a/tests/arthur/common/baselineprotocol.h +++ b/tests/arthur/common/baselineprotocol.h @@ -146,7 +146,7 @@ public: enum Constant { ProtocolVersion = 5, ServerPort = 54129, - Timeout = 5000 + Timeout = 15000 }; enum Command { diff --git a/tests/auto/lancelot/tst_lancelot.cpp b/tests/auto/lancelot/tst_lancelot.cpp index 9721665..2eb3f20 100644 --- a/tests/auto/lancelot/tst_lancelot.cpp +++ b/tests/auto/lancelot/tst_lancelot.cpp @@ -254,7 +254,8 @@ void tst_Lancelot::runTestSuite(GraphicsEngine engine, QImage::Format format) if (baseline.status == ImageItem::BaselineNotFound) { - proto.submitNewBaseline(rendered, 0); + if (!proto.submitNewBaseline(rendered, 0)) + QWARN("Failed to submit new baseline: " + proto.errorMessage().toLatin1()); QSKIP("Baseline not found; new baseline created.", SkipSingle); } -- cgit v0.12 From 36e01e698beb8b5703f5d68f5b2eb9494e11a571 Mon Sep 17 00:00:00 2001 From: Tero Toivola Date: Tue, 3 May 2011 14:14:40 +0200 Subject: memory leak fix If glyph is not found from glyphSet it is created dynamically and in this case not deleted. Task-number: https://projects.maemo.org/bugzilla/show_bug.cgi?id=244326 Merge-request: 1208 Reviewed-by: Jiang Jiang --- src/gui/text/qfontengine_ft.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index e89b508..9c90964 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -1800,10 +1800,12 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr } else { glyphSet = &defaultGlyphSet; } + bool needsDelete = false; Glyph * g = glyphSet->getGlyph(glyph); if (!g) { face = lockFace(); g = loadGlyphMetrics(glyphSet, glyph); + needsDelete = true; } if (g) { @@ -1812,6 +1814,8 @@ glyph_metrics_t QFontEngineFT::boundingBox(glyph_t glyph, const QTransform &matr overall.width = g->width; overall.height = g->height; overall.xoff = g->advance; + if (needsDelete) + delete g; } else { int left = FLOOR(face->glyph->metrics.horiBearingX); int right = CEIL(face->glyph->metrics.horiBearingX + face->glyph->metrics.width); -- cgit v0.12 From 747962e6ec20a59b7e2ed67c5cd685258f199a86 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 3 May 2011 14:28:56 +0200 Subject: Change the repaint() call to an update(). In show_sys(), if we directly call repaint() this will triggers too many UpdateRequest events. This fixes the qwidget autotest "compatibilityChildInsertedEvents". Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_mac.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 8dc9d2e..27a1bb6 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3526,8 +3526,8 @@ void QWidgetPrivate::show_sys() // INVARIANT: q is native. Just show the view: [view setHidden:NO]; } else { - // INVARIANT: q is alien. Repaint q instead: - q->repaint(); + // INVARIANT: q is alien. Update q instead: + q->update(); } #endif } -- cgit v0.12 From 2c6af885d959f90b801c74dc5d389a720dc9fd1d Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 3 May 2011 14:29:36 +0200 Subject: Fix the autotest condition. The previous preprocessor directive was aimed to exclude Mac OS X. With the raster engine, the behavior is unified and we don't need to have a separate path for Mac OS X/Cocoa. The new condition excludes only Mac OS X with a graphics system other than raster or Carbon. Reviewed-by: Jiang Jiang --- tests/auto/qwidget/tst_qwidget.cpp | 42 ++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 9c2f6ea..e266efb 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -6337,11 +6337,15 @@ void tst_QWidget::compatibilityChildInsertedEvents() expected = EventRecorder::EventList() << qMakePair(&widget, QEvent::PolishRequest) - << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA) - << qMakePair(&widget, QEvent::UpdateRequest) -#endif - ; + << qMakePair(&widget, QEvent::Type(QEvent::User + 1)); + +#ifndef QT_MAC_USE_CARBON +#ifdef QT_MAC_USE_COCOA + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) +#endif // QT_MAC_USE_COCOA + expected << qMakePair(&widget, QEvent::UpdateRequest); +#endif // !QT_MAC_USE_CARBON + QCOMPARE(spy.eventList(), expected); } @@ -6433,11 +6437,15 @@ void tst_QWidget::compatibilityChildInsertedEvents() #endif << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) - << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA) - << qMakePair(&widget, QEvent::UpdateRequest) -#endif - ; + << qMakePair(&widget, QEvent::Type(QEvent::User + 2)); + +#ifndef QT_MAC_USE_CARBON +#ifdef QT_MAC_USE_COCOA + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) +#endif // QT_MAC_USE_COCOA + expected << qMakePair(&widget, QEvent::UpdateRequest); +#endif // !QT_MAC_USE_CARBON + QCOMPARE(spy.eventList(), expected); } @@ -6529,11 +6537,15 @@ void tst_QWidget::compatibilityChildInsertedEvents() #endif << qMakePair(&widget, QEvent::PolishRequest) << qMakePair(&widget, QEvent::Type(QEvent::User + 1)) - << qMakePair(&widget, QEvent::Type(QEvent::User + 2)) -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA) - << qMakePair(&widget, QEvent::UpdateRequest) -#endif - ; + << qMakePair(&widget, QEvent::Type(QEvent::User + 2)); + +#ifndef QT_MAC_USE_CARBON +#ifdef QT_MAC_USE_COCOA + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) +#endif // QT_MAC_USE_COCOA + expected << qMakePair(&widget, QEvent::UpdateRequest); +#endif // !QT_MAC_USE_CARBON + QCOMPARE(spy.eventList(), expected); } } -- cgit v0.12 From 782535ac548c582542bd1c17207e288e816870a8 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 3 May 2011 13:50:10 +0200 Subject: Remove QFontEngineFT::loadGlyphMetrics It is no longer used and was accidentally merged back in. Reviewed-by: Eskil --- src/gui/text/qfontengine_ft.cpp | 100 ---------------------------------------- src/gui/text/qfontengine_ft_p.h | 1 - 2 files changed, 101 deletions(-) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 58bcca8..237cde4 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -803,106 +803,6 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags, return load_flags; } -QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const -{ - Glyph *g = set->getGlyph(glyph); - if (g && g->format == format) - return g; - - bool hsubpixel = false; - int vfactor = 1; - int load_flags = loadFlags(set, format, 0, hsubpixel, vfactor); - - // apply our matrix to this, but note that the metrics will not be affected by this. - FT_Face face = lockFace(); - FT_Matrix matrix = this->matrix; - FT_Matrix_Multiply(&set->transformationMatrix, &matrix); - FT_Set_Transform(face, &matrix, 0); - freetype->matrix = matrix; - - bool transform = matrix.xx != 0x10000 || matrix.yy != 0x10000 || matrix.xy != 0 || matrix.yx != 0; - if (transform) - load_flags |= FT_LOAD_NO_BITMAP; - - FT_Error err = FT_Load_Glyph(face, glyph, load_flags); - if (err && (load_flags & FT_LOAD_NO_BITMAP)) { - load_flags &= ~FT_LOAD_NO_BITMAP; - err = FT_Load_Glyph(face, glyph, load_flags); - } - if (err == FT_Err_Too_Few_Arguments) { - // this is an error in the bytecode interpreter, just try to run without it - load_flags |= FT_LOAD_FORCE_AUTOHINT; - err = FT_Load_Glyph(face, glyph, load_flags); - } - if (err != FT_Err_Ok) - qWarning("load glyph failed err=%x face=%p, glyph=%d", err, face, glyph); - - unlockFace(); - if (set->outline_drawing) - return 0; - - if (!g) { - g = new Glyph; - g->uploadedToServer = false; - g->data = 0; - } - - FT_GlyphSlot slot = face->glyph; - if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot); - int left = slot->metrics.horiBearingX; - int right = slot->metrics.horiBearingX + slot->metrics.width; - int top = slot->metrics.horiBearingY; - int bottom = slot->metrics.horiBearingY - slot->metrics.height; - if (transform && slot->format != FT_GLYPH_FORMAT_BITMAP) { // freetype doesn't apply the transformation on the metrics - int l, r, t, b; - FT_Vector vector; - vector.x = left; - vector.y = top; - FT_Vector_Transform(&vector, &matrix); - l = r = vector.x; - t = b = vector.y; - vector.x = right; - vector.y = top; - FT_Vector_Transform(&vector, &matrix); - if (l > vector.x) l = vector.x; - if (r < vector.x) r = vector.x; - if (t < vector.y) t = vector.y; - if (b > vector.y) b = vector.y; - vector.x = right; - vector.y = bottom; - FT_Vector_Transform(&vector, &matrix); - if (l > vector.x) l = vector.x; - if (r < vector.x) r = vector.x; - if (t < vector.y) t = vector.y; - if (b > vector.y) b = vector.y; - vector.x = left; - vector.y = bottom; - FT_Vector_Transform(&vector, &matrix); - if (l > vector.x) l = vector.x; - if (r < vector.x) r = vector.x; - if (t < vector.y) t = vector.y; - if (b > vector.y) b = vector.y; - left = l; - right = r; - top = t; - bottom = b; - } - left = FLOOR(left); - right = CEIL(right); - bottom = FLOOR(bottom); - top = CEIL(top); - - g->linearAdvance = face->glyph->linearHoriAdvance >> 10; - g->width = TRUNC(right-left); - g->height = TRUNC(top-bottom); - g->x = TRUNC(left); - g->y = TRUNC(top); - g->advance = TRUNC(ROUND(face->glyph->advance.x)); - g->format = Format_None; - - return g; -} - QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, QFixed subPixelPosition, GlyphFormat format, diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 6dbca7a..a620006 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -349,7 +349,6 @@ protected: private: friend class QFontEngineFTRawFont; - QFontEngineFT::Glyph *loadGlyphMetrics(QGlyphSet *set, uint glyph, GlyphFormat format) const; int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const; GlyphFormat defaultFormat; -- cgit v0.12 From 56443421cb5e537e60abd7ced42c9ebf587683fe Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Tue, 3 May 2011 15:30:28 +0200 Subject: qmake: Introduce new template type The template type "aux" is intended for projects that do not require building anything, but may need to install stuff (e.g. applications with QML entry point). Reviewed-by: Joerg Bornemann --- qmake/generators/unix/unixmake2.cpp | 6 +++++- qmake/generators/win32/borland_bmake.cpp | 8 +++++++- qmake/generators/win32/mingw_make.cpp | 8 +++++++- qmake/generators/win32/msvc_nmake.cpp | 8 +++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index 9f14492..82f2366 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -96,7 +96,8 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) } if (project->values("TEMPLATE").first() == "app" || - project->values("TEMPLATE").first() == "lib") { + project->values("TEMPLATE").first() == "lib" || + project->values("TEMPLATE").first() == "aux") { if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t)) return true; writeMakeParts(t); @@ -1017,6 +1018,9 @@ void UnixMakefileGenerator::init2() if(project->isEmpty("QMAKE_FRAMEWORK_VERSION")) project->values("QMAKE_FRAMEWORK_VERSION").append(project->values("VER_MAJ").first()); + if (project->values("TEMPLATE").first() == "aux") + return; + if (!project->values("QMAKE_APP_FLAG").isEmpty()) { if(!project->isEmpty("QMAKE_BUNDLE")) { QString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION"); diff --git a/qmake/generators/win32/borland_bmake.cpp b/qmake/generators/win32/borland_bmake.cpp index 585a0f4..1f7de00 100644 --- a/qmake/generators/win32/borland_bmake.cpp +++ b/qmake/generators/win32/borland_bmake.cpp @@ -68,7 +68,8 @@ BorlandMakefileGenerator::writeMakefile(QTextStream &t) } if(project->first("TEMPLATE") == "app" || - project->first("TEMPLATE") == "lib") { + project->first("TEMPLATE") == "lib" || + project->first("TEMPLATE") == "aux") { writeBorlandParts(t); return MakefileGenerator::writeMakefile(t); } @@ -136,6 +137,11 @@ BorlandMakefileGenerator::init() void BorlandMakefileGenerator::writeBuildRulesPart(QTextStream &t) { + if (project->first("TEMPLATE") == "aux") { + t << "first:" << endl; + return; + } + t << "first: all" << endl; t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl; t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 462920e..0d15cfb 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -141,7 +141,8 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t) } if(project->first("TEMPLATE") == "app" || - project->first("TEMPLATE") == "lib") { + project->first("TEMPLATE") == "lib" || + project->first("TEMPLATE") == "aux") { if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") writePkgConfigFile(); @@ -436,6 +437,11 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) { + if (project->first("TEMPLATE") == "aux") { + t << "first:" << endl; + return; + } + t << "first: all" << endl; t << "all: " << escapeDependencyPath(fileFixify(Option::output.fileName())) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS"))," "," "," ") << " $(DESTDIR_TARGET)" << endl << endl; t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index c55806d..0565c53 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -70,7 +70,8 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t) } if(project->first("TEMPLATE") == "app" || - project->first("TEMPLATE") == "lib") { + project->first("TEMPLATE") == "lib" || + project->first("TEMPLATE") == "aux") { #if 0 if(Option::mkfile::do_stub_makefile) return MakefileGenerator::writeStubMakefile(t); @@ -332,6 +333,11 @@ void NmakeMakefileGenerator::writeImplicitRulesPart(QTextStream &t) void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) { + if (project->first("TEMPLATE") == "aux") { + t << "first:" << endl; + return; + } + t << "first: all" << endl; t << "all: " << fileFixify(Option::output.fileName()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(DESTDIR_TARGET)" << endl << endl; t << "$(DESTDIR_TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) " << var("POST_TARGETDEPS"); -- cgit v0.12 From 004653e63b2c20f32750c54a609572329903d8be Mon Sep 17 00:00:00 2001 From: Ademar de Souza Reis Jr Date: Fri, 21 Jan 2011 08:19:00 -0600 Subject: QPainterPath: Ignore calls with NaN/Infinite parameters QPainterPath can't handle NaNs/Inf inside coordinates, but instead of safely ignoring or aborting an operation, it shows a warning and keeps going on, with undefined behavior. Sometimes leading to infinite loops, leaks or crashes (see qtwebkit example below). This is particularly bad when QPainterPath is used to render content from untrusted sources (web or user data). As an example, there's a qtwebkit bug where the browser crashes when a particular SVG is loaded: https://bugs.webkit.org/show_bug.cgi?id=51698. Please note that "untrusted sources" doesn't apply only to network sources. This behavior can probably be exploited on applications such as file-browsers with previews enabled. Task-number: QTBUG-16664 Signed-off-by: Ademar de Souza Reis Jr Merge-request: 1026 Reviewed-by: Marius Storm-Olsen Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Samuel --- src/gui/painting/qpainterpath.cpp | 66 ++++++++++++++++++++-------- tests/auto/qpainterpath/tst_qpainterpath.cpp | 46 +++++++++++++++++++ 2 files changed, 93 insertions(+), 19 deletions(-) diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 0bb2901..4744cb5 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -628,10 +628,14 @@ void QPainterPath::moveTo(const QPointF &p) #ifdef QPP_DEBUG printf("QPainterPath::moveTo() (%.2f,%.2f)\n", p.x(), p.y()); #endif + + if (!qt_is_finite(p.x()) || !qt_is_finite(p.y())) { #ifndef QT_NO_DEBUG - if (qt_is_nan(p.x()) || qt_is_nan(p.y())) - qWarning("QPainterPath::moveTo: Adding point where x or y is NaN, results are undefined"); + qWarning("QPainterPath::moveTo: Adding point where x or y is NaN or Inf, ignoring call"); #endif + return; + } + ensureData(); detach(); @@ -674,10 +678,14 @@ void QPainterPath::lineTo(const QPointF &p) #ifdef QPP_DEBUG printf("QPainterPath::lineTo() (%.2f,%.2f)\n", p.x(), p.y()); #endif + + if (!qt_is_finite(p.x()) || !qt_is_finite(p.y())) { #ifndef QT_NO_DEBUG - if (qt_is_nan(p.x()) || qt_is_nan(p.y())) - qWarning("QPainterPath::lineTo: Adding point where x or y is NaN, results are undefined"); + qWarning("QPainterPath::lineTo: Adding point where x or y is NaN or Inf, ignoring call"); #endif + return; + } + ensureData(); detach(); @@ -729,11 +737,15 @@ void QPainterPath::cubicTo(const QPointF &c1, const QPointF &c2, const QPointF & printf("QPainterPath::cubicTo() (%.2f,%.2f), (%.2f,%.2f), (%.2f,%.2f)\n", c1.x(), c1.y(), c2.x(), c2.y(), e.x(), e.y()); #endif + + if (!qt_is_finite(c1.x()) || !qt_is_finite(c1.y()) || !qt_is_finite(c2.x()) || !qt_is_finite(c2.y()) + || !qt_is_finite(e.x()) || !qt_is_finite(e.y())) { #ifndef QT_NO_DEBUG - if (qt_is_nan(c1.x()) || qt_is_nan(c1.y()) || qt_is_nan(c2.x()) || qt_is_nan(c2.y()) - || qt_is_nan(e.x()) || qt_is_nan(e.y())) - qWarning("QPainterPath::cubicTo: Adding point where x or y is NaN, results are undefined"); + qWarning("QPainterPath::cubicTo: Adding point where x or y is NaN or Inf, ignoring call"); #endif + return; + } + ensureData(); detach(); @@ -782,10 +794,14 @@ void QPainterPath::quadTo(const QPointF &c, const QPointF &e) printf("QPainterPath::quadTo() (%.2f,%.2f), (%.2f,%.2f)\n", c.x(), c.y(), e.x(), e.y()); #endif + + if (!qt_is_finite(c.x()) || !qt_is_finite(c.y()) || !qt_is_finite(e.x()) || !qt_is_finite(e.y())) { #ifndef QT_NO_DEBUG - if (qt_is_nan(c.x()) || qt_is_nan(c.y()) || qt_is_nan(e.x()) || qt_is_nan(e.y())) - qWarning("QPainterPath::quadTo: Adding point where x or y is NaN, results are undefined"); + qWarning("QPainterPath::quadTo: Adding point where x or y is NaN or Inf, ignoring call"); #endif + return; + } + ensureData(); detach(); @@ -849,11 +865,15 @@ void QPainterPath::arcTo(const QRectF &rect, qreal startAngle, qreal sweepLength printf("QPainterPath::arcTo() (%.2f, %.2f, %.2f, %.2f, angle=%.2f, sweep=%.2f\n", rect.x(), rect.y(), rect.width(), rect.height(), startAngle, sweepLength); #endif + + if (!qt_is_finite(rect.x()) && !qt_is_finite(rect.y()) || !qt_is_finite(rect.width()) || !qt_is_finite(rect.height()) + || !qt_is_finite(startAngle) || !qt_is_finite(sweepLength)) { #ifndef QT_NO_DEBUG - if (qt_is_nan(rect.x()) || qt_is_nan(rect.y()) || qt_is_nan(rect.width()) || qt_is_nan(rect.height()) - || qt_is_nan(startAngle) || qt_is_nan(sweepLength)) - qWarning("QPainterPath::arcTo: Adding arc where a parameter is NaN, results are undefined"); + qWarning("QPainterPath::arcTo: Adding arc where a parameter is NaN or Inf, ignoring call"); #endif + return; + } + if (rect.isNull()) return; @@ -952,10 +972,13 @@ QPointF QPainterPath::currentPosition() const */ void QPainterPath::addRect(const QRectF &r) { + if (!qt_is_finite(r.x()) || !qt_is_finite(r.y()) || !qt_is_finite(r.width()) || !qt_is_finite(r.height())) { #ifndef QT_NO_DEBUG - if (qt_is_nan(r.x()) || qt_is_nan(r.y()) || qt_is_nan(r.width()) || qt_is_nan(r.height())) - qWarning("QPainterPath::addRect: Adding rect where a parameter is NaN, results are undefined"); + qWarning("QPainterPath::addRect: Adding rect where a parameter is NaN or Inf, ignoring call"); #endif + return; + } + if (r.isNull()) return; @@ -1032,11 +1055,14 @@ void QPainterPath::addPolygon(const QPolygonF &polygon) */ void QPainterPath::addEllipse(const QRectF &boundingRect) { + if (!qt_is_finite(boundingRect.x()) || !qt_is_finite(boundingRect.y()) + || !qt_is_finite(boundingRect.width()) || !qt_is_finite(boundingRect.height())) { #ifndef QT_NO_DEBUG - if (qt_is_nan(boundingRect.x()) || qt_is_nan(boundingRect.y()) - || qt_is_nan(boundingRect.width()) || qt_is_nan(boundingRect.height())) - qWarning("QPainterPath::addEllipse: Adding ellipse where a parameter is NaN, results are undefined"); + qWarning("QPainterPath::addEllipse: Adding ellipse where a parameter is NaN or Inf, ignoring call"); #endif + return; + } + if (boundingRect.isNull()) return; @@ -2358,10 +2384,12 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p) s >> x; s >> y; Q_ASSERT(type >= 0 && type <= 3); + if (!qt_is_finite(x) || !qt_is_finite(y)) { #ifndef QT_NO_DEBUG - if (qt_is_nan(x) || qt_is_nan(y)) - qWarning("QDataStream::operator>>: Adding a NaN element to path, results are undefined"); + qWarning("QDataStream::operator>>: NaN or Inf element found in path, skipping it"); #endif + continue; + } QPainterPath::Element elm = { x, y, QPainterPath::ElementType(type) }; p.d_func()->elements.append(elm); } diff --git a/tests/auto/qpainterpath/tst_qpainterpath.cpp b/tests/auto/qpainterpath/tst_qpainterpath.cpp index bc3b5d9..e9f09ea 100644 --- a/tests/auto/qpainterpath/tst_qpainterpath.cpp +++ b/tests/auto/qpainterpath/tst_qpainterpath.cpp @@ -101,6 +101,8 @@ private slots: void testToFillPolygons(); + void testNaNandInfinites(); + void closing(); void operators_data(); @@ -1159,6 +1161,50 @@ void tst_QPainterPath::testToFillPolygons() QCOMPARE(polygons.first().count(QPointF(70, 50)), 0); } +void tst_QPainterPath::testNaNandInfinites() +{ + QPainterPath path1; + QPainterPath path2 = path1; + + QPointF p1 = QPointF(qSNaN(), 1); + QPointF p2 = QPointF(qQNaN(), 1); + QPointF p3 = QPointF(qQNaN(), 1); + QPointF pInf = QPointF(qInf(), 1); + + // all these operations with NaN/Inf should be ignored + // can't test operator>> reliably, as we can't create a path with NaN to << later + + path1.moveTo(p1); + path1.moveTo(qSNaN(), qQNaN()); + path1.moveTo(pInf); + + path1.lineTo(p1); + path1.lineTo(qSNaN(), qQNaN()); + path1.lineTo(pInf); + + path1.cubicTo(p1, p2, p3); + path1.cubicTo(p1, QPointF(1, 1), QPointF(2, 2)); + path1.cubicTo(pInf, QPointF(10, 10), QPointF(5, 1)); + + path1.quadTo(p1, p2); + path1.quadTo(QPointF(1, 1), p3); + path1.quadTo(QPointF(1, 1), pInf); + + path1.arcTo(QRectF(p1, p2), 5, 5); + path1.arcTo(QRectF(pInf, QPointF(1, 1)), 5, 5); + + path1.addRect(QRectF(p1, p2)); + path1.addRect(QRectF(pInf, QPointF(1, 1))); + + path1.addEllipse(QRectF(p1, p2)); + path1.addEllipse(QRectF(pInf, QPointF(1, 1))); + + QCOMPARE(path1, path2); + + path1.lineTo(QPointF(1, 1)); + QVERIFY(path1 != path2); +} + void tst_QPainterPath::connectPathDuplicatePoint() { QPainterPath a; -- cgit v0.12 From 79ba7cceca5e4029876ace2121edd25b08ae14ce Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 3 May 2011 15:06:13 +0200 Subject: Support gamma correction of text on GL If the SRGB framebuffer extension in GL is available, we can support gamma correction of text with a gamma of 2.1. On Mac this is sufficient for gamma correcting subpixel antialiased text. Gray antialiasing should not be gamma corrected on Mac. On Windows, the user can potentially set the gamma value to anything between 1.0 and 2.2 (or something like that). We support anything that resembles 1.0 closely enough by pushing the text out without any correction (like before). We also support anything that resembles 2.1 (the gamma hardcoded in GL's SRGB extension) by turning on the extension before blending the text. In between the two, we'll use gray antialiasing to avoid differing too much from the raster engine (which is our reference in this.) For gray antialiasing on Windows, we use a constant gamma of 2.3 which has been determined by experimentation. Since this is close enough to 2.1 we do gamma correction with SRGB extension. The distance limit of 0.2 is determined by some experimentation. Reviewed-by: Samuel --- src/gui/kernel/qapplication_win.cpp | 13 ++++++++- src/gui/painting/qdrawhelper.cpp | 10 ++----- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 31 ++++++++++++++++++++-- src/opengl/qgl.cpp | 7 +++++ src/opengl/qgl_p.h | 3 ++- src/opengl/qglextensions_p.h | 8 ++++++ 6 files changed, 60 insertions(+), 12 deletions(-) diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 6658300..a3a9ff1 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -237,6 +237,7 @@ static void resolveAygLibs() # define FE_FONTSMOOTHINGCLEARTYPE 0x0002 #endif +Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; Q_GUI_EXPORT bool qt_cleartype_enabled; Q_GUI_EXPORT bool qt_win_owndc_required; // CS_OWNDC is required if we use the GL graphicssystem as default @@ -653,8 +654,18 @@ static void qt_win_read_cleartype_settings() if (SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0)) qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE); #endif -} + int winSmooth; + if (SystemParametersInfo(SPI_GETFONTSMOOTHINGCONTRAST, 0, &winSmooth, 0)) { + qt_fontsmoothing_gamma = winSmooth / qreal(1000.0); + } else { + qt_fontsmoothing_gamma = 1.0; + } + + // Safeguard ourselves against corrupt registry values... + if (qt_fontsmoothing_gamma > 5 || qt_fontsmoothing_gamma < 1) + qt_fontsmoothing_gamma = qreal(1.4); +} static void qt_set_windows_resources() { diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index ae9993e..360292c 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7068,14 +7068,8 @@ void qt_build_pow_tables() { #endif #ifdef Q_WS_WIN - int winSmooth; - if (SystemParametersInfo(0x200C /* SPI_GETFONTSMOOTHINGCONTRAST */, 0, &winSmooth, 0)) - smoothing = winSmooth / qreal(1000.0); - - // Safeguard ourselves against corrupt registry values... - if (smoothing > 5 || smoothing < 1) - smoothing = qreal(1.4); - + extern qreal qt_fontsmoothing_gamma; // qapplication_win.cpp + smoothing = qt_fontsmoothing_gamma; #endif #ifdef Q_WS_X11 diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index a2707e0..38bd58d 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1554,6 +1554,14 @@ namespace { } +#if defined(Q_WS_WIN) +static bool fontSmoothingApproximately(qreal target) +{ + extern Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; // qapplication_win.cpp + return (qAbs(qt_fontsmoothing_gamma - target) < 0.2); +} +#endif + // #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyphType, @@ -1792,7 +1800,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp shaderManager->setMaskType(QGLEngineShaderManager::PixelMask); prepareForDraw(false); // Text always causes src pixels to be transparent } - //### TODO: Gamma correction QGLTextureGlyphCache::FilterMode filterMode = (s->matrix.type() > QTransform::TxTranslate)?QGLTextureGlyphCache::Linear:QGLTextureGlyphCache::Nearest; if (lastMaskTextureUsed != cache->texture() || cache->filterMode() != filterMode) { @@ -1815,12 +1822,31 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp } } + bool srgbFrameBufferEnabled = false; + if (ctx->d_ptr->extension_flags & QGLExtensions::SRGBFrameBuffer) { +#if defined(Q_WS_MAC) + if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) +#elif defined(Q_WS_WIN) + if (glyphType != QFontEngineGlyphCache::Raster_RGBMask || fontSmoothingApproximately(2.1)) +#else + if (false) +#endif + { + glEnable(FRAMEBUFFER_SRGB_EXT); + srgbFrameBufferEnabled = true; + } + } + #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, 0); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); #else glDrawElements(GL_TRIANGLE_STRIP, 6 * numGlyphs, GL_UNSIGNED_SHORT, elementIndices.data()); #endif + + if (srgbFrameBufferEnabled) + glDisable(FRAMEBUFFER_SRGB_EXT); + } void QGL2PaintEngineEx::drawPixmapFragments(const QPainter::PixmapFragment *fragments, int fragmentCount, const QPixmap &pixmap, @@ -1992,7 +2018,8 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) #if !defined(QT_OPENGL_ES_2) #if defined(Q_WS_WIN) - if (qt_cleartype_enabled) + if (qt_cleartype_enabled + && (fontSmoothingApproximately(1.0) || fontSmoothingApproximately(2.1))) #endif #if defined(Q_WS_MAC) if (qt_applefontsmoothing_enabled) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 057fb55..099cc00 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -5490,6 +5490,13 @@ QGLExtensions::Extensions QGLExtensions::currentContextExtensions() if (extensions.match("GL_EXT_bgra")) glExtensions |= BGRATextureFormat; + { + GLboolean srgbCapableFramebuffers; + glGetBooleanv(FRAMEBUFFER_SRGB_CAPABLE_EXT, &srgbCapableFramebuffers); + if (srgbCapableFramebuffers) + glExtensions |= SRGBFrameBuffer; + } + return glExtensions; } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 50d13c9..ac54e2f 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -288,7 +288,8 @@ public: PVRTCTextureCompression = 0x00020000, FragmentShader = 0x00040000, ElementIndexUint = 0x00080000, - Depth24 = 0x00100000 + Depth24 = 0x00100000, + SRGBFrameBuffer = 0x00200000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qglextensions_p.h b/src/opengl/qglextensions_p.h index 529c7a1..ac80ce8 100644 --- a/src/opengl/qglextensions_p.h +++ b/src/opengl/qglextensions_p.h @@ -477,6 +477,14 @@ struct QGLExtensionFuncs // OpenGL constants +#ifndef FRAMEBUFFER_SRGB_CAPABLE_EXT +#define FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA +#endif + +#ifndef FRAMEBUFFER_SRGB_EXT +#define FRAMEBUFFER_SRGB_EXT 0x8DB9 +#endif + #ifndef GL_ARRAY_BUFFER #define GL_ARRAY_BUFFER 0x8892 #endif -- cgit v0.12 From 320f172c851a4720299297c8b3b757eb1202c568 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 2 May 2011 13:46:40 +0200 Subject: Don't realloc user-provided buffer When QTextBoundaryFinder doesn't own the buffer, don't realloc it and get a new one instead. Reviewed-by: Ritt Konstantin --- src/corelib/tools/qtextboundaryfinder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qtextboundaryfinder.cpp b/src/corelib/tools/qtextboundaryfinder.cpp index 34bc406..47319d4 100644 --- a/src/corelib/tools/qtextboundaryfinder.cpp +++ b/src/corelib/tools/qtextboundaryfinder.cpp @@ -199,11 +199,11 @@ QTextBoundaryFinder &QTextBoundaryFinder::operator=(const QTextBoundaryFinder &o chars = other.chars; length = other.length; pos = other.pos; - freePrivate = true; QTextBoundaryFinderPrivate *newD = (QTextBoundaryFinderPrivate *) - realloc(d, length*sizeof(HB_CharAttributes)); + realloc(freePrivate ? d : 0, length*sizeof(HB_CharAttributes)); Q_CHECK_PTR(newD); + freePrivate = true; d = newD; memcpy(d, other.d, length*sizeof(HB_CharAttributes)); -- cgit v0.12 From 4cb9db404224c55859713c282aa90409e375c372 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Mon, 2 May 2011 13:49:36 +0200 Subject: Don't rely on uninitialized data HB_GetCharAttributes used to require a zero-initialized array for attributes, as it selectively sets relevant bits for each character. We ease that requirement by always initializing the attributes buffer explicitly with memset. Task-number: QT-4911 Reviewed-by: Ritt Konstantin --- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index ce4d4ac..1021b02 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -643,6 +643,7 @@ void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, const HB_ScriptItem *items, hb_uint32 numItems, HB_CharAttributes *attributes) { + memset(attributes, 0, stringLength * sizeof(HB_CharAttributes)); calcLineBreaks(string, stringLength, attributes); for (hb_uint32 i = 0; i < numItems; ++i) { -- cgit v0.12 From ae128aef03d246c9f89bed015092b1c5a925bcbc Mon Sep 17 00:00:00 2001 From: Simon Frost Date: Tue, 3 May 2011 18:29:56 +0100 Subject: Add enablers for Symbian App Booster To use the Symbian App Booster, a registration file (matching the filename of the executable, eg helloworld.applite) must be copied to the import folder within QtAppBooster's private directory. The appropriate library (qdeclarativebooster) must also be linked against. With this change, the required actions are carried out by adding "CONFIG += symbian_appbooster" to the application's .pro file. Task-number: QT-4892 Reviewed-by: Miikka Heikkinen --- mkspecs/common/symbian/template.applite | 1 + mkspecs/features/symbian/symbian_appbooster.prf | 32 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 mkspecs/common/symbian/template.applite create mode 100644 mkspecs/features/symbian/symbian_appbooster.prf diff --git a/mkspecs/common/symbian/template.applite b/mkspecs/common/symbian/template.applite new file mode 100644 index 0000000..73a1999 --- /dev/null +++ b/mkspecs/common/symbian/template.applite @@ -0,0 +1 @@ +// This is an auto-generated lite registration file \ No newline at end of file diff --git a/mkspecs/features/symbian/symbian_appbooster.prf b/mkspecs/features/symbian/symbian_appbooster.prf new file mode 100644 index 0000000..080f4d0 --- /dev/null +++ b/mkspecs/features/symbian/symbian_appbooster.prf @@ -0,0 +1,32 @@ +contains(TEMPLATE, ".*app") { + baseTarget = $$symbianRemoveSpecialCharacters($$basename(TARGET)) + + symbian-abld|symbian-sbsv2 { + LITE_REG_TARGET = $$_PRO_FILE_PWD_ + } else { + contains(DESTDIR, "/.*") { + LITE_REG_TARGET = $$DESTDIR + } else:isEmpty(DESTDIR) { + LITE_REG_TARGET = $$OUT_PWD + } else { + LITE_REG_TARGET = $$OUT_PWD/$$DESTDIR + } + } + + LITE_REG_TARGET = $${LITE_REG_TARGET}/$${baseTarget}.applite + LITE_REG_TEMPLATE = $$[QT_INSTALL_DATA]/mkspecs/common/symbian/template.applite + + lite_reg_copy.input = LITE_REG_TEMPLATE + lite_reg_copy.output = $$LITE_REG_TARGET + lite_reg_copy.variable_out = PRE_TARGETDEPS + lite_reg_copy.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} + lite_reg_copy.CONFIG += no_link + QMAKE_EXTRA_COMPILERS += lite_reg_copy + + isEmpty(LITE_IMPORT_DIR): LITE_IMPORT_DIR = /private/20034884/import/apps + lite_deployment.sources += $$LITE_REG_TARGET + lite_deployment.path = $$LITE_IMPORT_DIR + DEPLOYMENT += lite_deployment + + LIBS += -lqDeclarativeBooster.dll +} -- cgit v0.12 From d1011fc9328fa335bc69a065b29e77ce60608c55 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 10:38:03 +1000 Subject: Remove Q_ASSERT from qgraphicsanchorlayout test Q_ASSERT will only catch a violation of the precondition of the checkReverseDirection function in a debug build. This commit replaces the Q_ASSERT with QVERIFY'ing the precondition (that the widget has a layout) before calling the function. Change-Id: Ibaa2b52b7d67fa20784e0df022e8c8169da0e50e Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 67e9b0a..7b33081 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -135,7 +135,6 @@ static void setAnchor(QGraphicsAnchorLayout *l, static bool checkReverseDirection(QGraphicsWidget *widget) { QGraphicsLayout *layout = widget->layout(); - Q_ASSERT(layout); qreal left, top, right, bottom; layout->getContentsMargins(&left, &top, &right, &bottom); widget->setLayoutDirection(Qt::LeftToRight); @@ -345,6 +344,7 @@ void tst_QGraphicsAnchorLayout::layoutDirection() p->show(); view->show(); + QVERIFY(p->layout()); QCOMPARE(checkReverseDirection(p), true); if (hasSimplification) { @@ -445,6 +445,7 @@ void tst_QGraphicsAnchorLayout::diagonal() QVERIFY(!usedSimplex(l, Qt::Vertical)); } + QVERIFY(p.layout()); QCOMPARE(checkReverseDirection(&p), true); c->setMinimumWidth(300); @@ -735,6 +736,7 @@ void tst_QGraphicsAnchorLayout::snakeOppositeDirections() QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0)); QCOMPARE(p.size(), layoutMaximumSize); + QVERIFY(p.layout()); QCOMPARE(checkReverseDirection(&p), true); } -- cgit v0.12 From 012b2d8198b8cfe39a66025334ed9ae2a045a68c Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 10:44:51 +1000 Subject: Remove dead code from qgraphicsgridlayout autotest Change-Id: I230d1ec9dfd5df2a0fac161a03090308b7f07a1e Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- .../tst_qgraphicsgridlayout.cpp | 33 ---------------------- 1 file changed, 33 deletions(-) diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp index 837df78..78010e6 100644 --- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp +++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp @@ -3018,39 +3018,6 @@ static QSizeF wfh(Qt::SizeHint /*which*/, const QSizeF &constraint) return result; } -static qreal growthFactorBelowPreferredSize(qreal desired, qreal sumAvailable, qreal sumDesired) -{ - Q_ASSERT(sumDesired != 0.0); - return desired * qPow(sumAvailable / sumDesired, desired / sumDesired); -} - -static void expectedWidth(qreal minSize1, qreal prefSize1, - qreal minSize2, qreal prefSize2, - qreal targetSize, qreal *width1, qreal *width2) -{ - qreal sumAvail,factor1,factor2; - // stretch behaviour is different below and above preferred size... - if (targetSize < prefSize1 + prefSize2) { - sumAvail = targetSize - minSize1 - minSize2; - const qreal desired1 = prefSize1 - minSize1; - const qreal desired2 = prefSize2 - minSize2; - const qreal sumDesired = desired1 + desired2; - factor1 = growthFactorBelowPreferredSize(desired1, sumAvail, sumDesired); - factor2 = growthFactorBelowPreferredSize(desired2, sumAvail, sumDesired); - const qreal sumFactors = factor1 + factor2; - *width1 = sumAvail*factor1/sumFactors + minSize1; - *width2 = sumAvail*factor2/sumFactors + minSize2; - } else { - sumAvail = targetSize - prefSize1 - prefSize2; - factor1 = prefSize1; - factor2 = prefSize2; - const qreal sumFactors = factor1 + factor2; - *width1 = sumAvail*factor1/sumFactors + prefSize1; - *width2 = sumAvail*factor2/sumFactors + prefSize2; - } -} - - bool qFuzzyCompare(const QSizeF &a, const QSizeF &b) { return qFuzzyCompare(a.width(), b.width()) && qFuzzyCompare(a.height(), b.height()); -- cgit v0.12 From a388e104febb131cd35438bbb1397eeab41d3ab8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 10:48:14 +1000 Subject: Remove mention of Q_ASSERT from qheaderview autotest Change-Id: I3a97411c0b53345bffbadb60a3e7caabfb0441d2 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qheaderview/tst_qheaderview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp index 9a25fb6..d877d2f 100644 --- a/tests/auto/qheaderview/tst_qheaderview.cpp +++ b/tests/auto/qheaderview/tst_qheaderview.cpp @@ -1106,7 +1106,7 @@ void tst_QHeaderView::moveAndInsertSection() void tst_QHeaderView::resizeMode() { - // Q_ASSERT's when resizeMode is called with an invalid index + // resizeMode must not be called with an invalid index int last = view->count() - 1; view->setResizeMode(QHeaderView::Interactive); QCOMPARE(view->resizeMode(last), QHeaderView::Interactive); -- cgit v0.12 From 0d773d839e39f4f4bfd0bf9d652e4f2650adfcb0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 10:52:52 +1000 Subject: Remove Q_ASSERT from qitemmodel autotest Allow createModel() to return a null model on failure (which it already did in release mode builds), but fail the test gracefully instead of crashing when a null model is returned. Change-Id: Iaa0ec31183e0c90fcea512223d01e07ed188a380 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qitemmodel/modelstotest.cpp | 1 - tests/auto/qitemmodel/tst_qitemmodel.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/auto/qitemmodel/modelstotest.cpp b/tests/auto/qitemmodel/modelstotest.cpp index c4c2cbb..cec1703 100644 --- a/tests/auto/qitemmodel/modelstotest.cpp +++ b/tests/auto/qitemmodel/modelstotest.cpp @@ -227,7 +227,6 @@ QAbstractItemModel *ModelsToTest::createModel(const QString &modelType) return widget->model(); } - Q_ASSERT(false); return 0; } diff --git a/tests/auto/qitemmodel/tst_qitemmodel.cpp b/tests/auto/qitemmodel/tst_qitemmodel.cpp index 7e177ba..9482853 100644 --- a/tests/auto/qitemmodel/tst_qitemmodel.cpp +++ b/tests/auto/qitemmodel/tst_qitemmodel.cpp @@ -199,6 +199,7 @@ void tst_QItemModel::nonDestructiveBasicTest() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QCOMPARE(currentModel->buddy(QModelIndex()), QModelIndex()); currentModel->canFetchMore(QModelIndex()); @@ -244,6 +245,7 @@ void tst_QItemModel::rowCount() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, isEmpty); if (isEmpty) { @@ -291,6 +293,7 @@ void tst_QItemModel::columnCount() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, isEmpty); if (isEmpty) { @@ -325,6 +328,7 @@ void tst_QItemModel::hasIndex() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); // Make sure that invalid values returns an invalid index QCOMPARE(currentModel->hasIndex(-2, -2), false); @@ -359,6 +363,7 @@ void tst_QItemModel::index() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); // Make sure that invalid values returns an invalid index QCOMPARE(currentModel->index(-2, -2), QModelIndex()); @@ -489,6 +494,7 @@ void tst_QItemModel::parent() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); // Make sure the model wont crash and will return an invalid QModelIndex // when asked for the parent of an invalid index. @@ -538,6 +544,7 @@ void tst_QItemModel::data() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); // Invalid index should return an invalid qvariant QVERIFY(!currentModel->data(QModelIndex()).isValid()); @@ -618,6 +625,7 @@ void tst_QItemModel::setData() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); qRegisterMetaType("QModelIndex"); QSignalSpy spy(currentModel, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &))); QCOMPARE(currentModel->setData(QModelIndex(), QVariant()), false); @@ -660,6 +668,7 @@ void tst_QItemModel::setHeaderData() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QCOMPARE(currentModel->setHeaderData(-1, Qt::Horizontal, QVariant()), false); QCOMPARE(currentModel->setHeaderData(-1, Qt::Vertical, QVariant()), false); @@ -708,6 +717,7 @@ void tst_QItemModel::sort() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, isEmpty); if (isEmpty) @@ -819,6 +829,7 @@ void tst_QItemModel::remove() QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, readOnly); if (readOnly) @@ -1160,6 +1171,7 @@ void tst_QItemModel::insert() { QFETCH(QString, modelType); currentModel = testModels->createModel(modelType); + QVERIFY(currentModel); QFETCH(bool, readOnly); if (readOnly) -- cgit v0.12 From 51b1d8dc20a2557d2002550b03e5b9f37f425fb4 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:25:17 +1000 Subject: Remove Q_ASSERT from qitemview autotest Allow createView() to return a null view on failure (which it already did in release mode builds), but fail the test gracefully instead of crashing when a null view is returned. Also reordered the code slightly to put all the QFETCH's together. Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern Change-Id: I3a41c738cb0e4e860db2342b30817a804b20f30d --- tests/auto/qitemview/tst_qitemview.cpp | 25 +++++++++++++++++++------ tests/auto/qitemview/viewstotest.cpp | 1 - 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tests/auto/qitemview/tst_qitemview.cpp b/tests/auto/qitemview/tst_qitemview.cpp index 220a174..c987c8f 100644 --- a/tests/auto/qitemview/tst_qitemview.cpp +++ b/tests/auto/qitemview/tst_qitemview.cpp @@ -297,9 +297,11 @@ void tst_QItemView::nonDestructiveBasicTest() #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); @@ -454,9 +456,11 @@ void tst_QItemView::spider() QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->setModel(treeModel); @@ -489,9 +493,11 @@ void tst_QItemView::resize() // This test needs to be re-thought out, it takes too long and // doesn't really catch theproblem. QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->setModel(treeModel); @@ -517,9 +523,11 @@ void tst_QItemView::visualRect() QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); QCOMPARE(view->visualRect(QModelIndex()), QRect()); @@ -651,9 +659,11 @@ void tst_QItemView::indexAt() QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->show(); @@ -685,9 +695,11 @@ void tst_QItemView::scrollTo() QSKIP("This test takes too long to execute on IRIX", SkipAll); #endif QFETCH(QString, viewType); - view = testViews->createView(viewType); QFETCH(int, vscroll); QFETCH(int, hscroll); + + view = testViews->createView(viewType); + QVERIFY(view); view->setVerticalScrollMode((QAbstractItemView::ScrollMode)vscroll); view->setHorizontalScrollMode((QAbstractItemView::ScrollMode)hscroll); view->setModel(treeModel); @@ -735,6 +747,7 @@ void tst_QItemView::moveCursor() #endif QFETCH(QString, viewType); view = testViews->createView(viewType); + QVERIFY(view); if (view->objectName() == "QHeaderView") return; diff --git a/tests/auto/qitemview/viewstotest.cpp b/tests/auto/qitemview/viewstotest.cpp index 3aa355d..5e21daf 100644 --- a/tests/auto/qitemview/viewstotest.cpp +++ b/tests/auto/qitemview/viewstotest.cpp @@ -141,7 +141,6 @@ QAbstractItemView *ViewsToTest::createView(const QString &viewType) view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); view->setSelectionBehavior(QAbstractItemView::SelectItems); } - Q_ASSERT(view); return view; } -- cgit v0.12 From 291f04a4a7be4a975c6b8eaeeed4e0c196e23128 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:35:25 +1000 Subject: Change Q_ASSERT to QVERIFY in QMenu test. Change-Id: Ifc08d4eabd8565cfd242ec2e70cf597e92f28fe3 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qmenu/tst_qmenu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 1367e1f..c31361d 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -789,7 +789,7 @@ void tst_QMenu::task250673_activeMultiColumnSubMenuPosition() while (main.columnCount() < 2) { main.addAction(QString("Item %1").arg(i)); ++i; - Q_ASSERT(i<1000); + QVERIFY(i<1000); } main.setActiveAction(menuAction); sub.setActiveAction(subAction); -- cgit v0.12 From 6f082a3fdd368cd7a969b7f324354583d081da82 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:44:16 +1000 Subject: Remove Q_ASSERT from QMetaObject autotest. Issue a helpful warning rather than ignoring the error in release mode builds. Change-Id: Iea7bf4d63f8227abaf7dcf1700c5fef62763afad Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qmetaobject/tst_qmetaobject.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp index d496c56..5621c47 100644 --- a/tests/auto/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp @@ -241,7 +241,12 @@ public: QObject *child; public slots: - void on_child1_destroyed(QObject *obj = 0) { ++invokeCount1; Q_ASSERT(obj && obj == child); } + void on_child1_destroyed(QObject *obj = 0) + { + ++invokeCount1; + if (!obj || obj != child) + qWarning() << "on_child1_destroyed invoked with wrong child object"; + } void on_child2_destroyed() { ++invokeCount2; } }; @@ -265,7 +270,12 @@ public: } private slots: - void on_child1_destroyed(QObject *obj) { ++invokeCount1; Q_ASSERT(obj && obj == child); } + void on_child1_destroyed(QObject *obj) + { + ++invokeCount1; + if (!obj || obj != child) + qWarning() << "on_child1_destroyed invoked with wrong child object"; + } void on_child1_destroyed() { ++invokeCount2; } }; -- cgit v0.12 From a3b2fa3f1beffa7709c11522d4e2db9ec8f952e0 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:48:40 +1000 Subject: Remove Q_ASSERT's from QMetaType autotest. Instead of asserting in debug mode and doing nothing in release mode, put specific warnings in the test output and fail the test gracefully. Change-Id: I453a0ab7ddef5b2acf55f77f71a59a940d93ae54 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qmetatype/tst_qmetatype.cpp | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/tests/auto/qmetatype/tst_qmetatype.cpp b/tests/auto/qmetatype/tst_qmetatype.cpp index 67bbac2..fcb949f 100644 --- a/tests/auto/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/qmetatype/tst_qmetatype.cpp @@ -113,17 +113,35 @@ protected: #ifdef Q_OS_LINUX pthread_yield(); #endif - Q_ASSERT(QMetaType::isRegistered(tp)); - Q_ASSERT(QMetaType::type(nm) == tp); - Q_ASSERT(QMetaType::typeName(tp) == name); + if (!QMetaType::isRegistered(tp)) { + ++failureCount; + qWarning() << name << "is not a registered metatype"; + } + if (QMetaType::type(nm) != tp) { + ++failureCount; + qWarning() << "Wrong metatype returned for" << name; + } + if (QMetaType::typeName(tp) != name) { + ++failureCount; + qWarning() << "Wrong typeName returned for" << tp; + } void *buf = QMetaType::construct(tp, 0); void *buf2 = QMetaType::construct(tp, buf); - Q_ASSERT(buf); - Q_ASSERT(buf2); + if (!buf) { + ++failureCount; + qWarning() << "Null buffer returned by QMetaType::construct(tp, 0)"; + } + if (!buf2) { + ++failureCount; + qWarning() << "Null buffer returned by QMetaType::construct(tp, buf)"; + } QMetaType::destroy(tp, buf); QMetaType::destroy(tp, buf2); } } +public: + MetaTypeTorturer() : failureCount(0) { } + int failureCount; }; void tst_QMetaType::threadSafety() @@ -139,6 +157,10 @@ void tst_QMetaType::threadSafety() QVERIFY(t1.wait()); QVERIFY(t2.wait()); QVERIFY(t3.wait()); + + QCOMPARE(t1.failureCount, 0); + QCOMPARE(t2.failureCount, 0); + QCOMPARE(t3.failureCount, 0); } namespace TestSpace -- cgit v0.12 From 7bd6ca895e5fa4de197d9d7bf2e7b578c01c3c2a Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 11:59:05 +1000 Subject: Remove Q_ASSERT's from QObject autotest. The Receiver class has two slots that aren't meant to get called during the test (they're there to catch broken parsing of slot names). Rather than asserting when one of them gets called, which does nothing in a release mode build, this commit makes the slots record the number of times they were called (as for the other slots in the test) and fails the test gracefully if either of those slots was called. Change-Id: Ia0393026cb96ffdc6190b5e7bd951f75d231b11e Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qobject/tst_qobject.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp index d2307ee..29b07af 100644 --- a/tests/auto/qobject/tst_qobject.cpp +++ b/tests/auto/qobject/tst_qobject.cpp @@ -403,6 +403,8 @@ public: } void reset() { + called_slot10 = 0; + called_slot9 = 0; called_slot8 = 0; called_slot7 = 0; called_slot6 = 0; @@ -421,6 +423,8 @@ public: int called_slot6; int called_slot7; int called_slot8; + int called_slot9; + int called_slot10; bool called(int slot) { switch (slot) { @@ -432,6 +436,8 @@ public: case 6: return called_slot6; case 7: return called_slot7; case 8: return called_slot8; + case 9: return called_slot9; + case 10: return called_slot10; default: return false; } } @@ -449,8 +455,8 @@ public slots: void slotLoopBack() { ++called_slot8; } protected slots: - void o() { Q_ASSERT(0); } - void on() { Q_ASSERT(0); } + void o() { ++called_slot9; } + void on() { ++called_slot10; } signals: void on_Sender_signalLoopBack(); @@ -473,6 +479,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalWithParams(0); @@ -484,6 +492,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalWithParams(0, "string"); @@ -495,6 +505,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalManyParams(1, 2, 3, "string", true); @@ -506,6 +518,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalManyParams2(1, 2, 3, "string", true); @@ -517,6 +531,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), true); QCOMPARE(receiver.called(8), false); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); sender.emitSignalLoopBack(); @@ -528,6 +544,8 @@ void tst_QObject::connectByName() QCOMPARE(receiver.called(6), false); QCOMPARE(receiver.called(7), false); QCOMPARE(receiver.called(8), true); + QCOMPARE(receiver.called(9), false); + QCOMPARE(receiver.called(10), false); receiver.reset(); } -- cgit v0.12 From 8b95b4b5c09bf31f813fe39a3eec611c9daddb98 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 12:43:15 +1000 Subject: Remove Q_ASSERT's from qscriptclass autotest Allow the extension() function to return a null QVariant, which will cause the test to fail gracefully. Change-Id: Ide9ef69c48f4bdd5a000f525fe9f395c27854da9 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qscriptclass/tst_qscriptclass.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp index 9ab8318..4d27672 100644 --- a/tests/auto/qscriptclass/tst_qscriptclass.cpp +++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp @@ -369,8 +369,7 @@ QVariant TestClass::extension(Extension extension, { m_lastExtensionType = extension; m_lastExtensionArgument = argument; - if (extension == Callable) { - Q_ASSERT(m_callableMode != NotCallable); + if (extension == Callable && m_callableMode != NotCallable) { QScriptContext *ctx = qvariant_cast(argument); if (m_callableMode == CallableReturnsSum) { qsreal sum = 0; @@ -398,8 +397,7 @@ QVariant TestClass::extension(Extension extension, engine()->newQObject(ctx->thisObject(), engine()); return QVariant(); } - } else if (extension == HasInstance) { - Q_ASSERT(m_hasInstance); + } else if (extension == HasInstance && m_hasInstance) { QScriptValueList args = qvariant_cast(argument); QScriptValue obj = args.at(0); QScriptValue value = args.at(1); -- cgit v0.12 From 3ba55189d9aa7d9d7c2087071dcb4d338c0feab8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 12:51:47 +1000 Subject: Remove Q_ASSERT from V8 autotest Replace Q_ASSERT with QTest::qVerify, in line with the rest of this test function. Change-Id: Ia39e62efb9945f72a6a93fddddf36488cd456965 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp index b35fd06..0f63675 100644 --- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp +++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp @@ -153,7 +153,7 @@ void tst_QScriptV8TestSuite::runTestFunction(int testIndex) QScriptValue ret = engine.evaluate(contents); if (engine.hasUncaughtException()) { if (!ret.isError()) { - Q_ASSERT(ret.instanceOf(engine.globalObject().property("MjsUnitAssertionError"))); + QTest::qVerify(ret.instanceOf(engine.globalObject().property("MjsUnitAssertionError"))); QString actual = ret.property("actual").toString(); QString expected = ret.property("expected").toString(); int lineNumber = ret.property("lineNumber").toInt32(); -- cgit v0.12 From 5b86c4abc676b36d60e6625e89535e7f4907d2b3 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 12:56:16 +1000 Subject: Remove Q_ASSERT's from qsharedpointer autotest Report a meaningful warning message into the test output rather than aborting in debug mode and doing nothing in release mode. Change-Id: I6883fccbce0139c763f36f6839bb3452d8f69c1c Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qsharedpointer/externaltests.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsharedpointer/externaltests.cpp b/tests/auto/qsharedpointer/externaltests.cpp index 1ba03dc..b0490c9 100644 --- a/tests/auto/qsharedpointer/externaltests.cpp +++ b/tests/auto/qsharedpointer/externaltests.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #ifdef Q_OS_SYMBIAN #define DEFAULT_MAKESPEC "X:/STLsupport/mkspecs/symbian-abld/" @@ -342,7 +343,8 @@ namespace QTest { void QExternalTestPrivate::removeTemporaryDirectory() { - Q_ASSERT(!temporaryDir.isEmpty()); + if (temporaryDir.isEmpty()) + qWarning() << "Temporary directory is expected to be non-empty"; removeRecursive(temporaryDir); temporaryDir.clear(); } @@ -487,7 +489,8 @@ namespace QTest { bool QExternalTestPrivate::createProjectFile() { - Q_ASSERT(!temporaryDir.isEmpty()); + if (temporaryDir.isEmpty()) + qWarning() << "Temporary directory is expected to be non-empty"; QFile projectFile(temporaryDir + QLatin1String("/project.pro")); if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Truncate | QIODevice::Text)) { @@ -599,7 +602,9 @@ namespace QTest { bool QExternalTestPrivate::runQmake() { - Q_ASSERT(!temporaryDir.isEmpty()); + if (temporaryDir.isEmpty()) + qWarning() << "Temporary directory is expected to be non-empty"; + if (!createProjectFile()) return false; @@ -633,7 +638,8 @@ namespace QTest { bool QExternalTestPrivate::runMake(Target target) { - Q_ASSERT(!temporaryDir.isEmpty()); + if (temporaryDir.isEmpty()) + qWarning() << "Temporary directory is expected to be non-empty"; QExternalProcess make; make.setWorkingDirectory(temporaryDir); -- cgit v0.12 From b9b3ced2eafe13e491d5af5ad7432733941bfd8d Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 14:45:59 +1000 Subject: Remove Q_ASSERT from qsslsocket autotest. Make the server thread exit early if the socket is invalid. This will make the test fail gracefully instead of crashing. Change-Id: Ia9564c94dd32d65e6e9bdb4a2410f1512409546c Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qsslsocket/tst_qsslsocket.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index ef5833ef..6fbedfa 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -1517,8 +1517,8 @@ protected: // delayed start of encryption QTest::qSleep(100); QSslSocket *socket = server.socket; - Q_ASSERT(socket); - Q_ASSERT(socket->isValid()); + if (!socket || !socket->isValid()) + return; // error socket->ignoreSslErrors(); socket->startServerEncryption(); if (!socket->waitForEncrypted(2000)) -- cgit v0.12 From f01e2a5024db69913aed016e2854b2589ca85080 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 14:56:05 +1000 Subject: Remove Q_ASSERT from qtesselator autotest If the test data is incorrect, print a meaningful warning into the test output instead of deferencing an iterator beyond the last element in the list. Change-Id: I7be4f282639453de6d8240a2f17253025b415337 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qtessellator/dataparser.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/auto/qtessellator/dataparser.cpp b/tests/auto/qtessellator/dataparser.cpp index bd17ee2..d6566cb2 100644 --- a/tests/auto/qtessellator/dataparser.cpp +++ b/tests/auto/qtessellator/dataparser.cpp @@ -98,8 +98,12 @@ static QList parsePoints(const QByteArray &line) QList nums = parseNumbersList(it); QList::const_iterator nitr; for (nitr = nums.begin(); nitr != nums.end(); ++nitr) { - qreal x = *nitr; ++nitr; - Q_ASSERT(nitr != nums.end()); + qreal x = *nitr; + ++nitr; + if (nitr == nums.end()) { + qWarning() << "parsePoints: Even number of co-ordinates required, odd number found: skipping last point"; + break; + } qreal y = *nitr; res.append(QPointF(x, y)); } -- cgit v0.12 From a88dd1c5f62b5ded8ea0d76d185127ef28549c72 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 15:47:55 +1000 Subject: Remove Q_ASSERT from QTextOdfWriter autotest If the tag can't be found in the data, return an empty string rather than asserting, so that the test fails gracefully. Change-Id: I536f08c9c3e942817680849d96d035999d4994db Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp index 997cd68..ffce9a2 100644 --- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp +++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp @@ -114,11 +114,14 @@ QString tst_QTextOdfWriter::getContentFromXml() xmlWriter->writeEndDocument(); buffer->close(); QString stringContent = QString::fromUtf8(buffer->data()); + QString ret; int index = stringContent.indexOf("', index); - stringContent = stringContent.mid(index+1, stringContent.length() - index - 10); - return stringContent; + if (index > 0) { + index = stringContent.indexOf('>', index); + if (index > 0) + ret = stringContent.mid(index+1, stringContent.length() - index - 10); + } + return ret; } void tst_QTextOdfWriter::testWriteParagraph_data() -- cgit v0.12 From a8dc321b6669dd263a25a0cb5766e5b7150c6e20 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 15:58:24 +1000 Subject: Remove Q_ASSERT's from QVariant autotest. Print a meaningful warning message instead of aborting in debug mode builds and failing silently in release mode builds. Change-Id: I44143c5fbe6b6af87bdf5bd231cfaf9a3c9c33f8 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qvariant/tst_qvariant.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp index 62babdb..fef7ec2 100644 --- a/tests/auto/qvariant/tst_qvariant.cpp +++ b/tests/auto/qvariant/tst_qvariant.cpp @@ -3232,18 +3232,21 @@ struct MyData { void *ptr; MyData() : ptr(this) {} - ~MyData() { Q_ASSERT(ptr == this); } + ~MyData() + { + if (ptr != this) qWarning("MyData::~MyData(): object has moved"); + } MyData(const MyData& o) : ptr(this) { Q_ASSERT(o.ptr == &o); } MyData &operator=(const MyData &o) { - Q_ASSERT(ptr == this); - Q_ASSERT(o.ptr == &o); + if (ptr != this) qWarning("MyData::operator=(): object has moved"); + if (o.ptr != &o) qWarning("MyData::operator=(): other object has moved"); return *this; } bool operator==(const MyData &o) const { - Q_ASSERT(ptr == this); - Q_ASSERT(o.ptr == &o); + if (ptr != this) qWarning("MyData::operator==(): object has moved"); + if (o.ptr != &o) qWarning("MyData::operator==(): other object has moved"); return true; } }; -- cgit v0.12 From b2db13f245f09f1d14af64d2199284c78cbb5b6e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:04:31 +1000 Subject: Remove mention of Q_ASSERT in comments This will make it easier to check for stray Q_ASSERT's in the future. Change-Id: I5ddafe1bf26819566460920deae8ff448008c93f Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qwidget/tst_qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 64d543f..e8d9719 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -10383,7 +10383,7 @@ void tst_QWidget::taskQTBUG_7532_tabOrderWithFocusProxy() w.setFocusProxy(fp); QWidget::setTabOrder(&w, fp); - // No Q_ASSERT, then it's allright. + // In debug mode, no assertion failure means it's alright. } void tst_QWidget::movedAndResizedAttributes() -- cgit v0.12 From a54900d2227bfb2021c5d1255817824aff11cf32 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:08:25 +1000 Subject: Remove Q_ASSERT's from QWizard autotest Combine the two checking functions (check and checkInvariant) and have the resulting check function return a bool instead of asserting so that the test function can QVERIFY and fail gracefully. Change-Id: Ib069b5424483ba6ffb9caf75036c4f325e9dba51 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qwizard/tst_qwizard.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/auto/qwizard/tst_qwizard.cpp b/tests/auto/qwizard/tst_qwizard.cpp index a813727..61eb8d4 100644 --- a/tests/auto/qwizard/tst_qwizard.cpp +++ b/tests/auto/qwizard/tst_qwizard.cpp @@ -854,25 +854,26 @@ struct MyPage2 : public QWizardPage public: MyPage2() : init(0), cleanup(0), validate(0) {} - void initializePage() { ++init; QWizardPage::initializePage(); checkInvariant(); } - void cleanupPage() { ++cleanup; QWizardPage::cleanupPage(); checkInvariant(); } + void initializePage() { ++init; QWizardPage::initializePage(); } + void cleanupPage() { ++cleanup; QWizardPage::cleanupPage(); } bool validatePage() { ++validate; return QWizardPage::validatePage(); } - void check(int init, int cleanup) - { Q_ASSERT(init == this->init && cleanup == this->cleanup); Q_UNUSED(init); Q_UNUSED(cleanup); } + bool check(int init, int cleanup) + { + return init == this->init + && cleanup == this->cleanup + && (this->init == this->cleanup || this->init - 1 == this->cleanup); + } int init; int cleanup; int validate; - -private: - void checkInvariant() { Q_ASSERT(init == cleanup || init - 1 == cleanup); } }; #define CHECK_PAGE_INIT(i0, c0, i1, c1, i2, c2) \ - page0->check((i0), (c0)); \ - page1->check((i1), (c1)); \ - page2->check((i2), (c2)); + QVERIFY(page0->check((i0), (c0))); \ + QVERIFY(page1->check((i1), (c1))); \ + QVERIFY(page2->check((i2), (c2))); void tst_QWizard::setOption_IndependentPages() { -- cgit v0.12 From fed42f25e129af1f4f2c03a075530ad7111d2fdd Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:12:05 +1000 Subject: Remove Q_ASSERT from QThread autotest Report a meaningful fatal error instead of aborting in debug mode builds and failing silently in release mode builds. Change-Id: If9a6c0655e021b3bb6b7d894aefd9bbcc58e4605 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qthread/tst_qthread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp index c69052e..4e3d67d 100644 --- a/tests/auto/qthread/tst_qthread.cpp +++ b/tests/auto/qthread/tst_qthread.cpp @@ -207,7 +207,7 @@ public: cond.wait(&mutex, five_minutes); } setTerminationEnabled(true); - Q_ASSERT_X(false, "tst_QThread", "test case hung"); + qFatal("tst_QThread: test case hung"); } }; -- cgit v0.12 From b988b2f9f04ac0ebce7a779cd9bd5d394bfa1c95 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:14:03 +1000 Subject: Remove Q_ASSERT from QSharedPointer autotest Report a meaningful fatal error instead of aborting in debug mode builds and failing silently in release mode builds. Change-Id: I0f939dc40810f072a3e24aeba085191793c49ef3 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qsharedpointer/tst_qsharedpointer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp index f25f8e8..6250219 100644 --- a/tests/auto/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/qsharedpointer/tst_qsharedpointer.cpp @@ -139,7 +139,8 @@ public: virtual ~Data() { - Q_ASSERT_X(generation > 0, "tst_QSharedPointer", "Double deletion!"); + if (generation <= 0) + qFatal("tst_qsharedpointer: Double deletion!"); generation = 0; ++destructorCounter; } -- cgit v0.12 From 22aa68ecec96da4d14a4c9fe2f6e4a337b13b4a3 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:17:43 +1000 Subject: Remove Q_ASSERT from QLibrary autotest Report a regular test failure rather than aborting when an unknown operation is requested. Change-Id: I3678f42f9e9f895d8d0d49a768d4c8b575d1863f Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qlibrary/tst_qlibrary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qlibrary/tst_qlibrary.cpp b/tests/auto/qlibrary/tst_qlibrary.cpp index c79332d..a8c60c9 100644 --- a/tests/auto/qlibrary/tst_qlibrary.cpp +++ b/tests/auto/qlibrary/tst_qlibrary.cpp @@ -468,7 +468,7 @@ void tst_QLibrary::errorString() } break;} default: - Q_ASSERT(0); + QFAIL(qPrintable(QString("Unknown operation: %1").arg(operation))); break; } QRegExp re(errorString); -- cgit v0.12 From 4f818b8bcf51cf9c654edbf319d90f6c77a09b3e Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 16:39:50 +1000 Subject: Remove Q_ASSERT from QXmlInputSource autotest Report a fatal error in all builds rather than aborting in debug mode builds only. Change-Id: I53b348f077c6533433e32bbebd159066a2bc2c37 Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp b/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp index c0029f5..a2c84cf 100644 --- a/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp +++ b/tests/auto/qxmlinputsource/tst_qxmlinputsource.cpp @@ -181,9 +181,7 @@ private slots: { if(bodyLength == -1) { - Q_ASSERT_X(false, Q_FUNC_INFO, - "No length was specified in the header."); - return; + qFatal("No length was specified in the header."); } QDomDocument domDoc; -- cgit v0.12 From d7453aef14b80a5972909ed99f1b4c765b7436a5 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 17:16:52 +1000 Subject: Remove Q_ASSERT from qxmlsimplereader autotest Verify the success of setting the document content in the test function rather than using Q_ASSERT. Change-Id: I25e017e7f92803867a998b4f09ad9f717212a9bc Task-number: QTBUG-17582 Reviewed-by: Rohan McGovern --- .../auto/qxmlsimplereader/tst_qxmlsimplereader.cpp | 24 +++++++++++++--------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp index 565df30..0e49304 100644 --- a/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp +++ b/tests/auto/qxmlsimplereader/tst_qxmlsimplereader.cpp @@ -165,7 +165,7 @@ class tst_QXmlSimpleReader : public QObject void roundtripWithNamespaces() const; private: - static QDomDocument fromByteArray(const QString &title, const QByteArray &ba); + static QDomDocument fromByteArray(const QString &title, const QByteArray &ba, bool *ok); XmlServer *server; }; @@ -730,25 +730,27 @@ void tst_QXmlSimpleReader::reportNamespace_data() const << QString("http://example.com/"); } -QDomDocument tst_QXmlSimpleReader::fromByteArray(const QString &title, const QByteArray &ba) +QDomDocument tst_QXmlSimpleReader::fromByteArray(const QString &title, const QByteArray &ba, bool *ok) { QDomDocument doc(title); - const bool ret = doc.setContent(ba, true); - Q_ASSERT(ret); + *ok = doc.setContent(ba, true); return doc; } void tst_QXmlSimpleReader::roundtripWithNamespaces() const { - QEXPECT_FAIL("", "Known problem, see 154573. The fix happens to break uic.", Abort); - const char *const expected = "\n"; + bool ok; { const char *const xml = ""; - const QDomDocument one(fromByteArray("document", xml)); - const QDomDocument two(fromByteArray("document2", one.toByteArray(2))); + const QDomDocument one(fromByteArray("document", xml, &ok)); + QVERIFY(ok); + const QDomDocument two(fromByteArray("document2", one.toByteArray(2), &ok)); + QVERIFY(ok); + + QEXPECT_FAIL("", "Known problem, see 154573. The fix happens to break uic.", Abort); QCOMPARE(expected, one.toByteArray().constData()); QCOMPARE(one.toByteArray(2).constData(), two.toByteArray(2).constData()); @@ -758,8 +760,10 @@ void tst_QXmlSimpleReader::roundtripWithNamespaces() const { const char *const xml = ""; - const QDomDocument one(fromByteArray("document", xml)); - const QDomDocument two(fromByteArray("document2", one.toByteArray(2))); + const QDomDocument one(fromByteArray("document", xml, &ok)); + QVERIFY(ok); + const QDomDocument two(fromByteArray("document2", one.toByteArray(2), &ok)); + QVERIFY(ok); QCOMPARE(expected, one.toByteArray().constData()); QCOMPARE(one.toByteArray(2).constData(), two.toByteArray(2).constData()); -- cgit v0.12 From 614474fb3d440eabd3ba7e381d246064ce39f4fa Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 3 May 2011 17:30:43 +1000 Subject: Remove unused code from QXmlStream autotest Change-Id: I719e502ef14848a22d41de71245fe6b6758c8d6b Reviewed-by: Rohan McGovern --- tests/auto/qxmlstream/qc14n.h | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tests/auto/qxmlstream/qc14n.h b/tests/auto/qxmlstream/qc14n.h index bf80908..99432f3 100644 --- a/tests/auto/qxmlstream/qc14n.h +++ b/tests/auto/qxmlstream/qc14n.h @@ -47,17 +47,9 @@ QT_FORWARD_DECLARE_CLASS(QString) class QC14N { public: - enum Option - { - IgnoreProcessingInstruction, - IgnoreComments - }; - typedef QFlags