diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-22 10:24:09 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-22 10:24:09 (GMT) |
commit | da7c6cc8995f063435b25938ac10739a6e7f0067 (patch) | |
tree | 2f000c68138087b035cf29e31620cac2acd41f2d /tests | |
parent | 3ba4e43507cc2ca1f642a45aec4fda4bd3572678 (diff) | |
parent | e48850c6ec90cd5eaa95d07573c2afa1a1c4f67f (diff) | |
download | Qt-da7c6cc8995f063435b25938ac10739a6e7f0067.zip Qt-da7c6cc8995f063435b25938ac10739a6e7f0067.tar.gz Qt-da7c6cc8995f063435b25938ac10739a6e7f0067.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-s60-public: (36 commits)
Fixed updating the VKB display when inputting into QGraphicsWebView.
Switched out QT_SOURCE_TREE, which is not defined for user apps.
QS60Style: All itemviews should indicate selection with tick mark
QS60Style assert fails to detect an index failure
QScriptClass-implemented constructors lead to application crash
Improve test coverage of QScriptClass::Callable extension
Change fromSymbianRSgImage() to use the newer version of RSgImage
Removed extra space from the command line passed to QProcess in Symbian
installTranslatorFunctions doesn't work for custom global object
fix QTabBar scroll button arrow position in Windows mobile style
Revert "Optimize getting bearings of a glyph on Windows for true type fonts"
stabilize tst_QAccessibility::comboBoxTest
Enable s60main.rsc infixing.
Improved qt_x11_wait_for_window_manager
Virtual Keyboard and double tap for Symbian support
Whitespace
Better handling for NOTIFY in QGraphicsWidget regarding geometry changes
Add NOTIFY to size property so QML bindings are working fine.
Implement Q_PRIVATE_PROPERTY that allows you to declare properties
Don't assert in QScriptValue::call()
...
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/moc/tst_moc.cpp | 51 | ||||
-rw-r--r-- | tests/auto/qaccessibility/tst_qaccessibility.cpp | 3 | ||||
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 146 | ||||
-rw-r--r-- | tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 136 | ||||
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 58 | ||||
-rw-r--r-- | tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp | 17 | ||||
-rw-r--r-- | tests/auto/qscriptclass/tst_qscriptclass.cpp | 118 | ||||
-rw-r--r-- | tests/auto/qscriptengine/tst_qscriptengine.cpp | 31 | ||||
-rw-r--r-- | tests/auto/qscriptvalue/tst_qscriptvalue.cpp | 8 |
9 files changed, 469 insertions, 99 deletions
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp index fad4845..30c2721 100644 --- a/tests/auto/moc/tst_moc.cpp +++ b/tests/auto/moc/tst_moc.cpp @@ -484,6 +484,7 @@ private slots: void singleFunctionKeywordSignalAndSlot(); void templateGtGt(); void qprivateslots(); + void qprivateproperties(); void inlineSlotsWithThrowDeclaration(); void warnOnPropertyWithoutREAD(); void constructors(); @@ -1071,6 +1072,56 @@ void tst_Moc::qprivateslots() QVERIFY(mobj->indexOfMethod("method1()") != -1); //tast204730 } +class PrivatePropertyTest : public QObject +{ + Q_OBJECT + Q_PROPERTY(int foo READ foo WRITE setFoo); + Q_PRIVATE_PROPERTY(d, int bar READ bar WRITE setBar); + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int plop READ plop WRITE setPlop); + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d_func(), int baz READ baz WRITE setBaz); + class MyDPointer { + public: + MyDPointer() : mBar(0), mPlop(0) {} + int bar() { return mBar ; } + void setBar(int value) { mBar = value; } + int plop() { return mPlop ; } + void setPlop(int value) { mPlop = value; } + int baz() { return mBaz ; } + void setBaz(int value) { mBaz = value; } + private: + int mBar; + int mPlop; + int mBaz; + }; +public: + PrivatePropertyTest() : mFoo(0), d (new MyDPointer) {} + int foo() { return mFoo ; } + void setFoo(int value) { mFoo = value; } + MyDPointer *d_func() {return d;} +private: + int mFoo; + MyDPointer *d; +}; + + +void tst_Moc::qprivateproperties() +{ + PrivatePropertyTest test; + + test.setProperty("foo", 1); + QCOMPARE(test.property("foo"), qVariantFromValue(1)); + + test.setProperty("bar", 2); + QCOMPARE(test.property("bar"), qVariantFromValue(2)); + + test.setProperty("plop", 3); + QCOMPARE(test.property("plop"), qVariantFromValue(3)); + + test.setProperty("baz", 4); + QCOMPARE(test.property("baz"), qVariantFromValue(4)); + +} + #include "task189996.h" void InlineSlotsWithThrowDeclaration::c() throw() {} diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index 133cb33..e5a332a 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -3923,9 +3923,8 @@ void tst_QAccessibility::comboBoxTest() acc = QAccessible::queryAccessibleInterface(cb); - QRect accRect = acc->rect(0); for (int i = 1; i < acc->childCount(); ++i) { - QVERIFY(accRect.contains(acc->rect(i))); + QTRY_VERIFY(acc->rect(0).contains(acc->rect(i))); } QCOMPARE(acc->doAction(QAccessible::Press, 2), true); QTest::qWait(400); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index d37ff76..a155222 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -284,6 +284,7 @@ private slots: void task250680_childClip(); void taskQTBUG_5904_crashWithDeviceCoordinateCache(); void taskQT657_paintIntoCacheWithTransparentParts(); + void taskQTBUG_7863_paintIntoCacheWithTransparentParts(); }; void tst_QGraphicsScene::initTestCase() @@ -4349,12 +4350,14 @@ void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache() void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() { + // Test using DeviceCoordinateCache and opaque item QWidget *w = new QWidget(); - w->setPalette(Qt::blue); + w->setPalette(QColor(0, 0, 255)); w->setGeometry(0, 0, 50, 50); QGraphicsScene *scene = new QGraphicsScene(); - QGraphicsView *view = new QGraphicsView(scene); + CustomView *view = new CustomView; + view->setScene(scene); QGraphicsProxyWidget *proxy = scene->addWidget(w); proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); @@ -4362,13 +4365,14 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() view->show(); QTest::qWaitForWindowShown(view); - w->update(10,10,10,10); + view->repaints = 0; + proxy->update(10, 10, 10, 10); QTest::qWait(50); + QTRY_VERIFY(view->repaints > 0); QPixmap pix; QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(proxy); - QPixmapCache::Key key = itemp->extraItemCache()->deviceData.value(view->viewport()).key; - QVERIFY(QPixmapCache::find(key, &pix)); + QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->deviceData.value(view->viewport()).key, &pix)); QTransform t = proxy->sceneTransform(); // Map from scene coordinates to pixmap coordinates. @@ -4383,6 +4387,138 @@ void tst_QGraphicsScene::taskQT657_paintIntoCacheWithTransparentParts() for(int j = 0; j < im.height(); j++) QCOMPARE(qAlpha(im.pixel(i, j)), 255); } + + delete w; +} + +void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts() +{ + // Test using DeviceCoordinateCache and semi-transparent item + { + QGraphicsRectItem *backItem = new QGraphicsRectItem(0, 0, 100, 100); + backItem->setBrush(QColor(255, 255, 0)); + QGraphicsRectItem *rectItem = new QGraphicsRectItem(0, 0, 50, 50); + rectItem->setBrush(QColor(0, 0, 255, 125)); + rectItem->setParentItem(backItem); + + QGraphicsScene *scene = new QGraphicsScene(); + CustomView *view = new CustomView; + view->setScene(scene); + + scene->addItem(backItem); + rectItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); + backItem->rotate(15); + + view->show(); + QTest::qWaitForWindowShown(view); + view->repaints = 0; + rectItem->update(10, 10, 10, 10); + QTest::qWait(50); + QTRY_VERIFY(view->repaints > 0); + + QPixmap pix; + QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem); + QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->deviceData.value(view->viewport()).key, &pix)); + + QTransform t = rectItem->sceneTransform(); + // Map from scene coordinates to pixmap coordinates. + // X origin in the pixmap is the most-left point + // of the item's boundingRect in the scene. + qreal adjust = t.mapRect(rectItem->boundingRect().toRect()).left(); + QRect rect = t.mapRect(QRect(10, 10, 10, 10)).adjusted(-adjust, 0, -adjust + 1, 1); + QPixmap subpix = pix.copy(rect); + + QImage im = subpix.toImage(); + for(int i = 0; i < im.width(); i++) { + for(int j = 0; j < im.height(); j++) { + QCOMPARE(qAlpha(im.pixel(i, j)), 125); + } + } + + delete view; + } + + // Test using ItemCoordinateCache and opaque item + { + QGraphicsRectItem *rectItem = new QGraphicsRectItem(0, 0, 50, 50); + rectItem->setBrush(QColor(0, 0, 255)); + + QGraphicsScene *scene = new QGraphicsScene(); + CustomView *view = new CustomView; + view->setScene(scene); + + scene->addItem(rectItem); + rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); + rectItem->rotate(15); + + view->show(); + QTest::qWaitForWindowShown(view); + view->repaints = 0; + rectItem->update(10, 10, 10, 10); + QTest::qWait(50); + QTRY_VERIFY(view->repaints > 0); + + QPixmap pix; + QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem); + QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->key, &pix)); + + QTransform t = rectItem->sceneTransform(); + // Map from scene coordinates to pixmap coordinates. + // X origin in the pixmap is the most-left point + // of the item's boundingRect in the scene. + qreal adjust = t.mapRect(rectItem->boundingRect().toRect()).left(); + QRect rect = t.mapRect(QRect(10, 10, 10, 10)).adjusted(-adjust, 0, -adjust + 1, 1); + QPixmap subpix = pix.copy(rect); + + QImage im = subpix.toImage(); + for(int i = 0; i < im.width(); i++) { + for(int j = 0; j < im.height(); j++) + QCOMPARE(qAlpha(im.pixel(i, j)), 255); + } + + delete view; + } + + // Test using ItemCoordinateCache and semi-transparent item + { + QGraphicsRectItem *rectItem = new QGraphicsRectItem(0, 0, 50, 50); + rectItem->setBrush(QColor(0, 0, 255, 125)); + + QGraphicsScene *scene = new QGraphicsScene(); + CustomView *view = new CustomView; + view->setScene(scene); + + scene->addItem(rectItem); + rectItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); + rectItem->rotate(15); + + view->show(); + QTest::qWaitForWindowShown(view); + view->repaints = 0; + rectItem->update(10, 10, 10, 10); + QTest::qWait(50); + QTRY_VERIFY(view->repaints > 0); + + QPixmap pix; + QGraphicsItemPrivate* itemp = QGraphicsItemPrivate::get(rectItem); + QTRY_VERIFY(QPixmapCache::find(itemp->extraItemCache()->key, &pix)); + + QTransform t = rectItem->sceneTransform(); + // Map from scene coordinates to pixmap coordinates. + // X origin in the pixmap is the most-left point + // of the item's boundingRect in the scene. + qreal adjust = t.mapRect(rectItem->boundingRect().toRect()).left(); + QRect rect = t.mapRect(QRect(10, 10, 10, 10)).adjusted(-adjust, 0, -adjust + 1, 1); + QPixmap subpix = pix.copy(rect); + + QImage im = subpix.toImage(); + for(int i = 0; i < im.width(); i++) { + for(int j = 0; j < im.height(); j++) + QCOMPARE(qAlpha(im.pixel(i, j)), 125); + } + + delete view; + } } QTEST_MAIN(tst_QGraphicsScene) diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 6941d23..587b7d5 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -462,7 +462,7 @@ void tst_QGraphicsWidget::focusWidget() QFETCH(int, childWithFocus); SubQGraphicsWidget *widget = children[childWithFocus]; widget->setFocus(); - QVERIFY(widget->hasFocus()); + QTRY_VERIFY(widget->hasFocus()); QCOMPARE(parent->focusWidget(), static_cast<QGraphicsWidget*>(widget)); } } @@ -479,23 +479,23 @@ void tst_QGraphicsWidget::focusWidget2() scene.addItem(widget); - QVERIFY(!widget->hasFocus()); + QTRY_VERIFY(!widget->hasFocus()); widget->setFocusPolicy(Qt::StrongFocus); - QVERIFY(!widget->hasFocus()); + QTRY_VERIFY(!widget->hasFocus()); QGraphicsWidget *subWidget = new QGraphicsWidget(widget); - QVERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(!subWidget->hasFocus()); scene.setFocus(); - QVERIFY(!widget->hasFocus()); - QVERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(!widget->hasFocus()); + QTRY_VERIFY(!subWidget->hasFocus()); widget->setFocus(); - QVERIFY(widget->hasFocus()); - QCOMPARE(focusInSpy.count(), 1); - QVERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(widget->hasFocus()); + QTRY_COMPARE(focusInSpy.count(), 1); + QTRY_VERIFY(!subWidget->hasFocus()); QGraphicsWidget *otherSubWidget = new QGraphicsWidget; EventSpy otherFocusInSpy(otherSubWidget, QEvent::FocusIn); @@ -504,18 +504,18 @@ void tst_QGraphicsWidget::focusWidget2() otherSubWidget->setFocusPolicy(Qt::StrongFocus); otherSubWidget->setParentItem(widget); - QVERIFY(widget->hasFocus()); + QTRY_VERIFY(widget->hasFocus()); QCOMPARE(scene.focusItem(), (QGraphicsItem *)widget); - QVERIFY(!subWidget->hasFocus()); - QVERIFY(!otherSubWidget->hasFocus()); + QTRY_VERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(!otherSubWidget->hasFocus()); widget->hide(); - QVERIFY(!widget->hasFocus()); // lose but still has subfocus + QTRY_VERIFY(!widget->hasFocus()); // lose but still has subfocus QCOMPARE(focusInSpy.count(), 1); QCOMPARE(focusOutSpy.count(), 1); widget->show(); - QVERIFY(!widget->hasFocus()); // no regain + QTRY_VERIFY(!widget->hasFocus()); // no regain QCOMPARE(focusInSpy.count(), 1); QCOMPARE(focusOutSpy.count(), 1); @@ -523,24 +523,24 @@ void tst_QGraphicsWidget::focusWidget2() // try to setup subFocus on item that can't take focus subWidget->setFocus(); - QVERIFY(!subWidget->hasFocus()); + QTRY_VERIFY(!subWidget->hasFocus()); QVERIFY(!scene.focusItem()); // but isn't the scene's focus item // try to setup subFocus on item that can take focus otherSubWidget->setFocus(); - QVERIFY(!otherSubWidget->hasFocus()); + QTRY_VERIFY(!otherSubWidget->hasFocus()); QCOMPARE(widget->focusWidget(), otherSubWidget); QVERIFY(!scene.focusItem()); // but isn't the scene's focus item widget->show(); - QCOMPARE(scene.focusItem(), (QGraphicsItem *)otherSubWidget); // but isn't the scene's focus item + QTRY_COMPARE(scene.focusItem(), (QGraphicsItem *)otherSubWidget); // but isn't the scene's focus item QCOMPARE(otherFocusInSpy.count(), 1); QCOMPARE(otherFocusOutSpy.count(), 0); delete otherSubWidget; - QCOMPARE(otherFocusOutSpy.count(), 1); + QTRY_COMPARE(otherFocusOutSpy.count(), 1); QVERIFY(!scene.focusItem()); QVERIFY(!widget->focusWidget()); } @@ -579,16 +579,16 @@ void tst_QGraphicsWidget::focusPolicy() SubQGraphicsWidget *widget = new SubQGraphicsWidget; scene.addItem(widget); - QCOMPARE(Qt::NoFocus, widget->focusPolicy()); + QTRY_COMPARE(Qt::NoFocus, widget->focusPolicy()); QFETCH(Qt::FocusPolicy, focusPolicy1); widget->setFocusPolicy(focusPolicy1); - QCOMPARE(widget->focusPolicy(), focusPolicy1); + QTRY_COMPARE(widget->focusPolicy(), focusPolicy1); bool isFocusable = widget->flags() & QGraphicsItem::ItemIsFocusable; bool wasFocusable = isFocusable; - QVERIFY(isFocusable == (focusPolicy1 != Qt::NoFocus)); + QTRY_VERIFY(isFocusable == (focusPolicy1 != Qt::NoFocus)); widget->setFocus(); - QCOMPARE(widget->hasFocus(), isFocusable); + QTRY_COMPARE(widget->hasFocus(), isFocusable); QFETCH(Qt::FocusPolicy, focusPolicy2); widget->setFocusPolicy(focusPolicy2); @@ -691,25 +691,21 @@ void tst_QGraphicsWidget::fontChangedEvent() EventSpy rootSpyFont(root, QEvent::FontChange); EventSpy rootSpyPolish(root, QEvent::Polish); - QCOMPARE(rootSpyFont.count(), 0); - QApplication::processEvents(); //The polish event is sent - QCOMPARE(rootSpyPolish.count(), 1); - QApplication::processEvents(); //Process events to see if we get the font change event + QTRY_COMPARE(rootSpyFont.count(), 0); + QTRY_COMPARE(rootSpyPolish.count(), 1); //The font is still the same so no fontChangeEvent - QCOMPARE(rootSpyFont.count(), 0); + QTRY_COMPARE(rootSpyFont.count(), 0); QFont font; font.setPointSize(43); root->setFont(font); - QApplication::processEvents(); //Process events to get the font change event //The font changed - QCOMPARE(rootSpyFont.count(), 1); + QTRY_COMPARE(rootSpyFont.count(), 1); //then roll back to the default one. root->setFont(appFont); - QApplication::processEvents(); //Process events to get the font change event //The font changed - QCOMPARE(rootSpyFont.count(), 2); + QTRY_COMPARE(rootSpyFont.count(), 2); } void tst_QGraphicsWidget::fontPropagationWidgetItemWidget() @@ -770,11 +766,13 @@ void tst_QGraphicsWidget::geometry() { SubQGraphicsWidget widget; QCOMPARE(widget.geometry(), QRectF(widget.pos(), widget.size())); - + QSignalSpy spy(&widget, SIGNAL(geometryChanged())); QFETCH(QPointF, pos); QFETCH(QSizeF, size); widget.setPos(pos); widget.resize(size); + if (!size.isNull()) + QCOMPARE(spy.count(), 1); QCOMPARE(widget.geometry(), QRectF(pos, size)); } @@ -843,7 +841,6 @@ void tst_QGraphicsWidget::initStyleOption() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); view.setAlignment(Qt::AlignTop | Qt::AlignLeft); @@ -868,7 +865,6 @@ void tst_QGraphicsWidget::initStyleOption() view.resize(300, 300); view.show(); QTest::qWaitForWindowShown(&view); - QTest::qWait(20); sendMouseMove(view.viewport(), view.mapFromScene(widget->mapToScene(widget->boundingRect().center()))); } @@ -921,9 +917,7 @@ void tst_QGraphicsWidget::layout() } widget.setLayout(layout); - QTest::qWait(25); - - QCOMPARE(widget.layout(), static_cast<QGraphicsLayout*>(layout)); + QTRY_COMPARE(widget.layout(), static_cast<QGraphicsLayout*>(layout)); for (int i = 0; i < children.count(); ++i) { SubQGraphicsWidget *item = children[i]; QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget); @@ -963,10 +957,9 @@ void tst_QGraphicsWidget::layoutDirection() view->show(); QTest::qWaitForWindowShown(view); for (int i = 0; i < children.count(); ++i) { - QCOMPARE(children[i]->layoutDirection(), layoutDirection); - QCOMPARE(children[i]->testAttribute(Qt::WA_SetLayoutDirection), false); + QTRY_COMPARE(children[i]->layoutDirection(), layoutDirection); + QTRY_COMPARE(children[i]->testAttribute(Qt::WA_SetLayoutDirection), false); view->repaint(); - QApplication::processEvents(); QTRY_COMPARE(children[i]->m_painterLayoutDirection, layoutDirection); } delete view; @@ -1179,7 +1172,6 @@ void tst_QGraphicsWidget::setTabOrder() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); QGraphicsWidget *lastItem = 0; @@ -1200,7 +1192,6 @@ void tst_QGraphicsWidget::setTabOrder() if (!children.isEmpty()) { QGraphicsWidget *first = children.first(); view.viewport()->setFocus(); - QApplication::processEvents(); QTRY_VERIFY(view.viewport()->hasFocus()); first->setFocus(); QVERIFY(first->hasFocus()); @@ -1461,18 +1452,14 @@ void tst_QGraphicsWidget::verifyFocusChain() QTest::qWaitForWindowShown(window); lineEdit->setFocus(); - QTest::qWait(25); QTRY_VERIFY(lineEdit->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_1->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_2->hasFocus()); // remove the tabFocusFirst and insert new item delete w1_1; // calls _q_removeItemLater - QTest::qWait(25); SubQGraphicsWidget *w1_3 = new SubQGraphicsWidget; w1_3->setFocusPolicy(Qt::StrongFocus); w1_3->setData(0, "w1_3"); @@ -1480,14 +1467,11 @@ void tst_QGraphicsWidget::verifyFocusChain() scene.addItem(w1_3); QTRY_VERIFY(w1_2->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(25); QTRY_VERIFY(lineEdit->hasFocus()); // tabFocusFirst should now point to w1_2 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_2->hasFocus()); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_3->hasFocus()); scene.removeItem(w1_2); // does not call _q_removeItemLater delete w1_2; // calls _q_removeItemLater @@ -1498,16 +1482,12 @@ void tst_QGraphicsWidget::verifyFocusChain() w1_4->setGeometry(75,0,25, 25); scene.addItem(w1_4); QTRY_VERIFY(w1_3->hasFocus()); - QTest::qWait(25); QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4)); QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab); - QTest::qWait(25); QTRY_VERIFY(lineEdit->hasFocus()); // tabFocusFirst should now point to w1_3 QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab); - QTest::qWait(25); QTRY_VERIFY(w1_3->hasFocus()); - QTest::qWait(25); QTRY_VERIFY(compareFocusChain(view, QList<QGraphicsItem*>() << w1_3 << w1_4)); delete window; } @@ -1522,7 +1502,6 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie() qt_x11_wait_for_window_manager(&view); #endif QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); // delete item in focus chain with no focus and verify chain @@ -1756,31 +1735,29 @@ void tst_QGraphicsWidget::setSizes() widget->setPreferredSize(pref); widget->setMaximumSize(max); - QApplication::processEvents(); - for (i = 0; i < compareInstructions.count(); ++i) { Inst input = compareInstructions.at(i); switch (input.first) { case MinimumSize: - QCOMPARE(widget->minimumSize(), input.second.toSizeF()); + QTRY_COMPARE(widget->minimumSize(), input.second.toSizeF()); break; case PreferredSize: - QCOMPARE(widget->preferredSize(), input.second.toSizeF()); + QTRY_COMPARE(widget->preferredSize(), input.second.toSizeF()); break; case MaximumSize: - QCOMPARE(widget->maximumSize(), input.second.toSizeF()); + QTRY_COMPARE(widget->maximumSize(), input.second.toSizeF()); break; case Size: - QCOMPARE(widget->size(), input.second.toSizeF()); + QTRY_COMPARE(widget->size(), input.second.toSizeF()); break; case MinimumWidth: - QCOMPARE(widget->minimumWidth(), qreal(input.second.toDouble())); + QTRY_COMPARE(widget->minimumWidth(), qreal(input.second.toDouble())); break; case PreferredWidth: - QCOMPARE(widget->preferredWidth(), qreal(input.second.toDouble())); + QTRY_COMPARE(widget->preferredWidth(), qreal(input.second.toDouble())); break; case MaximumWidth: - QCOMPARE(widget->maximumWidth(), qreal(input.second.toDouble())); + QTRY_COMPARE(widget->maximumWidth(), qreal(input.second.toDouble())); break; default: qWarning("instruction not implemented"); @@ -1835,14 +1812,13 @@ void tst_QGraphicsWidget::task236127_bspTreeIndexFails() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTest::qWait(100); - QVERIFY(!scene.itemAt(25, 25)); + QTRY_VERIFY(!scene.itemAt(25, 25)); widget->setGeometry(0, 112, 360, 528); - QCOMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); widget2->setGeometry(0, 573, 360, 67); - QCOMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); - QCOMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2); + QTRY_COMPARE(scene.itemAt(15, 120), (QGraphicsItem *)widget); + QTRY_COMPARE(scene.itemAt(50, 585), (QGraphicsItem *)widget2); } void tst_QGraphicsWidget::defaultSize() @@ -1857,7 +1833,6 @@ void tst_QGraphicsWidget::defaultSize() #ifdef Q_WS_X11 qt_x11_wait_for_window_manager(&view); #endif - QTest::qWait(50); QSizeF initialSize = widget->size(); widget->resize(initialSize); @@ -1867,9 +1842,8 @@ void tst_QGraphicsWidget::defaultSize() widget->setPreferredSize(60, 60); widget->setMaximumSize(110, 110); widget->setVisible(true); - QTest::qWait(50); // should still have its size set to initialsize - QCOMPARE(widget->geometry().size(), initialSize); + QTRY_COMPARE(widget->geometry().size(), initialSize); } @@ -2391,7 +2365,6 @@ void tst_QGraphicsWidget::painterStateProtectionOnWindowFrame() scene.addItem(widget); view.show(); QTest::qWaitForWindowShown(&view); - QTest::qWait(500); } class ProxyStyle : public QCommonStyle @@ -2480,7 +2453,6 @@ void tst_QGraphicsWidget::task250119_shortcutContext() view.setScene(&scene); view.show(); QApplication::setActiveWindow(&view); - QTest::qWait(25); QTRY_COMPARE(QApplication::activeWindow(), &view); @@ -2735,9 +2707,7 @@ void tst_QGraphicsWidget::respectHFW() QTest::qWaitForWindowShown(view); { // here we go - simulate a interactive resize of the window - QTest::qWait(100); QTest::mouseMove(view, view->mapFromScene(71, 71)); // bottom right corner - QTest::qWait(100); QTest::mousePress(view->viewport(), Qt::LeftButton, 0, view->mapFromScene(71, 71), 200); view->grabMouse(); @@ -2751,10 +2721,9 @@ void tst_QGraphicsWidget::respectHFW() QApplication::sendEvent(view->viewport(), &e); view->releaseMouse(); } - QTest::qWait(100); const QSizeF winSize = window->size(); qreal minHFW = window->effectiveSizeHint(Qt::MinimumSize, QSizeF(winSize.width(), -1)).height(); - QVERIFY(qAbs(minHFW - winSize.height()) < 1); + QTRY_VERIFY(qAbs(minHFW - winSize.height()) < 1); #endif } @@ -2806,7 +2775,7 @@ void tst_QGraphicsWidget::addChildInpolishEvent() view.resize(200, 200); view.show(); QTest::qWaitForWindowShown(&view); - QCOMPARE(PolishWidget::numberOfPolish, 2); + QTRY_COMPARE(PolishWidget::numberOfPolish, 2); } void tst_QGraphicsWidget::polishEvent() @@ -2853,10 +2822,8 @@ void tst_QGraphicsWidget::polishEvent2() widget->events.clear(); - QApplication::processEvents(); - // Make sure the item got polish event. - QVERIFY(widget->events.contains(QEvent::Polish)); + QTRY_VERIFY(widget->events.contains(QEvent::Polish)); } void tst_QGraphicsWidget::autoFillBackground() @@ -2902,11 +2869,9 @@ void tst_QGraphicsWidget::initialShow() view.show(); QTest::qWaitForWindowShown(&view); - QTest::qWait(100); scene.addItem(widget); - QTest::qWait(100); - QCOMPARE(widget->repaints, 1); + QTRY_COMPARE(widget->repaints, 1); } void tst_QGraphicsWidget::initialShow2() @@ -2935,7 +2900,6 @@ void tst_QGraphicsWidget::initialShow2() const int expectedRepaintCount = paintSpy.count(); delete dummyView; dummyView = 0; - QTest::qWait(200); MyGraphicsWidget *widget = new MyGraphicsWidget; widget->resize(100, 100); @@ -2948,7 +2912,7 @@ void tst_QGraphicsWidget::initialShow2() view.show(); QTest::qWaitForWindowShown(&view); - QCOMPARE(widget->repaints, expectedRepaintCount); + QTRY_COMPARE(widget->repaints, expectedRepaintCount); } void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index e11900e..4922a89 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -205,6 +205,10 @@ private Q_SLOTS: #endif void ioGetFromHttpBrokenServer_data(); void ioGetFromHttpBrokenServer(); + void ioGetFromHttpStatus100_data(); + void ioGetFromHttpStatus100(); + void ioGetFromHttpNoHeaders_data(); + void ioGetFromHttpNoHeaders(); void ioGetFromHttpWithCache_data(); void ioGetFromHttpWithCache(); @@ -2159,6 +2163,60 @@ void tst_QNetworkReply::ioGetFromHttpBrokenServer() QVERIFY(reply->error() != QNetworkReply::NoError); } +void tst_QNetworkReply::ioGetFromHttpStatus100_data() +{ + QTest::addColumn<QByteArray>("dataToSend"); + QTest::newRow("normal") << QByteArray("HTTP/1.1 100 Continue\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("minimal") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("minimal2") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\r\n\r\n"); + QTest::newRow("minimal3") << QByteArray("HTTP/1.1 100 Continue\n\nHTTP/1.0 200 OK\n\n"); + QTest::newRow("with_headers") << QByteArray("HTTP/1.1 100 Continue\r\nBla: x\r\n\r\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); + QTest::newRow("with_headers2") << QByteArray("HTTP/1.1 100 Continue\nBla: x\n\nHTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"); +} + +void tst_QNetworkReply::ioGetFromHttpStatus100() +{ + QFETCH(QByteArray, dataToSend); + MiniHttpServer server(dataToSend); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->url(), request.url()); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); + QVERIFY(reply->rawHeader("bla").isNull()); +} + +void tst_QNetworkReply::ioGetFromHttpNoHeaders_data() +{ + QTest::addColumn<QByteArray>("dataToSend"); + QTest::newRow("justStatus+noheaders+disconnect") << QByteArray("HTTP/1.0 200 OK\r\n\r\n"); +} + +void tst_QNetworkReply::ioGetFromHttpNoHeaders() +{ + QFETCH(QByteArray, dataToSend); + MiniHttpServer server(dataToSend); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QCOMPARE(reply->url(), request.url()); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200); +} + void tst_QNetworkReply::ioGetFromHttpWithCache_data() { qRegisterMetaType<MyMemoryCache::CachedContent>(); diff --git a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index fb0f3e0..d2d86fb 100644 --- a/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -75,6 +75,8 @@ private slots: void loopCount(); void autoAdd(); void pauseResume(); + + void QTBUG8910_crashWhenRemovingUncontrolledAnimation(); }; tst_QParallelAnimationGroup::tst_QParallelAnimationGroup() @@ -999,9 +1001,22 @@ void tst_QParallelAnimationGroup::pauseResume() QCOMPARE(spy.count(), 2); //this shouldn't have changed group.resume(); QCOMPARE(spy.count(), 2); //this shouldn't have changed +} - +void tst_QParallelAnimationGroup::QTBUG8910_crashWhenRemovingUncontrolledAnimation() +{ + QParallelAnimationGroup group; + TestAnimation *anim = new TestAnimation; + anim->setLoopCount(-1); + TestAnimation *anim2 = new TestAnimation; + anim2->setLoopCount(-1); + group.addAnimation(anim); + group.addAnimation(anim2); + group.start(); + delete anim; + // it would crash here because the internals of the group would still have a reference to anim + delete anim2; } diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp index aca33ce..b4dbe73 100644 --- a/tests/auto/qscriptclass/tst_qscriptclass.cpp +++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp @@ -98,7 +98,12 @@ public: NotCallable, CallableReturnsSum, CallableReturnsArgument, - CallableReturnsInvalidVariant + CallableReturnsInvalidVariant, + CallableReturnsGlobalObject, + CallableReturnsThisObject, + CallableReturnsCallee, + CallableReturnsArgumentsObject, + CallableInitializesThisObject }; TestClass(QScriptEngine *engine); @@ -348,7 +353,7 @@ QVariant TestClass::extension(Extension extension, qsreal sum = 0; for (int i = 0; i < ctx->argumentCount(); ++i) sum += ctx->argument(i).toNumber(); - QScriptValueIterator it(ctx->thisObject()); + QScriptValueIterator it(ctx->callee()); while (it.hasNext()) { it.next(); sum += it.value().toNumber(); @@ -358,6 +363,17 @@ QVariant TestClass::extension(Extension extension, return qVariantFromValue(ctx->argument(0)); } else if (m_callableMode == CallableReturnsInvalidVariant) { return QVariant(); + } else if (m_callableMode == CallableReturnsGlobalObject) { + return qVariantFromValue(engine()->globalObject()); + } else if (m_callableMode == CallableReturnsThisObject) { + return qVariantFromValue(ctx->thisObject()); + } else if (m_callableMode == CallableReturnsCallee) { + return qVariantFromValue(ctx->callee()); + } else if (m_callableMode == CallableReturnsArgumentsObject) { + return qVariantFromValue(ctx->argumentsObject()); + } else if (m_callableMode == CallableInitializesThisObject) { + engine()->newQObject(ctx->thisObject(), engine()); + return QVariant(); } } else if (extension == HasInstance) { Q_ASSERT(m_hasInstance); @@ -797,9 +813,11 @@ void tst_QScriptClass::extension() QVERIFY(cls.supportsExtension(QScriptClass::Callable)); QScriptValue obj = eng.newObject(&cls); + eng.globalObject().setProperty("obj", obj); obj.setProperty("one", QScriptValue(&eng, 1)); obj.setProperty("two", QScriptValue(&eng, 2)); obj.setProperty("three", QScriptValue(&eng, 3)); + // From C++ cls.clearReceivedArgs(); { QScriptValueList args; @@ -810,8 +828,18 @@ void tst_QScriptClass::extension() QVERIFY(ret.isNumber()); QCOMPARE(ret.toNumber(), qsreal(15)); } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("obj(4, 5)"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toNumber(), qsreal(15)); + } cls.setCallableMode(TestClass::CallableReturnsArgument); + // From C++ cls.clearReceivedArgs(); { QScriptValue ret = obj.call(obj, QScriptValueList() << 123); @@ -843,6 +871,13 @@ void tst_QScriptClass::extension() QScriptValue ret = obj.call(obj, QScriptValueList() << QScriptValue()); QVERIFY(ret.isUndefined()); } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("obj(123)"); + QVERIFY(ret.isNumber()); + QCOMPARE(ret.toInt32(), 123); + } cls.setCallableMode(TestClass::CallableReturnsInvalidVariant); { @@ -850,13 +885,92 @@ void tst_QScriptClass::extension() QVERIFY(ret.isUndefined()); } + cls.setCallableMode(TestClass::CallableReturnsThisObject); + // From C++ + { + QScriptValue ret = obj.call(obj); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj()"); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); + } + + cls.setCallableMode(TestClass::CallableReturnsCallee); + // From C++ + { + QScriptValue ret = obj.call(); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj()"); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(obj)); + } + + cls.setCallableMode(TestClass::CallableReturnsArgumentsObject); + // From C++ + { + QScriptValue ret = obj.call(obj, QScriptValueList() << 123); + QVERIFY(ret.isObject()); + QVERIFY(ret.property("length").isNumber()); + QCOMPARE(ret.property("length").toInt32(), 1); + QVERIFY(ret.property(0).isNumber()); + QCOMPARE(ret.property(0).toInt32(), 123); + } + // From JS + { + QScriptValue ret = eng.evaluate("obj(123)"); + QVERIFY(ret.isObject()); + QVERIFY(ret.property("length").isNumber()); + QCOMPARE(ret.property("length").toInt32(), 1); + QVERIFY(ret.property(0).isNumber()); + QCOMPARE(ret.property(0).toInt32(), 123); + } + // construct() + // From C++ cls.clearReceivedArgs(); + cls.setCallableMode(TestClass::CallableReturnsGlobalObject); { QScriptValue ret = obj.construct(); QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); + } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("new obj()"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); + QVERIFY(ret.isObject()); + QVERIFY(ret.strictlyEquals(eng.globalObject())); + } + // From C++ + cls.clearReceivedArgs(); + cls.setCallableMode(TestClass::CallableInitializesThisObject); + { + QScriptValue ret = obj.construct(); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); + QVERIFY(ret.isQObject()); + QCOMPARE(ret.toQObject(), (QObject*)&eng); + } + // From JS + cls.clearReceivedArgs(); + { + QScriptValue ret = eng.evaluate("new obj()"); + QCOMPARE(cls.lastExtensionType(), QScriptClass::Callable); + QCOMPARE(cls.lastExtensionArgument().userType(), qMetaTypeId<QScriptContext*>()); + QVERIFY(ret.isQObject()); + QCOMPARE(ret.toQObject(), (QObject*)&eng); } } // HasInstance diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index d9beb45..e71d7c3 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -150,6 +150,7 @@ private slots: void getSetAgent(); void reentrancy(); void incDecNonObjectProperty(); + void installTranslatorFunctions_data(); void installTranslatorFunctions(); void functionScopes(); void nativeFunctionScopes(); @@ -4119,22 +4120,46 @@ void tst_QScriptEngine:: incDecNonObjectProperty() } } +void tst_QScriptEngine::installTranslatorFunctions_data() +{ + QTest::addColumn<bool>("useCustomGlobalObject"); + + QTest::newRow("Default global object") << false; + QTest::newRow("Custom global object") << true; +} + void tst_QScriptEngine::installTranslatorFunctions() { + QFETCH(bool, useCustomGlobalObject); + QScriptEngine eng; - QScriptValue global = eng.globalObject(); + QScriptValue globalOrig = eng.globalObject(); + QScriptValue global; + if (useCustomGlobalObject) { + global = eng.newObject(); + eng.setGlobalObject(global); + } else { + global = globalOrig; + } QVERIFY(!global.property("qsTranslate").isValid()); QVERIFY(!global.property("QT_TRANSLATE_NOOP").isValid()); QVERIFY(!global.property("qsTr").isValid()); QVERIFY(!global.property("QT_TR_NOOP").isValid()); - QVERIFY(!global.property("String").property("prototype").property("arg").isValid()); + QVERIFY(!globalOrig.property("String").property("prototype").property("arg").isValid()); eng.installTranslatorFunctions(); QVERIFY(global.property("qsTranslate").isFunction()); QVERIFY(global.property("QT_TRANSLATE_NOOP").isFunction()); QVERIFY(global.property("qsTr").isFunction()); QVERIFY(global.property("QT_TR_NOOP").isFunction()); - QVERIFY(global.property("String").property("prototype").property("arg").isFunction()); + QVERIFY(globalOrig.property("String").property("prototype").property("arg").isFunction()); + + if (useCustomGlobalObject) { + QVERIFY(!globalOrig.property("qsTranslate").isValid()); + QVERIFY(!globalOrig.property("QT_TRANSLATE_NOOP").isValid()); + QVERIFY(!globalOrig.property("qsTr").isValid()); + QVERIFY(!globalOrig.property("QT_TR_NOOP").isValid()); + } { QScriptValue ret = eng.evaluate("qsTr('foo')"); diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp index 5b79340..dc369aa 100644 --- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp @@ -2573,6 +2573,10 @@ void tst_QScriptValue::call() // call with something else as arguments QScriptValue ret5 = fun.call(QScriptValue(), QScriptValue(&eng, 123.0)); QCOMPARE(ret5.isError(), true); + // call with a non-array object as arguments + QScriptValue ret6 = fun.call(QScriptValue(), eng.globalObject()); + QVERIFY(ret6.isError()); + QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array")); } // calling things that are not functions @@ -2705,6 +2709,10 @@ void tst_QScriptValue::construct() // construct with something else as arguments QScriptValue ret5 = fun.construct(QScriptValue(&eng, 123.0)); QCOMPARE(ret5.isError(), true); + // construct with a non-array object as arguments + QScriptValue ret6 = fun.construct(eng.globalObject()); + QVERIFY(ret6.isError()); + QCOMPARE(ret6.toString(), QString::fromLatin1("TypeError: Arguments must be an array")); } // construct on things that are not functions |