summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-07-05 06:41:00 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-07-05 06:41:00 (GMT)
commitaaf6ebb3725055035d0d17767b4e155d39828553 (patch)
treeccff66bd71e661955fc5d9af0dea15bd40e7a08d /tests
parent601b12b7879e9a743ef9e516470219aae73e611d (diff)
parentd4740963fa6284407c74c49ea587b0511c9bc4c9 (diff)
downloadQt-aaf6ebb3725055035d0d17767b4e155d39828553.zip
Qt-aaf6ebb3725055035d0d17767b4e155d39828553.tar.gz
Qt-aaf6ebb3725055035d0d17767b4e155d39828553.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml-staging into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/qt-qml-staging: Flicking behaviour of ListView/GridView SnapOnItem is inconsistent Skip flick velocity test on Mac. Try again to fix flickable velocity on Mac. Try to fix Mac CI test failure qmlplugindump: Fix dumping with -path on Mac. qmlplugindump: Improve error message for misbehaving plugin components. Flickable is too sensitive. Reduce timing dependancy in flickable test Velocities reported by Flickable in onFlickStarted can be 0 qmldump: Fix export comparison. QmlInspector: Some code cleanups QmlInspector: Some cleanup in the Color Picker tool QmlInspector: Unified mouse and keyboard event handling QmlInspector: Removed private header postfix and Qt namespace QmlInspector: Share code between QGV/SG based QML debugging qmlplugindump: For extended types, remove exports of the base object. qmlplugindump: Build debug version if possible. QDeclarativeDebug: Add code coverage information
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp101
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml2
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp47
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp8
4 files changed, 153 insertions, 5 deletions
diff --git a/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp b/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
index a40bcc0..1990c0d 100644
--- a/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
+++ b/tests/auto/declarative/qdeclarativedebugjs/tst_qdeclarativedebugjs.cpp
@@ -69,6 +69,8 @@ public:
void expandObjectById(const QByteArray& objectName, quint64 objectId);
void setProperty(const QByteArray& id, qint64 objectId, const QString &property, const QString &value);
void activateFrame(int frameId);
+ void startCoverageCompleted();
+ void startCoverageRun();
// info from last exec
JSAgentWatchData exec_data;
@@ -94,6 +96,11 @@ signals:
void stopped();
void expanded();
void watchTriggered();
+ void coverageScriptLoaded();
+ void coverageFuncEntered();
+ void coverageFuncExited();
+ void coveragePosChanged();
+ void coverageCompleted();
protected:
virtual void statusChanged(Status status);
@@ -156,6 +163,9 @@ private slots:
void setProperty4();
void activateFrame2();
void verifyQMLOptimizerDisabled();
+ void testCoverageCompleted();
+ void testCoverageRun();
+
};
@@ -280,6 +290,28 @@ void QJSDebugClient::activateFrame(int frameId)
sendMessage(reply);
}
+void QJSDebugClient::startCoverageRun()
+{
+ QByteArray reply;
+ QDataStream rs(&reply, QIODevice::WriteOnly);
+ QByteArray cmd = "COVERAGE";
+ bool enabled = true;
+ rs << cmd
+ << enabled;
+ sendMessage(reply);
+}
+
+void QJSDebugClient::startCoverageCompleted()
+{
+ QByteArray reply;
+ QDataStream rs(&reply, QIODevice::WriteOnly);
+ QByteArray cmd = "COVERAGE";
+ bool enabled = false;
+ rs << cmd
+ << enabled;
+ sendMessage(reply);
+}
+
void QJSDebugClient::statusChanged(Status /*status*/)
{
emit statusHasChanged();
@@ -317,6 +349,30 @@ void QJSDebugClient::messageReceived(const QByteArray &data)
stream >> ping;
QCOMPARE(ping, m_ping);
emit pong();
+ } else if (command == "COVERAGE") {
+ qint64 time;
+ int messageType;
+ qint64 scriptId;
+ QString program;
+ QString fileName;
+ int baseLineNumber;
+ int lineNumber;
+ int columnNumber;
+ QString returnValue;
+
+ stream >> time >> messageType >> scriptId >> program >> fileName >> baseLineNumber
+ >> lineNumber >> columnNumber >> returnValue;
+ if (messageType == CoverageComplete) {
+ emit coverageCompleted();
+ } else if (messageType == CoverageScriptLoad) {
+ emit coverageScriptLoaded();
+ } else if (messageType == CoveragePosChange) {
+ emit coveragePosChanged();
+ } else if (messageType == CoverageFuncEntry) {
+ emit coverageFuncEntered();
+ } else if (messageType == CoverageFuncExit) {
+ emit coverageFuncExited();
+ }
} else {
QFAIL("Unknown message :" + command);
}
@@ -1336,6 +1392,51 @@ void tst_QDeclarativeDebugJS::verifyQMLOptimizerDisabled()
QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(stopped())));
}
+
+void tst_QDeclarativeDebugJS::testCoverageCompleted()
+{
+ QJSDebugProcess process;
+ process.start(QStringList() << "-qmljsdebugger=port:3771,block" << TEST_FILE("backtrace1.qml"));
+ QVERIFY(process.waitForStarted());
+
+ QDeclarativeDebugConnection connection;
+ connection.connectToHost("127.0.0.1", 3771);
+ QVERIFY(connection.waitForConnected());
+
+ QJSDebugClient client(&connection);
+ QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())));
+ if (client.status() == QJSDebugClient::Unavailable)
+ QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())));
+ QCOMPARE(client.status(), QJSDebugClient::Enabled);
+
+ client.startCoverageCompleted();
+ QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(coverageCompleted())));
+}
+
+void tst_QDeclarativeDebugJS::testCoverageRun()
+{
+ QJSDebugProcess process;
+ process.start(QStringList() << "-qmljsdebugger=port:3771,block" << TEST_FILE("backtrace1.qml"));
+ QVERIFY(process.waitForStarted());
+
+ QDeclarativeDebugConnection connection;
+ connection.connectToHost("127.0.0.1", 3771);
+ QVERIFY(connection.waitForConnected());
+
+ QJSDebugClient client(&connection);
+ QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())));
+ if (client.status() == QJSDebugClient::Unavailable)
+ QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(statusHasChanged())));
+ QCOMPARE(client.status(), QJSDebugClient::Enabled);
+
+ client.startCoverageRun();
+ client.startCoverageCompleted();
+ QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(coverageScriptLoaded())));
+ QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(coveragePosChanged())));
+ //QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(coverageFuncEntered())));
+ //QVERIFY(QDeclarativeDebugTest::waitForSignal(&client, SIGNAL(coverageFuncExited())));
+}
+
QTEST_MAIN(tst_QDeclarativeDebugJS)
#include "tst_qdeclarativedebugjs.moc"
diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml
index a3e92fe..8359ad1 100644
--- a/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml
+++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml
@@ -1,7 +1,7 @@
import QtQuick 1.0
Flickable {
- width: 100; height: 100
+ width: 100; height: 200
contentWidth: column.width; contentHeight: column.height
Column {
diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
index b077fdc..4d4c30b 100644
--- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
+++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
@@ -78,10 +78,12 @@ private slots:
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
void wheel();
+ void flickVelocity();
private:
QDeclarativeEngine engine;
+ void flick(QGraphicsView *canvas, const QPoint &from, const QPoint &to, int duration);
template<typename T>
T *findItem(QGraphicsObject *parent, const QString &objectName);
};
@@ -480,6 +482,51 @@ void tst_qdeclarativeflickable::wheel()
delete canvas;
}
+void tst_qdeclarativeflickable::flickVelocity()
+{
+#ifdef Q_WS_MAC
+ QSKIP("Producing flicks on Mac CI impossible due to timing problems", SkipAll);
+#endif
+
+ QDeclarativeView *canvas = new QDeclarativeView;
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QVERIFY(canvas->rootObject() != 0);
+
+ QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(canvas->rootObject());
+ QVERIFY(flickable != 0);
+
+ // flick up
+ flick(canvas, QPoint(20,190), QPoint(20, 50), 200);
+ QVERIFY(flickable->verticalVelocity() > 0.0);
+ QTRY_VERIFY(flickable->verticalVelocity() == 0.0);
+
+ // flick down
+ flick(canvas, QPoint(20,10), QPoint(20, 140), 200);
+ QVERIFY(flickable->verticalVelocity() < 0.0);
+ QTRY_VERIFY(flickable->verticalVelocity() == 0.0);
+
+ delete canvas;
+}
+
+void tst_qdeclarativeflickable::flick(QGraphicsView *canvas, const QPoint &from, const QPoint &to, int duration)
+{
+ const int pointCount = 5;
+ QPoint diff = to - from;
+
+ // send press, five equally spaced moves, and release.
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(from));
+
+ for (int i = 0; i < pointCount; ++i) {
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(from + (i+1)*diff/pointCount), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::qWait(duration/pointCount);
+ QCoreApplication::processEvents();
+ }
+
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(to));
+}
template<typename T>
T *tst_qdeclarativeflickable::findItem(QGraphicsObject *parent, const QString &objectName)
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index e3f7980..4342ff3 100644
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
@@ -450,12 +450,12 @@ void tst_QDeclarativeGridView::removed()
model.removeItem(1);
// Confirm items positioned correctly
- for (int i = 6; i < 18; ++i) {
+ for (int i = 3; i < 15; ++i) {
QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i);
if (!item) qWarning() << "Item" << i << "not found";
QTRY_VERIFY(item);
- QTRY_VERIFY(item->x() == (i%3)*80);
- QTRY_VERIFY(item->y() == (i/3)*60);
+ QTRY_COMPARE(item->x(), (i%3)*80.0);
+ QTRY_COMPARE(item->y(), 60+(i/3)*60.0);
}
// Remove currentIndex
@@ -476,7 +476,7 @@ void tst_QDeclarativeGridView::removed()
if (!item) qWarning() << "Item" << i << "not found";
QTRY_VERIFY(item);
QTRY_VERIFY(item->x() == (i%3)*80);
- QTRY_VERIFY(item->y() == (i/3)*60);
+ QTRY_VERIFY(item->y() == 60+(i/3)*60);
}
// remove item outside current view.