diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-05-31 05:23:40 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-05-31 05:23:40 (GMT) |
commit | f587dfeaa9d369235d347af3d14339054ee59908 (patch) | |
tree | 3ac92f6a08d871099d8808e8d5fc59f50863bacb /tests | |
parent | feb9949a11abbf244e0bfcdc128981596758de40 (diff) | |
parent | 9da305aedfaa5da5a3059c99ac5a5389dab42b10 (diff) | |
download | Qt-f587dfeaa9d369235d347af3d14339054ee59908.zip Qt-f587dfeaa9d369235d347af3d14339054ee59908.tar.gz Qt-f587dfeaa9d369235d347af3d14339054ee59908.tar.bz2 |
Merge remote branch 'staging/4.7' into HEAD
Diffstat (limited to 'tests')
45 files changed, 513 insertions, 116 deletions
diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro index a95a855..3a675e4 100644 --- a/tests/auto/declarative/parserstress/parserstress.pro +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -6,7 +6,7 @@ SOURCES += tst_parserstress.cpp symbian: { DEFINES += SRCDIR=\".\" - importFiles.sources = ..\..\qscriptjstestsuite\tests + importFiles.sources = ..\\..\\qscriptjstestsuite\\tests importFiles.path = DEPLOYMENT = importFiles } else { diff --git a/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml b/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml new file mode 100644 index 0000000..7cd4f26 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml @@ -0,0 +1,11 @@ +import Qt 4.7 + +Rectangle { + width: 77; height: 95 + Rectangle { + objectName: "centered" + width: 57; height: 57; color: "blue" + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index e169fa2..22f7966 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -77,6 +77,7 @@ private slots: void nullItem_data(); void crash1(); void centerIn(); + void hvCenter(); void fill(); void margins(); }; @@ -526,6 +527,19 @@ void tst_qdeclarativeanchors::centerIn() delete view; } +void tst_qdeclarativeanchors::hvCenter() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/hvCenter.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("centered")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + // test QTBUG-10999 + QCOMPARE(rect->x(), 10.0); + QCOMPARE(rect->y(), 19.0); + delete view; +} + void tst_qdeclarativeanchors::margins() { QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml index a3afd38..8956205 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml @@ -4,6 +4,8 @@ Rectangle { id: root property int currentA: -1 property int currentB: -1 + property real delegateWidth: 60 + property real delegateHeight: 20 width: 240 height: 320 color: "#ffffff" @@ -13,8 +15,8 @@ Rectangle { Rectangle { id: wrapper objectName: "wrapper" - height: 20 - width: 60 + height: root.delegateHeight + width: root.delegateWidth color: PathView.isCurrentItem ? "lightsteelblue" : "white" border.color: "black" Text { diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index f32a6c7..dffc7ac 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -445,6 +445,12 @@ void tst_QDeclarativePathView::pathMoved() pathview->setOffset(0.0); QCOMPARE(firstItem->pos() + offset, start); + // Change delegate size + canvas->rootObject()->setProperty("delegateWidth", 30); + QCOMPARE(firstItem->width(), 30.0); + offset.setX(firstItem->width()/2); + QTRY_COMPARE(firstItem->pos() + offset, start); + delete canvas; } diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index b07849d..d3e3c3a 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include <qtest.h> +#include <QtTest/QSignalSpy> #include "../../../shared/util.h" #include "../shared/testhttpserver.h" #include <math.h> @@ -811,7 +812,7 @@ QDeclarativeView *tst_qdeclarativetextedit::createView(const QString &filename) class MyInputContext : public QInputContext { public: - MyInputContext() : softwareInputPanelEventReceived(false) {} + MyInputContext() : openInputPanelReceived(false), closeInputPanelReceived(false) {} ~MyInputContext() {} QString identifierName() { return QString(); } @@ -824,10 +825,13 @@ public: bool filterEvent( const QEvent *event ) { if (event->type() == QEvent::RequestSoftwareInputPanel) - softwareInputPanelEventReceived = true; + openInputPanelReceived = true; + if (event->type() == QEvent::CloseSoftwareInputPanel) + closeInputPanelReceived = true; return QInputContext::filterEvent(event); } - bool softwareInputPanelEventReceived; + bool openInputPanelReceived; + bool closeInputPanelReceived; }; void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() @@ -835,10 +839,9 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() QGraphicsScene scene; QGraphicsView view(&scene); MyInputContext ic; - view.viewport()->setInputContext(&ic); - QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + view.setInputContext(&ic); QDeclarativeTextEdit edit; + QSignalSpy inputPanelonFocusSpy(&edit, SIGNAL(showInputPanelOnFocusChanged(bool))); edit.setText("Hello world"); edit.setPos(0, 0); scene.addItem(&edit); @@ -847,16 +850,86 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + + QVERIFY(edit.showInputPanelOnFocus()); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // focus on press, input panel on focus + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); QApplication::processEvents(); - if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { - QCOMPARE(ic.softwareInputPanelEventReceived, false); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); - QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); - } else if (behavior == QStyle::RSIP_OnMouseClick) { - QCOMPARE(ic.softwareInputPanelEventReceived, true); - } + QVERIFY(edit.hasFocus()); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // no events on release + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // Even with focus already gained, user needs + // to be able to open panel by pressing on the editor + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // input panel closed on focus lost + edit.setFocus(false); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // no input panel events if showInputPanelOnFocus is false + edit.setShowInputPanelOnFocus(false); + QCOMPARE(inputPanelonFocusSpy.count(),1); + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + edit.setFocus(false); + edit.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + edit.setShowInputPanelOnFocus(false); + QCOMPARE(inputPanelonFocusSpy.count(),1); + + // one show input panel event when openSoftwareInputPanel is called + edit.openSoftwareInputPanel(); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // one close input panel event when closeSoftwareInputPanel is called + edit.closeSoftwareInputPanel(); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.openInputPanelReceived = false; + + // set showInputPanelOnFocus back to true + edit.setShowInputPanelOnFocus(true); + QCOMPARE(inputPanelonFocusSpy.count(),2); + edit.setFocus(false); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // active window focus reason should not cause input panel to open + QGraphicsObject * editObject = qobject_cast<QGraphicsObject*>(&edit); + editObject->setFocus(Qt::ActiveWindowFocusReason); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // and input panel should not open if focus has already been set + edit.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + edit.setShowInputPanelOnFocus(true); + QCOMPARE(inputPanelonFocusSpy.count(),2); } void tst_qdeclarativetextedit::geometrySignals() diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index ac80edb..c01cfa5 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include <qtest.h> +#include <QtTest/QSignalSpy> #include "../../../shared/util.h" #include <QtDeclarative/qdeclarativeengine.h> #include <QFile> @@ -712,11 +713,10 @@ QDeclarativeView *tst_qdeclarativetextinput::createView(const QString &filename) return canvas; } - class MyInputContext : public QInputContext { public: - MyInputContext() : softwareInputPanelEventReceived(false) {} + MyInputContext() : openInputPanelReceived(false), closeInputPanelReceived(false) {} ~MyInputContext() {} QString identifierName() { return QString(); } @@ -729,10 +729,13 @@ public: bool filterEvent( const QEvent *event ) { if (event->type() == QEvent::RequestSoftwareInputPanel) - softwareInputPanelEventReceived = true; + openInputPanelReceived = true; + if (event->type() == QEvent::CloseSoftwareInputPanel) + closeInputPanelReceived = true; return QInputContext::filterEvent(event); } - bool softwareInputPanelEventReceived; + bool openInputPanelReceived; + bool closeInputPanelReceived; }; void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() @@ -740,10 +743,9 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() QGraphicsScene scene; QGraphicsView view(&scene); MyInputContext ic; - view.viewport()->setInputContext(&ic); - QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + view.setInputContext(&ic); QDeclarativeTextInput input; + QSignalSpy inputPanelonFocusSpy(&input, SIGNAL(showInputPanelOnFocusChanged(bool))); input.setText("Hello world"); input.setPos(0, 0); scene.addItem(&input); @@ -752,16 +754,86 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + + QVERIFY(input.showInputPanelOnFocus()); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // focus on press, input panel on focus + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); QApplication::processEvents(); - if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { - QCOMPARE(ic.softwareInputPanelEventReceived, false); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); - QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); - } else if (behavior == QStyle::RSIP_OnMouseClick) { - QCOMPARE(ic.softwareInputPanelEventReceived, true); - } + QVERIFY(input.hasFocus()); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // no events on release + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // Even with focus already gained, user needs + // to be able to open panel by pressing on the editor + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // input panel closed on focus lost + input.setFocus(false); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // no input panel events if showInputPanelOnFocus is false + input.setShowInputPanelOnFocus(false); + QCOMPARE(inputPanelonFocusSpy.count(),1); + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + input.setFocus(false); + input.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + input.setShowInputPanelOnFocus(false); + QCOMPARE(inputPanelonFocusSpy.count(),1); + + // one show input panel event when openSoftwareInputPanel is called + input.openSoftwareInputPanel(); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // one close input panel event when closeSoftwareInputPanel is called + input.closeSoftwareInputPanel(); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.openInputPanelReceived = false; + + // set showInputPanelOnFocus back to true + input.setShowInputPanelOnFocus(true); + QCOMPARE(inputPanelonFocusSpy.count(),2); + input.setFocus(false); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // active window focus reason should not cause input panel to open + QGraphicsObject * inputObject = qobject_cast<QGraphicsObject*>(&input); + inputObject->setFocus(Qt::ActiveWindowFocusReason); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // and input panel should not open if focus has already been set + input.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + input.setShowInputPanelOnFocus(true); + QCOMPARE(inputPanelonFocusSpy.count(),2); } class MyTextInput : public QDeclarativeTextInput diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml new file mode 100644 index 0000000..d275ca8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml @@ -0,0 +1,24 @@ +import Qt 4.7 + +WorkerScript { + id: worker + + property variant response + + signal done() + + function testSend(value) { + worker.sendMessage(value) + } + + function compareLiteralResponse(expected) { + var e = eval('(' + expected + ')') + return worker.response == e + } + + onMessage: { + worker.response = messageObject + worker.done() + } +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script.js index 09199de..90aae26 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/script.js +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script.js @@ -2,4 +2,3 @@ WorkerScript.onMessage = function(msg) { WorkerScript.sendMessage(msg) } - diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_fixed_return.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_fixed_return.js new file mode 100644 index 0000000..14f6f17 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script_fixed_return.js @@ -0,0 +1,4 @@ +WorkerScript.onMessage = function(msg) { + WorkerScript.sendMessage('Hello_World') +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_pragma.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_pragma.js new file mode 100644 index 0000000..cb3b6d3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script_pragma.js @@ -0,0 +1,6 @@ +.pragma library + +WorkerScript.onMessage = function(msg) { + WorkerScript.sendMessage(msg) +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml index 5c7a5ff..1a20098 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml @@ -1,24 +1,5 @@ import Qt 4.7 -WorkerScript { - id: worker +BaseWorker { source: "script.js" - - property variant response - - signal done() - - function testSend(value) { - worker.sendMessage(value) - } - - function compareLiteralResponse(expected) { - var e = eval('(' + expected + ')') - return worker.response == e - } - - onMessage: { - worker.response = messageObject - worker.done() - } } diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml new file mode 100644 index 0000000..3b720ef --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml @@ -0,0 +1,6 @@ +import Qt 4.7 + +BaseWorker { + source: "script_pragma.js" +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index a1dae24..7a4315a 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -64,6 +64,7 @@ private slots: void messaging_data(); void messaging_sendQObjectList(); void messaging_sendJsObject(); + void script_with_pragma(); private: void waitForEchoMessage(QDeclarativeWorkerScript *worker) { @@ -82,18 +83,25 @@ private: void tst_QDeclarativeWorkerScript::source() { - QUrl source = QUrl::fromLocalFile(SRCDIR "/data/worker.qml"); - - QDeclarativeComponent component(&m_engine); - component.setData("import Qt 4.7\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); + QVERIFY(worker != 0); + const QMetaObject *mo = worker->metaObject(); - QDeclarativeWorkerScript *item = qobject_cast<QDeclarativeWorkerScript*>(component.create()); - QVERIFY(item != 0); + QVariant value(100); + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value); - QCOMPARE(item->source(), source); + QUrl source = QUrl::fromLocalFile(SRCDIR "/data/script_fixed_return.js"); + worker->setSource(source); + QCOMPARE(worker->source(), source); + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), qVariantFromValue(QString("Hello_World"))); qApp->processEvents(); - delete item; + delete worker; } void tst_QDeclarativeWorkerScript::messaging() @@ -177,6 +185,25 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject() delete worker; } +void tst_QDeclarativeWorkerScript::script_with_pragma() +{ + QVariant value(100); + + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_pragma.qml"); + QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); + QVERIFY(worker != 0); + + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + + const QMetaObject *mo = worker->metaObject(); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value<QVariant>(), value); + + qApp->processEvents(); + delete worker; +} + + QTEST_MAIN(tst_QDeclarativeWorkerScript) #include "tst_qdeclarativeworkerscript.moc" diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml index d948e4a..73dd4d7 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml @@ -85,7 +85,7 @@ Rectangle { text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAnywhere } Text { - text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAtWordBoundaryOrAnywhere + text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.Wrap } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml index d10cfd3..b41b93a 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml @@ -85,7 +85,7 @@ Rectangle { text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAnywhere } Text { - text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAtWordBoundaryOrAnywhere + text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.Wrap } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml index abb4464..a1dc5bf 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml @@ -27,7 +27,7 @@ Item { TextEdit { width: 150 height: 100 - wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere + wrapMode: TextEdit.Wrap text: "This is a test that text edit wraps correctly. thisisaverylongstringwithnospaces" y:300 } diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro index 4698b2b..d4dcda8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro @@ -1,3 +1,3 @@ -SOURCES += src\main.cpp +SOURCES += src\\main.cpp -TRANSLATIONS = ts\project.ts +TRANSLATIONS = ts\\project.ts diff --git a/tests/auto/patternistexamples/patternistexamples.pro b/tests/auto/patternistexamples/patternistexamples.pro index 4092fc8..c528c93 100644 --- a/tests/auto/patternistexamples/patternistexamples.pro +++ b/tests/auto/patternistexamples/patternistexamples.pro @@ -13,7 +13,7 @@ wince*|symbian*: { recipes.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/* recipes.path = recipes files.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/files/* - files.path = recipes\files + files.path = recipes\\files DEPLOYMENT += snippets widgetRen globVar filetree recipes files # take care of dependency diff --git a/tests/auto/qaccessibility/qaccessibility.pro b/tests/auto/qaccessibility/qaccessibility.pro index e33c04d..1b30beb 100644 --- a/tests/auto/qaccessibility/qaccessibility.pro +++ b/tests/auto/qaccessibility/qaccessibility.pro @@ -5,7 +5,7 @@ unix:!mac:LIBS+=-lm contains(QT_CONFIG, qt3support): QT += qt3support wince*: { - accessneeded.sources = $$QT_BUILD_TREE\plugins\accessible\*.dll + accessneeded.sources = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll accessneeded.path = accessible DEPLOYMENT += accessneeded }
\ No newline at end of file diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index e5a332a..cea259c 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -475,7 +475,7 @@ void tst_QAccessibility::eventTest() QVERIFY_EVENT(button, 0, QAccessible::ObjectShow); button->setFocus(Qt::MouseFocusReason); QTestAccessibility::clearEvents(); - QTest::mouseClick(button, Qt::LeftButton, 0, QPoint(button->width()-7,button->height()-5)); + QTest::mouseClick(button, Qt::LeftButton, 0); QVERIFY_EVENT(button, 0, QAccessible::StateChanged); QVERIFY_EVENT(button, 0, QAccessible::StateChanged); diff --git a/tests/auto/qdesktopservices/qdesktopservices.pro b/tests/auto/qdesktopservices/qdesktopservices.pro index 9ef557d..d32ed4c 100644 --- a/tests/auto/qdesktopservices/qdesktopservices.pro +++ b/tests/auto/qdesktopservices/qdesktopservices.pro @@ -3,23 +3,23 @@ CONFIG += qttest_p4 SOURCES += tst_qdesktopservices.cpp TARGET = tst_qdesktopservices symbian: { - dummy.sources = text\testfile.txt + dummy.sources = text\\testfile.txt dummy.path = . - text.sources = text\* - text.path = \data\others\ + text.sources = text\\* + text.path = \\data\\others - image.sources = image\* - image.path = \data\images\ + image.sources = image\\* + image.path = \\data\\images - audio.sources = audio\* - audio.path = \data\sounds\ + audio.sources = audio\\* + audio.path = \\data\\sounds - video.sources = video\* - video.path = \data\videos\ + video.sources = video\\* + video.path = \\data\\videos - install.sources = install\* - install.path = \data\installs\ + install.sources = install\\* + install.path = \\data\\installs DEPLOYMENT += image audio video install diff --git a/tests/auto/qdirmodel/qdirmodel.pro b/tests/auto/qdirmodel/qdirmodel.pro index 5a66883..36929b9 100644 --- a/tests/auto/qdirmodel/qdirmodel.pro +++ b/tests/auto/qdirmodel/qdirmodel.pro @@ -2,9 +2,9 @@ load(qttest_p4) SOURCES += tst_qdirmodel.cpp wince*|symbian { - addit.sources = dirtest\test1\* - addit.path = dirtest\test1 - tests.sources = test\* + addit.sources = dirtest\\test1\\* + addit.path = dirtest\\test1 + tests.sources = test\\* tests.path = test sourceFile.sources = tst_qdirmodel.cpp sourceFile.path = . diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro index faaa927..70c93ce 100644 --- a/tests/auto/qfile/test/test.pro +++ b/tests/auto/qfile/test/test.pro @@ -3,11 +3,11 @@ SOURCES += ../tst_qfile.cpp wince*|symbian { QT = core gui - files.sources += ..\dosfile.txt ..\noendofline.txt ..\testfile.txt \ - ..\testlog.txt ..\two.dots.file ..\tst_qfile.cpp \ - ..\Makefile ..\forCopying.txt ..\forRenaming.txt + files.sources += ..\\dosfile.txt ..\\noendofline.txt ..\\testfile.txt \ + ..\\testlog.txt ..\\two.dots.file ..\\tst_qfile.cpp \ + ..\\Makefile ..\\forCopying.txt ..\\forRenaming.txt files.path = . - resour.sources += ..\resources\file1.ext1 + resour.sources += ..\\resources\\file1.ext1 resour.path = resources DEPLOYMENT = files resour diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro index 93599f4..2038514 100644 --- a/tests/auto/qfileinfo/qfileinfo.pro +++ b/tests/auto/qfileinfo/qfileinfo.pro @@ -8,7 +8,7 @@ RESOURCES += qfileinfo.qrc wince*:|symbian*: { deploy.sources += qfileinfo.qrc tst_qfileinfo.cpp - res.sources = resources\file1 resources\file1.ext1 resources\file1.ext1.ext2 + res.sources = resources\\file1 resources\\file1.ext1 resources\\file1.ext1.ext2 res.path = resources DEPLOYMENT = deploy res } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 300afc3..5547b02 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -348,6 +348,7 @@ private slots: void childrenBoundingRect2(); void childrenBoundingRect3(); void childrenBoundingRect4(); + void childrenBoundingRect5(); void group(); void setGroup(); void setGroup2(); @@ -3369,6 +3370,34 @@ void tst_QGraphicsItem::childrenBoundingRect4() QCOMPARE(rect2->childrenBoundingRect(), rect3->boundingRect()); } +void tst_QGraphicsItem::childrenBoundingRect5() +{ + QGraphicsScene scene; + + QGraphicsRectItem *parent = scene.addRect(QRectF(0, 0, 100, 100)); + QGraphicsRectItem *child = scene.addRect(QRectF(0, 0, 100, 100)); + child->setParentItem(parent); + + QGraphicsView view(&scene); + view.show(); + + QTest::qWaitForWindowShown(&view); + + // Try to mess up the cached bounding rect. + QRectF expectedChildrenBoundingRect = parent->boundingRect(); + QCOMPARE(parent->childrenBoundingRect(), expectedChildrenBoundingRect); + + // Apply some effects. + QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect; + dropShadow->setOffset(25, 25); + child->setGraphicsEffect(dropShadow); + parent->setGraphicsEffect(new QGraphicsOpacityEffect); + + QVERIFY(parent->childrenBoundingRect() != expectedChildrenBoundingRect); + expectedChildrenBoundingRect |= dropShadow->boundingRect(); + QCOMPARE(parent->childrenBoundingRect(), expectedChildrenBoundingRect); +} + void tst_QGraphicsItem::group() { QGraphicsScene scene; diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro index 31bb769..401c9eb 100644 --- a/tests/auto/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro @@ -9,8 +9,8 @@ DEFINES += QT_NO_CAST_TO_ASCII wince*|symbian*: { rootFiles.sources = Ash_European.jpg graphicsScene_selection.data rootFiles.path = . - renderFiles.sources = testData\render\* - renderFiles.path = testData\render + renderFiles.sources = testData\\render\\* + renderFiles.path = testData\\render DEPLOYMENT += rootFiles renderFiles } wince*:{ diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index a155222..67a41ca 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -275,6 +275,7 @@ private slots: void polishItems2(); void isActive(); void siblingIndexAlwaysValid(); + void removeFullyTransparentItem(); // task specific tests below me void task139710_bspTreeCrash(); @@ -4333,6 +4334,48 @@ void tst_QGraphicsScene::siblingIndexAlwaysValid() } +void tst_QGraphicsScene::removeFullyTransparentItem() +{ + QGraphicsScene scene; + + QGraphicsItem *parent = scene.addRect(0, 0, 100, 100); + parent->setFlag(QGraphicsItem::ItemHasNoContents); + + QGraphicsItem *child = scene.addRect(0, 0, 100, 100); + child->setParentItem(parent); + + CustomView view; + view.setScene(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + // NB! The parent has the ItemHasNoContents flag set, which means + // the parent itself doesn't generate any update requests, only the + // child can possibly trigger an update. Also note that the child + // is removed before processing events. + view.repaints = 0; + parent->setOpacity(0); + QVERIFY(qFuzzyIsNull(child->effectiveOpacity())); + scene.removeItem(child); + QVERIFY(!scene.items().contains(child)); + QTRY_VERIFY(view.repaints > 0); + + // Re-add child. There's nothing new to display (child is still + // effectively hidden), so it shouldn't trigger an update. + view.repaints = 0; + child->setParentItem(parent); + QVERIFY(scene.items().contains(child)); + QVERIFY(qFuzzyIsNull(child->effectiveOpacity())); + QApplication::processEvents(); + QCOMPARE(view.repaints, 0); + + // Nothing is visible on the screen, removing child item shouldn't trigger an update. + scene.removeItem(child); + QApplication::processEvents(); + QCOMPARE(view.repaints, 0); + delete child; +} + void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache() { QGraphicsScene scene; diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/qimagewriter/qimagewriter.pro index 8da2942..2171c3e 100644 --- a/tests/auto/qimagewriter/qimagewriter.pro +++ b/tests/auto/qimagewriter/qimagewriter.pro @@ -6,12 +6,12 @@ win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 wince*: { - addFiles.sources = images\*.* + addFiles.sources = images\\*.* addFiles.path = images DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\".\\\" } else:symbian* { - addFiles.sources = images\*.* + addFiles.sources = images\\*.* addFiles.path = images DEPLOYMENT += addFiles qt_not_deployed { diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/qlibrary/lib2/lib2.pro index 4654f4d..b441569 100644 --- a/tests/auto/qlibrary/lib2/lib2.pro +++ b/tests/auto/qlibrary/lib2/lib2.pro @@ -38,9 +38,9 @@ symbian-abld: { TARGET.CAPABILITY=ALL -TCB FIXEDROOT = $$replace(EPOCROOT,/,\\) QMAKE_POST_LINK = \ - copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dl2 && \ - copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\system.trolltech.test.mylib.dll && \ - IF NOT "$(PLATFORM)==WINSCW" copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll ..\tst\mylib.dl2 + copy /Y $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\mylib.dll $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\mylib.dl2 && \ + copy /Y $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\mylib.dll $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\system.trolltech.test.mylib.dll && \ + IF NOT "$(PLATFORM)==WINSCW" copy /Y $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\mylib.dll ..\\tst\\mylib.dl2 } symbian-sbsv2: { diff --git a/tests/auto/qlocale/test/test.pro b/tests/auto/qlocale/test/test.pro index 7bc9f59..d57f2d1 100644 --- a/tests/auto/qlocale/test/test.pro +++ b/tests/auto/qlocale/test/test.pro @@ -25,7 +25,7 @@ wince*: { addFiles.sources = \ ../syslocaleapp - addFiles.path = \Program Files\tst_qlocale + addFiles.path = "\\Program Files\\tst_qlocale" DEPLOYMENT += addFiles } diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro index cfdc89b..687aae2 100644 --- a/tests/auto/qlocalsocket/test/test.pro +++ b/tests/auto/qlocalsocket/test/test.pro @@ -34,7 +34,7 @@ wince* { symbian { additionalFiles.sources = lackey.exe - additionalFiles.path = \sys\bin + additionalFiles.path = \\sys\\bin TARGET.UID3 = 0xE0340005 DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) } diff --git a/tests/auto/qmainwindow/qmainwindow.pro b/tests/auto/qmainwindow/qmainwindow.pro index 43d73ae..e015f95 100644 --- a/tests/auto/qmainwindow/qmainwindow.pro +++ b/tests/auto/qmainwindow/qmainwindow.pro @@ -2,5 +2,5 @@ load(qttest_p4) SOURCES += tst_qmainwindow.cpp # Symbian toolchain does not support correct include semantics -symbian:INCPATH+=..\..\..\include\QtGui\private +symbian:INCPATH+=..\\..\\..\\include\\QtGui\\private diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/qmake/testdata/functions/functions.pro index 5e089e4..ad66ee8 100644 --- a/tests/auto/qmake/testdata/functions/functions.pro +++ b/tests/auto/qmake/testdata/functions/functions.pro @@ -53,7 +53,7 @@ include( infiletest.pro, "", true ) #replace VERSION=1.0.0 -VERSION_replaced=$$replace(VERSION,\.,_) +VERSION_replaced=$$replace(VERSION,\\.,_) !isEqual(VERSION_replaced, 1_0_0) { message( "FAILED: replace function: $$VERSION_replaced" ) } diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/qmovie/qmovie.pro index 30e5901..a8ec478 100644 --- a/tests/auto/qmovie/qmovie.pro +++ b/tests/auto/qmovie/qmovie.pro @@ -7,14 +7,14 @@ MOC_DIR=tmp !contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG wince*: { - addFiles.sources = animations\* + addFiles.sources = animations\\* addFiles.path = animations DEPLOYMENT += addFiles } symbian*: { - addFiles.sources = animations\* + addFiles.sources = animations\\* addFiles.path = animations DEPLOYMENT += addFiles diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/qnetworkreply/test/test.pro index 7bf3852..b9ece38 100644 --- a/tests/auto/qnetworkreply/test/test.pro +++ b/tests/auto/qnetworkreply/test/test.pro @@ -31,7 +31,7 @@ symbian:{ DEPLOYMENT += certFiles # Symbian toolchain does not support correct include semantics - INCPATH+=..\..\..\..\include\QtNetwork\private + INCPATH+=..\\..\\..\\..\\include\\QtNetwork\\private # bigfile test case requires more heap TARGET.EPOCHEAPSIZE="0x100 0x1000000" TARGET.CAPABILITY="ALL -TCB" diff --git a/tests/auto/qobject/tst_qobject.pro b/tests/auto/qobject/tst_qobject.pro index 0200f3e..1d6993a 100644 --- a/tests/auto/qobject/tst_qobject.pro +++ b/tests/auto/qobject/tst_qobject.pro @@ -16,6 +16,6 @@ wince*: { } symbian: { addFiles.sources = signalbug.exe - addFiles.path = \sys\bin + addFiles.path = \\sys\\bin DEPLOYMENT += addFiles } diff --git a/tests/auto/qprocess/test/test.pro b/tests/auto/qprocess/test/test.pro index e1afd22..d555067 100644 --- a/tests/auto/qprocess/test/test.pro +++ b/tests/auto/qprocess/test/test.pro @@ -118,7 +118,7 @@ symbian: { testProcessOutput.exe \ nospace.exe \ testSpaceInName.exe - binDep.path = \sys\bin + binDep.path = \\sys\\bin DEPLOYMENT += binDep } diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index 100e195..617c183 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -84,6 +84,7 @@ private slots: void jsActivationObject(); void qobjectAsActivationObject(); void parentContextCallee_QT2270(); + void popNativeContextScope(); }; tst_QScriptContext::tst_QScriptContext() @@ -539,6 +540,50 @@ void tst_QScriptContext::pushAndPopContext() } } +void tst_QScriptContext::popNativeContextScope() +{ + QScriptEngine eng; + QScriptContext *ctx = eng.pushContext(); + QVERIFY(ctx->popScope().isObject()); // the activation object + + QCOMPARE(ctx->scopeChain().size(), 1); + QVERIFY(ctx->scopeChain().at(0).strictlyEquals(eng.globalObject())); + // This was different in 4.5: scope and activation were decoupled + QVERIFY(ctx->activationObject().strictlyEquals(eng.globalObject())); + + QVERIFY(!eng.evaluate("var foo = 123; function bar() {}").isError()); + QVERIFY(eng.globalObject().property("foo").isNumber()); + QVERIFY(eng.globalObject().property("bar").isFunction()); + + QScriptValue customScope = eng.newObject(); + ctx->pushScope(customScope); + QCOMPARE(ctx->scopeChain().size(), 2); + QVERIFY(ctx->scopeChain().at(0).strictlyEquals(customScope)); + QVERIFY(ctx->scopeChain().at(1).strictlyEquals(eng.globalObject())); + QVERIFY(ctx->activationObject().strictlyEquals(eng.globalObject())); + ctx->setActivationObject(customScope); + QVERIFY(ctx->activationObject().strictlyEquals(customScope)); + QCOMPARE(ctx->scopeChain().size(), 2); + QVERIFY(ctx->scopeChain().at(0).strictlyEquals(customScope)); + QEXPECT_FAIL("", "QTBUG-11012", Continue); + QVERIFY(ctx->scopeChain().at(1).strictlyEquals(eng.globalObject())); + + QVERIFY(!eng.evaluate("baz = 456; var foo = 789; function barbar() {}").isError()); + QEXPECT_FAIL("", "QTBUG-11012", Continue); + QVERIFY(eng.globalObject().property("baz").isNumber()); + QVERIFY(customScope.property("foo").isNumber()); + QVERIFY(customScope.property("barbar").isFunction()); + + QVERIFY(ctx->popScope().strictlyEquals(customScope)); + QCOMPARE(ctx->scopeChain().size(), 1); + QEXPECT_FAIL("", "QTBUG-11012", Continue); + QVERIFY(ctx->scopeChain().at(0).strictlyEquals(eng.globalObject())); + + // Need to push another object, otherwise we crash in popContext() (QTBUG-11012) + ctx->pushScope(customScope); + eng.popContext(); +} + void tst_QScriptContext::lineNumber() { QScriptEngine eng; diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro index cd5e6e7..62c0c87 100644 --- a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro +++ b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro @@ -10,7 +10,7 @@ MOC_DIR=tmp QT = core network # Symbian toolchain does not support correct include semantics -symbian:INCPATH+=..\..\..\include\QtNetwork\private +symbian:INCPATH+=..\\..\\..\\include\\QtNetwork\\private symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 992c95e..53fefee 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -127,6 +127,8 @@ private slots: void sortColumnTracking1(); void sortColumnTracking2(); + void sortStable(); + void task236755_hiddenColumns(); void task247867_insertRowsSort(); void task248868_staticSorting(); @@ -2442,6 +2444,40 @@ void tst_QSortFilterProxyModel::sortColumnTracking2() QCOMPARE(proxyModel.data(proxyModel.index(strings.count()-1,0)).toString(),QString::fromLatin1("zz")); } +void tst_QSortFilterProxyModel::sortStable() +{ + QStandardItemModel* model = new QStandardItemModel(5, 2); + for (int r=0; r<5; r++) { + for (int c=0; c<2; c++) { + QStandardItem* item = new QStandardItem( + QString("Row:%0, Column:%1").arg(r).arg(c) ); + for( int i=0; i<3; i++ ) { + QStandardItem* child = new QStandardItem( + QString("Item %0").arg(i) ); + item->appendRow( child ); + } + model->setItem(r, c, item); + } + } + model->setHorizontalHeaderItem( 0, new QStandardItem( "Name" )); + model->setHorizontalHeaderItem( 1, new QStandardItem( "Value" ) ); + + + QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(model); + filterModel->setSourceModel(model); + + QTreeView *view = new QTreeView; + view->setModel(filterModel); + QModelIndex firstRoot = filterModel->index(0,0); + view->expand(firstRoot); + view->setSortingEnabled(true); + + view->model()->sort(1, Qt::DescendingOrder); + QVariant lastItemData =filterModel->index(2,0, firstRoot).data(); + view->model()->sort(1, Qt::DescendingOrder); + QCOMPARE(lastItemData, filterModel->index(2,0, firstRoot).data()); +} + void tst_QSortFilterProxyModel::task236755_hiddenColumns() { class MyStandardItemModel : public QStandardItemModel diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/qxmlstream/qxmlstream.pro index ac03d42..f82a7b3 100644 --- a/tests/auto/qxmlstream/qxmlstream.pro +++ b/tests/auto/qxmlstream/qxmlstream.pro @@ -1,5 +1,5 @@ load(qttest_p4) -SOURCES += tst_qxmlstream.cpp +SOURCES += tst_qxmlstream.cpp QT = core xml network @@ -8,4 +8,7 @@ wince*|symbian*: { addFiles.sources = data XML-Test-Suite addFiles.path = . DEPLOYMENT += addFiles + DEFINES += SRCDIR=\\\"\\\" +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" } diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/qxmlstream/tst_qxmlstream.cpp index 3c5358c..7d5e3b7 100644 --- a/tests/auto/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/qxmlstream/tst_qxmlstream.cpp @@ -57,7 +57,7 @@ Q_DECLARE_METATYPE(QXmlStreamReader::ReadElementTextBehaviour) -static const char *const catalogFile = "XML-Test-Suite/xmlconf/finalCatalog.xml"; +static const char *const catalogFile = SRCDIR "XML-Test-Suite/xmlconf/finalCatalog.xml"; static const int expectedRunCount = 1646; static const int expectedSkipCount = 532; @@ -527,8 +527,7 @@ class tst_QXmlStream: public QObject { Q_OBJECT public: - tst_QXmlStream() : m_handler(QUrl::fromLocalFile(QDir::currentPath() + QLatin1Char('/')) - .resolved(QUrl(QLatin1String(catalogFile)))) + tst_QXmlStream() : m_handler(QUrl::fromLocalFile(QLatin1String(catalogFile))) { } @@ -546,6 +545,7 @@ private slots: void writerHangs() const; void writerAutoFormattingWithComments() const; void writerAutoFormattingWithTabs() const; + void writerAutoFormattingWithProcessingInstructions() const; void writerAutoEmptyTags() const; void writeAttributesWithSpace() const; void addExtraNamespaceDeclarations(); @@ -805,7 +805,7 @@ void tst_QXmlStream::testReader_data() const QTest::addColumn<QString>("xml"); QTest::addColumn<QString>("ref"); QDir dir; - dir.cd("data/"); + dir.cd(SRCDIR "data/"); foreach(QString filename , dir.entryList(QStringList() << "*.xml")) { QString reference = QFileInfo(filename).baseName() + ".ref"; QTest::newRow(dir.filePath(filename).toLatin1().data()) << dir.filePath(filename) << dir.filePath(reference); @@ -1030,6 +1030,22 @@ void tst_QXmlStream::writerAutoFormattingWithTabs() const QCOMPARE(buffer.buffer().data(), str); } +void tst_QXmlStream::writerAutoFormattingWithProcessingInstructions() const +{ + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + + QXmlStreamWriter writer(&buffer); + writer.setAutoFormatting(true); + writer.writeStartDocument(); + writer.writeProcessingInstruction("B", "C"); + writer.writeStartElement("A"); + writer.writeEndElement(); + writer.writeEndDocument(); + const char *str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?B C?>\n<A/>\n"; + QCOMPARE(buffer.buffer().data(), str); +} + /*! Task 204822 */ @@ -1184,7 +1200,7 @@ void tst_QXmlStream::crashInUTF16Codec() const QEventLoop eventLoop; QNetworkAccessManager networkManager; - QNetworkRequest request(QUrl::fromLocalFile(QLatin1String("data/051reduced.xml"))); + QNetworkRequest request(QUrl::fromLocalFile(QLatin1String(SRCDIR "data/051reduced.xml"))); QNetworkReply *const reply = networkManager.get(request); eventLoop.connect(reply, SIGNAL(finished()), SLOT(quit())); diff --git a/tests/auto/solutions.pri b/tests/auto/solutions.pri index bcffb64..5c069c5 100644 --- a/tests/auto/solutions.pri +++ b/tests/auto/solutions.pri @@ -7,10 +7,10 @@ SOLUTIONBASEDIR = $$(SOLUTIONBASEDIR) # strip the trailing "..." -# SOLUTIONBASEDIR ~= s/\.\.\.$// +# SOLUTIONBASEDIR ~= s/\\.\\.\\.$// # replace \ with / -# win32:SOLUTIONBASEDIR ~= s.\\./.g +# win32:SOLUTIONBASEDIR ~= s.\\\\./.g isEmpty(SOLUTIONBASEDIR):DEFINES += QT_NO_SOLUTIONS diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro index 61e275d..f3124a3 100644 --- a/tests/auto/windowsmobile/test/test.pro +++ b/tests/auto/windowsmobile/test/test.pro @@ -11,7 +11,7 @@ wincewm*: { addFiles.sources = $$OUT_PWD/../testQMenuBar/*.exe - addFiles.path = "\Program Files\tst_windowsmobile" + addFiles.path = "\\Program Files\\tst_windowsmobile" DEPLOYMENT += addFiles } |