summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-05-06 08:07:16 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-06 08:07:39 (GMT)
commit4b35a36ca088a79c1aac877d3259e8a981399ee9 (patch)
treefc233cc0f2aa9e6de91b9d95037d218327cc0cc9
parent1d9a18142eb19d5dde93b7e5c63f9be0e4caf896 (diff)
parent718013958724210915b24142c499154f751f0bac (diff)
downloadQt-4b35a36ca088a79c1aac877d3259e8a981399ee9.zip
Qt-4b35a36ca088a79c1aac877d3259e8a981399ee9.tar.gz
Qt-4b35a36ca088a79c1aac877d3259e8a981399ee9.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts: src/gui/painting/qpainterpath.cpp src/gui/text/qfontengine_ft.cpp src/s60installs/eabi/QtGuiu.def
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp3
-rw-r--r--src/declarative/qml/qdeclarativeproperty.cpp2
-rw-r--r--src/declarative/qml/qmetaobjectbuilder.cpp2
-rw-r--r--src/gui/kernel/qwidget.cpp20
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/kernel/qwidget_s60.cpp5
-rw-r--r--src/gui/text/qfontengine_ft.cpp4
-rw-r--r--src/gui/text/qtextobject.cpp7
-rw-r--r--src/gui/text/qtextobject.h2
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp6
-rw-r--r--src/network/access/qnetworkreplyimpl.cpp8
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp15
-rw-r--r--src/network/socket/qabstractsocket.cpp4
-rw-r--r--src/network/socket/qhttpsocketengine.cpp8
-rw-r--r--src/network/ssl/qsslsocket.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativegridview/data/gridview1.qml1
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml1
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/datamodel.qml1
-rw-r--r--tests/auto/declarative/qdeclarativepathview/data/pathview0.qml1
-rw-r--r--tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp4
-rw-r--r--tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp42
-rw-r--r--tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp29
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp10
-rw-r--r--tests/auto/qtextblock/tst_qtextblock.cpp12
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp25
29 files changed, 199 insertions, 28 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index f30831d..a3395a4 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1499,6 +1499,7 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate)
d->ownModel = true;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) {
+ int oldCount = dataModel->count();
dataModel->setDelegate(delegate);
if (isComponentComplete()) {
for (int i = 0; i < d->visibleItems.count(); ++i)
@@ -1516,6 +1517,8 @@ void QDeclarativeGridView::setDelegate(QDeclarativeComponent *delegate)
}
d->moveReason = QDeclarativeGridViewPrivate::Other;
}
+ if (oldCount != dataModel->count())
+ emit countChanged();
emit delegateChanged();
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 3190d7e..27300c4 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -1813,6 +1813,7 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate)
d->ownModel = true;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) {
+ int oldCount = dataModel->count();
dataModel->setDelegate(delegate);
if (isComponentComplete()) {
for (int i = 0; i < d->visibleItems.count(); ++i)
@@ -1831,6 +1832,8 @@ void QDeclarativeListView::setDelegate(QDeclarativeComponent *delegate)
}
d->updateViewport();
}
+ if (oldCount != dataModel->count())
+ emit countChanged();
}
emit delegateChanged();
}
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index aed849b..be2bd60 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -1021,9 +1021,12 @@ void QDeclarativePathView::setDelegate(QDeclarativeComponent *delegate)
d->ownModel = true;
}
if (QDeclarativeVisualDataModel *dataModel = qobject_cast<QDeclarativeVisualDataModel*>(d->model)) {
+ int oldCount = dataModel->count();
dataModel->setDelegate(delegate);
d->modelCount = dataModel->count();
d->regenerate();
+ if (oldCount != dataModel->count())
+ emit countChanged();
emit delegateChanged();
}
}
diff --git a/src/declarative/qml/qdeclarativeproperty.cpp b/src/declarative/qml/qdeclarativeproperty.cpp
index 7f74da4..253d744 100644
--- a/src/declarative/qml/qdeclarativeproperty.cpp
+++ b/src/declarative/qml/qdeclarativeproperty.cpp
@@ -1451,6 +1451,7 @@ QByteArray QDeclarativePropertyPrivate::saveValueType(const QMetaObject *metaObj
QMetaProperty subProp = subObject->property(subIndex);
ValueTypeSerializedData sd;
+ memset(&sd, 0, sizeof(sd));
sd.isValueType = true;
sd.core.load(metaObject->property(index));
sd.valueType.flags = QDeclarativePropertyCache::Data::flagsForProperty(subProp);
@@ -1465,6 +1466,7 @@ QByteArray QDeclarativePropertyPrivate::saveValueType(const QMetaObject *metaObj
QByteArray QDeclarativePropertyPrivate::saveProperty(const QMetaObject *metaObject, int index)
{
SerializedData sd;
+ memset(&sd, 0, sizeof(sd));
sd.isValueType = false;
sd.core.load(metaObject->property(index));
diff --git a/src/declarative/qml/qmetaobjectbuilder.cpp b/src/declarative/qml/qmetaobjectbuilder.cpp
index a63656b..d8a7b77 100644
--- a/src/declarative/qml/qmetaobjectbuilder.cpp
+++ b/src/declarative/qml/qmetaobjectbuilder.cpp
@@ -1452,6 +1452,7 @@ QMetaObject *QMetaObjectBuilder::toMetaObject() const
{
int size = buildMetaObject(d, 0, false);
char *buf = reinterpret_cast<char *>(qMalloc(size));
+ memset(buf, 0, size);
buildMetaObject(d, buf, false);
return reinterpret_cast<QMetaObject *>(buf);
}
@@ -1481,6 +1482,7 @@ QByteArray QMetaObjectBuilder::toRelocatableData(bool *ok) const
QByteArray data;
data.resize(size);
char *buf = data.data();
+ memset(buf, 0, size);
buildMetaObject(d, buf, true);
if (ok) *ok = true;
return data;
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 80d7b85..69ec0bd 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -299,6 +299,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)
@@ -2599,6 +2600,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();
@@ -10111,6 +10128,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();
@@ -10271,6 +10289,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 919f8bc..ca6983d 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -770,6 +770,7 @@ public:
#ifndef QT_NO_IM
uint inheritsInputMethodHints : 1;
#endif
+ uint inSetParent : 1;
// *************************** Platform specific ************************************
#if defined(Q_WS_X11) // <----------------------------------------------------------- X11
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 12bcc4b..24dd00a 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -576,6 +576,11 @@ void QWidgetPrivate::show_sys()
if (isFullscreen) {
const bool cbaVisible = S60->buttonGroupContainer() && S60->buttonGroupContainer()->IsVisible();
S60->setStatusPaneAndButtonGroupVisibility(false, cbaVisible);
+ if (cbaVisible) {
+ // Fix window dimensions as without screen furniture they will have
+ // defaulted to full screen dimensions initially.
+ id->handleClientAreaChange();
+ }
}
}
}
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 237cde4..033c000 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1751,6 +1751,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
} else {
glyphSet = &defaultGlyphSet;
}
+ bool needsDelete = false;
Glyph * g = glyphSet->getGlyph(glyph);
if (!g || g->format != format) {
face = lockFace();
@@ -1758,6 +1759,7 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
FT_Matrix_Multiply(&glyphSet->transformationMatrix, &m);
freetype->matrix = m;
g = loadGlyph(glyphSet, glyph, subPixelPosition, format);
+ needsDelete = true;
}
if (g) {
@@ -1766,6 +1768,8 @@ glyph_metrics_t QFontEngineFT::alphaMapBoundingBox(glyph_t glyph, QFixed subPixe
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);
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index 5c1c8b9..4e8b8ca 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 ad8e657..2e588c2 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; }
- 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/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 6fbc6f8..b738ccf 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -579,6 +579,12 @@ bool QHttpNetworkConnectionChannel::ensureConnection()
connectHost = connection->d_func()->networkProxy.hostName();
connectPort = connection->d_func()->networkProxy.port();
}
+ if (socket->proxy().type() == QNetworkProxy::HttpProxy) {
+ // Make user-agent field available to HTTP proxy socket engine (QTBUG-17223)
+ QByteArray value = request.headerField("user-agent");
+ if (!value.isEmpty())
+ socket->setProperty("_q_user-agent", value);
+ }
#endif
if (ssl) {
#ifndef QT_NO_OPENSSL
diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp
index 9eb505d..de2913a 100644
--- a/src/network/access/qnetworkreplyimpl.cpp
+++ b/src/network/access/qnetworkreplyimpl.cpp
@@ -1010,10 +1010,6 @@ bool QNetworkReplyImplPrivate::migrateBackend()
if (state == Finished || state == Aborted)
return true;
- // Backend does not support resuming download.
- if (!backend->canResume())
- return false;
-
// Request has outgoing data, not migrating.
if (outgoingData)
return false;
@@ -1022,6 +1018,10 @@ bool QNetworkReplyImplPrivate::migrateBackend()
if (copyDevice)
return true;
+ // Backend does not support resuming download.
+ if (!backend->canResume())
+ return false;
+
state = QNetworkReplyImplPrivate::Reconnecting;
if (backend) {
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index e9b6703..a948d91 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -385,8 +385,6 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
this, SLOT(configurationRemoved(QNetworkConfigurationPrivatePointer)));
connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)),
this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer)));
-
- QMetaObject::invokeMethod(engine, "initialize");
}
}
@@ -410,8 +408,19 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations()
startPolling();
}
- if (firstUpdate)
+ if (firstUpdate) {
firstUpdate = false;
+ QList<QBearerEngine*> enginesToInitialize = sessionEngines; //shallow copy the list in case it is modified when we unlock mutex
+ Qt::ConnectionType connectionType;
+ if (QCoreApplicationPrivate::mainThread() == QThread::currentThread())
+ connectionType = Qt::DirectConnection;
+ else
+ connectionType = Qt::BlockingQueuedConnection;
+ locker.unlock();
+ foreach (QBearerEngine* engine, enginesToInitialize) {
+ QMetaObject::invokeMethod(engine, "initialize", connectionType);
+ }
+ }
}
void QNetworkConfigurationManagerPrivate::performAsyncConfigurationUpdate()
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index cfb1413..d8d2633 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -556,6 +556,10 @@ bool QAbstractSocketPrivate::initSocketLayer(QAbstractSocket::NetworkLayerProtoc
q->setErrorString(QAbstractSocket::tr("Operation on socket is not supported"));
return false;
}
+#ifndef QT_NO_NETWORKPROXY
+ //copy user agent to socket engine (if it has been set)
+ socketEngine->setProperty("_q_user-agent", q->property("_q_user-agent"));
+#endif
if (!socketEngine->initialize(q->socketType(), protocol)) {
#if defined (QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocketPrivate::initSocketLayer(%s, %s) failed (%s)",
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 7846056..a8a11a7 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -501,7 +501,13 @@ void QHttpSocketEngine::slotSocketConnected()
data += path;
data += " HTTP/1.1\r\n";
data += "Proxy-Connection: keep-alive\r\n"
- "User-Agent: Mozilla/5.0\r\n"
+ "User-Agent: ";
+ QVariant v = property("_q_user-agent");
+ if (v.isValid())
+ data += v.toByteArray();
+ else
+ data += "Mozilla/5.0";
+ data += "\r\n"
"Host: " + peerAddress + "\r\n";
QAuthenticatorPrivate *priv = QAuthenticatorPrivate::getPrivate(d->authenticator);
//qDebug() << "slotSocketConnected: priv=" << priv << (priv ? (int)priv->method : -1);
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 0dbf4b5..2695df1 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1736,6 +1736,8 @@ void QSslSocket::connectToHostImplementation(const QString &hostName, quint16 po
}
#ifndef QT_NO_NETWORKPROXY
d->plainSocket->setProxy(proxy());
+ //copy user agent down to the plain socket (if it has been set)
+ d->plainSocket->setProperty("_q_user-agent", property("_q_user-agent"));
#endif
QIODevice::open(openMode);
d->plainSocket->connectToHost(hostName, port, openMode);
diff --git a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml
index caa28d6..a2b0a91 100644
--- a/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml
+++ b/tests/auto/declarative/qdeclarativegridview/data/gridview1.qml
@@ -2,6 +2,7 @@ import QtQuick 1.1
Rectangle {
id: root
+ property int count: grid.count
property bool showHeader: false
property bool showFooter: false
property int added: -1
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index c8e7817..dc79370 100644
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
@@ -222,6 +222,7 @@ void tst_QDeclarativeGridView::items()
QTRY_VERIFY(contentItem != 0);
QTRY_COMPARE(gridview->count(), model.count());
+ QTRY_COMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
for (int i = 0; i < model.count(); ++i) {
@@ -305,6 +306,7 @@ void tst_QDeclarativeGridView::inserted()
QTRY_VERIFY(contentItem != 0);
model.insertItem(1, "Will", "9876");
+ QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
@@ -382,6 +384,7 @@ void tst_QDeclarativeGridView::removed()
QTRY_VERIFY(contentItem != 0);
model.removeItem(1);
+ QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QDeclarativeText *name = findItem<QDeclarativeText>(contentItem, "textName", 1);
QTRY_VERIFY(name != 0);
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
index 3cd6f42..75ddabb 100644
--- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
+++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml
@@ -6,6 +6,7 @@ Rectangle {
height: 320
color: "#ffffff"
+ property int count: list.count
property bool showHeader: false
property bool showFooter: false
property real hr: list.visibleArea.heightRatio
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index 0c96587..8b90030 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -389,6 +389,7 @@ void tst_QDeclarativeListView::items()
QTRY_VERIFY(listview->highlightItem() != 0);
QTRY_COMPARE(listview->count(), model.count());
+ QTRY_COMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
// current item should be first item
@@ -517,6 +518,7 @@ void tst_QDeclarativeListView::inserted()
model.insertItem(0, "Foo", "1111"); // zero index, and current item
+ QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item
name = findItem<QDeclarativeText>(contentItem, "textName", 0);
@@ -583,6 +585,7 @@ void tst_QDeclarativeListView::removed(bool animated)
QTRY_VERIFY(contentItem != 0);
model.removeItem(1);
+ QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QDeclarativeText *name = findItem<QDeclarativeText>(contentItem, "textName", 1);
QTRY_VERIFY(name != 0);
diff --git a/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml
index 1322025..e2c4e3d 100644
--- a/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml
+++ b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml
@@ -2,6 +2,7 @@ import QtQuick 1.0
PathView {
id: pathview
+ property int viewCount: count
objectName: "pathview"
width: 240; height: 320
pathItemCount: testObject.pathItemCount
diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml
index 04c7717..28b6fb9 100644
--- a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml
+++ b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml
@@ -2,6 +2,7 @@ import QtQuick 1.0
Rectangle {
id: root
+ property int count: view.count
property int currentA: -1
property int currentB: -1
property real delegateWidth: 60
diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
index 46c3519..24b1115 100644
--- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
+++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp
@@ -253,6 +253,8 @@ void tst_QDeclarativePathView::items()
QDeclarativePathView *pathview = findItem<QDeclarativePathView>(canvas->rootObject(), "view");
QVERIFY(pathview != 0);
+ QCOMPARE(pathview->count(), model.count());
+ QCOMPARE(canvas->rootObject()->property("count").toInt(), model.count());
QCOMPARE(pathview->childItems().count(), model.count()+1); // assumes all are visible, including highlight
for (int i = 0; i < model.count(); ++i) {
@@ -400,6 +402,7 @@ void tst_QDeclarativePathView::dataModel()
model.insertItem(4, "orange", "10");
QTest::qWait(100);
+ QCOMPARE(canvas->rootObject()->property("viewCount").toInt(), model.count());
QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 14);
QVERIFY(pathview->currentIndex() == 0);
@@ -409,6 +412,7 @@ void tst_QDeclarativePathView::dataModel()
QCOMPARE(text->text(), model.name(4));
model.removeItem(2);
+ QCOMPARE(canvas->rootObject()->property("viewCount").toInt(), model.count());
text = findItem<QDeclarativeText>(pathview, "myText", 2);
QVERIFY(text);
QCOMPARE(text->text(), model.name(2));
diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
index 7787608..c270eb8 100644
--- a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
+++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp
@@ -62,6 +62,7 @@ public slots:
void cleanup();
private slots:
+ void usedInThread(); // this test must be first, or it will falsely pass
void allConfigurations();
void defaultConfiguration();
void configurationFromIdentifier();
@@ -329,6 +330,47 @@ void tst_QNetworkConfigurationManager::configurationFromIdentifier()
QVERIFY(!invalid.isValid());
}
+class QNCMTestThread : public QThread
+{
+protected:
+ virtual void run()
+ {
+ QNetworkConfigurationManager manager;
+ preScanConfigs = manager.allConfigurations();
+ QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
+ manager.updateConfigurations(); //initiate scans
+ QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
+ configs = manager.allConfigurations();
+ }
+public:
+ QList<QNetworkConfiguration> configs;
+ QList<QNetworkConfiguration> preScanConfigs;
+};
+
+// regression test for QTBUG-18795
+void tst_QNetworkConfigurationManager::usedInThread()
+{
+#if defined Q_OS_MAC && !defined (QT_NO_COREWLAN)
+ QSKIP("QTBUG-19070 Mac CoreWlan plugin is broken", SkipAll);
+#else
+ QNCMTestThread thread;
+ connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ thread.start();
+ QTestEventLoop::instance().enterLoop(100); //QTRY_VERIFY could take ~90 seconds to time out in the thread
+ QVERIFY(thread.isFinished());
+ qDebug() << "prescan:" << thread.preScanConfigs.count();
+ qDebug() << "postscan:" << thread.configs.count();
+
+ QNetworkConfigurationManager manager;
+ QList<QNetworkConfiguration> preScanConfigs = manager.allConfigurations();
+ QSignalSpy spy(&manager, SIGNAL(updateCompleted()));
+ manager.updateConfigurations(); //initiate scans
+ QTRY_VERIFY(spy.count() == 1); //wait for scan to complete
+ QList<QNetworkConfiguration> configs = manager.allConfigurations();
+ QCOMPARE(thread.configs, configs);
+ QCOMPARE(thread.preScanConfigs, preScanConfigs);
+#endif
+}
QTEST_MAIN(tst_QNetworkConfigurationManager)
#include "tst_qnetworkconfigurationmanager.moc"
diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index 2baee27..17c890d 100644
--- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
+++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
@@ -41,14 +41,17 @@
#include <QtTest/QTest>
+#include <QtTest/QTestEventLoop>
#include <qcoreapplication.h>
#include <qdebug.h>
#include <qnetworkproxy.h>
+#include <QThread>
class tst_QNetworkProxyFactory : public QObject {
Q_OBJECT
private slots:
+ void systemProxyForQueryCalledFromThread();
void systemProxyForQuery() const;
private:
@@ -96,5 +99,31 @@ void tst_QNetworkProxyFactory::systemProxyForQuery() const
QFAIL("One or more system proxy lookup failures occurred.");
}
+class QSPFQThread : public QThread
+{
+protected:
+ virtual void run()
+ {
+ proxies = QNetworkProxyFactory::systemProxyForQuery(query);
+ }
+public:
+ QNetworkProxyQuery query;
+ QList<QNetworkProxy> proxies;
+};
+
+//regression test for QTBUG-18799
+void tst_QNetworkProxyFactory::systemProxyForQueryCalledFromThread()
+{
+ QUrl url(QLatin1String("http://qt.nokia.com"));
+ QNetworkProxyQuery query(url);
+ QSPFQThread thread;
+ thread.query = query;
+ connect(&thread, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()));
+ thread.start();
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(thread.isFinished());
+ QCOMPARE(thread.proxies, QNetworkProxyFactory::systemProxyForQuery(query));
+}
+
QTEST_MAIN(tst_QNetworkProxyFactory)
#include "tst_qnetworkproxyfactory.moc"
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index bf1feaf..38e8cee 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -4964,7 +4964,9 @@ void tst_QNetworkReply::httpProxyCommands()
QNetworkProxy proxy(QNetworkProxy::HttpProxy, "127.0.0.1", proxyServer.serverPort());
manager.setProxy(proxy);
- QNetworkReplyPtr reply = manager.get(QNetworkRequest(url));
+ QNetworkRequest request(url);
+ request.setRawHeader("User-Agent", "QNetworkReplyAutoTest/1.0");
+ QNetworkReplyPtr reply = manager.get(request);
manager.setProxy(QNetworkProxy());
// wait for the finished signal
@@ -4982,6 +4984,12 @@ void tst_QNetworkReply::httpProxyCommands()
QString receivedHeader = proxyServer.receivedData.left(expectedCommand.length());
QCOMPARE(receivedHeader, expectedCommand);
+
+ //QTBUG-17223 - make sure the user agent from the request is sent to proxy server even for CONNECT
+ int uapos = proxyServer.receivedData.indexOf("User-Agent");
+ int uaend = proxyServer.receivedData.indexOf("\r\n", uapos);
+ QByteArray uaheader = proxyServer.receivedData.mid(uapos, uaend - uapos);
+ QCOMPARE(uaheader, QByteArray("User-Agent: QNetworkReplyAutoTest/1.0"));
}
class ProxyChangeHelper : public QObject {
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"
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 35014c9..ff8e406 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();
@@ -8482,6 +8483,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: