summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2010-04-12 06:31:55 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2010-04-12 06:31:55 (GMT)
commitf710d57af1cc03af143573135390e6c68eecbfe8 (patch)
tree2b4f317509b101e2aa08d69225818054310e4d09 /tests
parentd22c8c60ffd986cc46d1f1cab878d60b03b5d4ea (diff)
parentf64ad3687c428644139690d565fe555ed2199aea (diff)
downloadQt-f710d57af1cc03af143573135390e6c68eecbfe8.zip
Qt-f710d57af1cc03af143573135390e6c68eecbfe8.tar.gz
Qt-f710d57af1cc03af143573135390e6c68eecbfe8.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qbrush/tst_qbrush.cpp13
-rw-r--r--tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp36
-rw-r--r--tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp25
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp23
-rw-r--r--tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp21
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp31
-rw-r--r--tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp2
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp12
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp127
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp1
-rw-r--r--tests/auto/qxmlquery/tst_qxmlquery.cpp12
11 files changed, 201 insertions, 102 deletions
diff --git a/tests/auto/qbrush/tst_qbrush.cpp b/tests/auto/qbrush/tst_qbrush.cpp
index 628e859..7e94f37 100644
--- a/tests/auto/qbrush/tst_qbrush.cpp
+++ b/tests/auto/qbrush/tst_qbrush.cpp
@@ -75,9 +75,10 @@ private slots:
void gradientStops();
void textures();
-
+
void nullBrush();
void isOpaque();
+ void debug();
};
Q_DECLARE_METATYPE(QBrush)
@@ -399,5 +400,15 @@ void tst_QBrush::isOpaque()
QVERIFY(!brush.isOpaque());
}
+void tst_QBrush::debug()
+{
+ QPixmap pixmap_source(10, 10);
+ fill(&pixmap_source);
+ QBrush pixmap_brush;
+ pixmap_brush.setTexture(pixmap_source);
+ QCOMPARE(pixmap_brush.style(), Qt::TexturePattern);
+ qDebug() << pixmap_brush; // don't crash
+}
+
QTEST_MAIN(tst_QBrush)
#include "tst_qbrush.moc"
diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
index 49b840f..dbd4a23 100644
--- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
+++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp
@@ -277,9 +277,8 @@ void tst_QGraphicsEffect::draw()
// Make sure installing the effect triggers a repaint.
CustomEffect *effect = new CustomEffect;
item->setGraphicsEffect(effect);
- QTest::qWait(50);
- QCOMPARE(effect->numRepaints, 1);
- QCOMPARE(item->numRepaints, 1);
+ QTRY_COMPARE(effect->numRepaints, 1);
+ QTRY_COMPARE(item->numRepaints, 1);
// Make sure QPainter* and QStyleOptionGraphicsItem* stays persistent
// during QGraphicsEffect::draw/QGraphicsItem::paint.
@@ -293,26 +292,23 @@ void tst_QGraphicsEffect::draw()
// Make sure updating the source triggers a repaint.
item->update();
- QTest::qWait(50);
- QCOMPARE(effect->numRepaints, 1);
- QCOMPARE(item->numRepaints, 1);
+ QTRY_COMPARE(effect->numRepaints, 1);
+ QTRY_COMPARE(item->numRepaints, 1);
QVERIFY(effect->m_sourceChangedFlags & QGraphicsEffect::SourceInvalidated);
effect->reset();
item->reset();
// Make sure changing the effect's bounding rect triggers a repaint.
effect->setMargin(20);
- QTest::qWait(50);
- QCOMPARE(effect->numRepaints, 1);
- QCOMPARE(item->numRepaints, 1);
+ QTRY_COMPARE(effect->numRepaints, 1);
+ QTRY_COMPARE(item->numRepaints, 1);
effect->reset();
item->reset();
// Make sure change the item's bounding rect triggers a repaint.
item->setRect(0, 0, 50, 50);
- QTest::qWait(50);
- QCOMPARE(effect->numRepaints, 1);
- QCOMPARE(item->numRepaints, 1);
+ QTRY_COMPARE(effect->numRepaints, 1);
+ QTRY_COMPARE(item->numRepaints, 1);
QVERIFY(effect->m_sourceChangedFlags & QGraphicsEffect::SourceBoundingRectChanged);
effect->reset();
item->reset();
@@ -320,8 +316,7 @@ void tst_QGraphicsEffect::draw()
// Make sure the effect is the one to issue a repaint of the item.
effect->doNothingInDraw = true;
item->update();
- QTest::qWait(50);
- QCOMPARE(effect->numRepaints, 1);
+ QTRY_COMPARE(effect->numRepaints, 1);
QCOMPARE(item->numRepaints, 0);
effect->doNothingInDraw = false;
effect->reset();
@@ -336,9 +331,8 @@ void tst_QGraphicsEffect::draw()
item->reset();
effect->setEnabled(true);
- QTest::qWait(50);
- QCOMPARE(effect->numRepaints, 1);
- QCOMPARE(item->numRepaints, 1);
+ QTRY_COMPARE(effect->numRepaints, 1);
+ QTRY_COMPARE(item->numRepaints, 1);
effect->reset();
item->reset();
@@ -352,8 +346,7 @@ void tst_QGraphicsEffect::draw()
QPointer<CustomEffect> ptr = effect;
item->setGraphicsEffect(0);
QVERIFY(!ptr);
- QTest::qWait(50);
- QCOMPARE(item->numRepaints, 1);
+ QTRY_COMPARE(item->numRepaints, 1);
}
void tst_QGraphicsEffect::opacity()
@@ -515,7 +508,6 @@ void tst_QGraphicsEffect::drawPixmapItem()
QTRY_VERIFY(effect->repaints >= 1);
item->rotate(180);
- QTest::qWait(50);
QTRY_VERIFY(effect->repaints >= 2);
}
@@ -560,9 +552,8 @@ void tst_QGraphicsEffect::deviceCoordinateTranslateCaching()
int numRepaints = item->numRepaints;
item->translate(10, 0);
- QTest::qWait(50);
- QVERIFY(item->numRepaints == numRepaints);
+ QTRY_VERIFY(item->numRepaints == numRepaints);
}
void tst_QGraphicsEffect::inheritOpacity()
@@ -588,7 +579,6 @@ void tst_QGraphicsEffect::inheritOpacity()
int numRepaints = item->numRepaints;
rectItem->setOpacity(1);
- QTest::qWait(50);
// item should have been rerendered due to opacity changing
QTRY_VERIFY(item->numRepaints > numRepaints);
diff --git a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
index be03481..49f110e 100644
--- a/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
+++ b/tests/auto/qgraphicseffectsource/tst_qgraphicseffectsource.cpp
@@ -48,6 +48,8 @@
#include <private/qgraphicseffect_p.h>
+#include "../../shared/util.h"
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -220,9 +222,8 @@ void tst_QGraphicsEffectSource::styleOption()
QCOMPARE(item->numRepaints, 0);
QCOMPARE(effect->numRepaints, 0);
item->update();
- QTest::qWait(50);
- QCOMPARE(item->numRepaints, 1);
- QCOMPARE(effect->numRepaints, 1);
+ QTRY_COMPARE(item->numRepaints, 1);
+ QTRY_COMPARE(effect->numRepaints, 1);
}
void tst_QGraphicsEffectSource::isPixmap()
@@ -255,10 +256,9 @@ void tst_QGraphicsEffectSource::update()
QCOMPARE(effect->numRepaints, 0);
effect->source()->update();
- QTest::qWait(50);
- QCOMPARE(item->numRepaints, 1);
- QCOMPARE(effect->numRepaints, 1);
+ QTRY_COMPARE(item->numRepaints, 1);
+ QTRY_COMPARE(effect->numRepaints, 1);
}
void tst_QGraphicsEffectSource::boundingRect()
@@ -273,22 +273,20 @@ void tst_QGraphicsEffectSource::boundingRect()
// We can at least check that the device bounding rect was correct in QGraphicsEffect::draw.
effect->storeDeviceDependentStuff = true;
effect->source()->update();
- QTest::qWait(50);
const QTransform deviceTransform = item->deviceTransform(view->viewportTransform());
- QCOMPARE(effect->sourceDeviceBoundingRect, deviceTransform.mapRect(itemBoundingRect));
+ QTRY_COMPARE(effect->sourceDeviceBoundingRect, deviceTransform.mapRect(itemBoundingRect));
// Bounding rect in logical coordinates is of course fine.
- QCOMPARE(effect->source()->boundingRect(Qt::LogicalCoordinates), itemBoundingRect);
+ QTRY_COMPARE(effect->source()->boundingRect(Qt::LogicalCoordinates), itemBoundingRect);
// Make sure default value is Qt::LogicalCoordinates.
- QCOMPARE(effect->source()->boundingRect(), itemBoundingRect);
+ QTRY_COMPARE(effect->source()->boundingRect(), itemBoundingRect);
}
void tst_QGraphicsEffectSource::deviceRect()
{
effect->storeDeviceDependentStuff = true;
effect->source()->update();
- QTest::qWait(50);
- QCOMPARE(effect->deviceRect, view->viewport()->rect());
+ QTRY_COMPARE(effect->deviceRect, view->viewport()->rect());
}
void tst_QGraphicsEffectSource::pixmap()
@@ -299,8 +297,7 @@ void tst_QGraphicsEffectSource::pixmap()
// We can at least verify a valid pixmap from QGraphicsEffect::draw.
effect->storeDeviceDependentStuff = true;
effect->source()->update();
- QTest::qWait(50);
- QVERIFY(!effect->deviceCoordinatesPixmap.isNull());
+ QTRY_VERIFY(!effect->deviceCoordinatesPixmap.isNull());
// Pixmaps in logical coordinates we can do fine.
QPixmap pixmap1 = effect->source()->pixmap(Qt::LogicalCoordinates);
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 89d5958..03ce45a 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -6882,8 +6882,8 @@ void tst_QGraphicsItem::cacheMode()
testerChild2->rotate(22);
QTest::qWait(25);
QTRY_COMPARE(tester->repaints, 4);
- QCOMPARE(testerChild->repaints, 4);
- QCOMPARE(testerChild2->repaints, 3);
+ QTRY_COMPARE(testerChild->repaints, 4);
+ QTRY_COMPARE(testerChild2->repaints, 3);
tester->resetTransform();
testerChild->resetTransform();
testerChild2->resetTransform();
@@ -6961,33 +6961,30 @@ void tst_QGraphicsItem::cacheMode()
testerChild->setPos(1, 1);
QTest::qWait(25);
QTRY_COMPARE(tester->repaints, 11);
- QCOMPARE(testerChild->repaints, 10);
- QCOMPARE(testerChild2->repaints, 5);
+ QTRY_COMPARE(testerChild->repaints, 10);
+ QTRY_COMPARE(testerChild2->repaints, 5);
tester->resetTransform();
// Make a huge item
tester->setGeometry(QRectF(-4000, -4000, 8000, 8000));
- QTest::qWait(25);
QTRY_COMPARE(tester->repaints, 12);
- QCOMPARE(testerChild->repaints, 11);
- QCOMPARE(testerChild2->repaints, 5);
+ QTRY_COMPARE(testerChild->repaints, 11);
+ QTRY_COMPARE(testerChild2->repaints, 5);
// Move the large item - will cause a repaint as the
// cache is clipped.
tester->setPos(5, 0);
- QTest::qWait(25);
QTRY_COMPARE(tester->repaints, 13);
- QCOMPARE(testerChild->repaints, 11);
- QCOMPARE(testerChild2->repaints, 5);
+ QTRY_COMPARE(testerChild->repaints, 11);
+ QTRY_COMPARE(testerChild2->repaints, 5);
// Hiding and showing should invalidate the cache
tester->hide();
QTest::qWait(25);
tester->show();
- QTest::qWait(25);
QTRY_COMPARE(tester->repaints, 14);
- QCOMPARE(testerChild->repaints, 12);
- QCOMPARE(testerChild2->repaints, 6);
+ QTRY_COMPARE(testerChild->repaints, 12);
+ QTRY_COMPARE(testerChild2->repaints, 6);
}
void tst_QGraphicsItem::cacheMode2()
diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
index fb2e145..dad3279 100644
--- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
+++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp
@@ -44,6 +44,8 @@
#include <QtGui>
#include <math.h>
+#include "../../shared/util.h"
+
//TESTED_CLASS=QGraphicsLayout
//TESTED_FILES=
@@ -423,22 +425,15 @@ void tst_QGraphicsLayout::alternativeLayoutItems()
view.resize(150, 150);
view.show();
- QApplication::processEvents();
- QTest::qWait(750);
- QApplication::processEvents();
-
- QCOMPARE(static_cast<QGraphicsRectItem*>(li1->graphicsItem())->rect(), QRectF( 0, 0, 33, 99));
- QCOMPARE(static_cast<QGraphicsRectItem*>(li2->graphicsItem())->rect(), QRectF(33, 0, 33, 99));
- QCOMPARE(static_cast<QGraphicsRectItem*>(li3->graphicsItem())->rect(), QRectF(66, 0, 33, 99));
+ QTRY_COMPARE(static_cast<QGraphicsRectItem*>(li1->graphicsItem())->rect(), QRectF( 0, 0, 33, 99));
+ QTRY_COMPARE(static_cast<QGraphicsRectItem*>(li2->graphicsItem())->rect(), QRectF(33, 0, 33, 99));
+ QTRY_COMPARE(static_cast<QGraphicsRectItem*>(li3->graphicsItem())->rect(), QRectF(66, 0, 33, 99));
lout->setOrientation(Qt::Vertical);
- QApplication::processEvents();
- QTest::qWait(750);
- QApplication::processEvents();
- QCOMPARE(static_cast<QGraphicsRectItem*>(li1->graphicsItem())->rect(), QRectF(0, 0, 99, 33));
- QCOMPARE(static_cast<QGraphicsRectItem*>(li2->graphicsItem())->rect(), QRectF(0, 33, 99, 33));
- QCOMPARE(static_cast<QGraphicsRectItem*>(li3->graphicsItem())->rect(), QRectF(0, 66, 99, 33));
+ QTRY_COMPARE(static_cast<QGraphicsRectItem*>(li1->graphicsItem())->rect(), QRectF(0, 0, 99, 33));
+ QTRY_COMPARE(static_cast<QGraphicsRectItem*>(li2->graphicsItem())->rect(), QRectF(0, 33, 99, 33));
+ QTRY_COMPARE(static_cast<QGraphicsRectItem*>(li3->graphicsItem())->rect(), QRectF(0, 66, 99, 33));
}
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 23b3458..e46709b 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -787,7 +787,6 @@ void tst_QGraphicsProxyWidget::focusNextPrevChild()
view.show();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
- QApplication::processEvents();
QTRY_COMPARE(QApplication::activeWindow(), &view);
if (hasScene) {
scene.addItem(proxy);
@@ -836,7 +835,6 @@ void tst_QGraphicsProxyWidget::focusOutEvent()
view.activateWindow();
view.setFocus();
QTest::qWaitForWindowShown(&view);
- QApplication::processEvents();
QTRY_VERIFY(view.isVisible());
QTRY_COMPARE(QApplication::activeWindow(), &view);
@@ -989,7 +987,6 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
// in
QTest::mouseMove(&view, QPoint(50, 50));
- QTest::qWait(25);
QTRY_COMPARE(widget->testAttribute(Qt::WA_UnderMouse), hasWidget ? true : false);
// ### this attribute isn't supported
QCOMPARE(widget->enterCount, hasWidget ? 1 : 0);
@@ -999,11 +996,10 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
// out
QTest::mouseMove(&view, QPoint(10, 10));
- QTest::qWait(25);
// QTRY_COMPARE(widget->testAttribute(Qt::WA_UnderMouse), false);
// ### this attribute isn't supported
- QCOMPARE(widget->leaveCount, hasWidget ? 1 : 0);
- QCOMPARE(widget->hoverLeave, (hasWidget && hoverEnabled) ? 1 : 0);
+ QTRY_COMPARE(widget->leaveCount, hasWidget ? 1 : 0);
+ QTRY_COMPARE(widget->hoverLeave, (hasWidget && hoverEnabled) ? 1 : 0);
// does not work on all platforms
//QCOMPARE(widget->moveCount, 0);
@@ -1071,7 +1067,6 @@ void tst_QGraphicsProxyWidget::hoverMoveEvent()
// move a little bit
QTest::mouseMove(&view, QPoint(60, 60));
- QTest::qWait(12);
QTRY_COMPARE(widget->hoverEnter, (hasWidget && hoverEnabled) ? 1 : 0);
QCOMPARE(widget->moveCount, (hasWidget && mouseTracking) || (hasWidget && mouseDown) ? 1 : 0);
@@ -1097,7 +1092,6 @@ void tst_QGraphicsProxyWidget::keyPressEvent()
view.viewport()->setFocus();
QApplication::setActiveWindow(&view);
QTest::qWaitForWindowShown(&view);
- QApplication::processEvents();
QTRY_COMPARE(QApplication::activeWindow(), &view);
SubQGraphicsProxyWidget *proxy = new SubQGraphicsProxyWidget;
@@ -1305,13 +1299,11 @@ void tst_QGraphicsProxyWidget::paintEvent()
scene.addItem(&proxy);
//make sure we flush all the paint events
- QTest::qWait(30);
QTRY_VERIFY(proxy.paintCount > 1);
QTest::qWait(30);
proxy.paintCount = 0;
w->update();
- QTest::qWait(30);
QTRY_COMPARE(proxy.paintCount, 1); //the widget should have been painted now
}
@@ -1504,7 +1496,6 @@ void tst_QGraphicsProxyWidget::scrollUpdate()
view.paintEventRegion = QRegion();
view.npaints = 0;
QTimer::singleShot(0, widget, SLOT(updateScroll()));
- QTest::qWait(50);
QTRY_COMPARE(view.npaints, 2);
// QRect(0, 0, 200, 12) is the first update, expanded (-2, -2, 2, 2)
// QRect(0, 12, 102, 10) is the scroll update, expanded (-2, -2, 2, 2),
@@ -2483,9 +2474,7 @@ void tst_QGraphicsProxyWidget::popup_basic()
QTest::mousePress(view.viewport(), Qt::LeftButton, 0,
view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
- QTest::qWait(12);
-
- QCOMPARE(box->pos(), QPoint());
+ QTRY_COMPARE(box->pos(), QPoint());
QCOMPARE(proxy->childItems().count(), 1);
QGraphicsProxyWidget *child = (QGraphicsProxyWidget*)(proxy->childItems())[0];
@@ -2498,7 +2487,6 @@ void tst_QGraphicsProxyWidget::popup_basic()
QSKIP("Does not work due to SH_Combobox_Popup", SkipAll);
QCOMPARE(child->widget()->parent(), static_cast<QObject*>(box));
- QTest::qWait(12);
QTRY_COMPARE(proxy->pos(), QPointF(box->pos()));
QCOMPARE(child->x(), qreal(box->x()));
QCOMPARE(child->y(), qreal(box->rect().bottom()));
@@ -2583,13 +2571,11 @@ void tst_QGraphicsProxyWidget::changingCursor_basic()
// in
QTest::mouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
sendMouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
- QTest::qWait(12);
QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor);
// out
QTest::mouseMove(view.viewport(), QPoint(1, 1));
sendMouseMove(view.viewport(), QPoint(1, 1));
- QTest::qWait(12);
QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor);
#endif
}
@@ -2615,9 +2601,8 @@ void tst_QGraphicsProxyWidget::tooltip_basic()
// in
QTest::mouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center())));
- QTest::qWait(3000);
- QCOMPARE(proxy->childItems().count(), 1);
+ QTRY_COMPARE(proxy->childItems().count(), 1);
QGraphicsProxyWidget *child = (QGraphicsProxyWidget*)(proxy->childItems())[0];
QVERIFY(child->isWidget());
QVERIFY(child->widget());
@@ -3348,7 +3333,6 @@ void tst_QGraphicsProxyWidget::updateAndDelete()
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
- QTest::qWait(20);
QTRY_VERIFY(view.npaints > 0);
const QRect itemDeviceBoundingRect = proxy->deviceTransform(view.viewportTransform())
@@ -3361,8 +3345,7 @@ void tst_QGraphicsProxyWidget::updateAndDelete()
// Update and hide.
proxy->update();
proxy->hide();
- QTest::qWait(50);
- QCOMPARE(view.npaints, 1);
+ QTRY_COMPARE(view.npaints, 1);
QCOMPARE(view.paintEventRegion, expectedRegion);
proxy->show();
@@ -3373,8 +3356,7 @@ void tst_QGraphicsProxyWidget::updateAndDelete()
// Update and delete.
proxy->update();
delete proxy;
- QTest::qWait(50);
- QCOMPARE(view.npaints, 1);
+ QTRY_COMPARE(view.npaints, 1);
QCOMPARE(view.paintEventRegion, expectedRegion);
}
@@ -3439,7 +3421,6 @@ void tst_QGraphicsProxyWidget::clickFocus()
qt_x11_wait_for_window_manager(&view);
#endif
QApplication::setActiveWindow(&view);
- QTest::qWait(25);
QTRY_COMPARE(QApplication::activeWindow(), &view);
QVERIFY(!proxy->hasFocus());
diff --git a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
index f27f469..35ebbd9 100644
--- a/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
+++ b/tests/auto/qhttpnetworkconnection/tst_qhttpnetworkconnection.cpp
@@ -385,7 +385,7 @@ void tst_QHttpNetworkConnection::post_data()
QTest::addColumn<int>("contentLength");
QTest::addColumn<int>("downloadSize");
- QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/cgi-bin/echo.cgi" << ushort(80) << false << "7 bytes" << 200 << "OK" << 7 << 7;
+ QTest::newRow("success-internal") << "http://" << QtNetworkSettings::serverName() << "/qtest/cgi-bin/echo.cgi" << ushort(80) << false << "7 bytes" << 200 << "OK" << 7 << 7;
QTest::newRow("failure-internal") << "http://" << QtNetworkSettings::serverName() << "/t" << ushort(80) << false << "Hello World" << 404 << "Not Found" << -1 << 997 + QtNetworkSettings::serverName().size();
}
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index e269092..c238f59 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -1410,10 +1410,10 @@ void tst_QNetworkReply::deleteFromHttp_data()
// for status codes to expect, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html
QTest::newRow("405-method-not-allowed") << QUrl("http://" + QtNetworkSettings::serverName() + "/index.html") << 405 << QNetworkReply::ContentOperationNotPermittedError;
- QTest::newRow("200-ok") << QUrl("http://" + QtNetworkSettings::serverName() + "/cgi-bin/http-delete.cgi?200-ok") << 200 << QNetworkReply::NoError;
- QTest::newRow("202-accepted") << QUrl("http://" + QtNetworkSettings::serverName() + "/cgi-bin/http-delete.cgi?202-accepted") << 202 << QNetworkReply::NoError;
- QTest::newRow("204-no-content") << QUrl("http://" + QtNetworkSettings::serverName() + "/cgi-bin/http-delete.cgi?204-no-content") << 204 << QNetworkReply::NoError;
- QTest::newRow("404-not-found") << QUrl("http://" + QtNetworkSettings::serverName() + "/cgi-bin/http-delete.cgi?404-not-found") << 404 << QNetworkReply::ContentNotFoundError;
+ QTest::newRow("200-ok") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/http-delete.cgi?200-ok") << 200 << QNetworkReply::NoError;
+ QTest::newRow("202-accepted") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/http-delete.cgi?202-accepted") << 202 << QNetworkReply::NoError;
+ QTest::newRow("204-no-content") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/http-delete.cgi?204-no-content") << 204 << QNetworkReply::NoError;
+ QTest::newRow("404-not-found") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/http-delete.cgi?404-not-found") << 404 << QNetworkReply::ContentNotFoundError;
}
void tst_QNetworkReply::deleteFromHttp()
@@ -3886,10 +3886,10 @@ void tst_QNetworkReply::authorizationError_data()
QTest::addColumn<QString>("httpBody");
QTest::newRow("unknown-authorization-method") << "http://" + QtNetworkSettings::serverName() +
- "/cgi-bin/http-unknown-authentication-method.cgi?401-authorization-required" << 1 << 1
+ "/qtest/cgi-bin/http-unknown-authentication-method.cgi?401-authorization-required" << 1 << 1
<< int(QNetworkReply::AuthenticationRequiredError) << 401 << "authorization required";
QTest::newRow("unknown-proxy-authorization-method") << "http://" + QtNetworkSettings::serverName() +
- "/cgi-bin/http-unknown-authentication-method.cgi?407-proxy-authorization-required" << 1 << 1
+ "/qtest/cgi-bin/http-unknown-authentication-method.cgi?407-proxy-authorization-required" << 1 << 1
<< int(QNetworkReply::ProxyAuthenticationRequiredError) << 407
<< "authorization required";
}
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 3c6c7b2..25d8e3df 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -104,6 +104,8 @@ private slots:
void getSetGlobalObject();
void globalObjectProperties();
void globalObjectGetterSetterProperty();
+ void customGlobalObjectWithPrototype();
+ void globalObjectWithCustomPrototype();
void builtinFunctionNames_data();
void builtinFunctionNames();
void checkSyntax_data();
@@ -1177,6 +1179,131 @@ void tst_QScriptEngine::globalObjectGetterSetterProperty()
QVERIFY(global.property("baz").equals(789));
}
+void tst_QScriptEngine::customGlobalObjectWithPrototype()
+{
+ for (int x = 0; x < 2; ++x) {
+ QScriptEngine engine;
+ QScriptValue wrap = engine.newObject();
+ QScriptValue global = engine.globalObject();
+ QScriptValue originalGlobalProto = global.prototype();
+ if (!x) {
+ // Set prototype before setting global object
+ wrap.setPrototype(global);
+ QVERIFY(wrap.prototype().strictlyEquals(global));
+ engine.setGlobalObject(wrap);
+ } else {
+ // Set prototype after setting global object
+ engine.setGlobalObject(wrap);
+ wrap.setPrototype(global);
+ QVERIFY(wrap.prototype().strictlyEquals(global));
+ }
+ {
+ QScriptValue ret = engine.evaluate("print");
+ QVERIFY(ret.isFunction());
+ QVERIFY(ret.strictlyEquals(wrap.property("print")));
+ }
+ {
+ QScriptValue ret = engine.evaluate("this.print");
+ QVERIFY(ret.isFunction());
+ QVERIFY(ret.strictlyEquals(wrap.property("print")));
+ }
+ {
+ QScriptValue ret = engine.evaluate("hasOwnProperty('print')");
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ }
+ {
+ QScriptValue ret = engine.evaluate("this.hasOwnProperty('print')");
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ }
+
+ QScriptValue anotherProto = engine.newObject();
+ anotherProto.setProperty("anotherProtoProperty", 123);
+ global.setPrototype(anotherProto);
+ {
+ QScriptValue ret = engine.evaluate("print");
+ QVERIFY(ret.isFunction());
+ QVERIFY(ret.strictlyEquals(wrap.property("print")));
+ }
+ {
+ QScriptValue ret = engine.evaluate("anotherProtoProperty");
+ QVERIFY(ret.isNumber());
+ QVERIFY(ret.strictlyEquals(wrap.property("anotherProtoProperty")));
+ }
+ {
+ QScriptValue ret = engine.evaluate("this.anotherProtoProperty");
+ QVERIFY(ret.isNumber());
+ QVERIFY(ret.strictlyEquals(wrap.property("anotherProtoProperty")));
+ }
+
+ wrap.setPrototype(anotherProto);
+ {
+ QScriptValue ret = engine.evaluate("print");
+ QVERIFY(ret.isError());
+ QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: print"));
+ }
+ {
+ QScriptValue ret = engine.evaluate("anotherProtoProperty");
+ QVERIFY(ret.isNumber());
+ QVERIFY(ret.strictlyEquals(wrap.property("anotherProtoProperty")));
+ }
+ QVERIFY(global.prototype().strictlyEquals(anotherProto));
+
+ global.setPrototype(originalGlobalProto);
+ engine.setGlobalObject(global);
+ {
+ QScriptValue ret = engine.evaluate("anotherProtoProperty");
+ QVERIFY(ret.isError());
+ QCOMPARE(ret.toString(), QString::fromLatin1("ReferenceError: Can't find variable: anotherProtoProperty"));
+ }
+ {
+ QScriptValue ret = engine.evaluate("print");
+ QVERIFY(ret.isFunction());
+ QVERIFY(ret.strictlyEquals(global.property("print")));
+ }
+ QVERIFY(!anotherProto.property("print").isValid());
+ }
+}
+
+void tst_QScriptEngine::globalObjectWithCustomPrototype()
+{
+ QScriptEngine engine;
+ QScriptValue proto = engine.newObject();
+ proto.setProperty("protoProperty", 123);
+ QScriptValue global = engine.globalObject();
+ QScriptValue originalProto = global.prototype();
+ global.setPrototype(proto);
+ {
+ QScriptValue ret = engine.evaluate("protoProperty");
+ QVERIFY(ret.isNumber());
+ QVERIFY(ret.strictlyEquals(global.property("protoProperty")));
+ }
+ {
+ QScriptValue ret = engine.evaluate("this.protoProperty");
+ QVERIFY(ret.isNumber());
+ QVERIFY(ret.strictlyEquals(global.property("protoProperty")));
+ }
+ {
+ QScriptValue ret = engine.evaluate("hasOwnProperty('protoProperty')");
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ }
+ {
+ QScriptValue ret = engine.evaluate("this.hasOwnProperty('protoProperty')");
+ QVERIFY(ret.isBool());
+ QVERIFY(!ret.toBool());
+ }
+
+ // Custom prototype set from JS
+ {
+ QScriptValue ret = engine.evaluate("this.__proto__ = { 'a': 123 }; a");
+ QVERIFY(ret.isNumber());
+ QEXPECT_FAIL("", "QTBUG-9737", Continue);
+ QVERIFY(ret.strictlyEquals(global.property("a")));
+ }
+}
+
void tst_QScriptEngine::builtinFunctionNames_data()
{
QTest::addColumn<QString>("expression");
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 4397ab1..2bfce74 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -1535,6 +1535,7 @@ void tst_QSslSocket::verifyMode()
loop.exec();
QVERIFY(clientSocket.isEncrypted());
+ qDebug() << server.socket->sslErrors();
QVERIFY(server.socket->sslErrors().isEmpty());
}
diff --git a/tests/auto/qxmlquery/tst_qxmlquery.cpp b/tests/auto/qxmlquery/tst_qxmlquery.cpp
index a6c0d35..be0d708 100644
--- a/tests/auto/qxmlquery/tst_qxmlquery.cpp
+++ b/tests/auto/qxmlquery/tst_qxmlquery.cpp
@@ -2040,7 +2040,7 @@ void tst_QXmlQuery::fnDocNetworkAccessSuccess_data() const
return;
QTest::newRow("http scheme")
- << QUrl(QString("http://" + QtNetworkSettings::serverName() + "/qxmlquery/wellFormed.xml"))
+ << QUrl(QString("http://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/wellFormed.xml"))
<< QByteArray("<!-- a comment --><e from=\"http\">Some Text</e>");
QTest::newRow("ftp scheme")
@@ -2103,10 +2103,10 @@ void tst_QXmlQuery::fnDocNetworkAccessFailure_data() const
return;
QTest::newRow("http scheme, not well-formed")
- << QUrl(QString("http://" + QtNetworkSettings::serverName() + "/qxmlquery/notWellformed.xml"));
+ << QUrl(QString("http://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/notWellformed.xml"));
QTest::newRow("https scheme, not well-formed")
- << QUrl(QString("https://" + QtNetworkSettings::serverName() + "/qxmlquery/notWellformedViaHttps.xml"));
+ << QUrl(QString("https://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/notWellformedViaHttps.xml"));
QTest::newRow("https scheme, nonexistent host")
<< QUrl(QLatin1String("https://this.host.does.not.exist.I.SWear"));
@@ -2564,7 +2564,7 @@ void tst_QXmlQuery::setQueryQUrlSuccess_data() const
<< QByteArray("This was received via FTP");
QTest::newRow("A valid query via the http scheme")
- << QUrl::fromEncoded(QString("http://" + QtNetworkSettings::serverName() + "/qxmlquery/viaHttp.xq").toLatin1())
+ << QUrl::fromEncoded(QString("http://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/viaHttp.xq").toLatin1())
<< QByteArray("This was received via HTTP.");
}
@@ -2630,11 +2630,11 @@ void tst_QXmlQuery::setQueryQUrlFailure_data() const
QTest::newRow("A query via http:// that is completely empty, but readable.")
<< QUrl::fromEncoded(QString(
- "http://" + QtNetworkSettings::serverName() + "/qxmlquery/completelyEmptyQuery.xq").toLatin1());
+ "http://" + QtNetworkSettings::serverName() + "/qtest/qxmlquery/completelyEmptyQuery.xq").toLatin1());
QTest::newRow("A query via ftp:// that is completely empty, but readable.")
<< QUrl::fromEncoded(QString(
- "ftp://" + QtNetworkSettings::serverName() + "qxmlquery/completelyEmptyQuery.xq").toLatin1());
+ "ftp://" + QtNetworkSettings::serverName() + "/pub/qxmlquery/completelyEmptyQuery.xq").toLatin1());
}