summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSami Lempinen <sami.lempinen@nokia.com>2011-03-09 14:18:08 (GMT)
committerSami Lempinen <sami.lempinen@nokia.com>2011-03-09 14:18:08 (GMT)
commite496be83f0ba8849cace30078223eb0fd40f004e (patch)
treee9d0736269ab86d9ed9e6125ac6e419f8328cd0e /tests
parentcf94df01d2d2364653f2ab602688394450e92d31 (diff)
parent56ad75da12ec6a4d7b65ce4e1a246ee48fda9736 (diff)
downloadQt-e496be83f0ba8849cace30078223eb0fd40f004e.zip
Qt-e496be83f0ba8849cace30078223eb0fd40f004e.tar.gz
Qt-e496be83f0ba8849cace30078223eb0fd40f004e.tar.bz2
Remerging SymbianLite to team repository.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/Double.qml14
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/doubleRegistrationBug.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/registrationBug.qml18
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp51
-rw-r--r--tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp16
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp40
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/data/nestedPressDelay.qml33
-rw-r--r--tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp29
-rw-r--r--tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp34
-rw-r--r--tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml8
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp61
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.2.qml21
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.qml13
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.qml5
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.errors.txt1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.qml6
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/Foo.qml5
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/qmldir2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlVersionPluginType/qmldir1
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp73
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/pluginMixed.pro9
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp73
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/pluginVersion.pro9
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro2
-rw-r--r--tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp64
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/data/preventstealing.qml24
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp125
-rw-r--r--tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp34
-rw-r--r--tests/auto/declarative/qdeclarativetext/data/qtbug_14734.qml10
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp14
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/positionAt.qml9
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp374
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp485
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/script_error_onCall.js6
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/script_error_onLoad.js5
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/worker_error_onCall.qml6
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/data/worker_error_onLoad.qml7
-rw-r--r--tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp52
-rw-r--r--tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp23
-rw-r--r--tests/auto/gui.pro1
-rw-r--r--tests/auto/moc/tst_moc.cpp152
-rw-r--r--tests/auto/network.pro2
-rw-r--r--tests/auto/networkselftest/tst_networkselftest.cpp2
-rw-r--r--tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp2
-rw-r--r--tests/auto/qclipboard/tst_qclipboard.cpp2
-rw-r--r--tests/auto/qdbusinterface/tst_qdbusinterface.cpp44
-rw-r--r--tests/auto/qdbusmarshall/test/test.pro3
-rw-r--r--tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp210
-rw-r--r--tests/auto/qdbusxmlparser/tst_qdbusxmlparser.cpp13
-rw-r--r--tests/auto/qfont/tst_qfont.cpp7
-rw-r--r--tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp12
-rw-r--r--tests/auto/qimagereader/images/corrupt-pixel-count.xpm11
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp3
-rw-r--r--tests/auto/qinputcontext/tst_qinputcontext.cpp32
-rw-r--r--tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp4
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp103
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp22
-rw-r--r--tests/auto/qscriptclass/tst_qscriptclass.cpp4
-rw-r--r--tests/auto/qscriptcontext/tst_qscriptcontext.cpp12
-rw-r--r--tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp6
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp78
-rw-r--r--tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp51
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp7
-rw-r--r--tests/auto/qscriptjstestsuite/expect_fail.txt198
-rw-r--r--tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro2
-rw-r--r--tests/auto/qscriptjstestsuite/qscriptjstestsuite.qrc6
-rw-r--r--tests/auto/qscriptjstestsuite/skip.txt9
-rw-r--r--tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp819
-rw-r--r--tests/auto/qscriptv8testsuite/abstracttestsuite.cpp481
-rw-r--r--tests/auto/qscriptv8testsuite/abstracttestsuite.h125
-rw-r--r--tests/auto/qscriptv8testsuite/abstracttestsuite.pri4
-rw-r--r--tests/auto/qscriptv8testsuite/expect_fail.txt16
-rw-r--r--tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro1
-rw-r--r--tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc2
-rw-r--r--tests/auto/qscriptv8testsuite/skip.txt17
-rw-r--r--tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp366
-rw-r--r--tests/auto/qscriptvalue/tst_qscriptvalue.cpp15
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp57
-rw-r--r--tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp21
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp8
-rw-r--r--tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro36
-rw-r--r--tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp225
-rw-r--r--tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro36
-rw-r--r--tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp226
-rw-r--r--tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp18
-rw-r--r--tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp5
-rw-r--r--tests/auto/qtextlayout/tst_qtextlayout.cpp13
-rw-r--r--tests/auto/qtimer/tst_qtimer.cpp8
-rw-r--r--tests/auto/qvolatileimage/qvolatileimage.pro7
-rw-r--r--tests/auto/qvolatileimage/tst_qvolatileimage.cpp403
-rw-r--r--tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp13
-rw-r--r--tests/benchmarks/script/script.pro4
-rw-r--r--tests/benchmarks/script/sunspider/tst_sunspider.cpp2
-rw-r--r--tests/benchmarks/script/v8/tst_v8.cpp4
95 files changed, 4667 insertions, 1034 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/Double.qml b/tests/auto/declarative/qdeclarativeanimations/data/Double.qml
new file mode 100644
index 0000000..b247fce
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimations/data/Double.qml
@@ -0,0 +1,14 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: container
+ property bool on: false
+ border.color: "#ffffff"
+ color: "green"
+ width: 50
+ height: 50
+ NumberAnimation on x {
+ objectName: "animation"
+ running: container.on; from: 0; to: 600; loops: Animation.Infinite; duration: 2000
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/doubleRegistrationBug.qml b/tests/auto/declarative/qdeclarativeanimations/data/doubleRegistrationBug.qml
new file mode 100644
index 0000000..f0fdf9c
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimations/data/doubleRegistrationBug.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 400; height: 400
+
+ Double { id: dub; on: parent.width < 800 }
+ Component.onCompleted: dub.on = false
+}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/registrationBug.qml b/tests/auto/declarative/qdeclarativeanimations/data/registrationBug.qml
new file mode 100644
index 0000000..7dc29f9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimations/data/registrationBug.qml
@@ -0,0 +1,18 @@
+import QtQuick 1.0
+
+Rectangle {
+ id: rect
+ width: 200
+ height: 200
+
+ property bool animating: true
+ property int value: 0
+
+ NumberAnimation {
+ target: rect
+ property: "value"
+ running: rect.animating
+ to: 100
+ duration: 50
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index 6f71dec..e2a54c0 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -85,6 +85,9 @@ private slots:
void rotation();
void runningTrueBug();
void nonTransitionBug();
+ void registrationBug();
+ void doubleRegistrationBug();
+ void alwaysRunToEndRestartBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -793,6 +796,54 @@ void tst_qdeclarativeanimations::nonTransitionBug()
QCOMPARE(mover->x(), qreal(100));
}
+//QTBUG-14042
+void tst_qdeclarativeanimations::registrationBug()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, SRCDIR "/data/registrationBug.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QTRY_COMPARE(rect->property("value"), QVariant(int(100)));
+}
+
+void tst_qdeclarativeanimations::doubleRegistrationBug()
+{
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, SRCDIR "/data/doubleRegistrationBug.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect != 0);
+
+ QDeclarativeAbstractAnimation *anim = rect->findChild<QDeclarativeAbstractAnimation*>("animation");
+ QVERIFY(anim != 0);
+ QTRY_COMPARE(anim->qtAnimation()->state(), QAbstractAnimation::Stopped);
+}
+
+//QTBUG-16736
+void tst_qdeclarativeanimations::alwaysRunToEndRestartBug()
+{
+ QDeclarativeRectangle rect;
+ QDeclarativePropertyAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("x");
+ animation.setTo(200);
+ animation.setDuration(1000);
+ animation.setLoops(-1);
+ animation.setAlwaysRunToEnd(true);
+ QVERIFY(animation.loops() == -1);
+ QVERIFY(animation.alwaysRunToEnd() == true);
+ animation.start();
+ animation.stop();
+ animation.start();
+ animation.stop();
+ QTest::qWait(500);
+ QVERIFY(rect.x() != qreal(200));
+ QTest::qWait(800);
+ QTIMED_COMPARE(rect.x(), qreal(200));
+ QCOMPARE(static_cast<QDeclarativeAbstractAnimation*>(&animation)->qtAnimation()->state(), QAbstractAnimation::Stopped);
+}
+
QTEST_MAIN(tst_qdeclarativeanimations)
#include "tst_qdeclarativeanimations.moc"
diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
index 9a15575..6bcb4eb 100644
--- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
+++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp
@@ -167,8 +167,8 @@ void tst_QDeclarativeDebug::recursiveObjectTest(QObject *o, const QDeclarativeDe
{
const QMetaObject *meta = o->metaObject();
- QDeclarativeType *type = QDeclarativeMetaType::qmlType(o->metaObject());
- QString className = type ? type->qmlTypeName() : QString();
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(meta);
+ QString className = type ? QString(type->qmlTypeName()) : QString(meta->className());
className = className.mid(className.lastIndexOf(QLatin1Char('/'))+1);
QCOMPARE(oref.debugId(), QDeclarativeDebugService::idForObject(o));
@@ -293,12 +293,21 @@ void tst_QDeclarativeDebug::initTestCase()
QList<QByteArray> qml;
qml << "import QtQuick 1.0\n"
"Item {"
+ "id: root\n"
"width: 10; height: 20; scale: blueRect.scale;"
"Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }"
"Text { color: blueRect.color; }"
"MouseArea {"
"onEntered: { console.log('hello') }"
"}"
+ "property variant varObj\n"
+ "property variant varObjList: []\n"
+ "Component.onCompleted: {\n"
+ "varObj = blueRect;\n"
+ "var list = varObjList;\n"
+ "list[0] = blueRect;\n"
+ "varObjList = list;\n"
+ "}\n"
"}";
// add second component to test multiple root contexts
@@ -742,7 +751,6 @@ void tst_QDeclarativeDebug::queryObject()
QCOMPARE(findProperty(rect.properties(), "color").value(), qVariantFromValue(QColor("blue")));
QCOMPARE(findProperty(text.properties(), "color").value(), qVariantFromValue(QColor("blue")));
-
} else {
foreach(const QDeclarativeDebugObjectReference &child, obj.children())
QCOMPARE(child.properties().count(), 0);
@@ -799,6 +807,8 @@ void tst_QDeclarativeDebug::queryExpressionResult_data()
QTest::newRow("width + 50") << "width + 50" << qVariantFromValue(60);
QTest::newRow("blueRect.width") << "blueRect.width" << qVariantFromValue(500);
QTest::newRow("bad expr") << "aeaef" << qVariantFromValue(QString("<undefined>"));
+ QTest::newRow("QObject*") << "varObj" << qVariantFromValue(QString("<unnamed object>"));
+ QTest::newRow("list of QObject*") << "varObjList" << qVariantFromValue(QString("<unknown value>"));
}
void tst_QDeclarativeDebug::tst_QDeclarativeDebugFileReference()
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index b19b3c9..40b0e1b 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -50,6 +50,7 @@
#include <QtCore/qnumeric.h>
#include <private/qdeclarativeengine_p.h>
#include <private/qdeclarativeglobalscriptclass_p.h>
+#include <private/qscriptdeclarativeclass_p.h>
#include "testtypes.h"
#include "testhttpserver.h"
#include "../../../shared/util.h"
@@ -174,6 +175,7 @@ private slots:
void aliasBindingsAssignCorrectly();
void aliasBindingsOverrideTarget();
void aliasWritesOverrideBindings();
+ void pushCleanContext();
void include();
@@ -3015,6 +3017,44 @@ void tst_qdeclarativeecmascript::revision()
}
}
+// Test for QScriptDeclarativeClass::pushCleanContext()
+void tst_qdeclarativeecmascript::pushCleanContext()
+{
+ QScriptEngine engine;
+ engine.globalObject().setProperty("a", 6);
+ QCOMPARE(engine.evaluate("a").toInt32(), 6);
+
+ // First confirm pushContext() behaves as we expect
+ QScriptValue object = engine.newObject();
+ object.setProperty("a", 15);
+ QScriptContext *context1 = engine.pushContext();
+ context1->pushScope(object);
+ QCOMPARE(engine.evaluate("a").toInt32(), 15);
+
+ QScriptContext *context2 = engine.pushContext();
+ Q_UNUSED(context2);
+ QCOMPARE(engine.evaluate("a").toInt32(), 15);
+ QScriptValue func1 = engine.evaluate("(function() { return a; })");
+
+ // Now check that pushCleanContext() works
+ QScriptDeclarativeClass::pushCleanContext(&engine);
+ QCOMPARE(engine.evaluate("a").toInt32(), 6);
+ QScriptValue func2 = engine.evaluate("(function() { return a; })");
+
+ engine.popContext();
+ QCOMPARE(engine.evaluate("a").toInt32(), 15);
+
+ engine.popContext();
+ QCOMPARE(engine.evaluate("a").toInt32(), 15);
+
+ engine.popContext();
+ QCOMPARE(engine.evaluate("a").toInt32(), 6);
+
+ // Check that function objects created in these contexts work
+ QCOMPARE(func1.call().toInt32(), 15);
+ QCOMPARE(func2.call().toInt32(), 6);
+}
+
QTEST_MAIN(tst_qdeclarativeecmascript)
#include "tst_qdeclarativeecmascript.moc"
diff --git a/tests/auto/declarative/qdeclarativeflickable/data/nestedPressDelay.qml b/tests/auto/declarative/qdeclarativeflickable/data/nestedPressDelay.qml
new file mode 100644
index 0000000..d0ee545
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeflickable/data/nestedPressDelay.qml
@@ -0,0 +1,33 @@
+import QtQuick 1.0
+
+Flickable {
+ property bool pressed: ma.pressed
+ width: 240
+ height: 320
+ contentWidth: 480
+ contentHeight: 320
+ flickableDirection: Flickable.HorizontalFlick
+ pressDelay: 50
+ Flickable {
+ objectName: "innerFlickable"
+ flickableDirection: Flickable.VerticalFlick
+ width: 480
+ height: 320
+ contentWidth: 480
+ contentHeight: 400
+ pressDelay: 10000
+ Rectangle {
+ y: 100
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: 240
+ height: 100
+ color: ma.pressed ? 'blue' : 'green'
+ MouseArea {
+ id: ma
+ objectName: "mouseArea"
+ anchors.fill: parent
+ }
+ }
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
index f4bec8f..736f8f4 100644
--- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
+++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp
@@ -69,6 +69,7 @@ private slots:
void maximumFlickVelocity();
void flickDeceleration();
void pressDelay();
+ void nestedPressDelay();
void flickableDirection();
void qgraphicswidget();
void resizeContent();
@@ -246,6 +247,34 @@ void tst_qdeclarativeflickable::pressDelay()
QCOMPARE(spy.count(),1);
}
+// QTBUG-17361
+void tst_qdeclarativeflickable::nestedPressDelay()
+{
+ QDeclarativeView *canvas = new QDeclarativeView;
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/nestedPressDelay.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QVERIFY(canvas->rootObject() != 0);
+
+ QDeclarativeFlickable *outer = qobject_cast<QDeclarativeFlickable*>(canvas->rootObject());
+ QVERIFY(outer != 0);
+
+ QDeclarativeFlickable *inner = canvas->rootObject()->findChild<QDeclarativeFlickable*>("innerFlickable");
+ QVERIFY(inner != 0);
+
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(150, 150)));
+ // the MouseArea is not pressed immediately
+ QVERIFY(outer->property("pressed").toBool() == false);
+
+ // The outer pressDelay will prevail (50ms, vs. 10sec)
+ QTest::qWait(300);
+ QVERIFY(outer->property("pressed").toBool() == true);
+
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(150, 150)));
+
+ delete canvas;
+}
+
void tst_qdeclarativeflickable::flickableDirection()
{
QDeclarativeComponent component(&engine);
diff --git a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
index a62ea31..ffd5d38 100644
--- a/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativefolderlistmodel/tst_qdeclarativefolderlistmodel.cpp
@@ -62,14 +62,24 @@ class tst_qdeclarativefolderlistmodel : public QObject
{
Q_OBJECT
public:
- tst_qdeclarativefolderlistmodel() {}
+ tst_qdeclarativefolderlistmodel() : removeStart(0), removeEnd(0) {}
+
+public slots:
+ void removed(const QModelIndex &, int start, int end) {
+ removeStart = start;
+ removeEnd = end;
+ }
private slots:
void basicProperties();
+ void refresh();
private:
void checkNoErrors(const QDeclarativeComponent& component);
QDeclarativeEngine engine;
+
+ int removeStart;
+ int removeEnd;
};
void tst_qdeclarativefolderlistmodel::checkNoErrors(const QDeclarativeComponent& component)
@@ -115,6 +125,28 @@ void tst_qdeclarativefolderlistmodel::basicProperties()
QCOMPARE(flm->property("folder").toUrl(), QUrl::fromLocalFile(""));
}
+void tst_qdeclarativefolderlistmodel::refresh()
+{
+ QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml"));
+ checkNoErrors(component);
+
+ QAbstractListModel *flm = qobject_cast<QAbstractListModel*>(component.create());
+ QVERIFY(flm != 0);
+
+ flm->setProperty("folder",QUrl::fromLocalFile(SRCDIR "/data"));
+ QTRY_COMPARE(flm->property("count").toInt(),2); // wait for refresh
+
+ int count = flm->rowCount();
+
+ connect(flm, SIGNAL(rowsRemoved(const QModelIndex&,int,int)),
+ this, SLOT(removed(const QModelIndex&,int,int)));
+
+ flm->setProperty("sortReversed", true);
+
+ QCOMPARE(removeStart, 0);
+ QCOMPARE(removeEnd, count-1);
+}
+
QTEST_MAIN(tst_qdeclarativefolderlistmodel)
#include "tst_qdeclarativefolderlistmodel.moc"
diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml
index 35a398b..b2d9213 100644
--- a/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml
+++ b/tests/auto/declarative/qdeclarativelistview/data/listview-sections_delegate.qml
@@ -1,6 +1,7 @@
import QtQuick 1.0
Rectangle {
+ property string sectionProperty: "number"
width: 240
height: 320
color: "#ffffff"
@@ -41,6 +42,11 @@ Rectangle {
text: wrapper.y
}
}
+ ListView.onRemove: SequentialAnimation {
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true }
+ NumberAnimation { target: wrapper; property: "height"; to: 0; duration: 100; easing.type: Easing.InOutQuad }
+ PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false }
+ }
}
}
]
@@ -51,7 +57,7 @@ Rectangle {
height: 320
model: testModel
delegate: myDelegate
- section.property: "number"
+ section.property: sectionProperty
section.delegate: Rectangle {
objectName: "sect_" + section
color: "#99bb99"
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index f358625..e326136 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -1078,6 +1078,65 @@ void tst_QDeclarativeListView::sectionsDelegate()
QTRY_COMPARE(item->y(), qreal(i*20*6));
}
+ // remove section boundary
+ model.removeItem(5);
+ qApp->processEvents();
+ for (int i = 0; i < 3; ++i) {
+ QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem,
+ "sect_" + (i == 0 ? QString("aaa") : QString::number(i)));
+ QVERIFY(item);
+ }
+
+ // QTBUG-17606
+ QList<QDeclarativeItem*> items = findItems<QDeclarativeItem>(contentItem, "sect_1");
+ QCOMPARE(items.count(), 1);
+
+ // QTBUG-17759
+ model.modifyItem(0, "One", "aaa");
+ model.modifyItem(1, "One", "aaa");
+ model.modifyItem(2, "One", "aaa");
+ model.modifyItem(3, "Four", "aaa");
+ model.modifyItem(4, "Four", "aaa");
+ model.modifyItem(5, "Four", "aaa");
+ model.modifyItem(6, "Five", "aaa");
+ model.modifyItem(7, "Five", "aaa");
+ model.modifyItem(8, "Five", "aaa");
+ model.modifyItem(9, "Two", "aaa");
+ model.modifyItem(10, "Two", "aaa");
+ model.modifyItem(11, "Two", "aaa");
+ QTRY_COMPARE(findItems<QDeclarativeItem>(contentItem, "sect_aaa").count(), 1);
+ canvas->rootObject()->setProperty("sectionProperty", "name");
+ // ensure view has settled.
+ QTRY_COMPARE(findItems<QDeclarativeItem>(contentItem, "sect_Four").count(), 1);
+ for (int i = 0; i < 4; ++i) {
+ QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem,
+ "sect_" + model.name(i*3));
+ QVERIFY(item);
+ QTRY_COMPARE(item->y(), qreal(i*20*4));
+ }
+
+ // QTBUG-17769
+ model.removeItems(10, 20);
+ // ensure view has settled.
+ QTRY_COMPARE(findItems<QDeclarativeItem>(contentItem, "wrapper").count(), 10);
+ // Drag view up beyond bounds
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(20,20)));
+ {
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(20,0)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ }
+ {
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(20,-50)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ }
+ {
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(QPoint(20,-200)), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ }
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(20,-200)));
+ // view should settle back at 0
+ QTRY_COMPARE(listview->contentY(), 0.0);
+
delete canvas;
}
@@ -2408,7 +2467,7 @@ QList<T*> tst_QDeclarativeListView::findItems(QGraphicsObject *parent, const QSt
//qDebug() << parent->childItems().count() << "children";
for (int i = 0; i < parent->childItems().count(); ++i) {
QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i));
- if(!item)
+ if(!item || !item->isVisible())
continue;
//qDebug() << "try" << item;
if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName))
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.2.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.2.qml
new file mode 100644
index 0000000..70b2bfd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.2.qml
@@ -0,0 +1,21 @@
+import com.nokia.AutoTestQmlMixedPluginType 1.5
+import QtQuick 1.0
+
+Item {
+ property bool test: false
+ property bool test2: false
+
+ Bar {
+ id: bar
+ }
+
+ Foo {
+ id: foo
+ }
+
+ Component.onCompleted: {
+ test = (bar.value == 16);
+ test2 = (foo.value == 89);
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.qml
new file mode 100644
index 0000000..da6ff46
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/importsMixedQmlCppPlugin.qml
@@ -0,0 +1,13 @@
+import com.nokia.AutoTestQmlMixedPluginType 1.0
+import QtQuick 1.0
+
+Item {
+ property bool test: false
+ Bar {
+ id: bar
+ }
+
+ Component.onCompleted: {
+ test = (bar.value == 16);
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.errors.txt b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.errors.txt
new file mode 100644
index 0000000..a40c1c8
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.errors.txt
@@ -0,0 +1 @@
+1:1:module "com.nokia.AutoTestQmlVersionPluginType" version 1.9 is not installed
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.qml
new file mode 100644
index 0000000..59fd084
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.2.qml
@@ -0,0 +1,5 @@
+import com.nokia.AutoTestQmlVersionPluginType 1.9
+import QtQuick 1.0
+
+QtObject {
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.errors.txt b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.errors.txt
new file mode 100644
index 0000000..2634223
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.errors.txt
@@ -0,0 +1 @@
+1:1:module "com.nokia.AutoTestQmlVersionPluginType" version 1.1 is not installed
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.qml b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.qml
new file mode 100644
index 0000000..2065c07
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/data/versionNotInstalled.qml
@@ -0,0 +1,6 @@
+import com.nokia.AutoTestQmlVersionPluginType 1.1
+import QtQuick 1.0
+
+QtObject {
+}
+
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/Foo.qml b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/Foo.qml
new file mode 100644
index 0000000..ce51cbd
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/Foo.qml
@@ -0,0 +1,5 @@
+import QtQuick 1.0
+
+Item {
+ property int value: 89
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/qmldir
new file mode 100644
index 0000000..065dc3b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlMixedPluginType/qmldir
@@ -0,0 +1,2 @@
+plugin pluginMixed
+Foo 1.5 Foo.qml
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlVersionPluginType/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlVersionPluginType/qmldir
new file mode 100644
index 0000000..640967f
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/imports/com/nokia/AutoTestQmlVersionPluginType/qmldir
@@ -0,0 +1 @@
+plugin pluginVersion
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp
new file mode 100644
index 0000000..c7796e2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/plugin.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class BarPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value);
+
+public:
+ int value() const { return 16; }
+};
+
+
+class MyMixedPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ MyMixedPlugin()
+ {
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlMixedPluginType");
+ qmlRegisterType<BarPluginType>(uri, 1, 0, "Bar");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyMixedPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/pluginMixed.pro b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/pluginMixed.pro
new file mode 100644
index 0000000..9766003
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginMixed/pluginMixed.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+DESTDIR = ../imports/com/nokia/AutoTestQmlMixedPluginType
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp
new file mode 100644
index 0000000..27a6341
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/plugin.cpp
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QStringList>
+#include <QtDeclarative/qdeclarativeextensionplugin.h>
+#include <QtDeclarative/qdeclarative.h>
+#include <QDebug>
+
+class FloorPluginType : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value);
+
+public:
+ int value() const { return 16; }
+};
+
+
+class MyMixedPlugin : public QDeclarativeExtensionPlugin
+{
+ Q_OBJECT
+public:
+ MyMixedPlugin()
+ {
+ }
+
+ void registerTypes(const char *uri)
+ {
+ Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlVersionPluginType");
+ qmlRegisterType<FloorPluginType>(uri, 1, 4, "Floor");
+ }
+};
+
+#include "plugin.moc"
+
+Q_EXPORT_PLUGIN2(plugin, MyMixedPlugin);
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/pluginVersion.pro b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/pluginVersion.pro
new file mode 100644
index 0000000..70a38b9
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/pluginVersion/pluginVersion.pro
@@ -0,0 +1,9 @@
+TEMPLATE = lib
+CONFIG += plugin
+SOURCES = plugin.cpp
+QT = core declarative
+DESTDIR = ../imports/com/nokia/AutoTestQmlVersionPluginType
+
+symbian: {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro
index 9d0e94e..6e72d98 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro
@@ -1,6 +1,6 @@
QT = core
TEMPLATE = subdirs
-SUBDIRS = plugin plugin.2 plugin.2.1 pluginWrongCase pluginWithQmlFile
+SUBDIRS = plugin plugin.2 plugin.2.1 pluginWrongCase pluginWithQmlFile pluginMixed pluginVersion
tst_qdeclarativemoduleplugin_pro.depends += plugin
SUBDIRS += tst_qdeclarativemoduleplugin.pro
diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
index 9ec0f84..dc104e2 100644
--- a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
+++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp
@@ -63,10 +63,13 @@ private slots:
void importsPlugin();
void importsPlugin2();
void importsPlugin21();
+ void importsMixedQmlCppPlugin();
void incorrectPluginCase();
void importPluginWithQmlFile();
void remoteImportWithQuotedUrl();
void remoteImportWithUnquotedUri();
+ void versionNotInstalled();
+ void versionNotInstalled_data();
};
#ifdef Q_OS_SYMBIAN
@@ -191,8 +194,18 @@ void tst_qdeclarativemoduleplugin::incorrectPluginCase()
void tst_qdeclarativemoduleplugin::importPluginWithQmlFile()
{
+ QString path = QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports");
+
+ // QTBUG-16885: adding an import path with a lower-case "c:" causes assert failure
+ // (this only happens if the plugin includes pure QML files)
+ #ifdef Q_OS_WIN
+ QVERIFY(path.at(0).isUpper() && path.at(1) == QLatin1Char(':'));
+ path = path.at(0).toLower() + path.mid(1);
+ #endif
+
QDeclarativeEngine engine;
- engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+ engine.addImportPath(path);
+
QDeclarativeComponent component(&engine, TEST_FILE("data/pluginWithQmlFile.qml"));
foreach (QDeclarativeError err, component.errors())
qWarning() << err;
@@ -246,6 +259,55 @@ void tst_qdeclarativemoduleplugin::remoteImportWithUnquotedUri()
VERIFY_ERRORS(0);
}
+// QTBUG-17324
+void tst_qdeclarativemoduleplugin::importsMixedQmlCppPlugin()
+{
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("data/importsMixedQmlCppPlugin.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ delete o;
+ }
+
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("data/importsMixedQmlCppPlugin.2.qml"));
+
+ QObject *o = component.create();
+ QVERIFY(o != 0);
+ QCOMPARE(o->property("test").toBool(), true);
+ QCOMPARE(o->property("test2").toBool(), true);
+ delete o;
+ }
+
+
+}
+
+void tst_qdeclarativemoduleplugin::versionNotInstalled_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("errorFile");
+
+ QTest::newRow("versionNotInstalled") << "data/versionNotInstalled.qml" << "versionNotInstalled.errors.txt";
+ QTest::newRow("versionNotInstalled") << "data/versionNotInstalled.2.qml" << "versionNotInstalled.2.errors.txt";
+}
+
+void tst_qdeclarativemoduleplugin::versionNotInstalled()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+
+ QDeclarativeEngine engine;
+ engine.addImportPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("imports"));
+
+ QDeclarativeComponent component(&engine, TEST_FILE(file));
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+}
+
QTEST_MAIN(tst_qdeclarativemoduleplugin)
#include "tst_qdeclarativemoduleplugin.moc"
diff --git a/tests/auto/declarative/qdeclarativemousearea/data/preventstealing.qml b/tests/auto/declarative/qdeclarativemousearea/data/preventstealing.qml
new file mode 100644
index 0000000..11553fa
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemousearea/data/preventstealing.qml
@@ -0,0 +1,24 @@
+import QtQuick 1.1
+
+Flickable {
+ property bool stealing: true
+ width: 200
+ height: 200
+ contentWidth: 400
+ contentHeight: 400
+ Rectangle {
+ color: "black"
+ width: 400
+ height: 400
+ Rectangle {
+ x: 50; y: 50
+ width: 100; height: 100
+ color: "steelblue"
+ MouseArea {
+ objectName: "mousearea"
+ anchors.fill: parent
+ preventStealing: stealing
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
index 845d6bb..e1c34fc 100644
--- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
+++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
@@ -43,8 +43,10 @@
#include <QtTest/QSignalSpy>
#include <private/qdeclarativemousearea_p.h>
#include <private/qdeclarativerectangle_p.h>
+#include <private/qdeclarativeflickable_p.h>
#include <QtDeclarative/qdeclarativeview.h>
#include <QtDeclarative/qdeclarativecontext.h>
+#include <QtDeclarative/qdeclarativeengine.h>
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
@@ -65,6 +67,9 @@ private slots:
void doubleClick();
void clickTwice();
void pressedOrdering();
+ void preventStealing();
+ void testQtQuick11Attributes();
+ void testQtQuick11Attributes_data();
private:
QDeclarativeView *createView();
@@ -356,6 +361,8 @@ void tst_QDeclarativeMouseArea::noOnClickedWithPressAndHold()
QVERIFY(!canvas->rootObject()->property("clicked").toBool());
QVERIFY(canvas->rootObject()->property("held").toBool());
+
+ delete canvas;
}
void tst_QDeclarativeMouseArea::onMousePressRejected()
@@ -399,6 +406,8 @@ void tst_QDeclarativeMouseArea::onMousePressRejected()
QVERIFY(canvas->rootObject()->property("mr1_released").toBool());
QVERIFY(!canvas->rootObject()->property("mr1_canceled").toBool());
QVERIFY(!canvas->rootObject()->property("mr2_released").toBool());
+
+ delete canvas;
}
void tst_QDeclarativeMouseArea::doubleClick()
@@ -436,6 +445,7 @@ void tst_QDeclarativeMouseArea::doubleClick()
QCOMPARE(canvas->rootObject()->property("doubleClicked").toInt(), 1);
QCOMPARE(canvas->rootObject()->property("released").toInt(), 2);
+ delete canvas;
}
// QTBUG-14832
@@ -476,6 +486,8 @@ void tst_QDeclarativeMouseArea::clickTwice()
QCOMPARE(canvas->rootObject()->property("pressed").toInt(), 2);
QCOMPARE(canvas->rootObject()->property("released").toInt(), 2);
QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 2);
+
+ delete canvas;
}
void tst_QDeclarativeMouseArea::pressedOrdering()
@@ -512,6 +524,119 @@ void tst_QDeclarativeMouseArea::pressedOrdering()
delete canvas;
}
+void tst_QDeclarativeMouseArea::preventStealing()
+{
+ QDeclarativeView *canvas = createView();
+
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/preventstealing.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QVERIFY(canvas->rootObject() != 0);
+
+ QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(canvas->rootObject());
+ QVERIFY(flickable != 0);
+
+ QDeclarativeMouseArea *mouseArea = canvas->rootObject()->findChild<QDeclarativeMouseArea*>("mousearea");
+ QVERIFY(mouseArea != 0);
+
+ QSignalSpy mousePositionSpy(mouseArea, SIGNAL(positionChanged(QDeclarativeMouseEvent*)));
+
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(80, 80)));
+
+ // Without preventStealing, mouse movement over MouseArea would
+ // cause the Flickable to steal mouse and trigger content movement.
+ QGraphicsScene *scene = canvas->scene();
+ QGraphicsSceneMouseEvent moveEvent(QEvent::GraphicsSceneMouseMove);
+ moveEvent.setScenePos(QPointF(70, 70));
+ moveEvent.setButton(Qt::LeftButton);
+ moveEvent.setButtons(Qt::LeftButton);
+ QApplication::sendEvent(scene, &moveEvent);
+
+ moveEvent.setScenePos(QPointF(60, 60));
+ moveEvent.setButton(Qt::LeftButton);
+ moveEvent.setButtons(Qt::LeftButton);
+ QApplication::sendEvent(scene, &moveEvent);
+
+ moveEvent.setScenePos(QPointF(50, 50));
+ moveEvent.setButton(Qt::LeftButton);
+ moveEvent.setButtons(Qt::LeftButton);
+ QApplication::sendEvent(scene, &moveEvent);
+
+ // We should have received all three move events
+ QCOMPARE(mousePositionSpy.count(), 3);
+ QVERIFY(mouseArea->pressed());
+
+ // Flickable content should not have moved.
+ QCOMPARE(flickable->contentX(), 0.);
+ QCOMPARE(flickable->contentY(), 0.);
+
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(50, 50)));
+
+ // Now allow stealing and confirm Flickable does its thing.
+ canvas->rootObject()->setProperty("stealing", false);
+
+ QTest::mousePress(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(80, 80)));
+
+ // Without preventStealing, mouse movement over MouseArea would
+ // cause the Flickable to steal mouse and trigger content movement.
+ moveEvent.setScenePos(QPointF(70, 70));
+ QApplication::sendEvent(scene, &moveEvent);
+
+ moveEvent.setScenePos(QPointF(60, 60));
+ QApplication::sendEvent(scene, &moveEvent);
+
+ moveEvent.setScenePos(QPointF(50, 50));
+ QApplication::sendEvent(scene, &moveEvent);
+
+ // We should only have received the first move event
+ QCOMPARE(mousePositionSpy.count(), 4);
+ // Our press should be taken away
+ QVERIFY(!mouseArea->pressed());
+
+ // Flickable content should have moved.
+ QCOMPARE(flickable->contentX(), 10.);
+ QCOMPARE(flickable->contentY(), 10.);
+
+ QTest::mouseRelease(canvas->viewport(), Qt::LeftButton, 0, canvas->mapFromScene(QPoint(50, 50)));
+
+ delete canvas;
+}
+
+void tst_QDeclarativeMouseArea::testQtQuick11Attributes()
+{
+ QFETCH(QString, code);
+ QFETCH(QString, warning);
+ QFETCH(QString, error);
+
+ QDeclarativeEngine engine;
+ QObject *obj;
+
+ QDeclarativeComponent valid(&engine);
+ valid.setData("import QtQuick 1.1; MouseArea { " + code.toUtf8() + " }", QUrl(""));
+ obj = valid.create();
+ QVERIFY(obj);
+ QVERIFY(valid.errorString().isEmpty());
+ delete obj;
+
+ QDeclarativeComponent invalid(&engine);
+ invalid.setData("import QtQuick 1.0; MouseArea { " + code.toUtf8() + " }", QUrl(""));
+ QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
+ obj = invalid.create();
+ QCOMPARE(invalid.errorString(), error);
+ delete obj;
+}
+
+void tst_QDeclarativeMouseArea::testQtQuick11Attributes_data()
+{
+ QTest::addColumn<QString>("code");
+ QTest::addColumn<QString>("warning");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("preventStealing") << "preventStealing: true"
+ << "QDeclarativeComponent: Component is not ready"
+ << ":1 \"MouseArea.preventStealing\" is not available in QtQuick 1.0.\n";
+}
+
QTEST_MAIN(tst_QDeclarativeMouseArea)
#include "tst_qdeclarativemousearea.moc"
diff --git a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp
index 7d746a7..e3a4723 100644
--- a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp
+++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp
@@ -76,6 +76,40 @@ void tst_QDeclarativePropertyMap::insert()
map.insert(QLatin1String("key1"),"Hello World");
QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World"));
+
+ //inserting property names same with existing method(signal, slot, method) names is not allowed
+ //QDeclarativePropertyMap has an invokable keys() method
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols. ");
+ map.insert(QLatin1String("keys"), 1);
+ QVERIFY(map.keys().count() == 2);
+ QVERIFY(!map.contains(QLatin1String("keys")));
+ QVERIFY(map.value(QLatin1String("keys")).isNull());
+
+ //QDeclarativePropertyMap has a deleteLater() slot
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols. ");
+ map.insert(QLatin1String("deleteLater"), 1);
+ QVERIFY(map.keys().count() == 2);
+ QVERIFY(!map.contains(QLatin1String("deleteLater")));
+ QVERIFY(map.value(QLatin1String("deleteLater")).isNull());
+
+ //QDeclarativePropertyMap has an valueChanged() signal
+ QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols. ");
+ map.insert(QLatin1String("valueChanged"), 1);
+ QVERIFY(map.keys().count() == 2);
+ QVERIFY(!map.contains(QLatin1String("valueChanged")));
+ QVERIFY(map.value(QLatin1String("valueChanged")).isNull());
+
+ //but 'valueChange' should be ok
+ map.insert(QLatin1String("valueChange"), 1);
+ QVERIFY(map.keys().count() == 3);
+ QVERIFY(map.contains(QLatin1String("valueChange")));
+ QCOMPARE(map.value(QLatin1String("valueChange")), QVariant(1));
+
+ //'valueCHANGED' should be ok, too
+ map.insert(QLatin1String("valueCHANGED"), 1);
+ QVERIFY(map.keys().count() == 4);
+ QVERIFY(map.contains(QLatin1String("valueCHANGED")));
+ QCOMPARE(map.value(QLatin1String("valueCHANGED")), QVariant(1));
}
void tst_QDeclarativePropertyMap::operatorInsert()
diff --git a/tests/auto/declarative/qdeclarativetext/data/qtbug_14734.qml b/tests/auto/declarative/qdeclarativetext/data/qtbug_14734.qml
new file mode 100644
index 0000000..bd07d66
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetext/data/qtbug_14734.qml
@@ -0,0 +1,10 @@
+import QtQuick 1.0
+
+Rectangle {
+ width: 640
+ height: 480
+
+ Text {
+ text: "í "
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index a3bba3b..dbb822b 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -109,6 +109,7 @@ private slots:
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
+ void qtbug_14734();
private:
QStringList standard;
QStringList richText;
@@ -1204,6 +1205,19 @@ void tst_qdeclarativetext::testQtQuick11Attributes_data()
<< "";
}
+void tst_qdeclarativetext::qtbug_14734()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/qtbug_14734.qml");
+ QVERIFY(canvas);
+
+ canvas->show();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas));
+
+ delete canvas;
+}
+
QTEST_MAIN(tst_qdeclarativetext)
#include "tst_qdeclarativetext.moc"
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/positionAt.qml b/tests/auto/declarative/qdeclarativetextedit/data/positionAt.qml
new file mode 100644
index 0000000..e010135
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/positionAt.qml
@@ -0,0 +1,9 @@
+import QtQuick 1.0
+
+TextEdit {
+ focus: true
+ objectName: "myInput"
+ width: 50
+ height: 25
+ text: "This is\n a long piece of text"
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 7d5101c..dc1063f 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -121,7 +121,10 @@ private slots:
void dragMouseSelection();
void inputMethodHints();
+ void positionAt();
+
void cursorDelegate();
+ void cursorVisible();
void delegateLoading_data();
void delegateLoading();
void navigation();
@@ -137,6 +140,10 @@ private slots:
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
+ void preeditMicroFocus();
+ void inputContextMouseHandler();
+ void inputMethodComposing();
+
private:
void simulateKey(QDeclarativeView *, int key);
QDeclarativeView *createView(const QString &filename);
@@ -1177,6 +1184,8 @@ void tst_qdeclarativetextedit::dragMouseSelection()
QVERIFY(str2.length() > 3);
QVERIFY(str1 != str2); // Verify the second press and drag is a new selection and doesn't not the first moved.
+
+ delete canvas;
}
void tst_qdeclarativetextedit::mouseSelectionMode_data()
@@ -1244,6 +1253,56 @@ void tst_qdeclarativetextedit::inputMethodHints()
delete canvas;
}
+void tst_qdeclarativetextedit::positionAt()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml");
+ QVERIFY(canvas->rootObject() != 0);
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+
+ QDeclarativeTextEdit *texteditObject = qobject_cast<QDeclarativeTextEdit *>(canvas->rootObject());
+ QVERIFY(texteditObject != 0);
+
+ QFontMetrics fm(texteditObject->font());
+ const int y0 = fm.height() / 2;
+ const int y1 = fm.height() * 3 / 2;
+
+ int pos = texteditObject->positionAt(texteditObject->width()/2, y0);
+ int diff = abs(int(fm.width(texteditObject->text().left(pos))-texteditObject->width()/2));
+
+ // some tollerance for different fonts.
+#ifdef Q_OS_LINUX
+ QVERIFY(diff < 2);
+#else
+ QVERIFY(diff < 5);
+#endif
+
+ const qreal x0 = texteditObject->positionToRectangle(pos).x();
+ const qreal x1 = texteditObject->positionToRectangle(pos + 1).x();
+
+ QString preeditText = texteditObject->text().mid(0, pos);
+ texteditObject->setText(texteditObject->text().mid(pos));
+ texteditObject->setCursorPosition(0);
+
+ QInputMethodEvent inputEvent(preeditText, QList<QInputMethodEvent::Attribute>());
+ QApplication::sendEvent(canvas, &inputEvent);
+
+ // Check all points within the preedit text return the same position.
+ QCOMPARE(texteditObject->positionAt(0, y0), 0);
+ QCOMPARE(texteditObject->positionAt(x0 / 2, y0), 0);
+ QCOMPARE(texteditObject->positionAt(x0, y0), 0);
+
+ // Verify positioning returns to normal after the preedit text.
+ QCOMPARE(texteditObject->positionAt(x1, y0), 1);
+ QCOMPARE(texteditObject->positionToRectangle(1).x(), x1);
+
+ QVERIFY(texteditObject->positionAt(x0 / 2, y1) > 0);
+
+ delete canvas;
+}
+
void tst_qdeclarativetextedit::cursorDelegate()
{
QDeclarativeView* view = createView(SRCDIR "/data/cursorTest.qml");
@@ -1272,6 +1331,76 @@ void tst_qdeclarativetextedit::cursorDelegate()
delete view;
}
+void tst_qdeclarativetextedit::cursorVisible()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ view.setFocus();
+
+ QDeclarativeTextEdit edit;
+ QSignalSpy spy(&edit, SIGNAL(cursorVisibleChanged(bool)));
+
+ QCOMPARE(edit.isCursorVisible(), false);
+
+ edit.setCursorVisible(true);
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 1);
+
+ edit.setCursorVisible(false);
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 2);
+
+ edit.setFocus(true);
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 2);
+
+ scene.addItem(&edit);
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 3);
+
+ edit.setFocus(false);
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 4);
+
+ edit.setFocus(true);
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 5);
+
+ scene.clearFocus();
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 6);
+
+ scene.setFocus();
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 7);
+
+ view.clearFocus();
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 8);
+
+ view.setFocus();
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 9);
+
+ // on mac, setActiveWindow(0) on mac does not deactivate the current application
+ // (you have to switch to a different app or hide the current app to trigger this)
+#if !defined(Q_WS_MAC)
+ QApplication::setActiveWindow(0);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(0));
+ QCOMPARE(edit.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 10);
+
+ QApplication::setActiveWindow(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ QCOMPARE(edit.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 11);
+#endif
+}
+
void tst_qdeclarativetextedit::delegateLoading_data()
{
QTest::addColumn<QString>("qmlfile");
@@ -1460,7 +1589,7 @@ QDeclarativeView *tst_qdeclarativetextedit::createView(const QString &filename)
class MyInputContext : public QInputContext
{
public:
- MyInputContext() : openInputPanelReceived(false), closeInputPanelReceived(false) {}
+ MyInputContext() : openInputPanelReceived(false), closeInputPanelReceived(false), updateReceived(false), eventType(QEvent::None) {}
~MyInputContext() {}
QString identifierName() { return QString(); }
@@ -1478,8 +1607,40 @@ public:
closeInputPanelReceived = true;
return QInputContext::filterEvent(event);
}
+
+ void update() { updateReceived = true; }
+
+ void sendPreeditText(const QString &text, int cursor)
+ {
+ QList<QInputMethodEvent::Attribute> attributes;
+ attributes.append(QInputMethodEvent::Attribute(
+ QInputMethodEvent::Cursor, cursor, text.length(), QVariant()));
+
+ QInputMethodEvent event(text, attributes);
+ sendEvent(event);
+ }
+
+ void mouseHandler(int x, QMouseEvent *event)
+ {
+ cursor = x;
+ eventType = event->type();
+ eventPosition = event->pos();
+ eventGlobalPosition = event->globalPos();
+ eventButton = event->button();
+ eventButtons = event->buttons();
+ eventModifiers = event->modifiers();
+ }
+
bool openInputPanelReceived;
bool closeInputPanelReceived;
+ bool updateReceived;
+ int cursor;
+ QEvent::Type eventType;
+ QPoint eventPosition;
+ QPoint eventGlobalPosition;
+ Qt::MouseButton eventButton;
+ Qt::MouseButtons eventButtons;
+ Qt::KeyboardModifiers eventModifiers;
};
void tst_qdeclarativetextedit::textInput()
@@ -1797,6 +1958,217 @@ void tst_qdeclarativetextedit::testQtQuick11Attributes_data()
<< ":1 \"TextEdit.onLinkActivated\" is not available in QtQuick 1.0.\n";
}
+void tst_qdeclarativetextedit::preeditMicroFocus()
+{
+ QString preeditText = "super";
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ QDeclarativeTextEdit edit;
+ edit.setFocus(true);
+ scene.addItem(&edit);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QRect currentRect;
+ QRect previousRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect();
+
+ // Verify that the micro focus rect is positioned the same for position 0 as
+ // it would be if there was no preedit text.
+ ic.updateReceived = false;
+ ic.sendPreeditText(preeditText, 0);
+ currentRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect();
+ QCOMPARE(currentRect, previousRect);
+#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+ QCOMPARE(ic.updateReceived, true);
+#endif
+
+ // Verify that the micro focus rect moves to the left as the cursor position
+ // is incremented.
+ for (int i = 1; i <= 5; ++i) {
+ ic.updateReceived = false;
+ ic.sendPreeditText(preeditText, i);
+ currentRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect();
+ QVERIFY(previousRect.left() < currentRect.left());
+#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+ QCOMPARE(ic.updateReceived, true);
+#endif
+ previousRect = currentRect;
+ }
+
+ // Verify that if there is no preedit cursor then the micro focus rect is the
+ // same as it would be if it were positioned at the end of the preedit text.
+ ic.sendPreeditText(preeditText, 0);
+ ic.updateReceived = false;
+ ic.sendEvent(QInputMethodEvent(preeditText, QList<QInputMethodEvent::Attribute>()));
+ currentRect = edit.inputMethodQuery(Qt::ImMicroFocus).toRect();
+ QCOMPARE(currentRect, previousRect);
+#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+ QCOMPARE(ic.updateReceived, true);
+#endif
+}
+
+void tst_qdeclarativetextedit::inputContextMouseHandler()
+{
+ QString text = "supercalifragisiticexpialidocious!";
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ QDeclarativeTextEdit edit;
+ edit.setPos(0, 0);
+ edit.setWidth(200);
+ edit.setText(text.mid(0, 12));
+ edit.setPos(0, 0);
+ edit.setCursorPosition(12);
+ edit.setFocus(true);
+ scene.addItem(&edit);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ view.setFocus();
+
+ QFontMetricsF fm(edit.font());
+ const qreal y = fm.height() / 2;
+
+ QPoint position2 = view.mapFromScene(edit.mapToScene(QPointF(fm.width(text.mid(0, 2)), y)));
+ QPoint position8 = view.mapFromScene(edit.mapToScene(QPointF(fm.width(text.mid(0, 8)), y)));
+ QPoint position20 = view.mapFromScene(edit.mapToScene(QPointF(fm.width(text.mid(0, 20)), y)));
+ QPoint position27 = view.mapFromScene(edit.mapToScene(QPointF(fm.width(text.mid(0, 27)), y)));
+ QPoint globalPosition2 = view.viewport()->mapToGlobal(position2);
+ QPoint globalposition8 = view.viewport()->mapToGlobal(position8);
+ QPoint globalposition20 = view.viewport()->mapToGlobal(position20);
+ QPoint globalposition27 = view.viewport()->mapToGlobal(position27);
+
+ ic.sendEvent(QInputMethodEvent(text.mid(12), QList<QInputMethodEvent::Attribute>()));
+
+ QTest::mouseDClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, position2);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonDblClick);
+ QCOMPARE(ic.eventPosition, position2);
+ QCOMPARE(ic.eventGlobalPosition, globalPosition2);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::NoModifier);
+ QVERIFY(ic.cursor < 0);
+ ic.eventType = QEvent::None;
+
+ QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, position2);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonPress);
+ QCOMPARE(ic.eventPosition, position2);
+ QCOMPARE(ic.eventGlobalPosition, globalPosition2);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::NoModifier);
+ QVERIFY(ic.cursor < 0);
+ ic.eventType = QEvent::None;
+
+ { QMouseEvent mv(QEvent::MouseMove, position8, globalposition8, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(view.viewport(), &mv); }
+ QCOMPARE(ic.eventType, QEvent::None);
+
+ { QMouseEvent mv(QEvent::MouseMove, position27, globalposition27, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(view.viewport(), &mv); }
+ QCOMPARE(ic.eventType, QEvent::MouseMove);
+ QCOMPARE(ic.eventPosition, position27);
+ QCOMPARE(ic.eventGlobalPosition, globalposition27);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::NoModifier);
+ QVERIFY(ic.cursor >= 14 && ic.cursor <= 16); // 15 is expected but some platforms may be off by one.
+ ic.eventType = QEvent::None;
+
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::NoModifier, position27);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonRelease);
+ QCOMPARE(ic.eventPosition, position27);
+ QCOMPARE(ic.eventGlobalPosition, globalposition27);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::NoModifier);
+ QVERIFY(ic.cursor >= 14 && ic.cursor <= 16);
+ ic.eventType = QEvent::None;
+
+ // And in the other direction.
+ QTest::mouseDClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, position27);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonDblClick);
+ QCOMPARE(ic.eventPosition, position27);
+ QCOMPARE(ic.eventGlobalPosition, globalposition27);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::ControlModifier);
+ QVERIFY(ic.cursor >= 14 && ic.cursor <= 16);
+ ic.eventType = QEvent::None;
+
+ QTest::mousePress(view.viewport(), Qt::RightButton, Qt::ControlModifier, position27);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonPress);
+ QCOMPARE(ic.eventPosition, position27);
+ QCOMPARE(ic.eventGlobalPosition, globalposition27);
+ QCOMPARE(ic.eventButton, Qt::RightButton);
+ QCOMPARE(ic.eventModifiers, Qt::ControlModifier);
+ QVERIFY(ic.cursor >= 14 && ic.cursor <= 16);
+ ic.eventType = QEvent::None;
+
+ { QMouseEvent mv(QEvent::MouseMove, position20, globalposition20, Qt::RightButton, Qt::RightButton,Qt::ControlModifier);
+ QApplication::sendEvent(view.viewport(), &mv); }
+ QCOMPARE(ic.eventType, QEvent::MouseMove);
+ QCOMPARE(ic.eventPosition, position20);
+ QCOMPARE(ic.eventGlobalPosition, globalposition20);
+ QCOMPARE(ic.eventButton, Qt::RightButton);
+ QCOMPARE(ic.eventModifiers, Qt::ControlModifier);
+ QVERIFY(ic.cursor >= 7 && ic.cursor <= 9);
+ ic.eventType = QEvent::None;
+
+ { QMouseEvent mv(QEvent::MouseMove, position2, globalPosition2, Qt::RightButton, Qt::RightButton,Qt::ControlModifier);
+ QApplication::sendEvent(view.viewport(), &mv); }
+ QCOMPARE(ic.eventType, QEvent::None);
+
+ QTest::mouseRelease(view.viewport(), Qt::RightButton, Qt::ControlModifier, position2);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonRelease);
+ QCOMPARE(ic.eventPosition, position2);
+ QCOMPARE(ic.eventGlobalPosition, globalPosition2);
+ QCOMPARE(ic.eventButton, Qt::RightButton);
+ QCOMPARE(ic.eventModifiers, Qt::ControlModifier);
+ QVERIFY(ic.cursor < 0);
+ ic.eventType = QEvent::None;
+}
+
+void tst_qdeclarativetextedit::inputMethodComposing()
+{
+ QString text = "supercalifragisiticexpialidocious!";
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ QDeclarativeTextEdit edit;
+ edit.setWidth(200);
+ edit.setText(text.mid(0, 12));
+ edit.setCursorPosition(12);
+ edit.setPos(0, 0);
+ edit.setFocus(true);
+ scene.addItem(&edit);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QSignalSpy spy(&edit, SIGNAL(inputMethodComposingChanged()));
+
+ QCOMPARE(edit.isInputMethodComposing(), false);
+
+ ic.sendEvent(QInputMethodEvent(text.mid(3), QList<QInputMethodEvent::Attribute>()));
+ QCOMPARE(edit.isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 1);
+
+ ic.sendEvent(QInputMethodEvent(text.mid(12), QList<QInputMethodEvent::Attribute>()));
+ QCOMPARE(edit.isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 1);
+
+ ic.sendEvent(QInputMethodEvent());
+ QCOMPARE(edit.isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 2);
+}
+
QTEST_MAIN(tst_qdeclarativetextedit)
#include "tst_qdeclarativetextedit.moc"
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index a6d30a5..ef64dd9 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -110,6 +110,8 @@ private slots:
void passwordCharacter();
void cursorDelegate();
+ void cursorVisible();
+ void cursorRectangle();
void navigation();
void copyAndPaste();
void readOnly();
@@ -125,6 +127,9 @@ private slots:
void testQtQuick11Attributes_data();
void preeditAutoScroll();
+ void preeditMicroFocus();
+ void inputContextMouseHandler();
+ void inputMethodComposing();
private:
void simulateKey(QDeclarativeView *, int key);
@@ -140,7 +145,8 @@ tst_qdeclarativetextinput::tst_qdeclarativetextinput()
standard << "the quick brown fox jumped over the lazy dog"
<< "It's supercalifragisiticexpialidocious!"
<< "Hello, world!"
- << "!dlrow ,olleH";
+ << "!dlrow ,olleH"
+ << " spacey text ";
colorStrings << "aliceblue"
<< "antiquewhite"
@@ -441,6 +447,9 @@ void tst_qdeclarativetextinput::moveCursorSelection_data()
QTest::addColumn<int>("selectionEnd");
QTest::addColumn<bool>("reversible");
+ // () contains the text selected by the cursor.
+ // <> contains the actual selection.
+
QTest::newRow("(t)he|characters")
<< standard[0] << 0 << 1 << QDeclarativeTextInput::SelectCharacters << 0 << 1 << true;
QTest::newRow("do(g)|characters")
@@ -578,6 +587,24 @@ void tst_qdeclarativetextinput::moveCursorSelection_data()
<< standard[3] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << true;
QTest::newRow("!<()>dlrow|words")
<< standard[3] << 1 << 1 << QDeclarativeTextInput::SelectWords << 1 << 1 << true;
+
+ QTest::newRow(" <s(pac)ey> text |words")
+ << standard[4] << 1 << 4 << QDeclarativeTextInput::SelectWords << 1 << 7 << true;
+ QTest::newRow(" spacey <t(ex)t> |words")
+ << standard[4] << 11 << 13 << QDeclarativeTextInput::SelectWords << 10 << 14 << false; // Should be reversible. QTBUG-11365
+ QTest::newRow("<( )>spacey text |words|ltr")
+ << standard[4] << 0 << 1 << QDeclarativeTextInput::SelectWords << 0 << 1 << false;
+ QTest::newRow("<( )spacey> text |words|rtl")
+ << standard[4] << 1 << 0 << QDeclarativeTextInput::SelectWords << 0 << 7 << false;
+ QTest::newRow("spacey <text( )>|words|ltr")
+ << standard[4] << 14 << 15 << QDeclarativeTextInput::SelectWords << 10 << 15 << false;
+// QTBUG-11365
+// QTest::newRow("spacey text<( )>|words|rtl")
+// << standard[4] << 15 << 14 << QDeclarativeTextInput::SelectWords << 14 << 15 << false;
+ QTest::newRow("<()> spacey text |words")
+ << standard[4] << 0 << 0 << QDeclarativeTextInput::SelectWords << 0 << 0 << false;
+ QTest::newRow(" spacey text <()>|words")
+ << standard[4] << 15 << 15 << QDeclarativeTextInput::SelectWords << 15 << 15 << false;
}
void tst_qdeclarativetextinput::moveCursorSelection()
@@ -624,6 +651,11 @@ void tst_qdeclarativetextinput::moveCursorSelectionSequence_data()
QTest::addColumn<int>("selection2Start");
QTest::addColumn<int>("selection2End");
+ // () contains the text selected by the cursor.
+ // <> contains the actual selection.
+ // ^ is the revised cursor position.
+ // {} contains the revised selection.
+
QTest::newRow("the {<quick( bro)wn> f^ox} jumped|ltr")
<< standard[0]
<< 9 << 13 << 17
@@ -736,6 +768,50 @@ void tst_qdeclarativetextinput::moveCursorSelectionSequence_data()
<< 11 << 9 << 5
<< 8 << 13
<< 1 << 13;
+
+ QTest::newRow("{<(^} sp)acey> text |ltr")
+ << standard[4]
+ << 0 << 3 << 0
+ << 0 << 7
+ << 0 << 0;
+ QTest::newRow("{<( ^}sp)acey> text |ltr")
+ << standard[4]
+ << 0 << 3 << 1
+ << 0 << 7
+ << 0 << 1;
+ QTest::newRow("<( {s^p)acey>} text |rtl")
+ << standard[4]
+ << 3 << 0 << 2
+ << 0 << 7
+ << 1 << 7;
+ QTest::newRow("<( {^sp)acey>} text |rtl")
+ << standard[4]
+ << 3 << 0 << 1
+ << 0 << 7
+ << 1 << 7;
+
+ QTest::newRow(" spacey <te(xt {^)>}|rtl")
+ << standard[4]
+ << 15 << 12 << 15
+ << 10 << 15
+ << 15 << 15;
+// QTBUG-11365
+// QTest::newRow(" spacey <te(xt{^ )>}|rtl")
+// << standard[4]
+// << 15 << 12 << 14
+// << 10 << 15
+// << 14 << 15;
+ QTest::newRow(" spacey {<te(x^t} )>|ltr")
+ << standard[4]
+ << 12 << 15 << 13
+ << 10 << 15
+ << 10 << 14;
+// QTBUG-11365
+// QTest::newRow(" spacey {<te(xt^} )>|ltr")
+// << standard[4]
+// << 12 << 15 << 14
+// << 10 << 15
+// << 10 << 14;
}
void tst_qdeclarativetextinput::moveCursorSelectionSequence()
@@ -952,6 +1028,10 @@ void tst_qdeclarativetextinput::positionAt()
QVERIFY(diff < 5);
#endif
+ int x = textinputObject->positionToRectangle(pos + 1).x() - 1;
+ QCOMPARE(textinputObject->positionAt(x, QDeclarativeTextInput::CursorBetweenCharacters), pos + 1);
+ QCOMPARE(textinputObject->positionAt(x, QDeclarativeTextInput::CursorOnCharacter), pos);
+
// Check without autoscroll...
textinputObject->setAutoScroll(false);
pos = textinputObject->positionAt(textinputObject->width()/2);
@@ -964,6 +1044,29 @@ void tst_qdeclarativetextinput::positionAt()
QVERIFY(diff < 5);
#endif
+ x = textinputObject->positionToRectangle(pos + 1).x() - 1;
+ QCOMPARE(textinputObject->positionAt(x, QDeclarativeTextInput::CursorBetweenCharacters), pos + 1);
+ QCOMPARE(textinputObject->positionAt(x, QDeclarativeTextInput::CursorOnCharacter), pos);
+
+ const qreal x0 = textinputObject->positionToRectangle(pos).x();
+ const qreal x1 = textinputObject->positionToRectangle(pos + 1).x();
+
+ QString preeditText = textinputObject->text().mid(0, pos);
+ textinputObject->setText(textinputObject->text().mid(pos));
+ textinputObject->setCursorPosition(0);
+
+ QInputMethodEvent inputEvent(preeditText, QList<QInputMethodEvent::Attribute>());
+ QApplication::sendEvent(canvas, &inputEvent);
+
+ // Check all points within the preedit text return the same position.
+ QCOMPARE(textinputObject->positionAt(0), 0);
+ QCOMPARE(textinputObject->positionAt(x0 / 2), 0);
+ QCOMPARE(textinputObject->positionAt(x0), 0);
+
+ // Verify positioning returns to normal after the preedit text.
+ QCOMPARE(textinputObject->positionAt(x1), 1);
+ QCOMPARE(textinputObject->positionToRectangle(1).x(), x1);
+
delete canvas;
}
@@ -1142,6 +1245,24 @@ void tst_qdeclarativetextinput::inputMethods()
QApplication::sendEvent(canvas, &event);
QCOMPARE(input->text(), QString("My Hello world!"));
+ input->setCursorPosition(2);
+ event.setCommitString("Your", -2, 2);
+ QApplication::sendEvent(canvas, &event);
+ QCOMPARE(input->text(), QString("Your Hello world!"));
+ QCOMPARE(input->cursorPosition(), 4);
+
+ input->setCursorPosition(7);
+ event.setCommitString("Goodbye", -2, 5);
+ QApplication::sendEvent(canvas, &event);
+ QCOMPARE(input->text(), QString("Your Goodbye world!"));
+ QCOMPARE(input->cursorPosition(), 12);
+
+ input->setCursorPosition(8);
+ event.setCommitString("Our", -8, 4);
+ QApplication::sendEvent(canvas, &event);
+ QCOMPARE(input->text(), QString("Our Goodbye world!"));
+ QCOMPARE(input->cursorPosition(), 7);
+
delete canvas;
}
@@ -1314,6 +1435,114 @@ void tst_qdeclarativetextinput::cursorDelegate()
delete view;
}
+void tst_qdeclarativetextinput::cursorVisible()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QDeclarativeTextInput input;
+ QSignalSpy spy(&input, SIGNAL(cursorVisibleChanged(bool)));
+
+ QCOMPARE(input.isCursorVisible(), false);
+
+ input.setCursorVisible(true);
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 1);
+
+ input.setCursorVisible(false);
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 2);
+
+ input.setFocus(true);
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 2);
+
+ scene.addItem(&input);
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 3);
+
+ input.setFocus(false);
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 4);
+
+ input.setFocus(true);
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 5);
+
+ scene.clearFocus();
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 6);
+
+ scene.setFocus();
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 7);
+
+ view.clearFocus();
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 8);
+
+ view.setFocus();
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 9);
+
+ // on mac, setActiveWindow(0) on mac does not deactivate the current application
+ // (you have to switch to a different app or hide the current app to trigger this)
+#if !defined(Q_WS_MAC)
+ QApplication::setActiveWindow(0);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(0));
+ QCOMPARE(input.isCursorVisible(), false);
+ QCOMPARE(spy.count(), 10);
+
+ QApplication::setActiveWindow(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+ QCOMPARE(input.isCursorVisible(), true);
+ QCOMPARE(spy.count(), 11);
+#endif
+}
+
+void tst_qdeclarativetextinput::cursorRectangle()
+{
+ QString text = "Hello World!";
+
+ QDeclarativeTextInput input;
+ input.setText(text);
+ QFontMetricsF fm(input.font());
+ input.setWidth(fm.width(text.mid(0, 5)));
+
+ QRect r;
+
+ for (int i = 0; i <= 5; ++i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+ int textWidth = fm.width(text.mid(0, i));
+
+ QVERIFY(r.left() < textWidth);
+ QVERIFY(r.right() > textWidth);
+ QCOMPARE(input.inputMethodQuery(Qt::ImMicroFocus).toRect(), r);
+ }
+
+ // Check the cursor rectangle remains within the input bounding rect when auto scrolling.
+ QVERIFY(r.left() < input.boundingRect().width());
+ QVERIFY(r.right() >= input.width());
+
+ for (int i = 6; i < text.length(); ++i) {
+ input.setCursorPosition(i);
+ QCOMPARE(r, input.cursorRectangle());
+ QCOMPARE(input.inputMethodQuery(Qt::ImMicroFocus).toRect(), r);
+ }
+
+ for (int i = text.length() - 2; i >= 0; --i) {
+ input.setCursorPosition(i);
+ r = input.cursorRectangle();
+ QVERIFY(r.right() >= 0);
+ QCOMPARE(input.inputMethodQuery(Qt::ImMicroFocus).toRect(), r);
+ }
+}
+
void tst_qdeclarativetextinput::readOnly()
{
QDeclarativeView *canvas = createView(SRCDIR "/data/readOnly.qml");
@@ -1419,7 +1648,7 @@ QDeclarativeView *tst_qdeclarativetextinput::createView(const QString &filename)
class MyInputContext : public QInputContext
{
public:
- MyInputContext() : openInputPanelReceived(false), closeInputPanelReceived(false) {}
+ MyInputContext() : openInputPanelReceived(false), closeInputPanelReceived(false), updateReceived(false), eventType(QEvent::None) {}
~MyInputContext() {}
QString identifierName() { return QString(); }
@@ -1438,6 +1667,19 @@ public:
return QInputContext::filterEvent(event);
}
+ void update() { updateReceived = true; }
+
+ void mouseHandler(int x, QMouseEvent *event)
+ {
+ cursor = x;
+ eventType = event->type();
+ eventPosition = event->pos();
+ eventGlobalPosition = event->globalPos();
+ eventButton = event->button();
+ eventButtons = event->buttons();
+ eventModifiers = event->modifiers();
+ }
+
void sendPreeditText(const QString &text, int cursor)
{
QList<QInputMethodEvent::Attribute> attributes;
@@ -1450,6 +1692,14 @@ public:
bool openInputPanelReceived;
bool closeInputPanelReceived;
+ bool updateReceived;
+ int cursor;
+ QEvent::Type eventType;
+ QPoint eventPosition;
+ QPoint eventGlobalPosition;
+ Qt::MouseButton eventButton;
+ Qt::MouseButtons eventButtons;
+ Qt::KeyboardModifiers eventModifiers;
};
void tst_qdeclarativetextinput::openInputPanelOnClick()
@@ -1747,7 +1997,8 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
MyInputContext ic;
view.setInputContext(&ic);
QDeclarativeTextInput input;
- input.setWidth(QFontMetricsF(input.font()).width(committedText));
+ QFontMetricsF fm(input.font());
+ input.setWidth(fm.width(committedText));
input.setText(committedText);
input.setPos(0, 0);
input.setFocus(true);
@@ -1760,7 +2011,7 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
// test the text is scrolled so the preedit is visible.
ic.sendPreeditText(preeditText.mid(0, 3), 1);
QVERIFY(input.positionAt(0) != 0);
- QCOMPARE(input.positionAt(input.width()), 8);
+ QVERIFY(input.cursorRectangle().left() < input.boundingRect().width());
// test the text is scrolled back when the preedit is removed.
ic.sendEvent(QInputMethodEvent());
@@ -1769,26 +2020,31 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
// test if the preedit is larger than the text input that the
// character preceding the cursor is still visible.
+ qreal x = input.positionToRectangle(0).x();
for (int i = 0; i < 3; ++i) {
ic.sendPreeditText(preeditText, i + 1);
- QCOMPARE(input.positionAt(0), 5 + i);
+ QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)));
+ QVERIFY(input.positionToRectangle(0).x() < x);
+ x = input.positionToRectangle(0).x();
}
for (int i = 1; i >= 0; --i) {
ic.sendPreeditText(preeditText, i + 1);
- QCOMPARE(input.positionAt(0), 5 + i);
+ QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)));
+ QVERIFY(input.positionToRectangle(0).x() > x);
+ x = input.positionToRectangle(0).x();
}
// Test incrementing the preedit cursor doesn't cause further
// scrolling when right most text is visible.
ic.sendPreeditText(preeditText, preeditText.length() - 3);
- int position = input.positionAt(0);
+ x = input.positionToRectangle(0).x();
for (int i = 2; i >= 0; --i) {
ic.sendPreeditText(preeditText, preeditText.length() - i);
- QCOMPARE(input.positionAt(0), position);
+ QCOMPARE(input.positionToRectangle(0).x(), x);
}
for (int i = 1; i < 3; ++i) {
ic.sendPreeditText(preeditText, preeditText.length() - i);
- QCOMPARE(input.positionAt(0), position);
+ QCOMPARE(input.positionToRectangle(0).x(), x);
}
// Test disabling auto scroll.
@@ -1800,6 +2056,217 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
QCOMPARE(input.positionAt(input.width()), 5);
}
+void tst_qdeclarativetextinput::preeditMicroFocus()
+{
+ QString preeditText = "super";
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ QDeclarativeTextInput input;
+ input.setPos(0, 0);
+ input.setAutoScroll(false);
+ input.setFocus(true);
+ scene.addItem(&input);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QRect currentRect;
+ QRect previousRect = input.inputMethodQuery(Qt::ImMicroFocus).toRect();
+
+ // Verify that the micro focus rect is positioned the same for position 0 as
+ // it would be if there was no preedit text.
+ ic.updateReceived = false;
+ ic.sendPreeditText(preeditText, 0);
+ currentRect = input.inputMethodQuery(Qt::ImMicroFocus).toRect();
+ QCOMPARE(currentRect, previousRect);
+#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+ QCOMPARE(ic.updateReceived, true);
+#endif
+
+ // Verify that the micro focus rect moves to the left as the cursor position
+ // is incremented.
+ for (int i = 1; i <= 5; ++i) {
+ ic.updateReceived = false;
+ ic.sendPreeditText(preeditText, i);
+ currentRect = input.inputMethodQuery(Qt::ImMicroFocus).toRect();
+ QVERIFY(previousRect.left() < currentRect.left());
+#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+ QCOMPARE(ic.updateReceived, true);
+#endif
+ previousRect = currentRect;
+ }
+
+ // Verify that if there is no preedit cursor then the micro focus rect is the
+ // same as it would be if it were positioned at the end of the preedit text.
+ ic.sendPreeditText(preeditText, 0);
+ ic.updateReceived = false;
+ ic.sendEvent(QInputMethodEvent(preeditText, QList<QInputMethodEvent::Attribute>()));
+ currentRect = input.inputMethodQuery(Qt::ImMicroFocus).toRect();
+ QCOMPARE(currentRect, previousRect);
+#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+ QCOMPARE(ic.updateReceived, true);
+#endif
+}
+
+void tst_qdeclarativetextinput::inputContextMouseHandler()
+{
+ QString text = "supercalifragisiticexpialidocious!";
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ QDeclarativeTextInput input;
+ input.setWidth(200);
+ input.setText(text.mid(0, 12));
+ input.setCursorPosition(12);
+ input.setPos(0, 0);
+ input.setFocus(true);
+ scene.addItem(&input);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QFontMetricsF fm(input.font());
+ const qreal y = fm.height() / 2;
+
+ QPoint position2 = view.mapFromScene(input.mapToScene(QPointF(fm.width(text.mid(0, 2)), y)));
+ QPoint position8 = view.mapFromScene(input.mapToScene(QPointF(fm.width(text.mid(0, 8)), y)));
+ QPoint position20 = view.mapFromScene(input.mapToScene(QPointF(fm.width(text.mid(0, 20)), y)));
+ QPoint position27 = view.mapFromScene(input.mapToScene(QPointF(fm.width(text.mid(0, 27)), y)));
+ QPoint globalPosition2 = view.viewport()->mapToGlobal(position2);
+ QPoint globalposition8 = view.viewport()->mapToGlobal(position8);
+ QPoint globalposition20 = view.viewport()->mapToGlobal(position20);
+ QPoint globalposition27 = view.viewport()->mapToGlobal(position27);
+
+ ic.sendEvent(QInputMethodEvent(text.mid(12), QList<QInputMethodEvent::Attribute>()));
+
+ QTest::mouseDClick(view.viewport(), Qt::LeftButton, Qt::NoModifier, position2);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonDblClick);
+ QCOMPARE(ic.eventPosition, position2);
+ QCOMPARE(ic.eventGlobalPosition, globalPosition2);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::NoModifier);
+ QVERIFY(ic.cursor < 0);
+ ic.eventType = QEvent::None;
+
+ QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::NoModifier, position2);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonPress);
+ QCOMPARE(ic.eventPosition, position2);
+ QCOMPARE(ic.eventGlobalPosition, globalPosition2);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::NoModifier);
+ QVERIFY(ic.cursor < 0);
+ ic.eventType = QEvent::None;
+
+ { QMouseEvent mv(QEvent::MouseMove, position8, globalposition8, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(view.viewport(), &mv); }
+ QCOMPARE(ic.eventType, QEvent::None);
+
+ { QMouseEvent mv(QEvent::MouseMove, position27, globalposition27, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(view.viewport(), &mv); }
+ QCOMPARE(ic.eventType, QEvent::MouseMove);
+ QCOMPARE(ic.eventPosition, position27);
+ QCOMPARE(ic.eventGlobalPosition, globalposition27);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::NoModifier);
+ QVERIFY(ic.cursor >= 14 && ic.cursor <= 16); // 15 is expected but some platforms may be off by one.
+ ic.eventType = QEvent::None;
+
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::NoModifier, position27);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonRelease);
+ QCOMPARE(ic.eventPosition, position27);
+ QCOMPARE(ic.eventGlobalPosition, globalposition27);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::NoModifier);
+ QVERIFY(ic.cursor >= 14 && ic.cursor <= 16);
+ ic.eventType = QEvent::None;
+
+ // And in the other direction.
+ QTest::mouseDClick(view.viewport(), Qt::LeftButton, Qt::ControlModifier, position27);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonDblClick);
+ QCOMPARE(ic.eventPosition, position27);
+ QCOMPARE(ic.eventGlobalPosition, globalposition27);
+ QCOMPARE(ic.eventButton, Qt::LeftButton);
+ QCOMPARE(ic.eventModifiers, Qt::ControlModifier);
+ QVERIFY(ic.cursor >= 14 && ic.cursor <= 16);
+ ic.eventType = QEvent::None;
+
+ QTest::mousePress(view.viewport(), Qt::RightButton, Qt::ControlModifier, position27);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonPress);
+ QCOMPARE(ic.eventPosition, position27);
+ QCOMPARE(ic.eventGlobalPosition, globalposition27);
+ QCOMPARE(ic.eventButton, Qt::RightButton);
+ QCOMPARE(ic.eventModifiers, Qt::ControlModifier);
+ QVERIFY(ic.cursor >= 14 && ic.cursor <= 16);
+ ic.eventType = QEvent::None;
+
+ { QMouseEvent mv(QEvent::MouseMove, position20, globalposition20, Qt::RightButton, Qt::RightButton,Qt::ControlModifier);
+ QApplication::sendEvent(view.viewport(), &mv); }
+ QCOMPARE(ic.eventType, QEvent::MouseMove);
+ QCOMPARE(ic.eventPosition, position20);
+ QCOMPARE(ic.eventGlobalPosition, globalposition20);
+ QCOMPARE(ic.eventButton, Qt::RightButton);
+ QCOMPARE(ic.eventModifiers, Qt::ControlModifier);
+ QVERIFY(ic.cursor >= 7 && ic.cursor <= 9);
+ ic.eventType = QEvent::None;
+
+ { QMouseEvent mv(QEvent::MouseMove, position2, globalPosition2, Qt::RightButton, Qt::RightButton,Qt::ControlModifier);
+ QApplication::sendEvent(view.viewport(), &mv); }
+ QCOMPARE(ic.eventType, QEvent::None);
+
+ QTest::mouseRelease(view.viewport(), Qt::RightButton, Qt::ControlModifier, position2);
+ QCOMPARE(ic.eventType, QEvent::MouseButtonRelease);
+ QCOMPARE(ic.eventPosition, position2);
+ QCOMPARE(ic.eventGlobalPosition, globalPosition2);
+ QCOMPARE(ic.eventButton, Qt::RightButton);
+ QCOMPARE(ic.eventModifiers, Qt::ControlModifier);
+ QVERIFY(ic.cursor < 0);
+ ic.eventType = QEvent::None;
+}
+
+void tst_qdeclarativetextinput::inputMethodComposing()
+{
+ QString text = "supercalifragisiticexpialidocious!";
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ MyInputContext ic;
+ view.setInputContext(&ic);
+ QDeclarativeTextInput input;
+ input.setWidth(200);
+ input.setText(text.mid(0, 12));
+ input.setCursorPosition(12);
+ input.setPos(0, 0);
+ input.setFocus(true);
+ scene.addItem(&input);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view));
+
+ QSignalSpy spy(&input, SIGNAL(inputMethodComposingChanged()));
+
+ QCOMPARE(input.isInputMethodComposing(), false);
+
+ ic.sendEvent(QInputMethodEvent(text.mid(3), QList<QInputMethodEvent::Attribute>()));
+ QCOMPARE(input.isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 1);
+
+ ic.sendEvent(QInputMethodEvent(text.mid(12), QList<QInputMethodEvent::Attribute>()));
+ QCOMPARE(input.isInputMethodComposing(), true);
+ QCOMPARE(spy.count(), 1);
+
+ ic.sendEvent(QInputMethodEvent());
+ QCOMPARE(input.isInputMethodComposing(), false);
+ QCOMPARE(spy.count(), 2);
+}
+
QTEST_MAIN(tst_qdeclarativetextinput)
#include "tst_qdeclarativetextinput.moc"
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_error_onCall.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_error_onCall.js
new file mode 100644
index 0000000..f589b0e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script_error_onCall.js
@@ -0,0 +1,6 @@
+WorkerScript.onMessage = function(msg) {
+ var a = 123
+ var b = 345
+ var f = getData()
+}
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_error_onLoad.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_error_onLoad.js
new file mode 100644
index 0000000..1d6eab2
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script_error_onLoad.js
@@ -0,0 +1,5 @@
+WorkerScript.onMessage = function(msg) {
+ var a = 123
+ aoij awef aljfaow eij
+}
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker_error_onCall.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_error_onCall.qml
new file mode 100644
index 0000000..90c4617
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_error_onCall.qml
@@ -0,0 +1,6 @@
+import QtQuick 1.0
+
+BaseWorker {
+ source: "script_error_onCall.js"
+}
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker_error_onLoad.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_error_onLoad.qml
new file mode 100644
index 0000000..0b9d21d
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_error_onLoad.qml
@@ -0,0 +1,7 @@
+import QtQuick 1.0
+
+BaseWorker {
+ source: "script_error_onLoad.js"
+}
+
+
diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
index aaedd82..4b922fb 100644
--- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
+++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp
@@ -41,6 +41,8 @@
#include <qtest.h>
#include <QtCore/qdebug.h>
#include <QtCore/qtimer.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfileinfo.h>
#include <QtScript/qscriptengine.h>
#include <QtDeclarative/qdeclarativecomponent.h>
@@ -58,6 +60,13 @@ Q_DECLARE_METATYPE(QScriptValue)
#define SRCDIR "."
#endif
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename));
+}
+
+
class tst_QDeclarativeWorkerScript : public QObject
{
Q_OBJECT
@@ -70,6 +79,8 @@ private slots:
void messaging_sendQObjectList();
void messaging_sendJsObject();
void script_with_pragma();
+ void scriptError_onLoad();
+ void scriptError_onCall();
private:
void waitForEchoMessage(QDeclarativeWorkerScript *worker) {
@@ -215,6 +226,47 @@ void tst_QDeclarativeWorkerScript::script_with_pragma()
delete worker;
}
+static QString qdeclarativeworkerscript_lastWarning;
+static void qdeclarativeworkerscript_warningsHandler(QtMsgType type, const char *msg)
+{
+ if (type == QtWarningMsg)
+ qdeclarativeworkerscript_lastWarning = QString::fromUtf8(msg);
+}
+
+void tst_QDeclarativeWorkerScript::scriptError_onLoad()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_error_onLoad.qml");
+
+ QtMsgHandler previousMsgHandler = qInstallMsgHandler(qdeclarativeworkerscript_warningsHandler);
+ QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QTRY_COMPARE(qdeclarativeworkerscript_lastWarning,
+ TEST_FILE("data/script_error_onLoad.js").toString() + QLatin1String(":3: SyntaxError: Parse error"));
+
+ qInstallMsgHandler(previousMsgHandler);
+ qApp->processEvents();
+ delete worker;
+}
+
+void tst_QDeclarativeWorkerScript::scriptError_onCall()
+{
+ QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_error_onCall.qml");
+ QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create());
+ QVERIFY(worker != 0);
+
+ QtMsgHandler previousMsgHandler = qInstallMsgHandler(qdeclarativeworkerscript_warningsHandler);
+ QVariant value;
+ QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value)));
+
+ QTRY_COMPARE(qdeclarativeworkerscript_lastWarning,
+ TEST_FILE("data/script_error_onCall.js").toString() + QLatin1String(":4: ReferenceError: Can't find variable: getData"));
+
+ qInstallMsgHandler(previousMsgHandler);
+ qApp->processEvents();
+ delete worker;
+}
+
QTEST_MAIN(tst_QDeclarativeWorkerScript)
diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
index 19d7967..af54008 100644
--- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp
@@ -569,6 +569,11 @@ void tst_qdeclarativexmllistmodel::reload()
QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int)));
QSignalSpy spyCount(model, SIGNAL(countChanged()));
+ //reload multiple times to test the xml query aborting
+ model->reload();
+ model->reload();
+ QCoreApplication::processEvents();
+ model->reload();
model->reload();
QTRY_COMPARE(spyCount.count(), 1);
QTRY_COMPARE(spyInsert.count(), 1);
@@ -839,9 +844,27 @@ void tst_qdeclarativexmllistmodel::threading()
data3 += "name=C" + QString::number(i) + ",age=3" + QString::number(i) + ",sport=Curling;";
}
+ //Set the xml data multiple times with randomized order and mixed with multiple event loops
+ //to test the xml query reloading/aborting, the result should be stable.
+ m1->setXml(makeItemXmlAndData(data1));
+ m2->setXml(makeItemXmlAndData(data2));
+ m3->setXml(makeItemXmlAndData(data3));
+ QCoreApplication::processEvents();
+ m2->setXml(makeItemXmlAndData(data2));
m1->setXml(makeItemXmlAndData(data1));
m2->setXml(makeItemXmlAndData(data2));
+ QCoreApplication::processEvents();
+ m3->setXml(makeItemXmlAndData(data3));
+ QCoreApplication::processEvents();
+ m2->setXml(makeItemXmlAndData(data2));
+ m1->setXml(makeItemXmlAndData(data1));
+ m2->setXml(makeItemXmlAndData(data2));
+ m3->setXml(makeItemXmlAndData(data3));
+ QCoreApplication::processEvents();
+ m2->setXml(makeItemXmlAndData(data2));
+ m3->setXml(makeItemXmlAndData(data3));
m3->setXml(makeItemXmlAndData(data3));
+ QCoreApplication::processEvents();
QTRY_VERIFY(m1->count() == dataCount && m2->count() == dataCount && m3->count() == dataCount);
diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro
index 07dc5ef..186f00c 100644
--- a/tests/auto/gui.pro
+++ b/tests/auto/gui.pro
@@ -112,6 +112,7 @@ SUBDIRS=\
qmimedata \
qmouseevent_modal \
qmovie \
+ qvolatileimage \
qnetworkaccessmanager_and_qprogressdialog \
qnetworkcachemetadata \
qnetworkdiskcache \
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index 20fade1..203f0ae 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -493,7 +493,12 @@ private slots:
void QTBUG5590_dummyProperty();
void QTBUG12260_defaultTemplate();
void notifyError();
+ void QTBUG17635_invokableAndProperty();
void revisions();
+ void warnings_data();
+ void warnings();
+
+
signals:
void sigWithUnsignedArg(unsigned foo);
void sigWithSignedArg(signed foo);
@@ -1386,6 +1391,31 @@ void tst_Moc::notifyError()
#endif
}
+class QTBUG_17635_InvokableAndProperty : public QObject
+{
+ Q_OBJECT
+public:
+ Q_PROPERTY(int numberOfEggs READ numberOfEggs)
+ Q_PROPERTY(int numberOfChickens READ numberOfChickens)
+ Q_INVOKABLE QString getEgg(int index) { return QString::fromLatin1("Egg"); }
+ Q_INVOKABLE QString getChicken(int index) { return QString::fromLatin1("Chicken"); }
+ int numberOfEggs() { return 2; }
+ int numberOfChickens() { return 4; }
+};
+
+void tst_Moc::QTBUG17635_invokableAndProperty()
+{
+ //Moc used to fail parsing Q_INVOKABLE if they were dirrectly following a Q_PROPERTY;
+ QTBUG_17635_InvokableAndProperty mc;
+ QString val;
+ QMetaObject::invokeMethod(&mc, "getEgg", Q_RETURN_ARG(QString, val), Q_ARG(int, 10));
+ QCOMPARE(val, QString::fromLatin1("Egg"));
+ QMetaObject::invokeMethod(&mc, "getChicken", Q_RETURN_ARG(QString, val), Q_ARG(int, 10));
+ QCOMPARE(val, QString::fromLatin1("Chicken"));
+ QVERIFY(mc.metaObject()->indexOfProperty("numberOfEggs") != -1);
+ QVERIFY(mc.metaObject()->indexOfProperty("numberOfChickens") != -1);
+}
+
// If changed, update VersionTestNotify below
class VersionTest : public QObject
{
@@ -1498,8 +1528,126 @@ void tst_Moc::revisions()
revisions_T<VersionTestNotify>();
}
-QTEST_APPLESS_MAIN(tst_Moc)
-#include "tst_moc.moc"
+void tst_Moc::warnings_data()
+{
+ QTest::addColumn<QByteArray>("input");
+ QTest::addColumn<QStringList>("args");
+ QTest::addColumn<int>("exitCode");
+ QTest::addColumn<QString>("expectedStdOut");
+ QTest::addColumn<QString>("expectedStdErr");
+
+ // empty input should result in "no relevant classes" note
+ QTest::newRow("No relevant classes")
+ << QByteArray(" ")
+ << QStringList()
+ << 0
+ << QString()
+ << QString("standard input:0: Note: No relevant classes found. No output generated.");
+
+ // passing "-nn" should suppress "no relevant classes" note
+ QTest::newRow("-nn")
+ << QByteArray(" ")
+ << (QStringList() << "-nn")
+ << 0
+ << QString()
+ << QString();
+
+ // passing "-nw" should also suppress "no relevant classes" note
+ QTest::newRow("-nw")
+ << QByteArray(" ")
+ << (QStringList() << "-nw")
+ << 0
+ << QString()
+ << QString();
+
+ // This should output a warning
+ QTest::newRow("Invalid property warning")
+ << QByteArray("class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };")
+ << QStringList()
+ << 0
+ << QString("IGNORE_ALL_STDOUT")
+ << QString("standard input:1: Warning: Property declaration x has no READ accessor function. The property will be invalid.");
+
+ // Passing "-nn" should NOT suppress the warning
+ QTest::newRow("Invalid property warning")
+ << QByteArray("class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };")
+ << (QStringList() << "-nn")
+ << 0
+ << QString("IGNORE_ALL_STDOUT")
+ << QString("standard input:1: Warning: Property declaration x has no READ accessor function. The property will be invalid.");
+
+ // Passing "-nw" should suppress the warning
+ QTest::newRow("Invalid property warning")
+ << QByteArray("class X : public QObject { Q_OBJECT Q_PROPERTY(int x) };")
+ << (QStringList() << "-nw")
+ << 0
+ << QString("IGNORE_ALL_STDOUT")
+ << QString();
+
+ // This should output an error
+ QTest::newRow("Does not inherit QObject")
+ << QByteArray("class X { Q_OBJECT };")
+ << QStringList()
+ << 1
+ << QString()
+ << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject");
+
+ // "-nn" should not suppress the error
+ QTest::newRow("Does not inherit QObject with -nn")
+ << QByteArray("class X { Q_OBJECT };")
+ << (QStringList() << "-nn")
+ << 1
+ << QString()
+ << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject");
+
+ // "-nw" should not suppress the error
+ QTest::newRow("Does not inherit QObject with -nn")
+ << QByteArray("class X { Q_OBJECT };")
+ << (QStringList() << "-nw")
+ << 1
+ << QString()
+ << QString("standard input:1: Error: Class contains Q_OBJECT macro but does not inherit from QObject");
+}
+
+void tst_Moc::warnings()
+{
+#ifdef MOC_CROSS_COMPILED
+ QSKIP("Not tested when cross-compiled", SkipAll);
+#endif
+ QFETCH(QByteArray, input);
+ QFETCH(QStringList, args);
+ QFETCH(int, exitCode);
+ QFETCH(QString, expectedStdOut);
+ QFETCH(QString, expectedStdErr);
+
+#ifdef Q_CC_MSVC
+ // for some reasons, moc compiled with MSVC uses a different output format
+ QRegExp lineNumberRe(":(\\d+):");
+ lineNumberRe.setMinimal(true);
+ expectedStdErr.replace(lineNumberRe, "(\\1):");
+#endif
+
+ QProcess proc;
+ proc.start("moc", args);
+ QVERIFY(proc.waitForStarted());
+ QCOMPARE(proc.write(input), qint64(input.size()));
+
+ proc.closeWriteChannel();
+
+ QVERIFY(proc.waitForFinished());
+
+ QCOMPARE(proc.exitCode(), exitCode);
+ QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
+
+ // magic value "IGNORE_ALL_STDOUT" ignores stdout
+ if (expectedStdOut != "IGNORE_ALL_STDOUT")
+ QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardOutput()).trimmed(), expectedStdOut);
+ QCOMPARE(QString::fromLocal8Bit(proc.readAllStandardError()).trimmed(), expectedStdErr);
+
+ }
+
+QTEST_APPLESS_MAIN(tst_Moc)
+#include "tst_moc.moc"
diff --git a/tests/auto/network.pro b/tests/auto/network.pro
index 7d83054..b427f1c 100644
--- a/tests/auto/network.pro
+++ b/tests/auto/network.pro
@@ -35,6 +35,8 @@ SUBDIRS=\
qsslerror \
qsslkey \
qsslsocket \
+ qsslsocket_onDemandCertificates_member \
+ qsslsocket_onDemandCertificates_static \
# qnetworkproxyfactory \ # Uses a hardcoded proxy configuration
!contains(QT_CONFIG, private_tests): SUBDIRS -= \
diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp
index cfcafc0..64de64a 100644
--- a/tests/auto/networkselftest/tst_networkselftest.cpp
+++ b/tests/auto/networkselftest/tst_networkselftest.cpp
@@ -967,7 +967,7 @@ void tst_NetworkSelfTest::smbServer()
QVERIFY2(f, qt_error_string().toLocal8Bit());
char buf[128];
- size_t ret = fread(buf, sizeof buf, 1, f);
+ size_t ret = fread(buf, 1, sizeof buf, f);
fclose(f);
QCOMPARE(ret, strlen(contents));
diff --git a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
index 6331db7..db0d0a7 100644
--- a/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
+++ b/tests/auto/qabstractnetworkcache/tst_qabstractnetworkcache.cpp
@@ -331,7 +331,7 @@ void tst_QAbstractNetworkCache::checkSynchronous()
QNetworkRequest request(realUrl);
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(QNetworkRequest::DownloadBufferAttribute + 1),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
// prime the cache
diff --git a/tests/auto/qclipboard/tst_qclipboard.cpp b/tests/auto/qclipboard/tst_qclipboard.cpp
index c05bbac..7840974 100644
--- a/tests/auto/qclipboard/tst_qclipboard.cpp
+++ b/tests/auto/qclipboard/tst_qclipboard.cpp
@@ -205,7 +205,7 @@ void tst_QClipboard::testSignals()
void tst_QClipboard::copy_exit_paste()
{
#ifndef QT_NO_PROCESS
-#if defined Q_WS_X11 || defined Q_WS_QWS
+#if defined Q_WS_X11 || defined Q_WS_QWS || defined (Q_WS_QPA)
QSKIP("This test does not make sense on X11 and embedded, copied data disappears from the clipboard when the application exits ", SkipAll);
// ### It's still possible to test copy/paste - just keep the apps running
#elif defined (Q_OS_SYMBIAN) && defined (Q_CC_NOKIAX86)
diff --git a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
index c1938b1..39f0677 100644
--- a/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
+++ b/tests/auto/qdbusinterface/tst_qdbusinterface.cpp
@@ -169,6 +169,25 @@ public slots:
int MyObject::callCount = 0;
QVariantList MyObject::callArgs;
+class MyObjectUnknownType: public QObject
+{
+ Q_OBJECT
+ Q_CLASSINFO("D-Bus Interface", "com.trolltech.QtDBus.MyObject")
+ Q_CLASSINFO("D-Bus Introspection", ""
+" <interface name=\"com.trolltech.QtDBus.MyObjectUnknownTypes\" >\n"
+" <property access=\"readwrite\" type=\"~\" name=\"prop1\" />\n"
+" <signal name=\"somethingHappened\" >\n"
+" <arg direction=\"out\" type=\"~\" />\n"
+" </signal>\n"
+" <method name=\"ping\" >\n"
+" <arg direction=\"in\" type=\"~\" name=\"ping\" />\n"
+" <arg direction=\"out\" type=\"~\" name=\"ping\" />\n"
+" </method>\n"
+" <method name=\"regularMethod\" />\n"
+" </interface>\n"
+ "")
+};
+
class Spy: public QObject
{
Q_OBJECT
@@ -228,6 +247,7 @@ private slots:
void notValidDerived();
void invalidAfterServiceOwnerChanged();
void introspect();
+ void introspectUnknownTypes();
void callMethod();
void invokeMethod();
void invokeMethodWithReturn();
@@ -250,8 +270,7 @@ void tst_QDBusInterface::initTestCase()
con.registerObject("/", &obj, QDBusConnection::ExportAllProperties
| QDBusConnection::ExportAllSlots
- | QDBusConnection::ExportAllInvokables
- | QDBusConnection::ExportChildObjects);
+ | QDBusConnection::ExportAllInvokables);
}
void tst_QDBusInterface::notConnected()
@@ -322,6 +341,27 @@ void tst_QDBusInterface::introspect()
QVERIFY(mo->indexOfProperty("complexProp") != -1);
}
+void tst_QDBusInterface::introspectUnknownTypes()
+{
+ QDBusConnection con = QDBusConnection::sessionBus();
+ MyObjectUnknownType obj;
+ con.registerObject("/unknownTypes", &obj, QDBusConnection::ExportAllContents);
+ QDBusInterface iface(QDBusConnection::sessionBus().baseService(), QLatin1String("/unknownTypes"),
+ "com.trolltech.QtDBus.MyObjectUnknownTypes");
+
+ const QMetaObject *mo = iface.metaObject();
+ QVERIFY(mo->indexOfMethod("regularMethod()") != -1); // this is the control
+ QVERIFY(mo->indexOfMethod("somethingHappened(QDBusRawType<0x7e>*)") != -1);
+
+ QVERIFY(mo->indexOfMethod("ping(QDBusRawType<0x7e>*)") != -1);
+ int midx = mo->indexOfMethod("ping(QDBusRawType<0x7e>*)");
+ QCOMPARE(mo->method(midx).typeName(), "QDBusRawType<0x7e>*");
+
+ QVERIFY(mo->indexOfProperty("prop1") != -1);
+ int pidx = mo->indexOfProperty("prop1");
+ QCOMPARE(mo->property(pidx).typeName(), "QDBusRawType<0x7e>*");
+}
+
void tst_QDBusInterface::callMethod()
{
QDBusConnection con = QDBusConnection::sessionBus();
diff --git a/tests/auto/qdbusmarshall/test/test.pro b/tests/auto/qdbusmarshall/test/test.pro
index 8901999..71fc656 100644
--- a/tests/auto/qdbusmarshall/test/test.pro
+++ b/tests/auto/qdbusmarshall/test/test.pro
@@ -5,4 +5,5 @@ TARGET = ../tst_qdbusmarshall
QT = core
QT += dbus
-
+LIBS += $$QT_LIBS_DBUS
+QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS
diff --git a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
index c05e49c..9bae6af 100644
--- a/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
+++ b/tests/auto/qdbusmarshall/tst_qdbusmarshall.cpp
@@ -38,7 +38,6 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#define DBUS_API_SUBJECT_TO_CHANGE
#include <QtCore/QtCore>
#include <QtTest/QtTest>
#include <QtDBus/QtDBus>
@@ -47,6 +46,8 @@
#include "common.h"
#include <limits>
+#include <dbus/dbus.h>
+
static const char serviceName[] = "com.trolltech.autotests.qpong";
static const char objectPath[] = "/com/trolltech/qpong";
static const char *interfaceName = serviceName;
@@ -88,66 +89,59 @@ private slots:
void sendCallErrors_data();
void sendCallErrors();
+ void receiveUnknownType_data();
+ void receiveUnknownType();
+
private:
QProcess proc;
};
-struct UnregisteredType { };
-Q_DECLARE_METATYPE(UnregisteredType)
-
-class WaitForQPong: public QObject
+class QDBusMessageSpy: public QObject
{
Q_OBJECT
-public:
- WaitForQPong();
- bool ok();
-public Q_SLOTS:
- void ownerChange(const QString &name)
+public slots:
+ Q_SCRIPTABLE int theSlot(const QDBusMessage &msg)
{
- if (name == serviceName)
- loop.quit();
+ list << msg;
+ return 42;
}
-
-private:
- QEventLoop loop;
+public:
+ QList<QDBusMessage> list;
};
-WaitForQPong::WaitForQPong()
-{
- QDBusConnection con = QDBusConnection::sessionBus();
- if (!ok()) {
- connect(con.interface(), SIGNAL(serviceOwnerChanged(QString,QString,QString)),
- SLOT(ownerChange(QString)));
- QTimer::singleShot(2000, &loop, SLOT(quit()));
- loop.exec();
- }
-}
-
-bool WaitForQPong::ok()
-{
- return QDBusConnection::sessionBus().isConnected() &&
- QDBusConnection::sessionBus().interface()->isServiceRegistered(serviceName);
-}
+struct UnregisteredType { };
+Q_DECLARE_METATYPE(UnregisteredType)
void tst_QDBusMarshall::initTestCase()
{
commonInit();
+ QDBusConnection con = QDBusConnection::sessionBus();
#ifdef Q_OS_WIN
proc.start("qpong");
#else
proc.start("./qpong/qpong");
#endif
- QVERIFY(proc.waitForStarted());
-
- WaitForQPong w;
- QVERIFY(w.ok());
- //QTest::qWait(2000);
+ if (!QDBusConnection::sessionBus().interface()->isServiceRegistered(serviceName)) {
+ QVERIFY(proc.waitForStarted());
+
+ QVERIFY(con.isConnected());
+ con.connect("org.freedesktop.DBus", QString(), "org.freedesktop.DBus", "NameOwnerChanged",
+ QStringList() << serviceName << QString(""), QString(),
+ &QTestEventLoop::instance(), SLOT(exitLoop()));
+ QTestEventLoop::instance().enterLoop(2);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(QDBusConnection::sessionBus().interface()->isServiceRegistered(serviceName));
+ con.disconnect("org.freedesktop.DBus", QString(), "org.freedesktop.DBus", "NameOwnerChanged",
+ QStringList() << serviceName << QString(""), QString(),
+ &QTestEventLoop::instance(), SLOT(exitLoop()));
+ }
}
void tst_QDBusMarshall::cleanupTestCase()
{
proc.close();
- proc.kill();
+ proc.terminate();
+ proc.waitForFinished(200);
}
void tst_QDBusMarshall::sendBasic_data()
@@ -700,6 +694,8 @@ void tst_QDBusMarshall::sendBasic()
msg << value;
QDBusMessage reply = con.call(msg);
+ QVERIFY2(reply.type() == QDBusMessage::ReplyMessage,
+ qPrintable(reply.errorName() + ": " + reply.errorMessage()));
//qDebug() << reply;
QCOMPARE(reply.arguments().count(), msg.arguments().count());
@@ -938,5 +934,145 @@ void tst_QDBusMarshall::sendCallErrors()
QCOMPARE(reply.errorMessage(), errorMsg);
}
+void tst_QDBusMarshall::receiveUnknownType_data()
+{
+ QTest::addColumn<int>("receivedTypeId");
+ QTest::newRow("in-call") << qMetaTypeId<void*>();
+ QTest::newRow("type-variant") << qMetaTypeId<QDBusVariant>();
+ QTest::newRow("type-array") << qMetaTypeId<QDBusArgument>();
+ QTest::newRow("type-struct") << qMetaTypeId<QDBusArgument>();
+ QTest::newRow("type-naked") << qMetaTypeId<void *>();
+}
+
+struct DisconnectRawDBus {
+ static void cleanup(DBusConnection *connection)
+ {
+ if (!connection)
+ return;
+ dbus_connection_close(connection);
+ dbus_connection_unref(connection);
+ }
+};
+template <typename T, void (*unref)(T *)> struct GenericUnref
+{
+ static void cleanup(T *type)
+ {
+ if (!type) return;
+ unref(type);
+ }
+};
+
+// use these scoped types to avoid memory leaks if QVERIFY or QCOMPARE fails
+typedef QScopedPointer<DBusConnection, DisconnectRawDBus> ScopedDBusConnection;
+typedef QScopedPointer<DBusMessage, GenericUnref<DBusMessage, dbus_message_unref> > ScopedDBusMessage;
+typedef QScopedPointer<DBusPendingCall, GenericUnref<DBusPendingCall, dbus_pending_call_unref> > ScopedDBusPendingCall;
+
+void tst_QDBusMarshall::receiveUnknownType()
+{
+#ifndef DBUS_TYPE_UNIX_FD
+ QSKIP("Your system's D-Bus library is too old for this test", SkipAll);
+#else
+ QDBusConnection con = QDBusConnection::sessionBus();
+ QVERIFY(con.isConnected());
+
+ // this needs to be implemented in raw
+ // open a new connection to the bus daemon
+ DBusError error;
+ dbus_error_init(&error);
+ ScopedDBusConnection rawcon(dbus_bus_get_private(DBUS_BUS_SESSION, &error));
+ QVERIFY2(rawcon.data(), error.name);
+
+ // check if this bus supports passing file descriptors
+ if (!dbus_connection_can_send_type(rawcon.data(), DBUS_TYPE_UNIX_FD))
+ QSKIP("Your session bus does not allow sending Unix file descriptors", SkipAll);
+
+ if (qstrcmp(QTest::currentDataTag(), "in-call") == 0) {
+ // create a call back to us containing a file descriptor
+ QDBusMessageSpy spy;
+ con.registerObject("/spyObject", &spy, QDBusConnection::ExportAllSlots);
+ ScopedDBusMessage msg(dbus_message_new_method_call(con.baseService().toLatin1(), "/spyObject", NULL, "theSlot"));
+
+ int fd = fileno(stdout);
+ dbus_message_append_args(msg.data(), DBUS_TYPE_UNIX_FD, &fd, DBUS_TYPE_INVALID);
+
+ // try to send to us
+ DBusPendingCall *pending_ptr;
+ dbus_connection_send_with_reply(rawcon.data(), msg.data(), &pending_ptr, 1000);
+ ScopedDBusPendingCall pending(pending_ptr);
+
+ // check that it got sent
+ while (dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
+ ;
+
+ // now spin our event loop. We don't catch this call, so let's get the reply
+ QEventLoop loop;
+ QTimer::singleShot(200, &loop, SLOT(quit()));
+ loop.exec();
+
+ // now try to receive the reply
+ dbus_pending_call_block(pending.data());
+
+ // check that the spy received what it was supposed to receive
+ QCOMPARE(spy.list.size(), 1);
+ QCOMPARE(spy.list.at(0).arguments().size(), 1);
+ QFETCH(int, receivedTypeId);
+ QCOMPARE(spy.list.at(0).arguments().at(0).userType(), receivedTypeId);
+
+ msg.reset(dbus_pending_call_steal_reply(pending.data()));
+ QVERIFY(msg);
+ QCOMPARE(dbus_message_get_type(msg.data()), DBUS_MESSAGE_TYPE_METHOD_RETURN);
+ QCOMPARE(dbus_message_get_signature(msg.data()), DBUS_TYPE_INT32_AS_STRING);
+
+ int retval;
+ QVERIFY(dbus_message_get_args(msg.data(), &error, DBUS_TYPE_INT32, &retval, DBUS_TYPE_INVALID));
+ QCOMPARE(retval, 42);
+ } else {
+ // create a signal that we'll emit
+ static const char signalName[] = "signalName";
+ static const char interfaceName[] = "local.interface.name";
+ ScopedDBusMessage msg(dbus_message_new_signal("/", interfaceName, signalName));
+ con.connect(dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &QTestEventLoop::instance(), SLOT(exitLoop()));
+
+ QDBusMessageSpy spy;
+ con.connect(dbus_bus_get_unique_name(rawcon.data()), QString(), interfaceName, signalName, &spy, SLOT(theSlot(QDBusMessage)));
+
+ DBusMessageIter iter;
+ dbus_message_iter_init_append(msg.data(), &iter);
+ int fd = fileno(stdout);
+
+ if (qstrcmp(QTest::currentDataTag(), "type-naked") == 0) {
+ // send naked
+ dbus_message_iter_append_basic(&iter, DBUS_TYPE_UNIX_FD, &fd);
+ } else {
+ DBusMessageIter subiter;
+ if (qstrcmp(QTest::currentDataTag(), "type-variant") == 0)
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_VARIANT, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
+ else if (qstrcmp(QTest::currentDataTag(), "type-array") == 0)
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, DBUS_TYPE_UNIX_FD_AS_STRING, &subiter);
+ else if (qstrcmp(QTest::currentDataTag(), "type-struct") == 0)
+ dbus_message_iter_open_container(&iter, DBUS_TYPE_STRUCT, 0, &subiter);
+ dbus_message_iter_append_basic(&subiter, DBUS_TYPE_UNIX_FD, &fd);
+ dbus_message_iter_close_container(&iter, &subiter);
+ }
+
+ // send it
+ dbus_connection_send(rawcon.data(), msg.data(), 0);
+
+ // check that it got sent
+ while (dbus_connection_dispatch(rawcon.data()) == DBUS_DISPATCH_DATA_REMAINS)
+ ;
+
+ // now let's see what happens
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QCOMPARE(spy.list.size(), 1);
+ QCOMPARE(spy.list.at(0).arguments().count(), 1);
+ QFETCH(int, receivedTypeId);
+ //qDebug() << spy.list.at(0).arguments().at(0).typeName();
+ QCOMPARE(spy.list.at(0).arguments().at(0).userType(), receivedTypeId);
+ }
+#endif
+}
+
QTEST_MAIN(tst_QDBusMarshall)
#include "tst_qdbusmarshall.moc"
diff --git a/tests/auto/qdbusxmlparser/tst_qdbusxmlparser.cpp b/tests/auto/qdbusxmlparser/tst_qdbusxmlparser.cpp
index 25595c5..f83795c 100644
--- a/tests/auto/qdbusxmlparser/tst_qdbusxmlparser.cpp
+++ b/tests/auto/qdbusxmlparser/tst_qdbusxmlparser.cpp
@@ -287,11 +287,14 @@ void tst_QDBusXmlParser::methods_data()
"</method>" << map;
// one invalid arg
+ method.inputArgs << arg("~", "invalid");
+ map.clear();
+ map << method;
QTest::newRow("two-in-one-invalid") <<
"<method name=\"Method\">"
"<arg type=\"s\" direction=\"in\"/>"
- "<arg type=\"~\" name=\"invalid\" direction=\"in\"/>" // this line should be ignored
"<arg type=\"v\" direction=\"in\"/>"
+ "<arg type=\"~\" name=\"invalid\" direction=\"in\"/>"
"</method>" << map;
// one out argument
@@ -380,8 +383,6 @@ void tst_QDBusXmlParser::methods()
QFETCH(QString, xmlDataFragment);
- if (strcmp(QTest::currentDataTag(), "two-in-one-invalid") == 0)
- QTest::ignoreMessage(QtWarningMsg, "Invalid D-BUS type signature '~' found while parsing introspection");
QDBusIntrospection::Interface iface =
QDBusIntrospection::parseInterface(xmlHeader + xmlDataFragment + xmlFooter);
@@ -390,9 +391,9 @@ void tst_QDBusXmlParser::methods()
QFETCH(MethodMap, methodMap);
MethodMap parsedMap = iface.methods;
- QCOMPARE(methodMap.count(), parsedMap.count());
- QCOMPARE(methodMap, parsedMap);
-}
+ QCOMPARE(parsedMap.count(), methodMap.count());
+ QCOMPARE(parsedMap, methodMap);
+}
void tst_QDBusXmlParser::signals__data()
{
diff --git a/tests/auto/qfont/tst_qfont.cpp b/tests/auto/qfont/tst_qfont.cpp
index 82c8f65..dabe3fa 100644
--- a/tests/auto/qfont/tst_qfont.cpp
+++ b/tests/auto/qfont/tst_qfont.cpp
@@ -150,6 +150,13 @@ void tst_QFont::exactMatch()
return;
#endif
+#ifdef Q_WS_X11
+ QVERIFY(QFont("sans").exactMatch());
+ QVERIFY(QFont("sans-serif").exactMatch());
+ QVERIFY(QFont("serif").exactMatch());
+ QVERIFY(QFont("monospace").exactMatch());
+#endif
+
QSKIP("This test is bogus on Unix with support for font aliases in fontconfig", SkipAll);
return;
diff --git a/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp b/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp
index eb8677a..a4598dc 100644
--- a/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp
+++ b/tests/auto/qfuturewatcher/tst_qfuturewatcher.cpp
@@ -486,8 +486,6 @@ class ProgressTextTask : public RunFunctionTask<T>
public:
void runFunctor()
{
- while (this->isProgressUpdateNeeded() == false)
- QTest::qSleep(1);
this->setProgressValueAndText(1, QLatin1String("Foo 1"));
while (this->isProgressUpdateNeeded() == false)
@@ -497,6 +495,10 @@ public:
while (this->isProgressUpdateNeeded() == false)
QTest::qSleep(1);
this->setProgressValueAndText(3, QLatin1String("Foo 3"));
+
+ while (this->isProgressUpdateNeeded() == false)
+ QTest::qSleep(1);
+ this->setProgressValueAndText(4, QLatin1String("Foo 4"));
}
};
@@ -524,14 +526,16 @@ void tst_QFutureWatcher::progressText()
QTestEventLoop::instance().enterLoop(5);
QVERIFY(!QTestEventLoop::instance().timeout());
- QCOMPARE(f.progressText(), QLatin1String("Foo 3"));
- QCOMPARE(f.progressValue(), 3);
+ QCOMPARE(f.progressText(), QLatin1String("Foo 4"));
+ QCOMPARE(f.progressValue(), 4);
QVERIFY(progressValues.contains(1));
QVERIFY(progressValues.contains(2));
QVERIFY(progressValues.contains(3));
+ QVERIFY(progressValues.contains(4));
QVERIFY(progressTexts.contains(QLatin1String("Foo 1")));
QVERIFY(progressTexts.contains(QLatin1String("Foo 2")));
QVERIFY(progressTexts.contains(QLatin1String("Foo 3")));
+ QVERIFY(progressTexts.contains(QLatin1String("Foo 4")));
}
}
diff --git a/tests/auto/qimagereader/images/corrupt-pixel-count.xpm b/tests/auto/qimagereader/images/corrupt-pixel-count.xpm
new file mode 100644
index 0000000..3a736ff
--- /dev/null
+++ b/tests/auto/qimagereader/images/corrupt-pixel-count.xpm
@@ -0,0 +1,11 @@
+/* XPM */
+static const char *marble_xpm[] = {
+/* width height num_colors chars_per_pixel */
+"2 2 2 -2",
+/* colors */
+"a c #adadad",
+"b c #dedede",
+/* pixels */
+"ab",
+"ba"
+};
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 7c2aee8..f02fd6a 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -1410,6 +1410,9 @@ void tst_QImageReader::readFromResources_data()
QTest::newRow("corrupt-pixels.xpm") << QString("corrupt-pixels.xpm")
<< QByteArray("xpm") << QSize(0, 0)
<< QString("QImage: XPM pixels missing on image line 3");
+ QTest::newRow("corrupt-pixel-count.xpm") << QString("corrupt-pixel-count.xpm")
+ << QByteArray("xpm") << QSize(0, 0)
+ << QString("");
QTest::newRow("marble.xpm") << QString("marble.xpm")
<< QByteArray("xpm") << QSize(240, 240)
<< QString("");
diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp
index 800f9de..6a047f2 100644
--- a/tests/auto/qinputcontext/tst_qinputcontext.cpp
+++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp
@@ -88,6 +88,7 @@ private slots:
void closeSoftwareInputPanel();
void selections();
void focusProxy();
+ void contextInheritance();
void symbianTestCoeFepInputContext_data();
void symbianTestCoeFepInputContext();
void symbianTestCoeFepAutoCommit_data();
@@ -473,6 +474,37 @@ void tst_QInputContext::focusProxy()
QCOMPARE(gic->focusWidget(), &proxy);
}
+void tst_QInputContext::contextInheritance()
+{
+ QWidget parent;
+ QWidget child(&parent);
+
+ parent.setAttribute(Qt::WA_InputMethodEnabled, true);
+ child.setAttribute(Qt::WA_InputMethodEnabled, true);
+
+ QCOMPARE(parent.inputContext(), qApp->inputContext());
+ QCOMPARE(child.inputContext(), qApp->inputContext());
+
+ QInputContext *qic = new QFilterInputContext;
+ parent.setInputContext(qic);
+ QCOMPARE(parent.inputContext(), qic);
+ QCOMPARE(child.inputContext(), qic);
+
+ parent.setAttribute(Qt::WA_InputMethodEnabled, false);
+ QVERIFY(!parent.inputContext());
+ QCOMPARE(child.inputContext(), qic);
+ parent.setAttribute(Qt::WA_InputMethodEnabled, true);
+
+ parent.setInputContext(0);
+ QCOMPARE(parent.inputContext(), qApp->inputContext());
+ QCOMPARE(child.inputContext(), qApp->inputContext());
+
+ qic = new QFilterInputContext;
+ qApp->setInputContext(qic);
+ QCOMPARE(parent.inputContext(), qic);
+ QCOMPARE(child.inputContext(), qic);
+}
+
#ifdef QT_WEBKIT_LIB
class AutoWebView : public QWebView
{
diff --git a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
index 10fa7c6..41da16e 100644
--- a/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
+++ b/tests/auto/qnetworkproxyfactory/tst_qnetworkproxyfactory.cpp
@@ -60,8 +60,8 @@ QString tst_QNetworkProxyFactory::formatProxyName(const QNetworkProxy & proxy) c
QString proxyName;
if (!proxy.user().isNull())
proxyName.append("%1:%2@").arg(proxy.user(), proxy.password());
- proxyName.append("%1:%2").arg(proxy.hostName(), proxy.port());
- proxyName.append(" (type=%1, capabilities=%2)").arg(proxy.type(), proxy.capabilities());
+ proxyName.append(QString("%1:%2").arg(proxy.hostName()).arg(proxy.port()));
+ proxyName.append(QString(" (type=%1, capabilities=%2)").arg(proxy.type()).arg(proxy.capabilities()));
return proxyName;
}
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 3715162..93e3051 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -84,8 +84,6 @@ Q_DECLARE_METATYPE(QList<QNetworkProxy>)
Q_DECLARE_METATYPE(QNetworkReply::NetworkError)
Q_DECLARE_METATYPE(QBuffer*)
-const int SynchronousRequestAttribute = QNetworkRequest::DownloadBufferAttribute + 1;
-
class QNetworkReplyPtr: public QSharedPointer<QNetworkReply>
{
public:
@@ -327,6 +325,7 @@ private Q_SLOTS:
void ioGetFromHttpBrokenChunkedEncoding();
void qtbug12908compressedHttpReply();
+ void compressedHttpReplyBrokenGzip();
void getFromUnreachableIp();
@@ -340,7 +339,9 @@ private Q_SLOTS:
void synchronousRequest_data();
void synchronousRequest();
+#ifndef QT_NO_OPENSSL
void synchronousRequestSslFailure();
+#endif
void httpAbort();
@@ -457,6 +458,7 @@ private:
{
//qDebug() << "connectSocketSignals" << client;
connect(client, SIGNAL(readyRead()), this, SLOT(readyReadSlot()));
+ connect(client, SIGNAL(bytesWritten(qint64)), this, SLOT(bytesWrittenSlot()));
connect(client, SIGNAL(error(QAbstractSocket::SocketError)),
this, SLOT(slotError(QAbstractSocket::SocketError)));
}
@@ -484,15 +486,19 @@ public slots:
if (multiple)
receivedData.remove(0, doubleEndlPos+4);
- client->write(dataToTransmit);
- while (client->bytesToWrite() > 0)
- client->waitForBytesWritten();
+ // we need to emulate the bytesWrittenSlot call if the data is empty.
+ if (dataToTransmit.size() == 0)
+ QMetaObject::invokeMethod(this, "bytesWrittenSlot", Qt::QueuedConnection);
+ else
+ client->write(dataToTransmit);
+ }
+ }
- if (doClose) {
- client->disconnectFromHost();
- disconnect(client, 0, this, 0);
- client = 0;
- }
+ void bytesWrittenSlot() {
+ if (doClose && client->bytesToWrite() == 0) {
+ client->disconnectFromHost();
+ disconnect(client, 0, this, 0);
+ client = 0;
}
}
};
@@ -961,7 +967,9 @@ tst_QNetworkReply::tst_QNetworkReply()
qRegisterMetaType<QNetworkReply *>(); // for QSignalSpy
qRegisterMetaType<QAuthenticator *>();
qRegisterMetaType<QNetworkProxy>();
+#ifndef QT_NO_OPENSSL
qRegisterMetaType<QList<QSslError> >();
+#endif
Q_SET_DEFAULT_IAP
@@ -1057,7 +1065,7 @@ QString tst_QNetworkReply::runSimpleRequest(QNetworkAccessManager::Operation op,
returnCode = Timeout;
int code = Success;
- if (request.attribute(static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute)).toBool()) {
+ if (request.attribute(QNetworkRequest::SynchronousRequestAttribute).toBool()) {
if (reply->isFinished())
code = reply->error() != QNetworkReply::NoError ? Failure : Success;
else
@@ -1494,6 +1502,12 @@ void tst_QNetworkReply::getErrors()
{
QFETCH(QString, url);
QNetworkRequest request(url);
+
+#if defined(Q_OS_WIN) || defined (Q_OS_SYMBIAN)
+ if (qstrcmp(QTest::currentDataTag(), "empty-scheme-host") == 0)
+ QTest::ignoreMessage(QtWarningMsg, "QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files");
+#endif
+
QNetworkReplyPtr reply = manager.get(request);
reply->setParent(this); // we have expect-fails
@@ -1508,6 +1522,9 @@ void tst_QNetworkReply::getErrors()
//qDebug() << reply->errorString();
QFETCH(int, error);
+#if defined(Q_OS_WIN) || defined (Q_OS_SYMBIAN)
+ QEXPECT_FAIL("empty-scheme-host", "this is expected to fail on Windows and Symbian, QTBUG-17731", Abort);
+#endif
QEXPECT_FAIL("ftp-is-dir", "QFtp cannot provide enough detail", Abort);
// the line below is not necessary
QEXPECT_FAIL("ftp-dir-not-readable", "QFtp cannot provide enough detail", Abort);
@@ -1680,7 +1697,7 @@ void tst_QNetworkReply::putToHttpSynchronous()
QFETCH(QByteArray, data);
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
RUN_REQUEST(runSimpleRequest(QNetworkAccessManager::PutOperation, request, reply, data));
@@ -1740,7 +1757,7 @@ void tst_QNetworkReply::postToHttpSynchronous()
QNetworkRequest request(url);
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QNetworkReplyPtr reply;
@@ -2255,7 +2272,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth()
// now check with synchronous calls:
{
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QSignalSpy authspy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)));
@@ -2279,7 +2296,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuthSynchronous()
QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt"));
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QSignalSpy authspy(&manager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)));
@@ -2364,7 +2381,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuth()
reference.seek(0);
{
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QSignalSpy authspy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
@@ -2390,7 +2407,7 @@ void tst_QNetworkReply::ioGetFromHttpWithProxyAuthSynchronous()
QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt"));
manager.setProxy(proxy);
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QSignalSpy authspy(&manager, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)));
@@ -3503,7 +3520,7 @@ void tst_QNetworkReply::ioPostToHttpFromSocketSynchronous()
QUrl url("http://" + QtNetworkSettings::serverName() + "/qtest/cgi-bin/md5sum.cgi");
QNetworkRequest request(url);
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QNetworkReplyPtr reply = manager.post(request, socketpair.endPoints[1]);
@@ -3695,12 +3712,12 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress()
incomingSocket->setReadBufferSize(1*1024);
QTestEventLoop::instance().enterLoop(2);
// some progress should have been made
+ QVERIFY(!spy.isEmpty());
QList<QVariant> args = spy.last();
qDebug() << "tst_QNetworkReply::ioPostToHttpsUploadProgress"
<< args.at(0).toLongLong()
<< sourceFile.size()
<< spy.size();
- QVERIFY(!args.isEmpty());
QVERIFY(args.at(0).toLongLong() > 0);
// FIXME this is where it messes up
@@ -3711,16 +3728,16 @@ void tst_QNetworkReply::ioPostToHttpsUploadProgress()
incomingSocket->read(16*1024);
QTestEventLoop::instance().enterLoop(2);
// some more progress than before
+ QVERIFY(!spy.isEmpty());
QList<QVariant> args2 = spy.last();
- QVERIFY(!args2.isEmpty());
QVERIFY(args2.at(0).toLongLong() > args.at(0).toLongLong());
// set the read buffer to unlimited
incomingSocket->setReadBufferSize(0);
QTestEventLoop::instance().enterLoop(10);
// progress should be finished
+ QVERIFY(!spy.isEmpty());
QList<QVariant> args3 = spy.last();
- QVERIFY(!args3.isEmpty());
QVERIFY(args3.at(0).toLongLong() > args2.at(0).toLongLong());
QCOMPARE(args3.at(0).toLongLong(), args3.at(1).toLongLong());
QCOMPARE(args3.at(0).toLongLong(), sourceFile.size());
@@ -3810,6 +3827,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
if (reader.data.size() < testData.size()) { // oops?
QCOMPARE(reader.data, testData.mid(0, reader.data.size()));
qDebug() << "The data is incomplete, the last" << testData.size() - reader.data.size() << "bytes are missing";
+ QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Abort);
+ QEXPECT_FAIL("https+limited", "Limiting is broken right now, check QTBUG-15065", Abort);
}
QCOMPARE(reader.data.size(), testData.size());
QCOMPARE(reader.data, testData);
@@ -3822,8 +3841,8 @@ void tst_QNetworkReply::ioGetFromBuiltinHttp()
const int maxRate = rate * 1024 * (100+allowedDeviation) / 100;
qDebug() << minRate << "<="<< server.transferRate << "<=" << maxRate << "?";
QVERIFY(server.transferRate >= minRate);
- QEXPECT_FAIL("http+limited", "Limiting is broken right now", Continue);
- QEXPECT_FAIL("https+limited", "Limiting is broken right now", Continue);
+ QEXPECT_FAIL("http+limited", "Limiting is broken right now, check QTBUG-15065", Continue);
+ QEXPECT_FAIL("https+limited", "Limiting is broken right now, check QTBUG-15065", Continue);
QVERIFY(server.transferRate <= maxRate);
}
}
@@ -4274,7 +4293,7 @@ void tst_QNetworkReply::receiveCookiesFromHttpSynchronous()
QNetworkRequest request(url);
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QNetworkReplyPtr reply;
@@ -4366,7 +4385,7 @@ void tst_QNetworkReply::sendCookiesSynchronous()
QNetworkRequest request(url);
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QNetworkReplyPtr reply;
@@ -4508,7 +4527,7 @@ void tst_QNetworkReply::httpProxyCommandsSynchronous()
// send synchronous request
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QNetworkReplyPtr reply = manager.get(request);
@@ -5234,6 +5253,7 @@ void tst_QNetworkReply::qtbug12908compressedHttpReply()
// dd if=/dev/zero of=qtbug-12908 bs=16384 count=1 && gzip qtbug-12908 && base64 -w 0 qtbug-12908.gz
QString encodedFile("H4sICDdDaUwAA3F0YnVnLTEyOTA4AO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA");
QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toAscii());
+ QCOMPARE(decodedFile.size(), 63);
MiniHttpServer server(header.toAscii() + decodedFile);
server.doClose = true;
@@ -5246,6 +5266,31 @@ void tst_QNetworkReply::qtbug12908compressedHttpReply()
QVERIFY(!QTestEventLoop::instance().timeout());
QCOMPARE(reply->error(), QNetworkReply::NoError);
+ QCOMPARE(reply->size(), qint64(16384));
+ QCOMPARE(reply->readAll(), QByteArray(16384, '\0'));
+}
+
+void tst_QNetworkReply::compressedHttpReplyBrokenGzip()
+{
+ QString header("HTTP/1.0 200 OK\r\nContent-Encoding: gzip\r\nContent-Length: 63\r\n\r\n");
+
+ // dd if=/dev/zero of=qtbug-12908 bs=16384 count=1 && gzip qtbug-12908 && base64 -w 0 qtbug-12908.gz
+ // Then change "BMQ" to "BMX"
+ QString encodedFile("H4sICDdDaUwAA3F0YnVnLTEyOTA4AO3BMXEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAIC3AYbSVKsAQAAA");
+ QByteArray decodedFile = QByteArray::fromBase64(encodedFile.toAscii());
+ QCOMPARE(decodedFile.size(), 63);
+
+ MiniHttpServer server(header.toAscii() + decodedFile);
+ 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->error(), QNetworkReply::ProtocolFailure);
}
// TODO add similar test for FTP
@@ -5454,7 +5499,7 @@ void tst_QNetworkReply::synchronousRequest()
#endif
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QNetworkReplyPtr reply;
@@ -5485,6 +5530,7 @@ void tst_QNetworkReply::synchronousRequest()
reply->deleteLater();
}
+#ifndef QT_NO_OPENSSL
void tst_QNetworkReply::synchronousRequestSslFailure()
{
// test that SSL won't be accepted with self-signed certificate,
@@ -5494,7 +5540,7 @@ void tst_QNetworkReply::synchronousRequestSslFailure()
QUrl url("https://" + QtNetworkSettings::serverName() + "/qtest/rfc3252.txt");
QNetworkRequest request(url);
request.setAttribute(
- static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
+ QNetworkRequest::SynchronousRequestAttribute,
true);
QNetworkReplyPtr reply;
QSignalSpy sslErrorsSpy(&manager, SIGNAL(sslErrors(QNetworkReply *, const QList<QSslError> &)));
@@ -5503,6 +5549,7 @@ void tst_QNetworkReply::synchronousRequestSslFailure()
QCOMPARE(reply->error(), QNetworkReply::SslHandshakeFailedError);
QCOMPARE(sslErrorsSpy.count(), 0);
}
+#endif
void tst_QNetworkReply::httpAbort()
{
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index ce1ff77..c21514b 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -262,6 +262,8 @@ private slots:
void QTBUG14614_gradientCacheRaceCondition();
void drawTextOpacity();
+ void QTBUG17053_zeroDashPattern();
+
private:
void fillData();
void setPenColor(QPainter& p);
@@ -4684,6 +4686,26 @@ void tst_QPainter::drawTextOpacity()
QCOMPARE(image, copy);
}
+void tst_QPainter::QTBUG17053_zeroDashPattern()
+{
+ QImage image(32, 32, QImage::Format_RGB32);
+ image.fill(0xffffffff);
+
+ QImage original = image;
+
+ QVector<qreal> pattern;
+ pattern << qreal(0) << qreal(0);
+
+ QPainter p(&image);
+ QPen pen(Qt::black, 2.0);
+ pen.setDashPattern(pattern);
+
+ p.setPen(pen);
+ p.drawLine(0, 0, image.width(), image.height());
+
+ QCOMPARE(image, original);
+}
+
QTEST_MAIN(tst_QPainter)
#include "tst_qpainter.moc"
diff --git a/tests/auto/qscriptclass/tst_qscriptclass.cpp b/tests/auto/qscriptclass/tst_qscriptclass.cpp
index 5286a5a..9ab8318 100644
--- a/tests/auto/qscriptclass/tst_qscriptclass.cpp
+++ b/tests/auto/qscriptclass/tst_qscriptclass.cpp
@@ -617,7 +617,7 @@ void tst_QScriptClass::newInstance()
QScriptValue obj1 = eng.newObject(&cls);
QVERIFY(!obj1.data().isValid());
QVERIFY(obj1.prototype().strictlyEquals(cls.prototype()));
- QEXPECT_FAIL("", "classname is not implemented", Continue);
+ QEXPECT_FAIL("", "QTBUG-17599: classname is not implemented", Continue);
QCOMPARE(obj1.toString(), QString::fromLatin1("[object TestClass]"));
QCOMPARE(obj1.scriptClass(), (QScriptClass*)&cls);
@@ -741,7 +741,7 @@ void tst_QScriptClass::getAndSetPropertyFromCpp()
QCOMPARE(obj1.propertyFlags(foo2), foo2Pflags);
QVERIFY(cls.lastQueryPropertyObject().strictlyEquals(obj1));
QVERIFY(cls.lastQueryPropertyName() == foo2);
- QEXPECT_FAIL("", "classObject.getOwnPropertyDescriptor() reads the property value", Continue);
+ QEXPECT_FAIL("", "QTBUG-17601: classObject.getOwnPropertyDescriptor() reads the property value", Continue);
QVERIFY(!cls.lastPropertyObject().isValid());
QVERIFY(cls.lastPropertyFlagsObject().strictlyEquals(obj1));
QVERIFY(cls.lastPropertyFlagsName() == foo2);
diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
index 9d7e896..457188c 100644
--- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
+++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp
@@ -725,10 +725,7 @@ void tst_QScriptContext::backtrace_data()
expected << "<native>('hey') at -1"
<< "<eval>() at 3"
- << QString::fromLatin1("foo(arg1 = 'hello', arg2 = 456) at testfile:%0")
- // interpreter unfortunately doesn't provide line number for eval()
- .arg(qt_script_isJITEnabled() ? 2 : -1);
- expected
+ << "foo(arg1 = 'hello', arg2 = 456) at testfile:2"
<< "<global>() at testfile:4";
QTest::newRow("eval") << source << expected;
@@ -787,10 +784,7 @@ void tst_QScriptContext::backtrace_data()
expected << "<native>('hey') at -1"
<< "<eval>() at 3"
- << QString::fromLatin1("plop('hello', 456) at testfile:%0")
- // interpreter unfortunately doesn't provide line number for eval()
- .arg(qt_script_isJITEnabled() ? 3 : -1);
- expected
+ << "plop('hello', 456) at testfile:3"
<< "<global>() at testfile:5";
QTest::newRow("eval in member") << source << expected;
@@ -987,6 +981,8 @@ void tst_QScriptContext::backtrace()
QVERIFY(!eng.hasUncaughtException());
QVERIFY(ret.isArray());
QStringList slist = qscriptvalue_cast<QStringList>(ret);
+ QEXPECT_FAIL("eval", "QTBUG-17842: Missing line number in backtrace when function calls eval()", Continue);
+ QEXPECT_FAIL("eval in member", "QTBUG-17842: Missing line number in backtrace when function calls eval()", Continue);
QCOMPARE(slist, expectedbacktrace);
}
diff --git a/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp b/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp
index 89c5330..62f899c 100644
--- a/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp
+++ b/tests/auto/qscriptcontextinfo/tst_qscriptcontextinfo.cpp
@@ -151,7 +151,7 @@ void tst_QScriptContextInfo::nativeFunction()
QVERIFY(info.scriptId() != -1);
QCOMPARE(info.fileName(), fileName);
QCOMPARE(info.lineNumber(), lineNumber);
- QEXPECT_FAIL("", "columnNumber doesn't work", Continue);
+ QEXPECT_FAIL("", "QTBUG-17602: columnNumber doesn't work", Continue);
QCOMPARE(info.columnNumber(), 1);
QCOMPARE(info.functionName(), QString());
QCOMPARE(info.functionEndLineNumber(), -1);
@@ -183,7 +183,7 @@ void tst_QScriptContextInfo::scriptFunction()
QVERIFY(info.scriptId() != -1);
QCOMPARE(info.fileName(), fileName);
QCOMPARE(info.lineNumber(), lineNumber + 1);
- QEXPECT_FAIL("", "columnNumber doesn't work", Continue);
+ QEXPECT_FAIL("", "QTBUG-17602: columnNumber doesn't work", Continue);
QCOMPARE(info.columnNumber(), 2);
QCOMPARE(info.functionName(), QString::fromLatin1("bar"));
QCOMPARE(info.functionStartLineNumber(), lineNumber);
@@ -202,7 +202,7 @@ void tst_QScriptContextInfo::scriptFunction()
QVERIFY(info.scriptId() != -1);
QCOMPARE(info.fileName(), fileName);
QCOMPARE(info.lineNumber(), lineNumber + 3);
- QEXPECT_FAIL("", "columnNumber doesn't work", Continue);
+ QEXPECT_FAIL("", "QTBUG-17602: columnNumber doesn't work", Continue);
QCOMPARE(info.columnNumber(), 1);
QCOMPARE(info.functionName(), QString());
QCOMPARE(info.functionEndLineNumber(), -1);
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index 589b3b1..bc4091d 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -157,6 +157,7 @@ private slots:
void reportAdditionalMemoryCost();
void gcWithNestedDataStructure();
void processEventsWhileRunning();
+ void throwErrorFromProcessEvents_data();
void throwErrorFromProcessEvents();
void disableProcessEventsInterval();
void stacktrace();
@@ -164,6 +165,7 @@ private slots:
void numberParsing();
void automaticSemicolonInsertion();
void abortEvaluation_notEvaluating();
+ void abortEvaluation_data();
void abortEvaluation();
void abortEvaluation_tryCatch();
void abortEvaluation_fromNative();
@@ -235,6 +237,7 @@ private slots:
void evaluateProgram_multipleEngines();
void evaluateProgram_empty();
void collectGarbageAfterConnect();
+ void collectGarbageAfterNativeArguments();
void promoteThisObjectToQObjectInConstructor();
void scriptValueFromQMetaObject();
@@ -470,10 +473,10 @@ void tst_QScriptEngine::newArray_HooliganTask233836()
{
QScriptEngine eng;
{
+ // According to ECMA-262, this should cause a RangeError.
QScriptValue ret = eng.evaluate("a = new Array(4294967295); a.push('foo')");
- QVERIFY(ret.isNumber());
- QCOMPARE(ret.toInt32(), 0);
- QCOMPARE(eng.evaluate("a[4294967295]").toString(), QString::fromLatin1("foo"));
+ QEXPECT_FAIL("", "ECMA compliance bug in Array.prototype.push: https://bugs.webkit.org/show_bug.cgi?id=55033", Continue);
+ QVERIFY(ret.isError() && ret.toString().contains(QLatin1String("RangeError")));
}
{
QScriptValue ret = eng.newArray(0xFFFFFFFF);
@@ -672,7 +675,8 @@ void tst_QScriptEngine::jsRegExp()
QCOMPARE(r5.toString(), QString::fromLatin1("/foo/gim"));
// In JSC, constructing a RegExp from another produces the same identical object.
// This is different from SpiderMonkey and old back-end.
- QVERIFY(r5.strictlyEquals(r));
+ QEXPECT_FAIL("", "RegExp copy-constructor should return a new object: https://bugs.webkit.org/show_bug.cgi?id=55040", Continue);
+ QVERIFY(!r5.strictlyEquals(r));
QScriptValue r6 = rxCtor.construct(QScriptValueList() << "foo" << "bar");
QVERIFY(r6.isError());
@@ -1316,7 +1320,7 @@ void tst_QScriptEngine::globalObjectProperties()
QCOMPARE(global.propertyFlags("URIError"), QScriptValue::SkipInEnumeration);
QVERIFY(global.property("Math").isObject());
QVERIFY(!global.property("Math").isFunction());
- QEXPECT_FAIL("", "[ECMA compliance] JSC sets DontDelete flag for Math object", Continue);
+ QEXPECT_FAIL("", "[ECMA compliance] JSC sets DontDelete flag for Math object: https://bugs.webkit.org/show_bug.cgi?id=55034", Continue);
QCOMPARE(global.propertyFlags("Math"), QScriptValue::SkipInEnumeration);
}
@@ -2960,17 +2964,42 @@ public:
QScriptEngine *engine;
};
+void tst_QScriptEngine::throwErrorFromProcessEvents_data()
+{
+ QTest::addColumn<QString>("script");
+ QTest::addColumn<QString>("error");
+
+ QTest::newRow("while (1)")
+ << QString::fromLatin1("while (1) { }")
+ << QString::fromLatin1("Error: Killed");
+ QTest::newRow("while (1) i++")
+ << QString::fromLatin1("i = 0; while (1) { i++; }")
+ << QString::fromLatin1("Error: Killed");
+ // Unlike abortEvaluation(), scripts should be able to catch the
+ // exception.
+ QTest::newRow("try catch")
+ << QString::fromLatin1("try {"
+ " while (1) { }"
+ "} catch(e) {"
+ " throw new Error('Caught');"
+ "}")
+ << QString::fromLatin1("Error: Caught");
+}
+
void tst_QScriptEngine::throwErrorFromProcessEvents()
{
+ QFETCH(QString, script);
+ QFETCH(QString, error);
+
QScriptEngine eng;
EventReceiver2 receiver(&eng);
QCoreApplication::postEvent(&receiver, new QEvent(QEvent::Type(QEvent::User+1)));
eng.setProcessEventsInterval(100);
- QScriptValue ret = eng.evaluate(QString::fromLatin1("while (1) { }"));
+ QScriptValue ret = eng.evaluate(script);
QVERIFY(ret.isError());
- QCOMPARE(ret.toString(), QString::fromLatin1("Error: Killed"));
+ QCOMPARE(ret.toString(), error);
}
void tst_QScriptEngine::disableProcessEventsInterval()
@@ -3385,8 +3414,26 @@ void tst_QScriptEngine::abortEvaluation_notEvaluating()
}
}
+void tst_QScriptEngine::abortEvaluation_data()
+{
+ QTest::addColumn<QString>("script");
+
+ QTest::newRow("while (1)")
+ << QString::fromLatin1("while (1) { }");
+ QTest::newRow("while (1) i++")
+ << QString::fromLatin1("i = 0; while (1) { i++; }");
+ QTest::newRow("try catch")
+ << QString::fromLatin1("try {"
+ " while (1) { }"
+ "} catch(e) {"
+ " throw new Error('Caught');"
+ "}");
+}
+
void tst_QScriptEngine::abortEvaluation()
{
+ QFETCH(QString, script);
+
QScriptEngine eng;
EventReceiver3 receiver(&eng);
@@ -3394,7 +3441,7 @@ void tst_QScriptEngine::abortEvaluation()
for (int x = 0; x < 4; ++x) {
QCoreApplication::postEvent(&receiver, new QEvent(QEvent::Type(QEvent::User+1)));
receiver.resultType = EventReceiver3::AbortionResult(x);
- QScriptValue ret = eng.evaluate(QString::fromLatin1("while (1) { }"));
+ QScriptValue ret = eng.evaluate(script);
switch (receiver.resultType) {
case EventReceiver3::None:
QVERIFY(!eng.hasUncaughtException());
@@ -4201,7 +4248,8 @@ void tst_QScriptEngine::getterSetterThisObject_activation()
// read
eng.evaluate("act.__defineGetter__('x', function() { return this; })");
QVERIFY(eng.evaluate("x === act").toBoolean());
- QEXPECT_FAIL("", "Exotic overload (don't care for now)", Continue);
+ QEXPECT_FAIL("", "QTBUG-17605: Not possible to implement local variables as getter/setter properties", Abort);
+ QVERIFY(!eng.hasUncaughtException());
QVERIFY(eng.evaluate("with (act) x").equals("foo"));
QVERIFY(eng.evaluate("(function() { with (act) return x; })() === act").toBoolean());
eng.evaluate("q = {}; with (act) with (q) x").equals(eng.evaluate("act"));
@@ -5332,7 +5380,7 @@ void tst_QScriptEngine::functionScopes()
// top-level functions have only the global object in their scope
QScriptValue fun = eng.evaluate("(function() {})");
QVERIFY(fun.isFunction());
- QEXPECT_FAIL("", "Function scope proxying is not implemented", Abort);
+ QEXPECT_FAIL("", "QScriptValue::scope() is internal, not implemented", Abort);
QVERIFY(fun.scope().isObject());
QVERIFY(fun.scope().strictlyEquals(eng.globalObject()));
QVERIFY(!eng.globalObject().scope().isValid());
@@ -5641,6 +5689,16 @@ void tst_QScriptEngine::collectGarbageAfterConnect()
QVERIFY(widget == 0);
}
+void tst_QScriptEngine::collectGarbageAfterNativeArguments()
+{
+ // QTBUG-17788
+ QScriptEngine eng;
+ QScriptContext *ctx = eng.pushContext();
+ QScriptValue arguments = ctx->argumentsObject();
+ // Shouldn't crash when marking the arguments object.
+ collectGarbage_helper(eng);
+}
+
static QScriptValue constructQObjectFromThisObject(QScriptContext *ctx, QScriptEngine *eng)
{
Q_ASSERT(ctx->isCalledAsConstructor());
diff --git a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
index d89f9f1..065f099 100644
--- a/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
+++ b/tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
@@ -1291,7 +1291,7 @@ void tst_QScriptEngineAgent::positionChange_1()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, lineNumber);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 8);
// 5 + 6
@@ -1326,7 +1326,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QVERIFY(spy->at(1).scriptId != spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, lineNumber);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 18);
}
@@ -1345,7 +1345,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 11);
}
@@ -1376,14 +1376,14 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 31);
// void(i)
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 31);
}
@@ -1402,21 +1402,21 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 12);
// ++i
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 28);
// ++i
QCOMPARE(spy->at(3).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(3).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(3).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(3).columnNumber, 28);
}
@@ -1435,28 +1435,28 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 12);
// ++i
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 17);
// do
QCOMPARE(spy->at(3).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(3).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(3).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(3).columnNumber, 12);
// ++i
QCOMPARE(spy->at(4).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(4).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(4).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(4).columnNumber, 17);
}
@@ -1487,7 +1487,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 15);
}
@@ -1506,14 +1506,14 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 32);
// continue
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 32);
}
@@ -1556,7 +1556,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 31);
}
@@ -1575,14 +1575,14 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 38);
// break
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 45);
}
@@ -1607,21 +1607,21 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange);
QVERIFY(spy->at(0).scriptId != -1);
QCOMPARE(spy->at(0).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(0).columnNumber, 7);
// i = e
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 29);
// i = 2
QCOMPARE(spy->at(2).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(2).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(2).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(2).columnNumber, 48);
}
@@ -1634,14 +1634,14 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(0).type, ScriptEngineEvent::PositionChange);
QVERIFY(spy->at(0).scriptId != -1);
QCOMPARE(spy->at(0).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(0).columnNumber, 7);
// i = 3
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 46);
}
@@ -1663,7 +1663,7 @@ void tst_QScriptEngineAgent::positionChange_2()
QCOMPARE(spy->at(1).type, ScriptEngineEvent::PositionChange);
QCOMPARE(spy->at(1).scriptId, spy->at(0).scriptId);
QCOMPARE(spy->at(1).lineNumber, 1);
- QEXPECT_FAIL("", "With JSC-based back-end, column number is always reported as 1", Continue);
+ QEXPECT_FAIL("", "QTBUG-17609: With JSC-based back-end, column number is always reported as 1", Continue);
QCOMPARE(spy->at(1).columnNumber, 20);
}
delete spy;
@@ -2247,8 +2247,7 @@ void tst_QScriptEngineAgent::syntaxError()
QCOMPARE(spy->at(i).scriptId, spy->at(0).scriptId);
QVERIFY(!spy->at(i).hasExceptionHandler);
QVERIFY(spy->at(i).value.isError());
- QEXPECT_FAIL("","QTBUG-6137 There are other messages in JSC",Continue);
- QCOMPARE(spy->at(i).value.toString(), QString("SyntaxError: Expected `}'"));
+ QVERIFY(spy->at(i).value.toString().contains(QLatin1String("SyntaxError")));
QCOMPARE(spy->at(i).scriptId, spy->at(0).scriptId);
i = 7;
//exit script
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index 1607bed..c53abcb 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -1008,8 +1008,9 @@ void tst_QScriptExtQObject::getSetStaticProperty_methodPersistence()
QVERIFY(slot.isFunction());
QScriptValue sameSlot = m_engine->evaluate("myObject.mySlot");
QVERIFY(sameSlot.strictlyEquals(slot));
- sameSlot = m_engine->evaluate("myObject[mySlot()]");
- QEXPECT_FAIL("", "Signature-based method lookup creates new function wrapper object", Continue);
+ sameSlot = m_engine->evaluate("myObject['mySlot()']");
+ QVERIFY(sameSlot.isFunction());
+ QEXPECT_FAIL("", "QTBUG-17611: Signature-based method lookup creates new function wrapper object", Continue);
QVERIFY(sameSlot.strictlyEquals(slot));
}
}
@@ -1103,7 +1104,7 @@ void tst_QScriptExtQObject::getSetDynamicProperty_doNotHideJSProperty()
val.setProperty("x", 42);
m_myObject->setProperty("x", 2222);
- QEXPECT_FAIL("", "", Continue);
+ QEXPECT_FAIL("", "QTBUG-17612: Dynamic C++ property overrides JS property", Continue);
// JS should see the original JS value
QVERIFY(val.property("x").strictlyEquals(QScriptValue(m_engine, 42)));
diff --git a/tests/auto/qscriptjstestsuite/expect_fail.txt b/tests/auto/qscriptjstestsuite/expect_fail.txt
new file mode 100644
index 0000000..7f93378
--- /dev/null
+++ b/tests/auto/qscriptjstestsuite/expect_fail.txt
@@ -0,0 +1,198 @@
+ecma/Array/15.4.3.1-2.js | var props = ''; for ( p in Array ) { props += p } props
+
+ecma/Boolean/15.6.3.1-1.js | var str='';for ( p in Boolean ) { str += p } str;
+
+ecma/Expressions/11.4.1.js | var abc; delete(abc)
+
+ecma/FunctionObjects/15.3.3.1-2.js | var str='';for (prop in Function ) str += prop; str;
+
+ecma/ObjectObjects/15.2.3.1-1.js | var str = '';for ( p in Object ) { str += p; }; str
+
+ecma/Statements/12.6.3-11.js | result = ""; for ( p in Number ) { result += String(p) };
+ecma/Statements/12.6.3-2.js | Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]
+
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4256) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4257) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4258) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4259) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4260) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4261) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4262) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4263) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4264) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4265) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4266) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4267) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4268) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4269) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4270) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4271) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4272) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4273) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4274) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4275) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4276) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4277) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4278) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4279) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4280) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4281) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4282) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4283) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4284) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4285) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4286) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4287) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4288) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4289) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4290) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4291) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4292) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-2.js | var s = new String( String.fromCharCode(4293) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-5.js | var s = new String( String.fromCharCode(1024) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.11-5.js | var s = new String( String.fromCharCode(1037) ); s.toLowerCase().charCodeAt(0)
+ecma/String/15.5.4.12-1.js | var s = new String( String.fromCharCode(181) ); s.toUpperCase().charCodeAt(0)
+ecma/String/15.5.4.12-1.js | var s = new String( String.fromCharCode(329) ); s.toUpperCase().charCodeAt(0)
+ecma/String/15.5.4.12-4.js | var s = new String( String.fromCharCode(1104) ); s.toUpperCase().charCodeAt(0)
+ecma/String/15.5.4.12-4.js | var s = new String( String.fromCharCode(1117) ); s.toUpperCase().charCodeAt(0)
+ecma/String/15.5.4.12-5.js | var s = new String( String.fromCharCode(1415) ); s.toUpperCase().charCodeAt(0)
+
+ecma/TypeConversion/9.3.1-3.js | -"\u20001234\u2001"
+ecma/TypeConversion/9.3.1-3.js | - "-0x123456789abcde8"
+
+ecma/extensions/15.1.2.1-1.js | var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS
+
+ecma/GlobalObject/15.1.2.2-1.js | var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS
+ecma/GlobalObject/15.1.2.3-1.js | var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS
+ecma/GlobalObject/15.1.2.4.js | var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS
+ecma/GlobalObject/15.1.2.5-1.js | var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS
+ecma/GlobalObject/15.1.2.6.js | var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS
+ecma/GlobalObject/15.1.2.7.js | var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS
+
+ecma_3/Array/15.4.5.1-01.js | 15.4.5.1 - array.length coverage
+
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 0
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 1
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 2
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 3
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 4
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 5
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 6
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 7
+ecma_3/extensions/regress-274152.js | Do not ignore unicode format-control characters: 8
+ecma_3/extensions/regress-368516.js | Treat unicode BOM characters as whitespace: 0
+ecma_3/extensions/regress-368516.js | Treat unicode BOM characters as whitespace: 1
+
+ecma_3/Date/15.9.4.3.js | 15.9.4.3 - Date.UTC edge-case arguments.: date Infinity
+ecma_3/Date/15.9.4.3.js | 15.9.4.3 - Date.UTC edge-case arguments.: hours Infinity
+ecma_3/Date/15.9.4.3.js | 15.9.4.3 - Date.UTC edge-case arguments.: minutes Infinity
+ecma_3/Date/15.9.4.3.js | 15.9.4.3 - Date.UTC edge-case arguments.: seconds Infinity
+ecma_3/Function/regress-131964.js | Section 1 of test -
+ecma_3/Function/regress-313570.js | length of objects whose prototype chain includes a function: immutable
+ecma_3/FunExpr/fe-001.js | Both functions were defined.
+
+ecma_3/LexicalConventions/7.9.1.js | Automatic Semicolon insertion in postfix expressions: expr\n++
+ecma_3/LexicalConventions/7.9.1.js | Automatic Semicolon insertion in postfix expressions: expr\n--
+ecma_3/LexicalConventions/7.9.1.js | Automatic Semicolon insertion in postfix expressions: (x\n)-- y
+ecma_3/LexicalConventions/7.9.1.js | Automatic Semicolon insertion in postfix expressions: (x)-- y
+
+ecma_3/Object/8.6.1-01.js | In strict mode, setting a read-only property should generate a warning: Throw if STRICT and WERROR is enabled
+
+ecma_3/Operators/order-01.js | operator evaluation order: 11.8.2 >
+ecma_3/Operators/order-01.js | operator evaluation order: 11.8.4 >=
+
+ecma_3/RegExp/15.10.2-1.js | Section 7 of test - \nregexp = /(z)((a+)?(b+)?(c))*/\nstring = 'zaacbbbcac'\nERROR !!! regexp failed to give expected match array:\nExpect: ["zaacbbbcac", "z", "ac", "a", , "c"]\nActual: ["zaacbbbcac", "z", "ac", "a", "bbb", "c"]\n
+ecma_3/RegExp/15.10.2-1.js | Section 8 of test - \nregexp = /(a*)*/\nstring = 'b'\nERROR !!! regexp failed to give expected match array:\nExpect: ["", , ]\nActual: ["", ""]\n
+ecma_3/RegExp/15.10.2-1.js | Section 12 of test - \nregexp = /(.*?)a(?!(a+)b\2c)\2(.*)/\nstring = 'baaabaac'\nERROR !!! regexp failed to give expected match array:\nExpect: ["baaabaac", "ba", , "abaac"]\nActual: ["baaabaac", "ba", "aa", "abaac"]\n
+ecma_3/RegExp/perlstress-001.js | Section 218 of test - \nregexp = /((foo)|(bar))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: ["foobar", "bar", , "bar"]\nActual: ["foobar", "bar", "foo", "bar"]\n
+ecma_3/RegExp/perlstress-001.js | Section 234 of test - \nregexp = /(?:(f)(o)(o)|(b)(a)(r))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: ["foobar", , , , "b", "a", "r"]\nActual: ["foobar", "f", "o", "o", "b", "a", "r"]\n
+ecma_3/RegExp/perlstress-001.js | Section 241 of test - \nregexp = /^(?:b|a(?=(.)))*\1/\nstring = 'abc'\nERROR !!! regexp failed to give expected match array:\nExpect: ["ab", , ]\nActual: ["ab", "b"]\n
+ecma_3/RegExp/perlstress-001.js | Section 412 of test - \nregexp = /^(a(b)?)+$/\nstring = 'aba'\nERROR !!! regexp failed to give expected match array:\nExpect: ["aba", "a", , ]\nActual: ["aba", "a", "b"]\n
+ecma_3/RegExp/perlstress-001.js | Section 413 of test - \nregexp = /^(aa(bb)?)+$/\nstring = 'aabbaa'\nERROR !!! regexp failed to give expected match array:\nExpect: ["aabbaa", "aa", , ]\nActual: ["aabbaa", "aa", "bb"]\n
+
+ecma_3/RegExp/regress-209919.js | Section 1 of test - \nregexp = /(a|b*)*/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: ["a", "a"]\nActual: ["a", ""]\n
+ecma_3/RegExp/regress-209919.js | Section 3 of test - \nregexp = /(b*)*/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: ["", , ]\nActual: ["", ""]\n
+ecma_3/RegExp/regress-209919.js | Section 5 of test - \nregexp = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/\nstring = '100.00'\nERROR !!! regexp failed to give expected match array:\nExpect: ["100.00", "00", , ]\nActual: ["100.00", "", , ]\n
+ecma_3/RegExp/regress-209919.js | Section 6 of test - \nregexp = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/\nstring = '100,00'\nERROR !!! regexp failed to give expected match array:\nExpect: ["100,00", "100", ",00"]\nActual: ["100,00", "", ",00"]\n
+ecma_3/RegExp/regress-209919.js | Section 7 of test - \nregexp = /^\-?(\d{1,}|\.{0,})*(\,\d{1,})?$/\nstring = '1.000,00'\nERROR !!! regexp failed to give expected match array:\nExpect: ["1.000,00", "000", ",00"]\nActual: ["1.000,00", "", ",00"]\n
+
+ecma_3/String/15.5.4.11.js | Section 7
+ecma_3/String/15.5.4.11.js | Section 24
+ecma_3/String/15.5.4.11.js | Section 26
+ecma_3/String/15.5.4.11.js | Section 28
+ecma_3/String/15.5.4.11.js | Section 30
+ecma_3/String/15.5.4.14.js | 15.5.4.14 - String.prototype.split(/()/)
+
+ecma_3/Unicode/regress-352044-01.js | issues with Unicode escape sequences in JavaScript source code
+ecma_3/Unicode/uc-001.js | Unicode format-control character test (Category Cf.)
+
+ecma_2/RegExp/exec-001.js | NO TESTS EXIST
+ecma_2/String/replace-001.js | NO TESTS EXIST
+
+[Q_CC_MSVC]
+ecma_3/Expressions/11.7.3-01.js | 11.7.3 - >>> should evaluate operands in order: order | QTBUG-8056
+ecma_3/Operators/order-01.js | operator evaluation order: 11.7.3 >>> | QTBUG-8056
+ecma_3/Operators/order-01.js | operator evaluation order: 11.13.2 >>>= | QTBUG-8056
+
+[Q_CC_MINGW]
+ecma/Math/15.8.2.13.js | Math.pow(NaN,0)
+ecma/Math/15.8.2.13.js | Math.pow(NaN,-0)
+ecma/Math/15.8.2.5.js | Math.atan2(Infinity, Infinity)
+ecma/Math/15.8.2.5.js | Math.atan2(Infinity, -Infinity)
+ecma/Math/15.8.2.5.js | Math.atan2(-Infinity, Infinity)
+ecma/Math/15.8.2.5.js | Math.atan2(-Infinity, -Infinity)
+
+[Q_OS_SOLARIS]
+ecma/Expressions/11.13.2-2.js | VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1
+ecma/Expressions/11.13.2-2.js | VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1
+ecma/Expressions/11.13.2-2.js | VAR1 = 1; VAR2= -0; VAR1 /= VAR2
+ecma/Expressions/11.13.2-2.js | VAR1 = -1; VAR2= -0; VAR1 /= VAR2
+ecma/Expressions/11.5.2.js | Number.POSITIVE_INFINITY / -0
+ecma/Expressions/11.5.2.js | Number.NEGATIVE_INFINITY / -0
+ecma/Expressions/11.5.2.js | 1 / -0
+ecma/Expressions/11.5.2.js | -1 / -0
+ecma/Math/15.8.2.10.js | Math.log(-0.0000001)
+ecma/Math/15.8.2.10.js | Math.log(-1)
+ecma/Math/15.8.2.11.js | Infinity/Math.max(-0,-0)
+ecma/Math/15.8.2.12.js | Infinity/Math.min(0,-0)
+ecma/Math/15.8.2.12.js | Infinity/Math.min(-0,-0)
+ecma/Math/15.8.2.13.js | Math.pow(NaN,0)
+ecma/Math/15.8.2.13.js | Math.pow(NaN,-0)
+ecma/Math/15.8.2.13.js | Infinity/Math.pow(-Infinity, -1)
+ecma/Math/15.8.2.13.js | Math.pow(0, -1)
+ecma/Math/15.8.2.13.js | Math.pow(0, -0.5)
+ecma/Math/15.8.2.13.js | Math.pow(0, -1000)
+ecma/Math/15.8.2.13.js | Infinity/Math.pow(-0, 1)
+ecma/Math/15.8.2.13.js | Infinity/Math.pow(-0, 3)
+ecma/Math/15.8.2.13.js | Math.pow(-0, -2)
+ecma/Math/15.8.2.15.js | Infinity/Math.round(-0)
+ecma/Math/15.8.2.15.js | Infinity/Math.round(-0.49)
+ecma/Math/15.8.2.15.js | Infinity/Math.round(-0.5)
+ecma/Math/15.8.2.17.js | Infinity/Math.sqrt(-0)
+ecma/Math/15.8.2.18.js | Infinity/Math.tan(-0)
+ecma/Math/15.8.2.2.js | Math.acos(1.00000001)
+ecma/Math/15.8.2.2.js | Math.acos(11.00000001)
+ecma/Math/15.8.2.3.js | Math.asin(1.000001)
+ecma/Math/15.8.2.3.js | Math.asin(-1.000001)
+ecma/Math/15.8.2.3.js | Infinity/Math.asin(-0)
+ecma/Math/15.8.2.4.js | Infinity/Math.atan(-0)
+ecma/Math/15.8.2.5.js | Math.atan2(0, -0)
+ecma/Math/15.8.2.5.js | Infinity/Math.atan2(-0, 1)
+ecma/Math/15.8.2.5.js | Math.atan2(-0,\t-0)
+ecma/Math/15.8.2.5.js | Math.atan2(-0,\t-1)
+ecma/Math/15.8.2.6.js | Infinity/Math.ceil('-0')
+ecma/Math/15.8.2.6.js | Infinity/Math.ceil(-0)
+ecma/Math/15.8.2.6.js | Infinity/Math.ceil(-Number.MIN_VALUE)
+ecma/Math/15.8.2.6.js | Infinity/Math.ceil(-0.9)
+ecma/Math/15.8.2.9.js | Infinity/Math.floor(-0)
+ecma/TypeConversion/9.3.1-3.js | var z = 0; print(1/-z)
+ecma/TypeConversion/9.3.1-3.js | 1/-1e-2000
+
+[Q_OS_SYMBIAN]
+ecma/Math/15.8.2.13.js | Math.pow(-1, 0.5)
+ecma/Math/15.8.2.13.js | Math.pow(-1, -0.5)
+ecma_3/Operators/order-01.js | operator evaluation order: 11.5.1 *
+ecma_3/Operators/order-01.js | operator evaluation order: 11.5.2 /
+ecma_3/Operators/order-01.js | operator evaluation order: 11.6.2 -
+ecma_3/Operators/order-01.js | operator evaluation order: 11.13.2 *=
+ecma_3/Operators/order-01.js | operator evaluation order: 11.13.2 /=
diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
index b1ddd64..471aa02 100644
--- a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
+++ b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.pro
@@ -1,6 +1,8 @@
load(qttest_p4)
QT = core script
SOURCES += tst_qscriptjstestsuite.cpp
+RESOURCES += qscriptjstestsuite.qrc
+include(../qscriptv8testsuite/abstracttestsuite.pri)
!symbian: DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/qscriptjstestsuite/qscriptjstestsuite.qrc b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.qrc
new file mode 100644
index 0000000..4a4eb60
--- /dev/null
+++ b/tests/auto/qscriptjstestsuite/qscriptjstestsuite.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>expect_fail.txt</file>
+ <file>skip.txt</file>
+</qresource>
+</RCC>
diff --git a/tests/auto/qscriptjstestsuite/skip.txt b/tests/auto/qscriptjstestsuite/skip.txt
new file mode 100644
index 0000000..2dc0ccb
--- /dev/null
+++ b/tests/auto/qscriptjstestsuite/skip.txt
@@ -0,0 +1,9 @@
+.+/15\.9\.2\..+ | unstable on slow machines
+.+/15\.9\.5\..+ | too slooow
+regress-130451.js | asserts
+regress-322135-01.js | asserts
+regress-322135-02.js | asserts
+regress-322135-03.js | takes forever
+regress-322135-04.js | takes forever
+ecma_3/RegExp/regress-375715-04.js | bug
+ecma_3/RegExp/regress-289669.js | Can fail due to relying on wall-clock time
diff --git a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
index 43a6dba..e042dfe 100644
--- a/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
+++ b/tests/auto/qscriptjstestsuite/tst_qscriptjstestsuite.cpp
@@ -40,44 +40,18 @@
****************************************************************************/
+#include "abstracttestsuite.h"
#include <QtTest/QtTest>
#include <QtScript>
#if defined(Q_OS_SYMBIAN)
-# define SRCDIR ""
+# define SRCDIR "."
#endif
//TESTED_CLASS=
//TESTED_FILES=
-// Uncomment the following define to have the autotest generate
-// addExpectedFailure() code for all the tests that fail.
-// This is useful when a whole new test (sub)suite is added.
-// The code is stored in addexpectedfailures.cpp.
-// Paste the contents into this file after the existing
-// addExpectedFailure() calls.
-
-//#define GENERATE_ADDEXPECTEDFAILURE_CODE
-
-static QString readFile(const QString &filename)
-{
- QFile file(filename);
- if (!file.open(QFile::ReadOnly))
- return QString();
- QTextStream stream(&file);
- return stream.readAll();
-}
-
-static void appendCString(QVector<char> *v, const char *s)
-{
- char c;
- do {
- c = *(s++);
- *v << c;
- } while (c != '\0');
-}
-
struct TestRecord
{
TestRecord() : lineNumber(-1) { }
@@ -120,17 +94,18 @@ struct FailureItem
QString message;
};
-class tst_Suite : public QObject
+class tst_QScriptJSTestSuite : public AbstractTestSuite
{
public:
- tst_Suite();
- virtual ~tst_Suite();
+ tst_QScriptJSTestSuite();
+ virtual ~tst_QScriptJSTestSuite();
- static QMetaObject staticMetaObject;
- virtual const QMetaObject *metaObject() const;
- virtual void *qt_metacast(const char *);
- virtual int qt_metacall(QMetaObject::Call, int, void **argv);
+protected:
+ virtual void configData(TestConfig::Mode mode, const QStringList &parts);
+ virtual void writeSkipConfigFile(QTextStream &);
+ virtual void writeExpectFailConfigFile(QTextStream &);
+ virtual void runTestFunction(int testIndex);
private:
void addExpectedFailure(const QString &fileName, const QString &description, const QString &message);
@@ -143,33 +118,11 @@ private:
void addFileExclusion(const QRegExp &rx, const QString &message);
bool isExcludedFile(const QString &fileName, QString *message) const;
- QDir testsDir;
QList<QString> subSuitePaths;
QList<FailureItem> expectedFailures;
QList<QPair<QRegExp, QString> > fileExclusions;
-#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE
- QString generatedAddExpectedFailureCode;
-#endif
};
-QMetaObject tst_Suite::staticMetaObject;
-
-Q_GLOBAL_STATIC(QVector<uint>, qt_meta_data_tst_Suite)
-Q_GLOBAL_STATIC(QVector<char>, qt_meta_stringdata_tst_Suite)
-
-const QMetaObject *tst_Suite::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *tst_Suite::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_tst_Suite()->constData()))
- return static_cast<void*>(const_cast<tst_Suite*>(this));
- return QObject::qt_metacast(_clname);
-}
-
static QScriptValue qscript_void(QScriptContext *, QScriptEngine *eng)
{
return eng->undefinedValue();
@@ -222,625 +175,245 @@ static QScriptValue qscript_TestCase(QScriptContext *ctx, QScriptEngine *eng)
return ret;
}
-int tst_Suite::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+void tst_QScriptJSTestSuite::runTestFunction(int testIndex)
{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- if (!(_id & 1)) {
- // data
- QTest::addColumn<TestRecord>("record");
- bool hasData = false;
-
- QString testsShellPath = testsDir.absoluteFilePath("shell.js");
- QString testsShellContents = readFile(testsShellPath);
-
- QDir subSuiteDir(subSuitePaths.at(_id / 2));
- QString subSuiteShellPath = subSuiteDir.absoluteFilePath("shell.js");
- QString subSuiteShellContents = readFile(subSuiteShellPath);
-
- QDir testSuiteDir(subSuiteDir);
- testSuiteDir.cdUp();
- QString suiteJsrefPath = testSuiteDir.absoluteFilePath("jsref.js");
- QString suiteJsrefContents = readFile(suiteJsrefPath);
- QString suiteShellPath = testSuiteDir.absoluteFilePath("shell.js");
- QString suiteShellContents = readFile(suiteShellPath);
-
- QFileInfoList testFileInfos = subSuiteDir.entryInfoList(QStringList() << "*.js", QDir::Files);
- foreach (QFileInfo tfi, testFileInfos) {
- if ((tfi.fileName() == "shell.js") || (tfi.fileName() == "browser.js"))
- continue;
-
- QString abspath = tfi.absoluteFilePath();
- QString relpath = testsDir.relativeFilePath(abspath);
- QString excludeMessage;
- if (isExcludedFile(relpath, &excludeMessage)) {
- QTest::newRow(relpath.toLatin1()) << TestRecord(excludeMessage, relpath);
- continue;
- }
+ if (!(testIndex & 1)) {
+ // data
+ QTest::addColumn<TestRecord>("record");
+ bool hasData = false;
+
+ QString testsShellPath = testsDir.absoluteFilePath("shell.js");
+ QString testsShellContents = readFile(testsShellPath);
+
+ QDir subSuiteDir(subSuitePaths.at(testIndex / 2));
+ QString subSuiteShellPath = subSuiteDir.absoluteFilePath("shell.js");
+ QString subSuiteShellContents = readFile(subSuiteShellPath);
+
+ QDir testSuiteDir(subSuiteDir);
+ testSuiteDir.cdUp();
+ QString suiteJsrefPath = testSuiteDir.absoluteFilePath("jsref.js");
+ QString suiteJsrefContents = readFile(suiteJsrefPath);
+ QString suiteShellPath = testSuiteDir.absoluteFilePath("shell.js");
+ QString suiteShellContents = readFile(suiteShellPath);
+
+ QFileInfoList testFileInfos = subSuiteDir.entryInfoList(QStringList() << "*.js", QDir::Files);
+ foreach (QFileInfo tfi, testFileInfos) {
+ if ((tfi.fileName() == "shell.js") || (tfi.fileName() == "browser.js"))
+ continue;
+
+ QString abspath = tfi.absoluteFilePath();
+ QString relpath = testsDir.relativeFilePath(abspath);
+ QString excludeMessage;
+ if (isExcludedFile(relpath, &excludeMessage)) {
+ QTest::newRow(relpath.toLatin1()) << TestRecord(excludeMessage, relpath);
+ continue;
+ }
- QScriptEngine eng;
- QScriptValue global = eng.globalObject();
- global.setProperty("print", eng.newFunction(qscript_void));
- global.setProperty("quit", eng.newFunction(qscript_quit));
- global.setProperty("options", eng.newFunction(qscript_options));
-
- eng.evaluate(testsShellContents, testsShellPath);
- if (eng.hasUncaughtException()) {
- QStringList bt = eng.uncaughtExceptionBacktrace();
- QString err = eng.uncaughtException().toString();
- qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
- break;
- }
+ QScriptEngine eng;
+ QScriptValue global = eng.globalObject();
+ global.setProperty("print", eng.newFunction(qscript_void));
+ global.setProperty("quit", eng.newFunction(qscript_quit));
+ global.setProperty("options", eng.newFunction(qscript_options));
+
+ eng.evaluate(testsShellContents, testsShellPath);
+ if (eng.hasUncaughtException()) {
+ QStringList bt = eng.uncaughtExceptionBacktrace();
+ QString err = eng.uncaughtException().toString();
+ qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
+ break;
+ }
- eng.evaluate(suiteJsrefContents, suiteJsrefPath);
- if (eng.hasUncaughtException()) {
- QStringList bt = eng.uncaughtExceptionBacktrace();
- QString err = eng.uncaughtException().toString();
- qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
- break;
- }
+ eng.evaluate(suiteJsrefContents, suiteJsrefPath);
+ if (eng.hasUncaughtException()) {
+ QStringList bt = eng.uncaughtExceptionBacktrace();
+ QString err = eng.uncaughtException().toString();
+ qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
+ break;
+ }
- eng.evaluate(suiteShellContents, suiteShellPath);
- if (eng.hasUncaughtException()) {
- QStringList bt = eng.uncaughtExceptionBacktrace();
- QString err = eng.uncaughtException().toString();
- qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
- break;
- }
+ eng.evaluate(suiteShellContents, suiteShellPath);
+ if (eng.hasUncaughtException()) {
+ QStringList bt = eng.uncaughtExceptionBacktrace();
+ QString err = eng.uncaughtException().toString();
+ qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
+ break;
+ }
- eng.evaluate(subSuiteShellContents, subSuiteShellPath);
- if (eng.hasUncaughtException()) {
- QStringList bt = eng.uncaughtExceptionBacktrace();
- QString err = eng.uncaughtException().toString();
- qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
- break;
- }
+ eng.evaluate(subSuiteShellContents, subSuiteShellPath);
+ if (eng.hasUncaughtException()) {
+ QStringList bt = eng.uncaughtExceptionBacktrace();
+ QString err = eng.uncaughtException().toString();
+ qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
+ break;
+ }
- QScriptValue origTestCaseCtor = global.property("TestCase");
- QScriptValue myTestCaseCtor = eng.newFunction(qscript_TestCase);
- myTestCaseCtor.setData(origTestCaseCtor);
- global.setProperty("TestCase", myTestCaseCtor);
+ QScriptValue origTestCaseCtor = global.property("TestCase");
+ QScriptValue myTestCaseCtor = eng.newFunction(qscript_TestCase);
+ myTestCaseCtor.setData(origTestCaseCtor);
+ global.setProperty("TestCase", myTestCaseCtor);
- global.setProperty("gTestfile", tfi.fileName());
- global.setProperty("gTestsuite", testSuiteDir.dirName());
- global.setProperty("gTestsubsuite", subSuiteDir.dirName());
- QString testFileContents = readFile(abspath);
+ global.setProperty("gTestfile", tfi.fileName());
+ global.setProperty("gTestsuite", testSuiteDir.dirName());
+ global.setProperty("gTestsubsuite", subSuiteDir.dirName());
+ QString testFileContents = readFile(abspath);
// qDebug() << relpath;
- eng.evaluate(testFileContents, abspath);
- if (eng.hasUncaughtException() && !relpath.endsWith("-n.js")) {
- QStringList bt = eng.uncaughtExceptionBacktrace();
- QString err = eng.uncaughtException().toString();
- qWarning("%s\n%s\n", qPrintable(err), qPrintable(bt.join("\n")));
- continue;
- }
+ eng.evaluate(testFileContents, abspath);
+ if (eng.hasUncaughtException() && !relpath.endsWith("-n.js")) {
+ QStringList bt = eng.uncaughtExceptionBacktrace();
+ QString err = eng.uncaughtException().toString();
+ qWarning("%s\n%s\n", qPrintable(err), qPrintable(bt.join("\n")));
+ continue;
+ }
- QScriptValue testcases = global.property("testcases");
- if (!testcases.isArray())
- testcases = global.property("gTestcases");
- int count = testcases.property("length").toInt32();
- if (count == 0)
- continue;
-
- hasData = true;
- QString title = global.property("TITLE").toString();
- for (int i = 0; i < count; ++i) {
- QScriptValue kase = testcases.property(i);
- QString description = kase.property("description").toString();
- QScriptValue expect = kase.property("expect");
- QScriptValue actual = kase.property("actual");
- bool passed = kase.property("passed").toBoolean();
- int lineNumber = kase.property("__lineNumber__").toInt32();
-
- TestRecord rec(description, passed,
- actual.toString(), expect.toString(),
- relpath, lineNumber);
-
- QTest::newRow(description.toLatin1()) << rec;
- }
+ QScriptValue testcases = global.property("testcases");
+ if (!testcases.isArray())
+ testcases = global.property("gTestcases");
+ int count = testcases.property("length").toInt32();
+ if (count == 0)
+ continue;
+
+ hasData = true;
+ QString title = global.property("TITLE").toString();
+ for (int i = 0; i < count; ++i) {
+ QScriptValue kase = testcases.property(i);
+ QString description = kase.property("description").toString();
+ QScriptValue expect = kase.property("expect");
+ QScriptValue actual = kase.property("actual");
+ bool passed = kase.property("passed").toBoolean();
+ int lineNumber = kase.property("__lineNumber__").toInt32();
+
+ TestRecord rec(description, passed,
+ actual.toString(), expect.toString(),
+ relpath, lineNumber);
+
+ QTest::newRow(description.toLatin1()) << rec;
}
- if (!hasData)
- QTest::newRow("") << TestRecord(); // dummy
+ }
+ if (!hasData)
+ QTest::newRow("") << TestRecord(); // dummy
+ } else {
+ QFETCH(TestRecord, record);
+ if ((record.lineNumber == -1) && (record.actual == "QSKIP")) {
+ QTest::qSkip(record.description.toLatin1(), QTest::SkipAll, record.fileName.toLatin1(), -1);
} else {
- QFETCH(TestRecord, record);
- if ((record.lineNumber == -1) && (record.actual == "QSKIP")) {
- QTest::qSkip(record.description.toLatin1(), QTest::SkipAll, record.fileName.toLatin1(), -1);
- } else {
- QString msg;
- FailureItem::Action failAct;
- bool expectFail = isExpectedFailure(record.fileName, record.description, &msg, &failAct);
- if (expectFail) {
- switch (failAct) {
- case FailureItem::ExpectFail:
- QTest::qExpectFail("", msg.toLatin1(),
- QTest::Continue, record.fileName.toLatin1(),
- record.lineNumber);
- break;
- case FailureItem::Skip:
- QTest::qSkip(msg.toLatin1(), QTest::SkipSingle,
- record.fileName.toLatin1(), record.lineNumber);
- break;
- }
+ QString msg;
+ FailureItem::Action failAct;
+ bool expectFail = isExpectedFailure(record.fileName, record.description, &msg, &failAct);
+ if (expectFail) {
+ switch (failAct) {
+ case FailureItem::ExpectFail:
+ QTest::qExpectFail("", msg.toLatin1(),
+ QTest::Continue, record.fileName.toLatin1(),
+ record.lineNumber);
+ break;
+ case FailureItem::Skip:
+ QTest::qSkip(msg.toLatin1(), QTest::SkipSingle,
+ record.fileName.toLatin1(), record.lineNumber);
+ break;
}
- if (!expectFail || (failAct == FailureItem::ExpectFail)) {
- if (!record.passed) {
-#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE
- if (!expectFail) {
- QString escapedDescription = record.description;
- escapedDescription.replace("\\", "\\\\");
- escapedDescription.replace("\n", "\\n");
- escapedDescription.replace("\"", "\\\"");
- generatedAddExpectedFailureCode.append(
- " addExpectedFailure(\"" + record.fileName
- + "\", \"" + escapedDescription +
- "\", willFixInNextReleaseMessage);\n");
- }
-#endif
- QTest::qCompare(record.actual, record.expected, "actual", "expect",
- record.fileName.toLatin1(), record.lineNumber);
- } else {
- QTest::qCompare(record.actual, record.actual, "actual", "expect",
- record.fileName.toLatin1(), record.lineNumber);
+ }
+ if (!expectFail || (failAct == FailureItem::ExpectFail)) {
+ if (!record.passed) {
+ if (!expectFail && shouldGenerateExpectedFailures) {
+ addExpectedFailure(record.fileName,
+ record.description,
+ QString());
}
+ QTest::qCompare(record.actual, record.expected, "actual", "expect",
+ record.fileName.toLatin1(), record.lineNumber);
+ } else {
+ QTest::qCompare(record.actual, record.actual, "actual", "expect",
+ record.fileName.toLatin1(), record.lineNumber);
}
}
}
- _id -= subSuitePaths.size()*2;
}
- return _id;
}
-tst_Suite::tst_Suite()
+tst_QScriptJSTestSuite::tst_QScriptJSTestSuite()
+ : AbstractTestSuite("tst_QScriptJsTestSuite",
+ QString::fromLatin1("%0/tests").arg(SRCDIR),
+ ":/")
{
- testsDir = QDir(SRCDIR);
- bool testsFound = testsDir.cd("tests");
- if (!testsFound) {
- qWarning("*** no tests/ dir!");
- }
-
- QString willFixInNextReleaseMessage = QString::fromLatin1("Will fix in next release");
- QString fromCharCodeMessage = QString::fromLatin1("Test is wrong?");
- for (int i = 4256; i < 4294; ++i) {
- addExpectedFailure("ecma/String/15.5.4.11-2.js", QString::fromLatin1("var s = new String( String.fromCharCode(%0) ); s.toLowerCase().charCodeAt(0)").arg(i), fromCharCodeMessage);
- }
- addExpectedFailure("ecma/String/15.5.4.11-5.js", "var s = new String( String.fromCharCode(1024) ); s.toLowerCase().charCodeAt(0)", fromCharCodeMessage);
- addExpectedFailure("ecma/String/15.5.4.11-5.js", "var s = new String( String.fromCharCode(1037) ); s.toLowerCase().charCodeAt(0)", fromCharCodeMessage);
- addExpectedFailure("ecma/String/15.5.4.12-1.js", "var s = new String( String.fromCharCode(181) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage);
- addExpectedFailure("ecma/String/15.5.4.12-1.js", "var s = new String( String.fromCharCode(329) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage);
- addExpectedFailure("ecma/String/15.5.4.12-4.js", "var s = new String( String.fromCharCode(1104) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage);
- addExpectedFailure("ecma/String/15.5.4.12-4.js", "var s = new String( String.fromCharCode(1117) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage);
- addExpectedFailure("ecma/String/15.5.4.12-5.js", "var s = new String( String.fromCharCode(1415) ); s.toUpperCase().charCodeAt(0)", fromCharCodeMessage);
-
- addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "- \"-0x123456789abcde8\"", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma/extensions/15.1.2.1-1.js", "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/GlobalObject/15.1.2.2-1.js", "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma/GlobalObject/15.1.2.3-1.js", "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/GlobalObject/15.1.2.4.js", "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/GlobalObject/15.1.2.5-1.js", "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/GlobalObject/15.1.2.6.js", "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/GlobalObject/15.1.2.7.js", "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", willFixInNextReleaseMessage);
-
- addExpectedFailure(QRegExp(), "NO TESTS EXIST", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma_3/Array/15.4.5.1-01.js", "15.4.5.1 - array.length coverage", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma_3/extensions/regress-228087-002.js",
- "Section 1 of test - \nregexp = /{1.*}/g\n"
- "string = 'foo {1} foo {2} foo'\n"
- "ERROR !!! match arrays have different lengths:\n"
- "Expect: [\"{1} foo {2}\"]\n"
- "Actual: []", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js",
- "Section 1 of test - \n"
- "regexp = /a|ab/\n"
- "string = 'abc'\n"
- "ERROR !!! regexp failed to give expected match array:\n"
- "Expect: [\"a\"]\n"
- "Actual: [\"ab\"]\n", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js",
- "Section 2 of test - \n"
- "regexp = /((a)|(ab))((c)|(bc))/\n"
- "string = 'abc'\n"
- "ERROR !!! regexp failed to give expected match array:\n"
- "Expect: [\"abc\", \"a\", \"a\", , \"bc\", , \"bc\"]\n"
- "Actual: [\"abc\", \"ab\", \"\", \"ab\", \"c\", \"c\", \"\"]\n", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js",
- "Section 4 of test - \n"
- "regexp = /a[a-z]{2,4}?/\n"
- "string = 'abcdefghi'\n"
- "ERROR !!! regexp FAILED to match anything !!!\n"
- "Expect: abc\n"
- "Actual: null\n", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js(317)",
- "Section 5 of test - \n"
- "regexp = /(aa|aabaac|ba|b|c)*/\n"
- "string = 'aabaac'\n"
- "ERROR !!! regexp failed to give expected match array:\n"
- "Expect: [\"aaba\", \"ba\"]\n"
- "Actual: [\"aabaac\", \"aabaac\"]\n", willFixInNextReleaseMessage);
-
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 1 of test - \nregexp = /{1.*}/g\nstring = 'foo {1} foo {2} foo'\nERROR !!! match arrays have different lengths:\nExpect: [\"{1} foo {2}\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 2 of test - \nregexp = /{1.*}/g\nstring = 'foo {1} foo {2} foo'\nERROR !!! match arrays have different lengths:\nExpect: [\"{1} foo {2}\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 3 of test - \nregexp = /{1[.!}]*}/g\nstring = 'foo {1} foo {2} foo'\nERROR !!! match arrays have different lengths:\nExpect: [\"{1}\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 4 of test - \nregexp = /{1[.!}]*}/g\nstring = 'foo {1} foo {2} foo'\nERROR !!! match arrays have different lengths:\nExpect: [\"{1}\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 6 of test - \nregexp = /c{3 }/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 }\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 7 of test - \nregexp = /c{3.}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 }\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 8 of test - \nregexp = /c{3\\s}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 }\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 9 of test - \nregexp = /c{3[ ]}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 }\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 10 of test - \nregexp = /c{ 3}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{ 3}\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 12 of test - \nregexp = /c{3, }/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3, }\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 13 of test - \nregexp = /c{3 ,}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 ,}\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 15 of test - \nregexp = /c{3 ,4}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3 ,4}\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 16 of test - \nregexp = /c{3, 4}/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3, 4}\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-228087.js", "Section 17 of test - \nregexp = /c{3,4 }/\nstring = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de'\nERROR !!! regexp FAILED to match anything !!!\nExpect: c{3,4 }\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 0", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 1", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 2", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 3", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 4", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 5", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 6", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 7", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-274152.js", "Do not ignore unicode format-control characters: 8", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-368516.js", "Treat unicode BOM characters as whitespace: 0", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/extensions/regress-368516.js", "Treat unicode BOM characters as whitespace: 1", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/FunExpr/fe-001-n.js", "Previous statement should have thrown a ReferenceError", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/LexicalConventions/7.9.1.js", "Automatic Semicolon insertion in postfix expressions: expr\n++", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/LexicalConventions/7.9.1.js", "Automatic Semicolon insertion in postfix expressions: expr\n--", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/LexicalConventions/7.9.1.js", "Automatic Semicolon insertion in postfix expressions: (x\n)-- y", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/LexicalConventions/7.9.1.js", "Automatic Semicolon insertion in postfix expressions: (x)-- y", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Object/8.6.1-01.js", "In strict mode, setting a read-only property should generate a warning: Throw if STRICT and WERROR is enabled", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.8.2 >", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.8.4 >=", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 5 of test - \nregexp = /(aa|aabaac|ba|b|c)*/\nstring = 'aabaac'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aaba\", \"ba\"]\nActual: [\"aabaac\", \"aabaac\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 6 of test - \nregexp = /^(a+)\\1*,\\1+$/\nstring = 'aaaaaaaaaa,aaaaaaaaaaaaaaa'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aaaaaaaaaa,aaaaaaaaaaaaaaa,aaaaa\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 7 of test - \nregexp = /(z)((a+)?(b+)?(c))*/\nstring = 'zaacbbbcac'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"zaacbbbcac\", \"z\", \"ac\", \"a\", , \"c\"]\nActual: [\"zaacbbbcac\", \"z\", \"ac\", \"a\", \"\", \"c\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 8 of test - \nregexp = /(a*)*/\nstring = 'b'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", , ]\nActual: [\"\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 10 of test - \nregexp = /(?=(a+))/\nstring = 'baaabac'\nERROR !!! match arrays have different lengths:\nExpect: [\"\", \"aaa\"]\nActual: [\"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 11 of test - \nregexp = /(?=(a+))a*b\\1/\nstring = 'baaabac'\nERROR !!! match arrays have different lengths:\nExpect: [\"aba\", \"a\"]\nActual: [\"aaab\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 12 of test - \nregexp = /(.*?)a(?!(a+)b\\2c)\\2(.*)/\nstring = 'baaabaac'\nERROR !!! regexp FAILED to match anything !!!\nExpect: baaabaac,ba,,abaac\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 13 of test - \nregexp = /(?=(a+))/\nstring = 'baaabac'\nERROR !!! match arrays have different lengths:\nExpect: [\"\", \"aaa\"]\nActual: [\"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 34 of test - \nregexp = /a]/\nstring = 'a]'\nERROR !!! regexp FAILED to match anything !!!\nExpect: a]\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 66 of test - \nregexp = /a.+?c/\nstring = 'abcabc'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abc\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 94 of test - \nregexp = /^a(bc+|b[eh])g|.h$/\nstring = 'abh'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"bh\", , ]\nActual: [\"bh\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 95 of test - \nregexp = /(bc+d$|ef*g.|h?i(j|k))/\nstring = 'effgz'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"effgz\", \"effgz\", , ]\nActual: [\"effgz\", \"effgz\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 97 of test - \nregexp = /(bc+d$|ef*g.|h?i(j|k))/\nstring = 'reffgz'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"effgz\", \"effgz\", , ]\nActual: [\"effgz\", \"effgz\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 109 of test - \nregexp = /(([a-c])b*?\\2)*/\nstring = 'ababbbcbc'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ababb,bb,b\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 110 of test - \nregexp = /(([a-c])b*?\\2){3}/\nstring = 'ababbbcbc'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ababbbcbc,cbc,c\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 119 of test - \nregexp = /ab*?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 120 of test - \nregexp = /ab{0,}?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 121 of test - \nregexp = /ab+?bc/i\nstring = 'ABBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 123 of test - \nregexp = /ab{1,}?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 124 of test - \nregexp = /ab{1,3}?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 125 of test - \nregexp = /ab{3,4}?bc/i\nstring = 'ABBBBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBBBC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 126 of test - \nregexp = /ab??bc/i\nstring = 'ABBC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABBC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 127 of test - \nregexp = /ab??bc/i\nstring = 'ABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 128 of test - \nregexp = /ab{0,1}?bc/i\nstring = 'ABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 129 of test - \nregexp = /ab??c/i\nstring = 'ABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 130 of test - \nregexp = /ab{0,1}?c/i\nstring = 'ABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 138 of test - \nregexp = /a.*?c/i\nstring = 'AXYZC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: AXYZC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 144 of test - \nregexp = /a]/i\nstring = 'A]'\nERROR !!! regexp FAILED to match anything !!!\nExpect: A]\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 160 of test - \nregexp = /a.+?c/i\nstring = 'ABCABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 161 of test - \nregexp = /a.*?c/i\nstring = 'ABCABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 162 of test - \nregexp = /a.{0,5}?c/i\nstring = 'ABCABC'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ABC\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 169 of test - \nregexp = /(a+|b){0,1}?/i\nstring = 'AB'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ,\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 191 of test - \nregexp = /^a(bc+|b[eh])g|.h$/i\nstring = 'ABH'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"BH\", , ]\nActual: [\"BH\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 192 of test - \nregexp = /(bc+d$|ef*g.|h?i(j|k))/i\nstring = 'EFFGZ'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"EFFGZ\", \"EFFGZ\", , ]\nActual: [\"EFFGZ\", \"EFFGZ\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 194 of test - \nregexp = /(bc+d$|ef*g.|h?i(j|k))/i\nstring = 'REFFGZ'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"EFFGZ\", \"EFFGZ\", , ]\nActual: [\"EFFGZ\", \"EFFGZ\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 212 of test - \nregexp = /a(?:b|c|d)+?(.)/\nstring = 'ace'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ace,e\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 213 of test - \nregexp = /a(?:b|c|d)+?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acd,d\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 217 of test - \nregexp = /a(?:b|c|d){4,5}?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acdbcd,d\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 218 of test - \nregexp = /((foo)|(bar))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"foobar\", \"bar\", , \"bar\"]\nActual: [\"foobar\", \"bar\", \"\", \"bar\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 220 of test - \nregexp = /a(?:b|c|d){6,7}?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acdbcdbe,e\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 222 of test - \nregexp = /a(?:b|c|d){5,6}?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acdbcdb,b\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 224 of test - \nregexp = /a(?:b|c|d){5,7}?(.)/\nstring = 'acdbcdbe'\nERROR !!! regexp FAILED to match anything !!!\nExpect: acdbcdb,b\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 225 of test - \nregexp = /a(?:b|(c|e){1,2}?|d)+?(.)/\nstring = 'ace'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ace,c,e\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 227 of test - \nregexp = /^([^a-z])|(\\^)$/\nstring = '.'\nERROR !!! regexp failed to give expected match array:\nExpect: [\".\", \".\", , ]\nActual: [\".\", \".\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 234 of test - \nregexp = /(?:(f)(o)(o)|(b)(a)(r))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"foobar\", , , , \"b\", \"a\", \"r\"]\nActual: [\"foobar\", \"\", \"\", \"\", \"b\", \"a\", \"r\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 240 of test - \nregexp = /(?:..)*?a/\nstring = 'aba'\nERROR !!! regexp FAILED to match anything !!!\nExpect: a\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 241 of test - \nregexp = /^(?:b|a(?=(.)))*\\1/\nstring = 'abc'\nERROR !!! match arrays have different lengths:\nExpect: [\"ab\", , ]\nActual: [\"ab\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 246 of test - \nregexp = /(a|x)*ab/\nstring = 'cab'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"ab\", , ]\nActual: [\"ab\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 247 of test - \nregexp = /(a)*ab/\nstring = 'cab'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"ab\", , ]\nActual: [\"ab\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 300 of test - \nregexp = /(?=(a+?))(\\1ab)/\nstring = 'aaab'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aab,a,aab\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 303 of test - \nregexp = /(?=(a+?))(\\1ab)/\nstring = 'aaab'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aab,a,aab\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 304 of test - \nregexp = /([\\w:]+::)?(\\w+)$/\nstring = 'abcd'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"abcd\", , \"abcd\"]\nActual: [\"abcd\", \"\", \"abcd\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 308 of test - \nregexp = /([\\w:]+::)?(\\w+)$/\nstring = 'abcd'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"abcd\", , \"abcd\"]\nActual: [\"abcd\", \"\", \"abcd\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 342 of test - \nregexp = /a$/m\nstring = 'a\\nb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: a\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 344 of test - \nregexp = /a$/m\nstring = 'b\\na\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: a\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 353 of test - \nregexp = /aa$/m\nstring = 'aa\\nb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aa\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 355 of test - \nregexp = /aa$/m\nstring = 'b\\naa\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: aa\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 364 of test - \nregexp = /ab$/m\nstring = 'ab\\nb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ab\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 366 of test - \nregexp = /ab$/m\nstring = 'b\\nab\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: ab\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 375 of test - \nregexp = /abb$/m\nstring = 'abb\\nb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abb\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 377 of test - \nregexp = /abb$/m\nstring = 'b\\nabb\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abb\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 383 of test - \nregexp = /^d[x][x][x]/m\nstring = 'abcd\\ndxxx'\nERROR !!! regexp FAILED to match anything !!!\nExpect: dxxx\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 391 of test - \nregexp = /\\.c(pp|xx|c)?$/i\nstring = 'IO.c'\nERROR !!! regexp failed to give expected match array:\nExpect: [\".c\", , ]\nActual: [\".c\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 392 of test - \nregexp = /(\\.c(pp|xx|c)?$)/i\nstring = 'IO.c'\nERROR !!! regexp failed to give expected match array:\nExpect: [\".c\", \".c\", , ]\nActual: [\".c\", \".c\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 394 of test - \nregexp = /^([ab]*?)(b)?(c)$/\nstring = 'abac'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abac,aba,,c\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 412 of test - \nregexp = /^(a(b)?)+$/\nstring = 'aba'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aba\", \"a\", , ]\nActual: [\"aba\", \"a\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 413 of test - \nregexp = /^(aa(bb)?)+$/\nstring = 'aabbaa'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aabbaa\", \"aa\", , ]\nActual: [\"aabbaa\", \"aa\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 414 of test - \nregexp = /^.{9}abc.*\\n/m\nstring = '123\\nabcabcabcabc\\n'\nERROR !!! regexp FAILED to match anything !!!\nExpect: abcabcabcabc\n\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 415 of test - \nregexp = /^(a)?a$/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , ]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 416 of test - \nregexp = /^(a\\1?)(a\\1?)(a\\2?)(a\\3?)$/\nstring = 'aaaaaa'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aaaaaa\", \"a\", \"aa\", \"a\", \"aa\"]\nActual: [\"aaaaaa\", \"aa\", \"a\", \"aa\", \"a\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 418 of test - \nregexp = /^(0+)?(?:x(1))?/\nstring = 'x1'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"x1\", , \"1\"]\nActual: [\"x1\", \"\", \"1\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 419 of test - \nregexp = /^([0-9a-fA-F]+)(?:x([0-9a-fA-F]+)?)(?:x([0-9a-fA-F]+))?/\nstring = '012cxx0190'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"012cxx0190\", \"012c\", , \"0190\"]\nActual: [\"012cxx0190\", \"012c\", \"\", \"0190\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 420 of test - \nregexp = /^(b+?|a){1,2}c/\nstring = 'bbbac'\nERROR !!! regexp FAILED to match anything !!!\nExpect: bbbac,a\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 421 of test - \nregexp = /^(b+?|a){1,2}c/\nstring = 'bbbbac'\nERROR !!! regexp FAILED to match anything !!!\nExpect: bbbbac,a\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-002.js", "Section 40 of test - \nregexp = /(a)|\\1/\nstring = 'x'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", , ]\nActual: [\"\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-105972.js", "Section 1 of test - \nregexp = /^.*?$/\nstring = 'Hello World'\nERROR !!! regexp FAILED to match anything !!!\nExpect: Hello World\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-105972.js", "Section 2 of test - \nregexp = /^.*?/\nstring = 'Hello World'\nERROR !!! regexp FAILED to match anything !!!\nExpect: \nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-105972.js", "Section 3 of test - \nregexp = /^.*?(:|$)/\nstring = 'Hello: World'\nERROR !!! regexp FAILED to match anything !!!\nExpect: Hello:,:\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-123437.js", "Section 1 of test - \nregexp = /(a)?a/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , ]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-123437.js", "Section 2 of test - \nregexp = /a|(b)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , ]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-123437.js", "Section 3 of test - \nregexp = /(a)?(a)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , \"a\"]\nActual: [\"a\", \"\", \"a\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-165353.js", "Section 1 of test - \nregexp = /^([a-z]+)*[a-z]$/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", , ]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-169497.js", "Section 1 of test - \nregexp = /<body.*>((.*\\n?)*?)<\\/body>/i\nstring = '<html>\\n<body onXXX=\"alert(event.type);\">\\n<p>Kibology for all</p>\\n<p>All for Kibology</p>\\n</body>\\n</html>'\nERROR !!! regexp FAILED to match anything !!!\nExpect: <body onXXX=\"alert(event.type);\">\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n</body>,\n<p>Kibology for all</p>\n<p>All for Kibology</p>\n,<p>All for Kibology</p>\n\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-187133.js", "Section 5 of test - \nregexp = /(?!a|b)|c/\nstring = 'bc'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\"]\nActual: [\"c\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 1 of test - \nregexp = /(\\d|\\d\\s){2,}/\nstring = '12 3 45'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"12\", \"2\"]\nActual: [\"12 3 45\", \"5\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 3 of test - \nregexp = /(\\d|\\d\\s)+/\nstring = '12 3 45'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"12\", \"2\"]\nActual: [\"12 3 45\", \"5\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 8 of test - \nregexp = /(\\d|\\d\\s){2,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12,2\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 9 of test - \nregexp = /(\\d|\\d\\s){4,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12 3 4,4\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 10 of test - \nregexp = /(\\d|\\d\\s)+?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 1,1\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 11 of test - \nregexp = /(\\d\\s?){4,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12 3 4,4\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 12 of test - \nregexp = /(\\d\\s|\\d){2,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12 ,2 \nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 13 of test - \nregexp = /(\\d\\s|\\d){4,}?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 12 3 4,4\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-191479.js", "Section 14 of test - \nregexp = /(\\d\\s|\\d)+?/\nstring = '12 3 45'\nERROR !!! regexp FAILED to match anything !!!\nExpect: 1,1\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-202564.js", "Section 1 of test - \nregexp = /(?:(.+), )?(.+), (..) to (?:(.+), )?(.+), (..)/\nstring = 'Seattle, WA to Buckley, WA'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"Seattle, WA to Buckley, WA\", , \"Seattle\", \"WA\", , \"Buckley\", \"WA\"]\nActual: [\"Seattle, WA to Buckley, WA\", \"\", \"Seattle\", \"WA\", \"\", \"Buckley\", \"WA\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 2 of test - \nregexp = /(a|b*){5,}/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", \"\"]\nActual: [\"a\", \"a\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 3 of test - \nregexp = /(b*)*/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", , ]\nActual: [\"\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 5 of test - \nregexp = /^\\-?(\\d{1,}|\\.{0,})*(\\,\\d{1,})?$/\nstring = '100.00'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"100.00\", \"00\", , ]\nActual: [\"100.00\", \"00\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-216591.js", "Section 1 of test - \nregexp = /\\{(([a-z0-9\\-_]+?\\.)+?)([a-z0-9\\-_]+?)\\}/i\nstring = 'a {result.data.DATA} b'\nERROR !!! regexp FAILED to match anything !!!\nExpect: {result.data.DATA},result.data.,data.,DATA\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-216591.js", "Section 2 of test - \nregexp = /\\{(([a-z0-9\\-_]+?\\.)+?)([a-z0-9\\-_]+?)\\}/gi\nstring = 'a {result.data.DATA} b'\nERROR !!! match arrays have different lengths:\nExpect: [\"{result.data.DATA}\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-220367-001.js", "Section 1 of test - \nregexp = /(a)|(b)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", \"a\", , ]\nActual: [\"a\", \"a\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-220367-001.js", "Section 2 of test - \nregexp = /(a)|(b)/\nstring = 'b'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"b\", , \"b\"]\nActual: [\"b\", \"\", \"b\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-223535.js", "Section 2 of test - \nregexp = /|a/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\"]\nActual: [\"a\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-223535.js", "Section 6 of test - \nregexp = /(|a)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", \"\"]\nActual: [\"a\", \"a\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-223535.js", "Section 7 of test - \nregexp = /(|a|)/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"\", \"\"]\nActual: [\"a\", \"a\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-224676.js", "Section 17 of test - \nregexp = /[x]b|(a)/\nstring = 'ZZZxbZZZ'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"xb\", , ]\nActual: [\"xb\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-224676.js", "Section 18 of test - \nregexp = /[x]b|()a/\nstring = 'ZZZxbZZZ'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"xb\", , ]\nActual: [\"xb\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 7 of test - \nregexp = /(a)|([^a])/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", \"a\", , ]\nActual: [\"a\", \"a\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 9 of test - \nregexp = /(a)|([^a])/\nstring = '()'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"(\", , \"(\"]\nActual: [\"(\", \"\", \"(\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 10 of test - \nregexp = /((?:a|[^a])*)/g\nstring = 'a'\nERROR !!! match arrays have different lengths:\nExpect: [\"a\", \"\"]\nActual: [\"a\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 11 of test - \nregexp = /((?:a|[^a])*)/g\nstring = ''\nERROR !!! match arrays have different lengths:\nExpect: [\"\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-225289.js", "Section 12 of test - \nregexp = /((?:a|[^a])*)/g\nstring = '()'\nERROR !!! match arrays have different lengths:\nExpect: [\"()\", \"\"]\nActual: [\"()\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-31316.js", "Section 1 of test - \nregexp = /<([^\\/<>][^<>]*[^\\/])>|<([^\\/<>])>/\nstring = '<p>Some<br />test</p>'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"<p>\", , \"p\"]\nActual: [\"<p>\", \"\", \"p\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-330684.js", "Do not hang on RegExp", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-375711.js", "Do not assert with /[Q-b]/i.exec(\"\"): /[q-b]/.exec(\"\")", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-375711.js", "Do not assert with /[Q-b]/i.exec(\"\"): /[q-b]/i.exec(\"\")", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(?)'and flag 'i'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(?)'and flag 'g'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(?)'and flag 'm'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(?)'and flag 'undefined'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(a'and flag 'i'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(a'and flag 'g'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(a'and flag 'm'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '(a'and flag 'undefined'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '( ]'and flag 'i'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '( ]'and flag 'g'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '( ]'and flag 'm'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-57631.js", "Testing for error creating illegal RegExp object on pattern '( ]'and flag 'undefined'", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-78156.js", "Section 1 of test - \nregexp = /^\\d/gm\nstring = 'aaa\\n789\\r\\nccc\\r\\n345'\nERROR !!! match arrays have different lengths:\nExpect: [\"7\", \"3\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-78156.js", "Section 2 of test - \nregexp = /\\d$/gm\nstring = 'aaa\\n789\\r\\nccc\\r\\n345'\nERROR !!! match arrays have different lengths:\nExpect: [\"9\", \"5\"]\nActual: [\"5\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-78156.js", "Section 3 of test - \nregexp = /^\\d/gm\nstring = 'aaa\\n789\\r\\nccc\\r\\nddd'\nERROR !!! match arrays have different lengths:\nExpect: [\"7\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-78156.js", "Section 4 of test - \nregexp = /\\d$/gm\nstring = 'aaa\\n789\\r\\nccc\\r\\nddd'\nERROR !!! match arrays have different lengths:\nExpect: [\"9\"]\nActual: []\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-85721.js", "Section 2 of test - \nregexp = /<sql:connection id=\"([^\\r\\n]*?)\">\\s*<sql:url>\\s*([^\\r\\n]*?)\\s*<\\/sql:url>\\s*<sql:driver>\\s*([^\\r\\n]*?)\\s*<\\/sql:driver>\\s*(\\s*<sql:userId>\\s*([^\\r\\n]*?)\\s*<\\/sql:userId>\\s*)?\\s*(\\s*<sql:password>\\s*([^\\r\\n]*?)\\s*<\\/sql:password>\\s*)?\\s*<\\/sql:connection>/\nstring = '<sql:connection id=\"conn1\"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>'\nERROR !!! regexp FAILED to match anything !!!\nExpect: <sql:connection id=\"conn1\"> <sql:url>www.m.com</sql:url> <sql:driver>drive.class</sql:driver>\n<sql:userId>foo</sql:userId> <sql:password>goo</sql:password> </sql:connection>,conn1,www.m.com,drive.class,<sql:userId>foo</sql:userId> ,foo,<sql:password>goo</sql:password> ,goo\nActual: null\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-87231.js", "Section 3 of test - \nregexp = /^(A)?(A.*)$/\nstring = 'A'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"A\", , \"A\"]\nActual: [\"A\", \"\", \"A\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-87231.js", "Section 6 of test - \nregexp = /(A)?(A.*)/\nstring = 'zxcasd;fl\\ ^AaaAAaaaf;lrlrzs'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"AaaAAaaaf;lrlrzs\", , \"AaaAAaaaf;lrlrzs\"]\nActual: [\"AaaAAaaaf;lrlrzs\", \"\", \"AaaAAaaaf;lrlrzs\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 24", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 28", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 30", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/String/15.5.4.14.js", "15.5.4.14 - String.prototype.split(/()/)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Unicode/regress-352044-01.js", "issues with Unicode escape sequences in JavaScript source code", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Unicode/uc-001.js", "Unicode format-control character test (Category Cf.)", willFixInNextReleaseMessage);
-
- addFileExclusion(".+/15\\.9\\.2\\..+", "unstable on slow machines");
- addFileExclusion(".+/15\\.9\\.5\\..+", "too slooow");
- addFileExclusion("regress-130451.js", "asserts");
- addFileExclusion("regress-322135-01.js", "asserts");
- addFileExclusion("regress-322135-02.js", "asserts");
- addFileExclusion("regress-322135-03.js", "takes forever");
- addFileExclusion("regress-322135-04.js", "takes forever");
- addFileExclusion("ecma_3/RegExp/regress-375715-04.js", "bug");
-
- addFileExclusion("ecma_3/RegExp/regress-289669.js", "Can fail due to relying on wall-clock time");
-
- // Failures due to switch to JSC as back-end
- addExpectedFailure("ecma/Array/15.4.3.1-2.js", "var props = ''; for ( p in Array ) { props += p } props", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Boolean/15.6.3.1-1.js", "var str='';for ( p in Boolean ) { str += p } str;", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Expressions/11.4.1.js", "var abc; delete(abc)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/FunctionObjects/15.3.3.1-2.js", "var str='';for (prop in Function ) str += prop; str;", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/ObjectObjects/15.2.3.1-1.js", "var str = '';for ( p in Object ) { str += p; }; str", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Statements/12.6.3-11.js", "result = \"\"; for ( p in Number ) { result += String(p) };", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Statements/12.6.3-2.js", "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "-\"\\u20001234\\u2001\"", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_2/RegExp/properties-001.js", "//.toString()", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Date/15.9.4.3.js", "15.9.4.3 - Date.UTC edge-case arguments.: date Infinity", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Date/15.9.4.3.js", "15.9.4.3 - Date.UTC edge-case arguments.: hours Infinity", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Date/15.9.4.3.js", "15.9.4.3 - Date.UTC edge-case arguments.: minutes Infinity", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Date/15.9.4.3.js", "15.9.4.3 - Date.UTC edge-case arguments.: seconds Infinity", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Function/regress-131964.js", "Section 1 of test - ", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Function/regress-313570.js", "length of objects whose prototype chain includes a function: immutable", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/FunExpr/fe-001.js", "Both functions were defined.", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 7 of test - \nregexp = /(z)((a+)?(b+)?(c))*/\nstring = 'zaacbbbcac'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"zaacbbbcac\", \"z\", \"ac\", \"a\", , \"c\"]\nActual: [\"zaacbbbcac\", \"z\", \"ac\", \"a\", \"bbb\", \"c\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/15.10.2-1.js", "Section 12 of test - \nregexp = /(.*?)a(?!(a+)b\\2c)\\2(.*)/\nstring = 'baaabaac'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"baaabaac\", \"ba\", , \"abaac\"]\nActual: [\"baaabaac\", \"ba\", \"aa\", \"abaac\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 218 of test - \nregexp = /((foo)|(bar))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"foobar\", \"bar\", , \"bar\"]\nActual: [\"foobar\", \"bar\", \"foo\", \"bar\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 234 of test - \nregexp = /(?:(f)(o)(o)|(b)(a)(r))*/\nstring = 'foobar'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"foobar\", , , , \"b\", \"a\", \"r\"]\nActual: [\"foobar\", \"f\", \"o\", \"o\", \"b\", \"a\", \"r\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 241 of test - \nregexp = /^(?:b|a(?=(.)))*\\1/\nstring = 'abc'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"ab\", , ]\nActual: [\"ab\", \"b\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 412 of test - \nregexp = /^(a(b)?)+$/\nstring = 'aba'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aba\", \"a\", , ]\nActual: [\"aba\", \"a\", \"b\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/perlstress-001.js", "Section 413 of test - \nregexp = /^(aa(bb)?)+$/\nstring = 'aabbaa'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"aabbaa\", \"aa\", , ]\nActual: [\"aabbaa\", \"aa\", \"bb\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 1 of test - \nregexp = /(a|b*)*/\nstring = 'a'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"a\", \"a\"]\nActual: [\"a\", \"\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 5 of test - \nregexp = /^\\-?(\\d{1,}|\\.{0,})*(\\,\\d{1,})?$/\nstring = '100.00'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"100.00\", \"00\", , ]\nActual: [\"100.00\", \"\", , ]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 6 of test - \nregexp = /^\\-?(\\d{1,}|\\.{0,})*(\\,\\d{1,})?$/\nstring = '100,00'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"100,00\", \"100\", \",00\"]\nActual: [\"100,00\", \"\", \",00\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-209919.js", "Section 7 of test - \nregexp = /^\\-?(\\d{1,}|\\.{0,})*(\\,\\d{1,})?$/\nstring = '1.000,00'\nERROR !!! regexp failed to give expected match array:\nExpect: [\"1.000,00\", \"000\", \",00\"]\nActual: [\"1.000,00\", \"\", \",00\"]\n", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/RegExp/regress-311414.js", "RegExp captured tail match should be O(N) BigO 2 < 2", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 7", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/String/15.5.4.11.js", "Section 26", willFixInNextReleaseMessage);
-
-#ifdef Q_CC_MSVC
- addExpectedFailure("ecma_3/Expressions/11.7.3-01.js", "11.7.3 - >>> should evaluate operands in order: order", "QTBUG-8056");
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.7.3 >>>", "QTBUG-8056");
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 >>>=", "QTBUG-8056");
-#endif
-
-#ifdef Q_CC_MINGW
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(Infinity, Infinity)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(Infinity, -Infinity)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-Infinity, Infinity)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-Infinity, -Infinity)", willFixInNextReleaseMessage);
-#endif
-
-#ifdef Q_OS_SOLARIS
- addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Expressions/11.13.2-2.js", "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Expressions/11.5.2.js", "Number.POSITIVE_INFINITY / -0", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Expressions/11.5.2.js", "Number.NEGATIVE_INFINITY / -0", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Expressions/11.5.2.js", "1 / -0", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Expressions/11.5.2.js", "-1 / -0", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.10.js", "Math.log(-0.0000001)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.10.js", "Math.log(-1)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.11.js", "Infinity/Math.max(-0,-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.12.js", "Infinity/Math.min(0,-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.12.js", "Infinity/Math.min(-0,-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(NaN,-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-Infinity, -1)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -1)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -0.5)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(0, -1000)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-0, 1)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Infinity/Math.pow(-0, 3)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-0, -2)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0.49)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.15.js", "Infinity/Math.round(-0.5)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.17.js", "Infinity/Math.sqrt(-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.18.js", "Infinity/Math.tan(-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.2.js", "Math.acos(1.00000001)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.2.js", "Math.acos(11.00000001)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.3.js", "Math.asin(1.000001)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.3.js", "Math.asin(-1.000001)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.3.js", "Infinity/Math.asin(-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.4.js", "Infinity/Math.atan(-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(0, -0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.5.js", "Infinity/Math.atan2(-0, 1)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-0,\t-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.5.js", "Math.atan2(-0,\t-1)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil('-0')", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-Number.MIN_VALUE)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.6.js", "Infinity/Math.ceil(-0.9)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.9.js", "Infinity/Math.floor(-0)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "var z = 0; print(1/-z)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/TypeConversion/9.3.1-3.js", "1/-1e-2000", willFixInNextReleaseMessage);
-#endif
-
-#ifdef Q_OS_SYMBIAN
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-1, 0.5)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma/Math/15.8.2.13.js", "Math.pow(-1, -0.5)", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.5.1 *", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.5.2 /", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.6.2 -", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 *=", willFixInNextReleaseMessage);
- addExpectedFailure("ecma_3/Operators/order-01.js", "operator evaluation order: 11.13.2 /=", willFixInNextReleaseMessage);
-#endif
-
- static const char klass[] = "tst_QScriptJsTestSuite";
-
- QVector<uint> *data = qt_meta_data_tst_Suite();
- // content:
- *data << 1 // revision
- << 0 // classname
- << 0 << 0 // classinfo
- << 0 << 10 // methods (backpatched later)
- << 0 << 0 // properties
- << 0 << 0 // enums/sets
- ;
-
- QVector<char> *stringdata = qt_meta_stringdata_tst_Suite();
- appendCString(stringdata, klass);
- appendCString(stringdata, "");
-
// don't execute any tests on slow machines
#if !defined(Q_OS_IRIX)
// do all the test suites
- QFileInfoList testSuiteDirInfos;
- if (testsFound)
- testSuiteDirInfos = testsDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot);
+ QFileInfoList testSuiteDirInfos = testsDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot);
foreach (QFileInfo tsdi, testSuiteDirInfos) {
QDir testSuiteDir(tsdi.absoluteFilePath());
// do all the dirs in the test suite
QFileInfoList subSuiteDirInfos = testSuiteDir.entryInfoList(QDir::AllDirs | QDir::NoDotAndDotDot);
foreach (QFileInfo ssdi, subSuiteDirInfos) {
subSuitePaths.append(ssdi.absoluteFilePath());
- // slot: signature, parameters, type, tag, flags
- QString data_slot = QString::fromLatin1("%0/%1_data()")
- .arg(testSuiteDir.dirName()).arg(ssdi.fileName());
- static const int nullbyte = sizeof(klass);
- *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08;
- appendCString(stringdata, data_slot.toLatin1());
- QString slot = QString::fromLatin1("%0/%1()")
- .arg(testSuiteDir.dirName()).arg(ssdi.fileName());
- *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08;
- appendCString(stringdata, slot.toLatin1());
+ QString function = QString::fromLatin1("%0/%1")
+ .arg(testSuiteDir.dirName()).arg(ssdi.fileName());
+ addTestFunction(function, CreateDataFunction);
}
}
#endif
- (*data)[4] = subSuitePaths.size() * 2;
+ finalizeMetaObject();
+}
+
+tst_QScriptJSTestSuite::~tst_QScriptJSTestSuite()
+{
+}
- *data << 0; // eod
+void tst_QScriptJSTestSuite::configData(TestConfig::Mode mode, const QStringList &parts)
+{
+ switch (mode) {
+ case TestConfig::Skip:
+ addFileExclusion(parts.at(0), parts.value(1));
+ break;
+
+ case TestConfig::ExpectFail:
+ addExpectedFailure(parts.at(0), parts.value(1), parts.value(2));
+ break;
+ }
+}
- // initialize staticMetaObject
- staticMetaObject.d.superdata = &QObject::staticMetaObject;
- staticMetaObject.d.stringdata = stringdata->constData();
- staticMetaObject.d.data = data->constData();
- staticMetaObject.d.extradata = 0;
+void tst_QScriptJSTestSuite::writeSkipConfigFile(QTextStream &stream)
+{
+ stream << QString::fromLatin1("# testcase | message") << endl;
}
-tst_Suite::~tst_Suite()
+void tst_QScriptJSTestSuite::writeExpectFailConfigFile(QTextStream &stream)
{
-#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE
- if (!generatedAddExpectedFailureCode.isEmpty()) {
- QFile file("addexpectedfailures.cpp");
- file.open(QFile::WriteOnly);
- QTextStream ts(&file);
- ts << generatedAddExpectedFailureCode;
+ stream << QString::fromLatin1("# testcase | description | message") << endl;
+ for (int i = 0; i < expectedFailures.size(); ++i) {
+ const FailureItem &fail = expectedFailures.at(i);
+ if (fail.pathRegExp.pattern().isEmpty())
+ continue;
+ stream << QString::fromLatin1("%0 | %1")
+ .arg(fail.pathRegExp.pattern())
+ .arg(escape(fail.description));
+ if (!fail.message.isEmpty())
+ stream << QString::fromLatin1(" | %0").arg(escape(fail.message));
+ stream << endl;
}
-#endif
}
-void tst_Suite::addExpectedFailure(const QRegExp &path, const QString &description, const QString &message)
+void tst_QScriptJSTestSuite::addExpectedFailure(const QRegExp &path, const QString &description, const QString &message)
{
expectedFailures.append(FailureItem(FailureItem::ExpectFail, path, description, message));
}
-void tst_Suite::addExpectedFailure(const QString &fileName, const QString &description, const QString &message)
+void tst_QScriptJSTestSuite::addExpectedFailure(const QString &fileName, const QString &description, const QString &message)
{
expectedFailures.append(FailureItem(FailureItem::ExpectFail, QRegExp(fileName), description, message));
}
-void tst_Suite::addSkip(const QRegExp &path, const QString &description, const QString &message)
+void tst_QScriptJSTestSuite::addSkip(const QRegExp &path, const QString &description, const QString &message)
{
expectedFailures.append(FailureItem(FailureItem::Skip, path, description, message));
}
-void tst_Suite::addSkip(const QString &fileName, const QString &description, const QString &message)
+void tst_QScriptJSTestSuite::addSkip(const QString &fileName, const QString &description, const QString &message)
{
expectedFailures.append(FailureItem(FailureItem::Skip, QRegExp(fileName), description, message));
}
-bool tst_Suite::isExpectedFailure(const QString &fileName, const QString &description,
+bool tst_QScriptJSTestSuite::isExpectedFailure(const QString &fileName, const QString &description,
QString *message, FailureItem::Action *action) const
{
for (int i = 0; i < expectedFailures.size(); ++i) {
@@ -857,17 +430,17 @@ bool tst_Suite::isExpectedFailure(const QString &fileName, const QString &descri
return false;
}
-void tst_Suite::addFileExclusion(const QString &fileName, const QString &message)
+void tst_QScriptJSTestSuite::addFileExclusion(const QString &fileName, const QString &message)
{
fileExclusions.append(qMakePair(QRegExp(fileName), message));
}
-void tst_Suite::addFileExclusion(const QRegExp &rx, const QString &message)
+void tst_QScriptJSTestSuite::addFileExclusion(const QRegExp &rx, const QString &message)
{
fileExclusions.append(qMakePair(rx, message));
}
-bool tst_Suite::isExcludedFile(const QString &fileName, QString *message) const
+bool tst_QScriptJSTestSuite::isExcludedFile(const QString &fileName, QString *message) const
{
for (int i = 0; i < fileExclusions.size(); ++i) {
if (fileExclusions.at(i).first.indexIn(fileName) != -1) {
@@ -879,4 +452,4 @@ bool tst_Suite::isExcludedFile(const QString &fileName, QString *message) const
return false;
}
-QTEST_MAIN(tst_Suite)
+QTEST_MAIN(tst_QScriptJSTestSuite)
diff --git a/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp b/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp
new file mode 100644
index 0000000..d47eb24
--- /dev/null
+++ b/tests/auto/qscriptv8testsuite/abstracttestsuite.cpp
@@ -0,0 +1,481 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "abstracttestsuite.h"
+#include <QtTest/QtTest>
+#include <QtCore/qset.h>
+#include <QtCore/qtextstream.h>
+
+/*!
+ AbstractTestSuite provides a way of building QtTest test objects
+ dynamically. The use case is integration of JavaScript test suites
+ into QtTest autotests.
+
+ Subclasses add their tests functions with addTestFunction() in the
+ constructor, and must reimplement runTestFunction(). Additionally,
+ subclasses can reimplement initTestCase() and cleanupTestCase()
+ (but make sure to call the base implementation).
+
+ AbstractTestSuite uses configuration files for getting information
+ about skipped tests (skip.txt) and expected test failures
+ (expect_fail.txt). Subclasses must reimplement
+ createSkipConfigFile() and createExpectFailConfigFile() for
+ creating these files, and configData() for processing an entry of
+ such a file.
+
+ The config file format is as follows:
+ - Lines starting with '#' are skipped.
+ - Lines of the form [SYMBOL] means that the upcoming data
+ should only be processed if the given SYMBOL is defined on
+ this platform.
+ - Any other line is split on ' | ' and handed off to the client.
+
+ Subclasses must provide a default tests directory (where the
+ subclass expects to find the script files to run as tests), and a
+ default config file directory. Some environment variables can be
+ used to affect where AbstractTestSuite will look for files:
+
+ - QTSCRIPT_TEST_CONFIG_DIR: Overrides the default test config path.
+
+ - QTSCRIPT_TEST_CONFIG_SUFFIX: Is appended to "skip" and
+ "expect_fail" to create the test config name. This makes it easy to
+ maintain skip- and expect_fail-files corresponding to different
+ revisions of a test suite, and switch between them.
+
+ - QTSCRIPT_TEST_DIR: Overrides the default test dir.
+
+ AbstractTestSuite does _not_ define how the test dir itself is
+ processed or how tests are run; this is left up to the subclass.
+
+ If no config files are found, AbstractTestSuite will ask the
+ subclass to create a default skip file. Also, the
+ shouldGenerateExpectedFailures variable will be set to true. The
+ subclass should check for this when a test fails, and add an entry
+ to its set of expected failures. When all tests have been run,
+ AbstractTestSuite will ask the subclass to create the expect_fail
+ file based on the tests that failed. The next time the autotest is
+ run, the created config files will be used.
+
+ The reason for skipping a test is usually that it takes a very long
+ time to complete (or even hangs completely), or it crashes. It's
+ not possible for the test runner to know in advance which tests are
+ problematic, which is why the entries to the skip file are
+ typically added manually. When running tests for the first time, it
+ can be useful to run the autotest with the -v1 command line option,
+ so you can see the name of each test before it's run, and can add a
+ skip entry if appropriate.
+*/
+
+// Helper class for constructing the test class's QMetaObject contents
+// at runtime.
+class TestMetaObjectBuilder
+{
+public:
+ TestMetaObjectBuilder(const QByteArray &className,
+ const QMetaObject *superClass);
+
+ void appendPrivateVoidSlot(const char *signature);
+ void appendPrivateVoidSlot(const QString &signature)
+ { appendPrivateVoidSlot(signature.toLatin1().constData()); }
+
+ void assignContents(QMetaObject &);
+
+private:
+ void appendString(const char *);
+ void finalize();
+
+ const QByteArray m_className;
+ const QMetaObject *m_superClass;
+ QVector<uint> m_data;
+ QVector<char> m_stringdata;
+ int m_emptyStringOffset;
+ bool m_finalized;
+};
+
+TestMetaObjectBuilder::TestMetaObjectBuilder(
+ const QByteArray &className,
+ const QMetaObject *superClass)
+ : m_className(className), m_superClass(superClass),
+ m_finalized(false)
+{
+ // header
+ m_data << 1 // revision
+ << 0 // classname
+ << 0 << 0 // classinfo
+ << 0 << 10 // methods (backpatched later)
+ << 0 << 0 // properties
+ << 0 << 0 // enums/sets
+ ;
+
+ appendString(className.constData());
+ m_emptyStringOffset = m_stringdata.size();
+ appendString("");
+}
+
+void TestMetaObjectBuilder::appendString(const char *s)
+{
+ char c;
+ do {
+ c = *(s++);
+ m_stringdata << c;
+ } while (c != '\0');
+}
+
+void TestMetaObjectBuilder::appendPrivateVoidSlot(const char *signature)
+{
+ static const int methodCountOffset = 4;
+ // signature, parameters, type, tag, flags
+ m_data << m_stringdata.size()
+ << m_emptyStringOffset
+ << m_emptyStringOffset
+ << m_emptyStringOffset
+ << 0x08;
+ appendString(signature);
+ ++m_data[methodCountOffset];
+}
+
+void TestMetaObjectBuilder::finalize()
+{
+ if (m_finalized)
+ return;
+ m_data << 0; // eod
+ m_finalized = true;
+}
+
+/**
+ Assigns this builder's contents to the meta-object \a mo. It's up
+ to the caller to ensure that this builder (and hence, its data)
+ stays alive as long as needed.
+*/
+void TestMetaObjectBuilder::assignContents(QMetaObject &mo)
+{
+ finalize();
+ mo.d.superdata = m_superClass;
+ mo.d.stringdata = m_stringdata.constData();
+ mo.d.data = m_data.constData();
+ mo.d.extradata = 0;
+}
+
+
+class TestConfigClientInterface;
+// For parsing information about skipped tests and expected failures.
+class TestConfigParser
+{
+public:
+ static void parse(const QString &path,
+ TestConfig::Mode mode,
+ TestConfigClientInterface *client);
+
+private:
+ static QString unescape(const QString &);
+ static bool isKnownSymbol(const QString &);
+ static bool isDefined(const QString &);
+
+ static QSet<QString> knownSymbols;
+ static QSet<QString> definedSymbols;
+};
+
+QSet<QString> TestConfigParser::knownSymbols;
+QSet<QString> TestConfigParser::definedSymbols;
+
+/**
+ Parses the config file at the given \a path in the given \a mode.
+ Handling of errors and data is delegated to the given \a client.
+*/
+void TestConfigParser::parse(const QString &path,
+ TestConfig::Mode mode,
+ TestConfigClientInterface *client)
+{
+ QFile file(path);
+ if (!file.open(QIODevice::ReadOnly))
+ return;
+ QTextStream stream(&file);
+ int lineNumber = 0;
+ QString predicate;
+ const QString separator = QString::fromLatin1(" | ");
+ while (!stream.atEnd()) {
+ ++lineNumber;
+ QString line = stream.readLine();
+ if (line.isEmpty())
+ continue;
+ if (line.startsWith('#')) // Comment
+ continue;
+ if (line.startsWith('[')) { // Predicate
+ if (!line.endsWith(']')) {
+ client->configError(path, "malformed predicate", lineNumber);
+ return;
+ }
+ QString symbol = line.mid(1, line.size()-2);
+ if (isKnownSymbol(symbol)) {
+ predicate = symbol;
+ } else {
+ qWarning("symbol %s is not known -- add it to TestConfigParser!", qPrintable(symbol));
+ predicate = QString();
+ }
+ } else {
+ if (predicate.isEmpty() || isDefined(predicate)) {
+ QStringList parts = line.split(separator, QString::KeepEmptyParts);
+ for (int i = 0; i < parts.size(); ++i)
+ parts[i] = unescape(parts[i]);
+ client->configData(mode, parts);
+ }
+ }
+ }
+}
+
+QString TestConfigParser::unescape(const QString &str)
+{
+ return QString(str).replace("\\n", "\n");
+}
+
+bool TestConfigParser::isKnownSymbol(const QString &symbol)
+{
+ if (knownSymbols.isEmpty()) {
+ knownSymbols
+ // If you add a symbol here, add a case for it in
+ // isDefined() as well.
+ << "Q_OS_LINUX"
+ << "Q_OS_SOLARIS"
+ << "Q_OS_WINCE"
+ << "Q_OS_SYMBIAN"
+ << "Q_CC_MSVC"
+ << "Q_CC_MINGW"
+ ;
+ }
+ return knownSymbols.contains(symbol);
+}
+
+bool TestConfigParser::isDefined(const QString &symbol)
+{
+ if (definedSymbols.isEmpty()) {
+ definedSymbols
+#ifdef Q_OS_LINUX
+ << "Q_OS_LINUX"
+#endif
+#ifdef Q_OS_SOLARIS
+ << "Q_OS_SOLARIS"
+#endif
+#ifdef Q_OS_WINCE
+ << "Q_OS_WINCE"
+#endif
+#ifdef Q_OS_SYMBIAN
+ << "Q_OS_SYMBIAN"
+#endif
+#ifdef Q_CC_MSVC
+ << "Q_CC_MSVC"
+#endif
+#ifdef Q_CC_MINGW
+ << "Q_CC_MINGW"
+#endif
+ ;
+ }
+ return definedSymbols.contains(symbol);
+}
+
+
+QMetaObject AbstractTestSuite::staticMetaObject;
+
+const QMetaObject *AbstractTestSuite::metaObject() const
+{
+ return &staticMetaObject;
+}
+
+void *AbstractTestSuite::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, staticMetaObject.d.stringdata))
+ return static_cast<void*>(const_cast<AbstractTestSuite*>(this));
+ return QObject::qt_metacast(_clname);
+}
+
+int AbstractTestSuite::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QObject::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ switch (_id) {
+ case 0:
+ initTestCase();
+ break;
+ case 1:
+ cleanupTestCase();
+ break;
+ default:
+ // If another method is added above, this offset must be adjusted.
+ runTestFunction(_id - 2);
+ }
+ _id -= staticMetaObject.methodCount() - staticMetaObject.methodOffset();
+ }
+ return _id;
+}
+
+AbstractTestSuite::AbstractTestSuite(const QByteArray &className,
+ const QString &defaultTestsPath,
+ const QString &defaultConfigPath)
+ : shouldGenerateExpectedFailures(false),
+ metaBuilder(new TestMetaObjectBuilder(className, &QObject::staticMetaObject))
+{
+ QString testConfigPath = qgetenv("QTSCRIPT_TEST_CONFIG_DIR");
+ if (testConfigPath.isEmpty())
+ testConfigPath = defaultConfigPath;
+ QString configSuffix = qgetenv("QTSCRIPT_TEST_CONFIG_SUFFIX");
+ skipConfigPath = QString::fromLatin1("%0/skip%1.txt")
+ .arg(testConfigPath).arg(configSuffix);
+ expectFailConfigPath = QString::fromLatin1("%0/expect_fail%1.txt")
+ .arg(testConfigPath).arg(configSuffix);
+
+ QString testsPath = qgetenv("QTSCRIPT_TEST_DIR");
+ if (testsPath.isEmpty())
+ testsPath = defaultTestsPath;
+ testsDir = QDir(testsPath);
+
+ addTestFunction("initTestCase");
+ addTestFunction("cleanupTestCase");
+
+ // Subclass constructors should add their custom test functions to
+ // the meta-object and call finalizeMetaObject().
+}
+
+AbstractTestSuite::~AbstractTestSuite()
+{
+ delete metaBuilder;
+}
+
+void AbstractTestSuite::addTestFunction(const QString &name,
+ DataFunctionCreation dfc)
+{
+ if (dfc == CreateDataFunction) {
+ QString dataSignature = QString::fromLatin1("%0_data()").arg(name);
+ metaBuilder->appendPrivateVoidSlot(dataSignature);
+ }
+ QString signature = QString::fromLatin1("%0()").arg(name);
+ metaBuilder->appendPrivateVoidSlot(signature);
+}
+
+void AbstractTestSuite::finalizeMetaObject()
+{
+ metaBuilder->assignContents(staticMetaObject);
+}
+
+void AbstractTestSuite::initTestCase()
+{
+ if (!testsDir.exists()) {
+ QString message = QString::fromLatin1("tests directory (%0) doesn't exist.")
+ .arg(testsDir.path());
+ QFAIL(qPrintable(message));
+ return;
+ }
+
+ if (QFileInfo(skipConfigPath).exists())
+ TestConfigParser::parse(skipConfigPath, TestConfig::Skip, this);
+ else
+ createSkipConfigFile();
+
+ if (QFileInfo(expectFailConfigPath).exists())
+ TestConfigParser::parse(expectFailConfigPath, TestConfig::ExpectFail, this);
+ else
+ shouldGenerateExpectedFailures = true;
+}
+
+void AbstractTestSuite::cleanupTestCase()
+{
+ if (shouldGenerateExpectedFailures)
+ createExpectFailConfigFile();
+}
+
+void AbstractTestSuite::configError(const QString &path, const QString &message, int lineNumber)
+{
+ QString output;
+ output.append(path);
+ if (lineNumber != -1)
+ output.append(":").append(QString::number(lineNumber));
+ output.append(": ").append(message);
+ QFAIL(qPrintable(output));
+}
+
+void AbstractTestSuite::createSkipConfigFile()
+{
+ QFile file(skipConfigPath);
+ if (!file.open(QIODevice::WriteOnly))
+ return;
+ QWARN(qPrintable(QString::fromLatin1("creating %0").arg(skipConfigPath)));
+ QTextStream stream(&file);
+
+ writeSkipConfigFile(stream);
+
+ file.close();
+}
+
+void AbstractTestSuite::createExpectFailConfigFile()
+{
+ QFile file(expectFailConfigPath);
+ if (!file.open(QFile::WriteOnly))
+ return;
+ QWARN(qPrintable(QString::fromLatin1("creating %0").arg(expectFailConfigPath)));
+ QTextStream stream(&file);
+
+ writeExpectFailConfigFile(stream);
+
+ file.close();
+}
+
+/*!
+ Convenience function for reading all contents of a file.
+ */
+QString AbstractTestSuite::readFile(const QString &filename)
+{
+ QFile file(filename);
+ if (!file.open(QFile::ReadOnly))
+ return QString();
+ QTextStream stream(&file);
+ stream.setCodec("UTF-8");
+ return stream.readAll();
+}
+
+/*!
+ Escapes characters in the string \a str so it's suitable for writing
+ to a config file.
+ */
+QString AbstractTestSuite::escape(const QString &str)
+{
+ return QString(str).replace("\n", "\\n");
+}
diff --git a/tests/auto/qscriptv8testsuite/abstracttestsuite.h b/tests/auto/qscriptv8testsuite/abstracttestsuite.h
new file mode 100644
index 0000000..b13c61a
--- /dev/null
+++ b/tests/auto/qscriptv8testsuite/abstracttestsuite.h
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ABSTRACTTESTSUITE_H
+#define ABSTRACTTESTSUITE_H
+
+#include <QtCore/qobject.h>
+
+#include <QtCore/qbytearray.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qstringlist.h>
+#include <QtCore/qvector.h>
+#include <QtCore/qtextstream.h>
+
+class TestMetaObjectBuilder;
+
+namespace TestConfig {
+enum Mode {
+ Skip,
+ ExpectFail
+};
+}
+
+// For receiving callbacks from the config parser.
+class TestConfigClientInterface
+{
+public:
+ virtual ~TestConfigClientInterface() {}
+ virtual void configData(TestConfig::Mode mode,
+ const QStringList &parts) = 0;
+ virtual void configError(const QString &path,
+ const QString &message,
+ int lineNumber) = 0;
+};
+
+class AbstractTestSuite : public QObject,
+ public TestConfigClientInterface
+{
+// No Q_OBJECT macro, we implement the meta-object ourselves.
+public:
+ AbstractTestSuite(const QByteArray &className,
+ const QString &defaultTestsPath,
+ const QString &defaultConfigPath);
+ virtual ~AbstractTestSuite();
+
+ static QMetaObject staticMetaObject;
+ virtual const QMetaObject *metaObject() const;
+ virtual void *qt_metacast(const char *);
+ virtual int qt_metacall(QMetaObject::Call, int, void **argv);
+
+ static QString readFile(const QString &);
+ static QString escape(const QString &);
+
+protected:
+ enum DataFunctionCreation {
+ DontCreateDataFunction,
+ CreateDataFunction
+ };
+
+ void addTestFunction(const QString &,
+ DataFunctionCreation = DontCreateDataFunction);
+ void finalizeMetaObject();
+
+ virtual void initTestCase();
+ virtual void cleanupTestCase();
+
+ virtual void writeSkipConfigFile(QTextStream &) = 0;
+ virtual void writeExpectFailConfigFile(QTextStream &) = 0;
+
+ virtual void runTestFunction(int index) = 0;
+
+ virtual void configError(const QString &path, const QString &message, int lineNumber);
+
+ QDir testsDir;
+ bool shouldGenerateExpectedFailures;
+
+private:
+ TestMetaObjectBuilder *metaBuilder;
+ QString skipConfigPath, expectFailConfigPath;
+
+private:
+ void createSkipConfigFile();
+ void createExpectFailConfigFile();
+};
+
+#endif
diff --git a/tests/auto/qscriptv8testsuite/abstracttestsuite.pri b/tests/auto/qscriptv8testsuite/abstracttestsuite.pri
new file mode 100644
index 0000000..1de5b93
--- /dev/null
+++ b/tests/auto/qscriptv8testsuite/abstracttestsuite.pri
@@ -0,0 +1,4 @@
+SOURCES += $$PWD/abstracttestsuite.cpp
+HEADERS += $$PWD/abstracttestsuite.h
+INCLUDEPATH += $$PWD
+DEPENDPATH += $$PWD
diff --git a/tests/auto/qscriptv8testsuite/expect_fail.txt b/tests/auto/qscriptv8testsuite/expect_fail.txt
new file mode 100644
index 0000000..a4eee73
--- /dev/null
+++ b/tests/auto/qscriptv8testsuite/expect_fail.txt
@@ -0,0 +1,16 @@
+# testcase | actual | expected | message
+arguments-enum | 2 | 0
+const-redecl | undefined | TypeError | local:'const x; var x'
+date-parse | NaN | 946713600000 | Sat, 01-Jan-2000 08:00:00 GMT+00:00
+delete-global-properties | true | false
+delete | false | true | delete 100
+function-arguments-null | false | true
+function-caller | null | function eval() {\n [native code]\n}
+function-prototype | prototype | disconnectconnect
+global-const-var-conflicts | false | true
+number-tostring | 0 | 0.0000a7c5ac471b4788
+parse-int-float | 1e+21 | 1
+regexp | false | true
+string-lastindexof | 0 | -1
+string-split | 4 | 3 | 19 - array length
+substr | abcdefghijklmn |
diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
index 00e2e01..e1c6234 100644
--- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
+++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.pro
@@ -2,3 +2,4 @@ load(qttest_p4)
QT = core script
SOURCES += tst_qscriptv8testsuite.cpp
RESOURCES += qscriptv8testsuite.qrc
+include(abstracttestsuite.pri)
diff --git a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc
index a894ee5..150ccf0 100644
--- a/tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc
+++ b/tests/auto/qscriptv8testsuite/qscriptv8testsuite.qrc
@@ -1,5 +1,7 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>tests</file>
+ <file>expect_fail.txt</file>
+ <file>skip.txt</file>
</qresource>
</RCC>
diff --git a/tests/auto/qscriptv8testsuite/skip.txt b/tests/auto/qscriptv8testsuite/skip.txt
new file mode 100644
index 0000000..3c2cc53
--- /dev/null
+++ b/tests/auto/qscriptv8testsuite/skip.txt
@@ -0,0 +1,17 @@
+# testcase | message
+debug-* | not applicable
+mirror-* | not applicable
+array-concat | Hangs on JSC backend
+array-splice | Hangs on JSC backend
+sparse-array-reverse | Hangs on JSC backend
+string-case | V8-specific behavior? (Doesn't pass on SpiderMonkey either)
+
+[Q_OS_WINCE]
+deep-recursion | Demands too much memory on WinCE
+nested-repetition-count-overflow | Demands too much memory on WinCE
+unicode-test | Demands too much memory on WinCE
+mul-exhaustive | Demands too much memory on WinCE
+
+[Q_OS_SYMBIAN]
+nested-repetition-count-overflow | Demands too much memory on Symbian
+unicode-test | Demands too much memory on Symbian
diff --git a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
index 7d0858e..b35fd06 100644
--- a/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
+++ b/tests/auto/qscriptv8testsuite/tst_qscriptv8testsuite.cpp
@@ -40,68 +40,33 @@
****************************************************************************/
+#include "abstracttestsuite.h"
#include <QtTest/QtTest>
-#include <QByteArray>
-
#include <QtScript>
//TESTED_CLASS=
//TESTED_FILES=
-// Uncomment the following define to have the autotest generate
-// addExpectedFailure() code for all the tests that fail.
-// This is useful when a whole new test (sub)suite is added.
-// The code is stored in addexpectedfailures.cpp.
-// Paste the contents into this file after the existing
-// addExpectedFailure() calls.
-
-//#define GENERATE_ADDEXPECTEDFAILURE_CODE
-
-static QString readFile(const QString &filename)
-{
- QFile file(filename);
- if (!file.open(QFile::ReadOnly))
- return QString();
- QTextStream stream(&file);
- stream.setCodec("UTF-8");
- return stream.readAll();
-}
-
-static void appendCString(QVector<char> *v, const char *s)
-{
- char c;
- do {
- c = *(s++);
- *v << c;
- } while (c != '\0');
-}
-
-struct ExpectedFailure
+class tst_QScriptV8TestSuite : public AbstractTestSuite
{
- ExpectedFailure(const QString &name, const QString &act,
- const QString &exp, const QString &msg)
- : testName(name), actual(act), expected(exp), message(msg)
- { }
-
- QString testName;
- QString actual;
- QString expected;
- QString message;
-};
-
-class tst_Suite : public QObject
-{
-
public:
- tst_Suite();
- virtual ~tst_Suite();
+ tst_QScriptV8TestSuite();
+ virtual ~tst_QScriptV8TestSuite();
+
+protected:
+ struct ExpectedFailure
+ {
+ ExpectedFailure(const QString &name, const QString &act,
+ const QString &exp, const QString &msg)
+ : testName(name), actual(act), expected(exp), message(msg)
+ { }
+
+ QString testName;
+ QString actual;
+ QString expected;
+ QString message;
+ };
- static QMetaObject staticMetaObject;
- virtual const QMetaObject *metaObject() const;
- virtual void *qt_metacast(const char *);
- virtual int qt_metacall(QMetaObject::Call, int, void **argv);
-
-private:
void addExpectedFailure(const QString &testName, const QString &actual,
const QString &expected, const QString &message);
bool isExpectedFailure(const QString &testName, const QString &actual,
@@ -110,34 +75,23 @@ private:
void addTestExclusion(const QRegExp &rx, const QString &message);
bool isExcludedTest(const QString &testName, QString *message) const;
- QDir testsDir;
+ virtual void initTestCase();
+ virtual void configData(TestConfig::Mode mode, const QStringList &parts);
+ virtual void writeSkipConfigFile(QTextStream &);
+ virtual void writeExpectFailConfigFile(QTextStream &);
+ virtual void runTestFunction(int testIndex);
+
QStringList testNames;
QList<ExpectedFailure> expectedFailures;
QList<QPair<QRegExp, QString> > testExclusions;
QString mjsunitContents;
-#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE
- QString generatedAddExpectedFailureCode;
-#endif
};
-QMetaObject tst_Suite::staticMetaObject;
-
-Q_GLOBAL_STATIC(QVector<uint>, qt_meta_data_tst_Suite)
-Q_GLOBAL_STATIC(QVector<char>, qt_meta_stringdata_tst_Suite)
-
-const QMetaObject *tst_Suite::metaObject() const
-{
- return &staticMetaObject;
-}
-
-void *tst_Suite::qt_metacast(const char *_clname)
-{
- if (!_clname) return 0;
- if (!strcmp(_clname, qt_meta_stringdata_tst_Suite()->constData()))
- return static_cast<void*>(const_cast<tst_Suite*>(this));
- return QObject::qt_metacast(_clname);
-}
-
+// We expect failing tests to call the fail() function (defined in
+// mjsunit.js) with arguments expected, actual, message_opt. This
+// function intercepts the call, calls the real fail() function (which
+// will throw an exception), and sets the original arguments on the
+// exception object so that we can process them later.
static QScriptValue qscript_fail(QScriptContext *ctx, QScriptEngine *eng)
{
QScriptValue realFail = ctx->callee().data();
@@ -146,193 +100,141 @@ static QScriptValue qscript_fail(QScriptContext *ctx, QScriptEngine *eng)
Q_ASSERT(eng->hasUncaughtException());
ret.setProperty("expected", ctx->argument(0));
ret.setProperty("actual", ctx->argument(1));
+ ret.setProperty("message", ctx->argument(2));
QScriptContextInfo info(ctx->parentContext()->parentContext());
ret.setProperty("lineNumber", info.lineNumber());
return ret;
}
-int tst_Suite::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+void tst_QScriptV8TestSuite::writeSkipConfigFile(QTextStream &stream)
{
- _id = QObject::qt_metacall(_c, _id, _a);
- if (_id < 0)
- return _id;
- if (_c == QMetaObject::InvokeMetaMethod) {
- QString name = testNames.at(_id);
- QString path = testsDir.absoluteFilePath(name + ".js");
- QString excludeMessage;
- if (isExcludedTest(name, &excludeMessage)) {
- QTest::qSkip(excludeMessage.toLatin1(), QTest::SkipAll, path.toLatin1(), -1);
- } else {
- QScriptEngine engine;
- engine.evaluate(mjsunitContents).toString();
- if (engine.hasUncaughtException()) {
- QStringList bt = engine.uncaughtExceptionBacktrace();
- QString err = engine.uncaughtException().toString();
- qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
- } else {
- QScriptValue fakeFail = engine.newFunction(qscript_fail);
- fakeFail.setData(engine.globalObject().property("fail"));
- engine.globalObject().setProperty("fail", fakeFail);
- QString contents = readFile(path);
- QScriptValue ret = engine.evaluate(contents);
- if (engine.hasUncaughtException()) {
- if (!ret.isError()) {
- Q_ASSERT(ret.instanceOf(engine.globalObject().property("MjsUnitAssertionError")));
- QString actual = ret.property("actual").toString();
- QString expected = ret.property("expected").toString();
- int lineNumber = ret.property("lineNumber").toInt32();
- QString failMessage;
- if (isExpectedFailure(name, actual, expected, &failMessage)) {
- QTest::qExpectFail("", failMessage.toLatin1(),
- QTest::Continue, path.toLatin1(),
- lineNumber);
- }
-#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE
- else {
- generatedAddExpectedFailureCode.append(
- " addExpectedFailure(\"" + name
- + "\", \"" + actual + "\", \"" + expected
- + "\", willFixInNextReleaseMessage);\n");
- }
-#endif
- QTest::qCompare(actual, expected, "actual", "expect",
- path.toLatin1(), lineNumber);
- } else {
- int lineNumber = ret.property("lineNumber").toInt32();
- QTest::qExpectFail("", ret.toString().toLatin1(),
- QTest::Continue, path.toLatin1(), lineNumber);
- QTest::qVerify(false, ret.toString().toLatin1(), "", path.toLatin1(), lineNumber);
- }
- }
- }
- }
- _id -= testNames.size();
- }
- return _id;
+ stream << QString::fromLatin1("# testcase | message") << endl;
}
-tst_Suite::tst_Suite()
+void tst_QScriptV8TestSuite::writeExpectFailConfigFile(QTextStream &stream)
{
- testsDir = QDir(":/tests");
- if (!testsDir.exists()) {
- qWarning("*** no tests/ dir!");
- } else {
- if (!testsDir.exists("mjsunit.js"))
- qWarning("*** no tests/mjsunit.js file!");
- else {
- mjsunitContents = readFile(testsDir.absoluteFilePath("mjsunit.js"));
- if (mjsunitContents.isEmpty())
- qWarning("*** tests/mjsunit.js is empty!");
- }
+ stream << QString::fromLatin1("# testcase | actual | expected | message") << endl;
+ for (int i = 0; i < expectedFailures.size(); ++i) {
+ const ExpectedFailure &fail = expectedFailures.at(i);
+ stream << QString::fromLatin1("%0 | %1 | %2")
+ .arg(fail.testName)
+ .arg(escape(fail.actual))
+ .arg(escape(fail.expected));
+ if (!fail.message.isEmpty())
+ stream << QString::fromLatin1(" | %0").arg(escape(fail.message));
+ stream << endl;
}
- QString willFixInNextReleaseMessage = QString::fromLatin1("Will fix in next release");
- addExpectedFailure("arguments-enum", "2", "0", willFixInNextReleaseMessage);
- addExpectedFailure("const-redecl", "undefined", "TypeError", willFixInNextReleaseMessage);
- addExpectedFailure("global-const-var-conflicts", "false", "true", willFixInNextReleaseMessage);
- addExpectedFailure("string-lastindexof", "0", "-1", "test is wrong?");
-
-#ifndef Q_OS_LINUX
- addExpectedFailure("to-precision", "1.235e+27", "1.234e+27", "QTBUG-8053: toPrecision(4) gives wrong result on Mac");
-#endif
-
-#ifdef Q_OS_SOLARIS
- addExpectedFailure("math-min-max", "Infinity", "-Infinity", willFixInNextReleaseMessage);
- addExpectedFailure("negate-zero", "false", "true", willFixInNextReleaseMessage);
- addExpectedFailure("str-to-num", "Infinity", "-Infinity", willFixInNextReleaseMessage);
-#endif
-
- addTestExclusion("debug-*", "not applicable");
- addTestExclusion("mirror-*", "not applicable");
-
- addTestExclusion("array-concat", "Hangs on JSC backend");
- addTestExclusion("array-splice", "Hangs on JSC backend");
- addTestExclusion("sparse-array-reverse", "Hangs on JSC backend");
-
- addTestExclusion("string-case", "V8-specific behavior? (Doesn't pass on SpiderMonkey either)");
-
-#ifdef Q_OS_WINCE
- addTestExclusion("deep-recursion", "Demands too much memory on WinCE");
- addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on WinCE");
- addTestExclusion("unicode-test", "Demands too much memory on WinCE");
- addTestExclusion("mul-exhaustive", "Demands too much memory on WinCE");
-#endif
-
-#ifdef Q_OS_SYMBIAN
- addTestExclusion("nested-repetition-count-overflow", "Demands too much memory on Symbian");
- addTestExclusion("unicode-test", "Demands too much memory on Symbian");
-#endif
- // Failures due to switch to JSC as back-end
- addExpectedFailure("date-parse", "NaN", "946713600000", willFixInNextReleaseMessage);
- addExpectedFailure("delete-global-properties", "true", "false", willFixInNextReleaseMessage);
- addExpectedFailure("delete", "false", "true", willFixInNextReleaseMessage);
- addExpectedFailure("function-arguments-null", "false", "true", willFixInNextReleaseMessage);
- addExpectedFailure("function-caller", "null", "function eval() {\n [native code]\n}", willFixInNextReleaseMessage);
- addExpectedFailure("function-prototype", "prototype", "disconnectconnect", willFixInNextReleaseMessage);
- addExpectedFailure("number-tostring", "0", "0.0000a7c5ac471b4788", willFixInNextReleaseMessage);
- addExpectedFailure("parse-int-float", "1e+21", "1", willFixInNextReleaseMessage);
- addExpectedFailure("regexp", "false", "true", willFixInNextReleaseMessage);
- addExpectedFailure("smi-negative-zero", "-Infinity", "Infinity", willFixInNextReleaseMessage);
- addExpectedFailure("string-split", "4", "3", willFixInNextReleaseMessage);
- addExpectedFailure("substr", "abcdefghijklmn", "", willFixInNextReleaseMessage);
+}
- static const char klass[] = "tst_QScriptV8TestSuite";
+void tst_QScriptV8TestSuite::runTestFunction(int testIndex)
+{
+ QString name = testNames.at(testIndex);
+ QString path = testsDir.absoluteFilePath(name + ".js");
- QVector<uint> *data = qt_meta_data_tst_Suite();
- // content:
- *data << 1 // revision
- << 0 // classname
- << 0 << 0 // classinfo
- << 0 << 10 // methods (backpatched later)
- << 0 << 0 // properties
- << 0 << 0 // enums/sets
- ;
+ QString excludeMessage;
+ if (isExcludedTest(name, &excludeMessage)) {
+ QTest::qSkip(excludeMessage.toLatin1(), QTest::SkipAll, path.toLatin1(), -1);
+ return;
+ }
- QVector<char> *stringdata = qt_meta_stringdata_tst_Suite();
- appendCString(stringdata, klass);
- appendCString(stringdata, "");
+ QScriptEngine engine;
+ engine.evaluate(mjsunitContents);
+ if (engine.hasUncaughtException()) {
+ QStringList bt = engine.uncaughtExceptionBacktrace();
+ QString err = engine.uncaughtException().toString();
+ qWarning("%s\n%s", qPrintable(err), qPrintable(bt.join("\n")));
+ } else {
+ // Prepare to intercept calls to mjsunit's fail() function.
+ QScriptValue fakeFail = engine.newFunction(qscript_fail);
+ fakeFail.setData(engine.globalObject().property("fail"));
+ engine.globalObject().setProperty("fail", fakeFail);
+
+ QString contents = readFile(path);
+ QScriptValue ret = engine.evaluate(contents);
+ if (engine.hasUncaughtException()) {
+ if (!ret.isError()) {
+ Q_ASSERT(ret.instanceOf(engine.globalObject().property("MjsUnitAssertionError")));
+ QString actual = ret.property("actual").toString();
+ QString expected = ret.property("expected").toString();
+ int lineNumber = ret.property("lineNumber").toInt32();
+ QString failMessage;
+ if (shouldGenerateExpectedFailures) {
+ if (ret.property("message").isString())
+ failMessage = ret.property("message").toString();
+ addExpectedFailure(name, actual, expected, failMessage);
+ } else if (isExpectedFailure(name, actual, expected, &failMessage)) {
+ QTest::qExpectFail("", failMessage.toLatin1(),
+ QTest::Continue, path.toLatin1(),
+ lineNumber);
+ }
+ QTest::qCompare(actual, expected, "actual", "expect",
+ path.toLatin1(), lineNumber);
+ } else {
+ int lineNumber = ret.property("lineNumber").toInt32();
+ QTest::qExpectFail("", ret.toString().toLatin1(),
+ QTest::Continue, path.toLatin1(), lineNumber);
+ QTest::qVerify(false, ret.toString().toLatin1(), "", path.toLatin1(), lineNumber);
+ }
+ }
+ }
+}
+tst_QScriptV8TestSuite::tst_QScriptV8TestSuite()
+ : AbstractTestSuite("tst_QScriptV8TestSuite",
+ ":/tests", ":/")
+{
+ // One test function per test file.
QFileInfoList testFileInfos;
testFileInfos = testsDir.entryInfoList(QStringList() << "*.js", QDir::Files);
foreach (QFileInfo tfi, testFileInfos) {
QString name = tfi.baseName();
- // slot: signature, parameters, type, tag, flags
- QString slot = QString::fromLatin1("%0()").arg(name);
- static const int nullbyte = sizeof(klass);
- *data << stringdata->size() << nullbyte << nullbyte << nullbyte << 0x08;
- appendCString(stringdata, slot.toLatin1());
+ addTestFunction(name);
testNames.append(name);
}
- (*data)[4] = testFileInfos.size();
+ finalizeMetaObject();
+}
- *data << 0; // eod
+tst_QScriptV8TestSuite::~tst_QScriptV8TestSuite()
+{
+}
- // initialize staticMetaObject
- staticMetaObject.d.superdata = &QObject::staticMetaObject;
- staticMetaObject.d.stringdata = stringdata->constData();
- staticMetaObject.d.data = data->constData();
- staticMetaObject.d.extradata = 0;
+void tst_QScriptV8TestSuite::initTestCase()
+{
+ AbstractTestSuite::initTestCase();
+
+ // FIXME: These warnings should be QFAIL, but that would make the
+ // test fail right now.
+ if (!testsDir.exists("mjsunit.js"))
+ qWarning("*** no tests/mjsunit.js file!");
+ else {
+ mjsunitContents = readFile(testsDir.absoluteFilePath("mjsunit.js"));
+ if (mjsunitContents.isEmpty())
+ qWarning("*** tests/mjsunit.js is empty!");
+ }
}
-tst_Suite::~tst_Suite()
+void tst_QScriptV8TestSuite::configData(TestConfig::Mode mode, const QStringList &parts)
{
-#ifdef GENERATE_ADDEXPECTEDFAILURE_CODE
- if (!generatedAddExpectedFailureCode.isEmpty()) {
- QFile file("addexpectedfailures.cpp");
- file.open(QFile::WriteOnly);
- QTextStream ts(&file);
- ts << generatedAddExpectedFailureCode;
+ switch (mode) {
+ case TestConfig::Skip:
+ addTestExclusion(parts.at(0), parts.value(1));
+ break;
+
+ case TestConfig::ExpectFail:
+ addExpectedFailure(parts.at(0), parts.value(1),
+ parts.value(2), parts.value(3));
+ break;
}
-#endif
}
-void tst_Suite::addExpectedFailure(const QString &testName, const QString &actual,
+void tst_QScriptV8TestSuite::addExpectedFailure(const QString &testName, const QString &actual,
const QString &expected, const QString &message)
{
expectedFailures.append(ExpectedFailure(testName, actual, expected, message));
}
-bool tst_Suite::isExpectedFailure(const QString &testName, const QString &actual,
+bool tst_QScriptV8TestSuite::isExpectedFailure(const QString &testName, const QString &actual,
const QString &expected, QString *message) const
{
for (int i = 0; i < expectedFailures.size(); ++i) {
@@ -346,17 +248,17 @@ bool tst_Suite::isExpectedFailure(const QString &testName, const QString &actual
return false;
}
-void tst_Suite::addTestExclusion(const QString &testName, const QString &message)
+void tst_QScriptV8TestSuite::addTestExclusion(const QString &testName, const QString &message)
{
testExclusions.append(qMakePair(QRegExp(testName), message));
}
-void tst_Suite::addTestExclusion(const QRegExp &rx, const QString &message)
+void tst_QScriptV8TestSuite::addTestExclusion(const QRegExp &rx, const QString &message)
{
testExclusions.append(qMakePair(rx, message));
}
-bool tst_Suite::isExcludedTest(const QString &testName, QString *message) const
+bool tst_QScriptV8TestSuite::isExcludedTest(const QString &testName, QString *message) const
{
for (int i = 0; i < testExclusions.size(); ++i) {
if (testExclusions.at(i).first.indexIn(testName) != -1) {
@@ -368,4 +270,4 @@ bool tst_Suite::isExcludedTest(const QString &testName, QString *message) const
return false;
}
-QTEST_MAIN(tst_Suite)
+QTEST_MAIN(tst_QScriptV8TestSuite)
diff --git a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
index b302eba..6686e2d 100644
--- a/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
+++ b/tests/auto/qscriptvalue/tst_qscriptvalue.cpp
@@ -1889,7 +1889,7 @@ void tst_QScriptValue::getSetProperty_gettersAndSetters()
QCOMPARE(object.propertyFlags("foo") & ~QScriptValue::UserRange,
QScriptValue::PropertyGetter );
- QEXPECT_FAIL("", "User-range flags are not retained for getter/setter properties", Continue);
+ QEXPECT_FAIL("", "QTBUG-17615: User-range flags are not retained for getter/setter properties", Continue);
QCOMPARE(object.propertyFlags("foo"),
QScriptValue::PropertyGetter | QScriptValue::UserRange);
object.setProperty("x", num);
@@ -2004,10 +2004,10 @@ void tst_QScriptValue::getSetProperty_gettersAndSettersThrowErrorJS()
QScriptValue object = eng.evaluate("o");
QVERIFY(!eng.hasUncaughtException());
QScriptValue ret = object.property("foo");
- QEXPECT_FAIL("", "Exception thrown from js function are not returned by the JSC port", Continue);
+ QEXPECT_FAIL("", "QTBUG-17616: Exception thrown from js function are not returned by the JSC port", Continue);
QVERIFY(ret.isError());
QVERIFY(eng.hasUncaughtException());
- QEXPECT_FAIL("", "Exception thrown from js function are not returned by the JSC port", Continue);
+ QEXPECT_FAIL("", "QTBUG-17616: Exception thrown from js function are not returned by the JSC port", Continue);
QVERIFY(ret.strictlyEquals(eng.uncaughtException()));
QCOMPARE(eng.uncaughtException().toString(), QLatin1String("Error: get foo"));
eng.evaluate("Object"); // clear exception state...
@@ -2185,9 +2185,9 @@ void tst_QScriptValue::getSetProperty()
}
// should still be deletable from C++
object.setProperty("undeletableProperty", QScriptValue());
- QEXPECT_FAIL("", "With JSC-based back-end, undeletable properties can't be deleted from C++", Continue);
+ QEXPECT_FAIL("", "QTBUG-17617: With JSC-based back-end, undeletable properties can't be deleted from C++", Continue);
QVERIFY(!object.property("undeletableProperty").isValid());
- QEXPECT_FAIL("", "With JSC-based back-end, undeletable properties can't be deleted from C++", Continue);
+ QEXPECT_FAIL("", "QTBUG-17617: With JSC-based back-end, undeletable properties can't be deleted from C++", Continue);
QCOMPARE(object.propertyFlags("undeletableProperty"), 0);
// SkipInEnumeration
@@ -2328,8 +2328,7 @@ void tst_QScriptValue::getSetPrototype_invalidPrototype()
inv.setPrototype(object);
QCOMPARE(inv.prototype().isValid(), false);
object.setPrototype(inv);
- // FIXME should it be invalid or proto?
- QVERIFY(object.prototype().strictlyEquals(inv));
+ QVERIFY(object.prototype().strictlyEquals(proto));
}
void tst_QScriptValue::getSetPrototype_twoEngines()
@@ -2367,8 +2366,6 @@ void tst_QScriptValue::getSetPrototype_notObjectOrNull()
QScriptValue object = eng.newObject();
QScriptValue originalProto = object.prototype();
- QEXPECT_FAIL("", "QTBUG-15154: QScriptValue::setPrototype() allows a non-Object value to be set as prototype", Abort);
-
// bool
object.setPrototype(true);
QVERIFY(object.prototype().equals(originalProto));
diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
index 6bb971d..d26f0cd 100644
--- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
+++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
@@ -144,6 +144,8 @@ private slots:
void taskQTBUG_7537_appearsAndSort();
void taskQTBUG_7716_unnecessaryDynamicSorting();
void taskQTBUG_10287_unnecessaryMapCreation();
+ void taskQTBUG_17812_resetInvalidate_data();
+ void taskQTBUG_17812_resetInvalidate();
void testMultipleProxiesWithSelection();
void mapSelectionFromSource();
@@ -3351,5 +3353,60 @@ void tst_QSortFilterProxyModel::filteredColumns()
insertCommand->doCommand();
}
+void tst_QSortFilterProxyModel::taskQTBUG_17812_resetInvalidate_data()
+{
+ QTest::addColumn<int>("test");
+ QTest::addColumn<bool>("works");
+
+ QTest::newRow("nothing") << 0 << false;
+ QTest::newRow("reset") << 1 << true;
+ QTest::newRow("invalidate") << 2 << true;
+ QTest::newRow("invalidate_filter") << 3 << true;
+}
+
+void tst_QSortFilterProxyModel::taskQTBUG_17812_resetInvalidate()
+{
+ QFETCH(int, test);
+ QFETCH(bool, works);
+
+ struct Proxy : QSortFilterProxyModel {
+ QString pattern;
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex&) const {
+ return sourceModel()->data(sourceModel()->index(source_row, 0)).toString().contains(pattern);
+ }
+ void notifyChange(int test) {
+ switch (test) {
+ case 0: break;
+ case 1: reset(); break;
+ case 2: invalidate(); break;
+ case 3: invalidateFilter(); break;
+ }
+ }
+ };
+
+ QStringListModel sourceModel(QStringList() << "Poisson" << "Vache" << "Brebis"
+ << "Elephant" << "Cochon" << "Serpent"
+ << "Mouton" << "Ecureuil" << "Mouche");
+ Proxy proxy;
+ proxy.pattern = QString::fromLatin1("n");
+ proxy.setSourceModel(&sourceModel);
+
+ QCOMPARE(proxy.rowCount(), 5);
+ for (int i = 0; i < proxy.rowCount(); i++) {
+ QVERIFY(proxy.data(proxy.index(i,0)).toString().contains('n'));
+ }
+
+ proxy.pattern = QString::fromLatin1("o");
+ proxy.notifyChange(test);
+
+ QCOMPARE(proxy.rowCount(), works ? 4 : 5);
+ bool ok = true;
+ for (int i = 0; i < proxy.rowCount(); i++) {
+ if (!proxy.data(proxy.index(i,0)).toString().contains('o'))
+ ok = false;
+ }
+ QCOMPARE(ok, works);
+}
+
QTEST_MAIN(tst_QSortFilterProxyModel)
#include "tst_qsortfilterproxymodel.moc"
diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
index f7d2180..bf68375 100644
--- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
+++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp
@@ -773,6 +773,27 @@ void tst_QSqlTableModel::removeInsertedRow()
QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi"));
+
+ // Now insert a row with a null, and check that removing it also works (QTBUG-15979 etc)
+ model.insertRow(1);
+ model.setData(model.index(1,0), 55);
+ model.setData(model.index(1,1), QString("null columns"));
+ model.setData(model.index(1,2), QVariant());
+
+ model.submitAll();
+
+ QCOMPARE(model.rowCount(), 4);
+ QCOMPARE(model.data(model.index(3, 0)).toInt(), 55);
+ QCOMPARE(model.data(model.index(3, 1)).toString(), QString("null columns"));
+ QCOMPARE(model.data(model.index(3, 2)).isNull(), true);
+
+ QVERIFY(model.removeRow(3));
+ model.submitAll();
+ QCOMPARE(model.rowCount(), 3);
+
+ QCOMPARE(model.data(model.index(0, 1)).toString(), QString("harry"));
+ QCOMPARE(model.data(model.index(1, 1)).toString(), QString("trond"));
+ QCOMPARE(model.data(model.index(2, 1)).toString(), QString("vohi"));
}
void tst_QSqlTableModel::removeInsertedRows()
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 8177d29..739f902 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -390,6 +390,9 @@ void tst_QSslSocket::constructing()
QSslConfiguration savedDefault = QSslConfiguration::defaultConfiguration();
// verify that changing the default config doesn't affect this socket
+ // (on Unix, the ca certs might be empty, depending on whether we load
+ // them on demand or not, so set them explicitly)
+ socket.setCaCertificates(QSslSocket::systemCaCertificates());
QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>());
QSslSocket::setDefaultCiphers(QList<QSslCipher>());
QVERIFY(!socket.caCertificates().isEmpty());
@@ -518,11 +521,6 @@ void tst_QSslSocket::sslErrors_data()
<< 993
<< (SslErrorList() << QSslError::HostNameMismatch
<< QSslError::SelfSignedCertificate);
-
- QTest::newRow("imap.trolltech.com")
- << "imap.trolltech.com"
- << 993
- << (SslErrorList() << QSslError::SelfSignedCertificateInChain);
}
void tst_QSslSocket::sslErrors()
diff --git a/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro b/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro
new file mode 100644
index 0000000..ea62865
--- /dev/null
+++ b/tests/auto/qsslsocket_onDemandCertificates_member/qsslsocket_onDemandCertificates_member.pro
@@ -0,0 +1,36 @@
+load(qttest_p4)
+
+SOURCES += tst_qsslsocket_onDemandCertificates_member.cpp
+!wince*:win32:LIBS += -lws2_32
+QT += network
+QT -= gui
+
+TARGET = tst_qsslsocket_onDemandCertificates_member
+
+win32 {
+ CONFIG(debug, debug|release) {
+ DESTDIR = debug
+} else {
+ DESTDIR = release
+ }
+}
+
+wince* {
+ DEFINES += SRCDIR=\\\"./\\\"
+
+ certFiles.files = certs ssl.tar.gz
+ certFiles.path = .
+ DEPLOYMENT += certFiles
+} else:symbian {
+ TARGET.EPOCHEAPSIZE="0x100 0x1000000"
+ TARGET.CAPABILITY=NetworkServices
+
+ certFiles.files = certs ssl.tar.gz
+ certFiles.path = .
+ DEPLOYMENT += certFiles
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
+
+requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
new file mode 100644
index 0000000..2a1358d
--- /dev/null
+++ b/tests/auto/qsslsocket_onDemandCertificates_member/tst_qsslsocket_onDemandCertificates_member.cpp
@@ -0,0 +1,225 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtNetwork>
+#include <QtTest/QtTest>
+
+#include <QNetworkProxy>
+#include <QAuthenticator>
+
+#include "private/qhostinfo_p.h"
+
+#include "../network-settings.h"
+
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
+
+#ifndef QT_NO_OPENSSL
+class QSslSocketPtr: public QSharedPointer<QSslSocket>
+{
+public:
+ inline QSslSocketPtr(QSslSocket *ptr = 0)
+ : QSharedPointer<QSslSocket>(ptr)
+ { }
+
+ inline operator QSslSocket *() const { return data(); }
+};
+#endif
+
+class tst_QSslSocket_onDemandCertificates_member : public QObject
+{
+ Q_OBJECT
+
+ int proxyAuthCalled;
+
+public:
+ tst_QSslSocket_onDemandCertificates_member();
+ virtual ~tst_QSslSocket_onDemandCertificates_member();
+
+#ifndef QT_NO_OPENSSL
+ QSslSocketPtr newSocket();
+#endif
+
+public slots:
+ void initTestCase_data();
+ void init();
+ void cleanup();
+ void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth);
+
+#ifndef QT_NO_OPENSSL
+private slots:
+ void onDemandRootCertLoadingMemberMethods();
+
+private:
+ QSslSocket *socket;
+#endif // QT_NO_OPENSSL
+};
+
+tst_QSslSocket_onDemandCertificates_member::tst_QSslSocket_onDemandCertificates_member()
+{
+ Q_SET_DEFAULT_IAP
+}
+
+tst_QSslSocket_onDemandCertificates_member::~tst_QSslSocket_onDemandCertificates_member()
+{
+}
+
+enum ProxyTests {
+ NoProxy = 0x00,
+ Socks5Proxy = 0x01,
+ HttpProxy = 0x02,
+ TypeMask = 0x0f,
+
+ NoAuth = 0x00,
+ AuthBasic = 0x10,
+ AuthNtlm = 0x20,
+ AuthMask = 0xf0
+};
+
+void tst_QSslSocket_onDemandCertificates_member::initTestCase_data()
+{
+ QTest::addColumn<bool>("setProxy");
+ QTest::addColumn<int>("proxyType");
+
+ QTest::newRow("WithoutProxy") << false << 0;
+ QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy);
+ QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic);
+
+ QTest::newRow("WithHttpProxy") << true << int(HttpProxy);
+ QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic);
+ // uncomment the line below when NTLM works
+// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm);
+}
+
+void tst_QSslSocket_onDemandCertificates_member::init()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy) {
+ QFETCH_GLOBAL(int, proxyType);
+ QString testServer = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
+ QNetworkProxy proxy;
+
+ switch (proxyType) {
+ case Socks5Proxy:
+ proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1080);
+ break;
+
+ case Socks5Proxy | AuthBasic:
+ proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1081);
+ break;
+
+ case HttpProxy | NoAuth:
+ proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3128);
+ break;
+
+ case HttpProxy | AuthBasic:
+ proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3129);
+ break;
+
+ case HttpProxy | AuthNtlm:
+ proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3130);
+ break;
+ }
+ QNetworkProxy::setApplicationProxy(proxy);
+ }
+
+ qt_qhostinfo_clear_cache();
+}
+
+void tst_QSslSocket_onDemandCertificates_member::cleanup()
+{
+ QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
+}
+
+#ifndef QT_NO_OPENSSL
+QSslSocketPtr tst_QSslSocket_onDemandCertificates_member::newSocket()
+{
+ QSslSocket *socket = new QSslSocket;
+
+ proxyAuthCalled = 0;
+ connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
+ SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
+ Qt::DirectConnection);
+
+ return QSslSocketPtr(socket);
+}
+#endif
+
+void tst_QSslSocket_onDemandCertificates_member::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth)
+{
+ ++proxyAuthCalled;
+ auth->setUser("qsockstest");
+ auth->setPassword("password");
+}
+
+#ifndef QT_NO_OPENSSL
+
+void tst_QSslSocket_onDemandCertificates_member::onDemandRootCertLoadingMemberMethods()
+{
+ QString host("qt.nokia.com");
+
+ // not using any root certs -> should not work
+ QSslSocketPtr socket2 = newSocket();
+ this->socket = socket2;
+ socket2->setCaCertificates(QList<QSslCertificate>());
+ socket2->connectToHostEncrypted(host, 443);
+ QVERIFY(!socket2->waitForEncrypted());
+
+ // default: using on demand loading -> should work
+ QSslSocketPtr socket = newSocket();
+ this->socket = socket;
+ socket->connectToHostEncrypted(host, 443);
+ QVERIFY(socket->waitForEncrypted());
+
+ // not using any root certs again -> should not work
+ QSslSocketPtr socket3 = newSocket();
+ this->socket = socket3;
+ socket3->setCaCertificates(QList<QSslCertificate>());
+ socket3->connectToHostEncrypted(host, 443);
+ QVERIFY(!socket3->waitForEncrypted());
+}
+
+#endif // QT_NO_OPENSSL
+
+QTEST_MAIN(tst_QSslSocket_onDemandCertificates_member)
+#include "tst_qsslsocket_onDemandCertificates_member.moc"
diff --git a/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro b/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro
new file mode 100644
index 0000000..13990cb
--- /dev/null
+++ b/tests/auto/qsslsocket_onDemandCertificates_static/qsslsocket_onDemandCertificates_static.pro
@@ -0,0 +1,36 @@
+load(qttest_p4)
+
+SOURCES += tst_qsslsocket_onDemandCertificates_static.cpp
+!wince*:win32:LIBS += -lws2_32
+QT += network
+QT -= gui
+
+TARGET = tst_qsslsocket_onDemandCertificates_static
+
+win32 {
+ CONFIG(debug, debug|release) {
+ DESTDIR = debug
+} else {
+ DESTDIR = release
+ }
+}
+
+wince* {
+ DEFINES += SRCDIR=\\\"./\\\"
+
+ certFiles.files = certs ssl.tar.gz
+ certFiles.path = .
+ DEPLOYMENT += certFiles
+} else:symbian {
+ TARGET.EPOCHEAPSIZE="0x100 0x1000000"
+ TARGET.CAPABILITY=NetworkServices
+
+ certFiles.files = certs ssl.tar.gz
+ certFiles.path = .
+ DEPLOYMENT += certFiles
+ INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE # Needed for e32svr.h in S^3 envs
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
+
+requires(contains(QT_CONFIG,private_tests))
diff --git a/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
new file mode 100644
index 0000000..8259977
--- /dev/null
+++ b/tests/auto/qsslsocket_onDemandCertificates_static/tst_qsslsocket_onDemandCertificates_static.cpp
@@ -0,0 +1,226 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtNetwork>
+#include <QtTest/QtTest>
+
+#include <QNetworkProxy>
+#include <QAuthenticator>
+
+#include "private/qhostinfo_p.h"
+
+#include "../network-settings.h"
+
+#ifdef Q_OS_SYMBIAN
+#define SRCDIR ""
+#endif
+
+#ifndef QT_NO_OPENSSL
+class QSslSocketPtr: public QSharedPointer<QSslSocket>
+{
+public:
+ inline QSslSocketPtr(QSslSocket *ptr = 0)
+ : QSharedPointer<QSslSocket>(ptr)
+ { }
+
+ inline operator QSslSocket *() const { return data(); }
+};
+#endif
+
+class tst_QSslSocket_onDemandCertificates_static : public QObject
+{
+ Q_OBJECT
+
+ int proxyAuthCalled;
+
+public:
+ tst_QSslSocket_onDemandCertificates_static();
+ virtual ~tst_QSslSocket_onDemandCertificates_static();
+
+#ifndef QT_NO_OPENSSL
+ QSslSocketPtr newSocket();
+#endif
+
+public slots:
+ void initTestCase_data();
+ void init();
+ void cleanup();
+ void proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth);
+
+#ifndef QT_NO_OPENSSL
+private slots:
+ void onDemandRootCertLoadingStaticMethods();
+
+private:
+ QSslSocket *socket;
+#endif // QT_NO_OPENSSL
+};
+
+tst_QSslSocket_onDemandCertificates_static::tst_QSslSocket_onDemandCertificates_static()
+{
+ Q_SET_DEFAULT_IAP
+}
+
+tst_QSslSocket_onDemandCertificates_static::~tst_QSslSocket_onDemandCertificates_static()
+{
+}
+
+enum ProxyTests {
+ NoProxy = 0x00,
+ Socks5Proxy = 0x01,
+ HttpProxy = 0x02,
+ TypeMask = 0x0f,
+
+ NoAuth = 0x00,
+ AuthBasic = 0x10,
+ AuthNtlm = 0x20,
+ AuthMask = 0xf0
+};
+
+void tst_QSslSocket_onDemandCertificates_static::initTestCase_data()
+{
+ QTest::addColumn<bool>("setProxy");
+ QTest::addColumn<int>("proxyType");
+
+ QTest::newRow("WithoutProxy") << false << 0;
+ QTest::newRow("WithSocks5Proxy") << true << int(Socks5Proxy);
+ QTest::newRow("WithSocks5ProxyAuth") << true << int(Socks5Proxy | AuthBasic);
+
+ QTest::newRow("WithHttpProxy") << true << int(HttpProxy);
+ QTest::newRow("WithHttpProxyBasicAuth") << true << int(HttpProxy | AuthBasic);
+ // uncomment the line below when NTLM works
+// QTest::newRow("WithHttpProxyNtlmAuth") << true << int(HttpProxy | AuthNtlm);
+}
+
+void tst_QSslSocket_onDemandCertificates_static::init()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy) {
+ QFETCH_GLOBAL(int, proxyType);
+ QString testServer = QHostInfo::fromName(QtNetworkSettings::serverName()).addresses().first().toString();
+ QNetworkProxy proxy;
+
+ switch (proxyType) {
+ case Socks5Proxy:
+ proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1080);
+ break;
+
+ case Socks5Proxy | AuthBasic:
+ proxy = QNetworkProxy(QNetworkProxy::Socks5Proxy, testServer, 1081);
+ break;
+
+ case HttpProxy | NoAuth:
+ proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3128);
+ break;
+
+ case HttpProxy | AuthBasic:
+ proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3129);
+ break;
+
+ case HttpProxy | AuthNtlm:
+ proxy = QNetworkProxy(QNetworkProxy::HttpProxy, testServer, 3130);
+ break;
+ }
+ QNetworkProxy::setApplicationProxy(proxy);
+ }
+
+ qt_qhostinfo_clear_cache();
+}
+
+void tst_QSslSocket_onDemandCertificates_static::cleanup()
+{
+ QNetworkProxy::setApplicationProxy(QNetworkProxy::DefaultProxy);
+}
+
+#ifndef QT_NO_OPENSSL
+QSslSocketPtr tst_QSslSocket_onDemandCertificates_static::newSocket()
+{
+ QSslSocket *socket = new QSslSocket;
+
+ proxyAuthCalled = 0;
+ connect(socket, SIGNAL(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
+ SLOT(proxyAuthenticationRequired(QNetworkProxy,QAuthenticator*)),
+ Qt::DirectConnection);
+
+ return QSslSocketPtr(socket);
+}
+#endif
+
+void tst_QSslSocket_onDemandCertificates_static::proxyAuthenticationRequired(const QNetworkProxy &, QAuthenticator *auth)
+{
+ ++proxyAuthCalled;
+ auth->setUser("qsockstest");
+ auth->setPassword("password");
+}
+
+#ifndef QT_NO_OPENSSL
+
+void tst_QSslSocket_onDemandCertificates_static::onDemandRootCertLoadingStaticMethods()
+{
+ QString host("qt.nokia.com");
+
+ // not using any root certs -> should not work
+ QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>());
+ QSslSocketPtr socket = newSocket();
+ this->socket = socket;
+ socket->connectToHostEncrypted(host, 443);
+ QVERIFY(!socket->waitForEncrypted());
+
+ // using system root certs -> should work
+ QSslSocket::setDefaultCaCertificates(QSslSocket::systemCaCertificates());
+ QSslSocketPtr socket2 = newSocket();
+ this->socket = socket2;
+ socket2->connectToHostEncrypted(host, 443);
+ QVERIFY(socket2->waitForEncrypted());
+
+ // not using any root certs again -> should not work
+ QSslSocket::setDefaultCaCertificates(QList<QSslCertificate>());
+ QSslSocketPtr socket3 = newSocket();
+ this->socket = socket3;
+ socket3->connectToHostEncrypted(host, 443);
+ QVERIFY(!socket3->waitForEncrypted());
+}
+
+#endif // QT_NO_OPENSSL
+
+QTEST_MAIN(tst_QSslSocket_onDemandCertificates_static)
+#include "tst_qsslsocket_onDemandCertificates_static.moc"
diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
index 50002a6..83adf49 100644
--- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
+++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp
@@ -100,6 +100,7 @@ private slots:
void task188195_baseBackground();
void task232085_spinBoxLineEditBg();
void changeStyleInChangeEvent();
+ void QTBUG15910_crashNullWidget();
//at the end because it mess with the style.
void widgetStyle();
@@ -1657,6 +1658,23 @@ void tst_QStyleSheetStyle::QTBUG11658_cachecrash()
qApp->setStyleSheet(QString());
}
+void tst_QStyleSheetStyle::QTBUG15910_crashNullWidget()
+{
+ struct : QWidget {
+ virtual void paintEvent(QPaintEvent* ) {
+ QStyleOption opt;
+ opt.init(this);
+ QPainter p(this);
+ style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, 0);
+ style()->drawPrimitive(QStyle::PE_Frame, &opt, &p, 0);
+ style()->drawControl(QStyle::CE_PushButton, &opt, &p, 0);
+ }
+ } w;
+ w.setStyleSheet("* { background-color: white; color:black; border 3px solid yellow }");
+ w.show();
+ QTest::qWaitForWindowShown(&w);
+}
+
QTEST_MAIN(tst_QStyleSheetStyle)
#include "tst_qstylesheetstyle.moc"
diff --git a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
index a6499ff..92e8608 100644
--- a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
+++ b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp
@@ -201,6 +201,7 @@ void tst_QtConcurrentIterateKernel::noIterations()
startThreadEngine(new IterateKernel<TestIterator, void>(0, 0)).startBlocking();
}
+QMutex threadsMutex;
QSet<QThread *> threads;
class ThrottleFor : public IterateKernel<TestIterator, void>
{
@@ -219,8 +220,10 @@ public:
QThread *thread = QThread::currentThread();
- if (begin > 140 && end < 160)
+ if (begin > 140 && end < 160) {
+ QMutexLocker locker(&threadsMutex);
threads.insert(thread);
+ }
if (100 >= begin && 100 < end) {
throttling = true;
diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp
index d1b615e..0a14e4a 100644
--- a/tests/auto/qtextlayout/tst_qtextlayout.cpp
+++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp
@@ -124,8 +124,8 @@ private slots:
void testLineBreakingAllSpaces();
void lineWidthFromBOM();
void textWidthVsWIdth();
-
void textWithSurrogates_qtbug15679();
+ void textWidthWithStackedTextEngine();
private:
QFont testFont;
@@ -1432,5 +1432,16 @@ void tst_QTextLayout::textWithSurrogates_qtbug15679()
QCOMPARE(x[2] - x[0], x[5] - x[3]);
}
+void tst_QTextLayout::textWidthWithStackedTextEngine()
+{
+ QString text = QString::fromUtf8("คลิก ถัดไป เพื่อดำเนินการต่อ");
+ QTextLayout layout(text);
+ layout.beginLayout();
+ QTextLine line = layout.createLine();
+ layout.endLayout();
+ QFontMetricsF fm(layout.font());
+ QCOMPARE(line.naturalTextWidth(), fm.width(text));
+}
+
QTEST_MAIN(tst_QTextLayout)
#include "tst_qtextlayout.moc"
diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp
index 6cff7c53..c2acc18 100644
--- a/tests/auto/qtimer/tst_qtimer.cpp
+++ b/tests/auto/qtimer/tst_qtimer.cpp
@@ -50,6 +50,8 @@
#include <unistd.h>
#endif
+#include "../../shared/util.h"
+
//TESTED_CLASS=
//TESTED_FILES=
@@ -272,9 +274,9 @@ void tst_QTimer::livelock()
QFETCH(int, interval);
LiveLockTester tester(interval);
QTest::qWait(180); // we have to use wait here, since we're testing timers with a non-zero timeout
- QCOMPARE(tester.timeoutsForFirst, 1);
+ QTRY_COMPARE(tester.timeoutsForFirst, 1);
QCOMPARE(tester.timeoutsForExtra, 0);
- QCOMPARE(tester.timeoutsForSecond, 1);
+ QTRY_COMPARE(tester.timeoutsForSecond, 1);
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (QSysInfo::WindowsVersion < QSysInfo::WV_XP)
QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Windows 2000", Continue);
@@ -724,7 +726,7 @@ void tst_QTimer::QTBUG13633_dontBlockEvents()
{
DontBlockEvents t;
QTest::qWait(60);
- QVERIFY(t.total > 2);
+ QTRY_VERIFY(t.total > 2);
}
class SlotRepeater : public QObject {
diff --git a/tests/auto/qvolatileimage/qvolatileimage.pro b/tests/auto/qvolatileimage/qvolatileimage.pro
new file mode 100644
index 0000000..5a0a613
--- /dev/null
+++ b/tests/auto/qvolatileimage/qvolatileimage.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+SOURCES += tst_qvolatileimage.cpp
+
+symbian {
+ TARGET.EPOCHEAPSIZE = 0x200000 0x800000
+ LIBS += -lfbscli
+}
diff --git a/tests/auto/qvolatileimage/tst_qvolatileimage.cpp b/tests/auto/qvolatileimage/tst_qvolatileimage.cpp
new file mode 100644
index 0000000..b91a150
--- /dev/null
+++ b/tests/auto/qvolatileimage/tst_qvolatileimage.cpp
@@ -0,0 +1,403 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+#include <QtGui/qpainter.h>
+#include <QtGui/qpaintengine.h>
+#include <QtGui/private/qvolatileimage_p.h>
+#ifdef Q_OS_SYMBIAN
+#include <fbs.h>
+#endif
+
+class tst_QVolatileImage : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QVolatileImage() { }
+
+private slots:
+ void create();
+ void ensureFormat();
+ void dataAccess();
+ void sharing();
+ void paint();
+ void fill();
+ void copy();
+ void bitmap();
+};
+
+void tst_QVolatileImage::create()
+{
+ QVolatileImage nullImg;
+ QVERIFY(nullImg.isNull());
+
+ QVolatileImage img(100, 200, QImage::Format_ARGB32);
+ QVERIFY(!img.isNull());
+ QCOMPARE(img.width(), 100);
+ QCOMPARE(img.height(), 200);
+ QCOMPARE(img.format(), QImage::Format_ARGB32);
+ QCOMPARE(img.byteCount(), img.bytesPerLine() * img.height());
+ QCOMPARE(img.hasAlphaChannel(), true);
+ QCOMPARE(img.depth(), 32);
+
+ QImage source(12, 23, QImage::Format_ARGB32_Premultiplied);
+ img = QVolatileImage(source);
+ QVERIFY(!img.isNull());
+ QCOMPARE(img.width(), 12);
+ QCOMPARE(img.height(), 23);
+ QCOMPARE(img.format(), source.format());
+ QCOMPARE(img.byteCount(), img.bytesPerLine() * img.height());
+ QVERIFY(img.imageRef() == source);
+ QVERIFY(img.toImage() == source);
+ QCOMPARE(img.hasAlphaChannel(), true);
+ QCOMPARE(img.hasAlphaChannel(), img.imageRef().hasAlphaChannel());
+ QCOMPARE(img.hasAlphaChannel(), img.toImage().hasAlphaChannel());
+ QCOMPARE(img.depth(), 32);
+
+#ifdef Q_OS_SYMBIAN
+ CFbsBitmap *bmp = new CFbsBitmap;
+ QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone);
+ QVolatileImage bmpimg(bmp);
+ QVERIFY(!bmpimg.isNull());
+ QCOMPARE(bmpimg.width(), 100);
+ QCOMPARE(bmpimg.height(), 50);
+ // Verify that we only did handle duplication, not pixel data copying.
+ QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
+ delete bmp;
+ // Check if content is still valid.
+ QImage copyimg = bmpimg.toImage();
+ QCOMPARE(copyimg.format(), QImage::Format_ARGB32_Premultiplied);
+#endif
+}
+
+void tst_QVolatileImage::ensureFormat()
+{
+ QImage source(12, 23, QImage::Format_ARGB32_Premultiplied);
+ QVolatileImage img(source);
+ QVERIFY(!img.isNull());
+ QVERIFY(img.imageRef() == source);
+ QVERIFY(img.toImage() == source);
+
+ QVERIFY(img.ensureFormat(QImage::Format_ARGB32_Premultiplied)); // no-op
+ QVERIFY(img.imageRef() == source);
+ QVERIFY(img.toImage() == source);
+ QVERIFY(img.format() == QImage::Format_ARGB32_Premultiplied);
+
+ QVERIFY(img.ensureFormat(QImage::Format_RGB32)); // new data under-the-hood
+ QVERIFY(img.imageRef() != source);
+ QVERIFY(img.toImage() != source);
+ QVERIFY(img.format() == QImage::Format_RGB32);
+
+#ifdef Q_OS_SYMBIAN
+ CFbsBitmap *bmp = new CFbsBitmap;
+ QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone);
+ QVolatileImage bmpimg(bmp);
+ QVERIFY(bmpimg.ensureFormat(QImage::Format_ARGB32_Premultiplied)); // no-op
+ QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
+
+ // A different format should cause data copying.
+ QVERIFY(bmpimg.ensureFormat(QImage::Format_RGB32));
+ QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
+ const uchar *prevBits = bmpimg.constBits();
+
+ QVERIFY(bmpimg.ensureFormat(QImage::Format_RGB16));
+ QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
+ QVERIFY(bmpimg.constBits() != prevBits);
+ prevBits = bmpimg.constBits();
+
+ QVERIFY(bmpimg.ensureFormat(QImage::Format_MonoLSB));
+ QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
+ QVERIFY(bmpimg.constBits() != prevBits);
+
+ delete bmp;
+#endif
+}
+
+void tst_QVolatileImage::dataAccess()
+{
+ QImage source(12, 23, QImage::Format_ARGB32_Premultiplied);
+ QVolatileImage img(source);
+ QVERIFY(!img.isNull());
+ img.beginDataAccess();
+ QVERIFY(img.constBits());
+ QVERIFY(img.imageRef().constBits());
+ QVERIFY(img.bits());
+ QVERIFY(img.imageRef().bits());
+ img.endDataAccess();
+
+ img = QVolatileImage(12, 23, QImage::Format_ARGB32);
+ img.beginDataAccess();
+ QVERIFY(img.constBits() && img.bits());
+ img.endDataAccess();
+}
+
+void tst_QVolatileImage::sharing()
+{
+ QVolatileImage img1(100, 100, QImage::Format_ARGB32);
+ QVolatileImage img2 = img1;
+ img1.beginDataAccess();
+ img2.beginDataAccess();
+ QVERIFY(img1.constBits() == img2.constBits());
+ img2.endDataAccess();
+ img1.endDataAccess();
+ img1.imageRef(); // non-const call, should detach
+ img1.beginDataAccess();
+ img2.beginDataAccess();
+ QVERIFY(img1.constBits() != img2.constBits());
+ img2.endDataAccess();
+ img1.endDataAccess();
+
+ // toImage() should return a copy of the internal QImage.
+ // imageRef() is a reference to the internal QImage.
+ QVERIFY(img1.imageRef().constBits() != img1.toImage().constBits());
+
+#ifdef Q_OS_SYMBIAN
+ CFbsBitmap *bmp = new CFbsBitmap;
+ QVERIFY(bmp->Create(TSize(100, 50), EColor16MAP) == KErrNone);
+ QVolatileImage bmpimg(bmp);
+ QVolatileImage bmpimg2;
+ bmpimg2 = bmpimg;
+ QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
+ QCOMPARE(bmpimg2.constBits(), (const uchar *) bmp->DataAddress());
+ // Now force a detach, which should copy the pixel data under-the-hood.
+ bmpimg.imageRef();
+ QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
+ QCOMPARE(bmpimg2.constBits(), (const uchar *) bmp->DataAddress());
+ delete bmp;
+#endif
+}
+
+bool fuzzyCompareImages(const QImage &image1, const QImage &image2, int tolerance)
+{
+ if (image1.bytesPerLine() != image2.bytesPerLine()
+ || image1.width() != image2.width()
+ || image1.height() != image2.height()) {
+ return false;
+ }
+ for (int i = 0; i < image1.height(); i++) {
+ const uchar *line1 = image1.scanLine(i);
+ const uchar *line2 = image2.scanLine(i);
+ int bytes = image1.bytesPerLine();
+ for (int j = 0; j < bytes; j++) {
+ int delta = line1[j] - line2[j];
+ if (qAbs(delta) > tolerance)
+ return false;
+ }
+ }
+ return true;
+}
+
+void tst_QVolatileImage::paint()
+{
+#ifdef Q_OS_SYMBIAN
+ QVolatileImage img(100, 100, QImage::Format_ARGB32);
+ img.beginDataAccess();
+ img.imageRef().fill(QColor(Qt::green).rgba());
+ QPainter p(&img.imageRef());
+ p.drawRect(10, 10, 50, 50);
+ p.end();
+ img.endDataAccess();
+ QImage imgA = img.toImage();
+
+ // The following assumes that on openvg the pixmapdata is backed by QVolatileImage)
+ // (and that openvg is in use)
+ // It should pass with any engine nonetheless.
+ // See if painting into the underlying QImage succeeds.
+ QPixmap pm(100, 100);
+ if (pm.paintEngine()->type() == QPaintEngine::Raster) {
+ pm.fill(Qt::green);
+ QPainter pmp(&pm);
+ pmp.drawRect(10, 10, 50, 50);
+ pmp.end();
+ QImage imgB = pm.toImage();
+ QVERIFY(fuzzyCompareImages(imgA, imgB, 0));
+ // Exercise the accelerated QVolatileImagePaintEngine::drawPixmap() a bit.
+ QPixmap targetPm(pm.size());
+ targetPm.fill(Qt::black);
+ pmp.begin(&targetPm);
+ pmp.drawPixmap(QPointF(0, 0), pm);
+ pmp.end();
+ imgB = targetPm.toImage();
+ QVERIFY(fuzzyCompareImages(imgA, imgB, 0));
+ // Now the overload taking rects.
+ targetPm.fill(Qt::black);
+ pmp.begin(&targetPm);
+ QRectF rect(QPointF(0, 0), pm.size());
+ pmp.drawPixmap(rect, pm, rect);
+ pmp.end();
+ imgB = targetPm.toImage();
+ QVERIFY(fuzzyCompareImages(imgA, imgB, 0));
+ } else {
+ QSKIP("Pixmaps not painted via raster, skipping paint test", SkipSingle);
+ }
+#endif
+}
+
+void tst_QVolatileImage::fill()
+{
+ QVolatileImage img(100, 100, QImage::Format_ARGB32_Premultiplied);
+ QColor col = QColor(10, 20, 30);
+ img.fill(col.rgba());
+ QVERIFY(img.imageRef().pixel(1, 1) == col.rgba());
+ QVERIFY(img.toImage().pixel(1, 1) == col.rgba());
+
+#ifdef Q_OS_SYMBIAN
+ CFbsBitmap *bmp = static_cast<CFbsBitmap *>(img.duplicateNativeImage());
+ QVERIFY(bmp);
+ TRgb pix;
+ bmp->GetPixel(pix, TPoint(1, 1));
+ QCOMPARE(pix.Red(), col.red());
+ QCOMPARE(pix.Green(), col.green());
+ QCOMPARE(pix.Blue(), col.blue());
+ delete bmp;
+#endif
+}
+
+void tst_QVolatileImage::copy()
+{
+ QVolatileImage img(100, 100, QImage::Format_RGB32);
+ img.beginDataAccess();
+ img.imageRef().fill(QColor(Qt::green).rgba());
+ QPainter p(&img.imageRef());
+ p.drawRect(10, 10, 50, 50);
+ p.end();
+ img.endDataAccess();
+
+ QVolatileImage img2(100, 100, QImage::Format_RGB32);
+ img2.copyFrom(&img, QRect());
+ QImage imgA = img.toImage();
+ QImage imgB = img2.toImage();
+ QCOMPARE(imgA.size(), imgB.size());
+ QVERIFY(fuzzyCompareImages(imgA, imgB, 0));
+
+ img2 = QVolatileImage(20, 20, QImage::Format_RGB32);
+ img2.copyFrom(&img, QRect(5, 5, 20, 20));
+ imgA = img.toImage().copy(5, 5, 20, 20);
+ imgB = img2.toImage();
+ QCOMPARE(imgA.size(), imgB.size());
+ QVERIFY(fuzzyCompareImages(imgA, imgB, 0));
+}
+
+void tst_QVolatileImage::bitmap()
+{
+#ifdef Q_OS_SYMBIAN
+ CFbsBitmap *bmp = new CFbsBitmap;
+ QVERIFY(bmp->Create(TSize(100, 50), EColor64K) == KErrNone);
+ QVolatileImage bmpimg(bmp);
+ CFbsBitmap *dupbmp = static_cast<CFbsBitmap *>(bmpimg.duplicateNativeImage());
+ QVERIFY(dupbmp);
+ QVERIFY(dupbmp != bmp);
+ QCOMPARE(dupbmp->DataAddress(), bmp->DataAddress());
+ delete dupbmp;
+ delete bmp;
+ bmpimg.beginDataAccess();
+ qMemSet(bmpimg.bits(), 0, bmpimg.byteCount());
+ qMemSet(bmpimg.bits(), 1, bmpimg.bytesPerLine() * bmpimg.height());
+ bmpimg.endDataAccess();
+
+ // Test bgr->rgb conversion in case of EColor16M.
+ bmp = new CFbsBitmap;
+ QVERIFY(bmp->Create(TSize(101, 89), EColor16M) == KErrNone);
+ bmp->BeginDataAccess();
+ TUint32 *addr = bmp->DataAddress();
+ uint rgb = QColor(10, 20, 30).rgb();
+ qMemCopy(bmp->DataAddress(), &rgb, 3);
+ bmp->EndDataAccess();
+ TRgb symrgb;
+ bmp->GetPixel(symrgb, TPoint(0, 0));
+ QVERIFY(symrgb.Red() == 10 && symrgb.Green() == 20 && symrgb.Blue() == 30);
+ bmpimg = QVolatileImage(bmp);
+ QVERIFY(bmpimg.toImage().pixel(0, 0) == rgb);
+ // check if there really was a conversion
+ bmp->BeginDataAccess();
+ bmpimg.beginDataAccess();
+ qMemCopy(&rgb, bmpimg.constBits(), 3);
+ uint rgb2 = rgb;
+ qMemCopy(&rgb2, bmp->DataAddress(), 3);
+ QVERIFY(rgb != rgb2);
+ bmpimg.endDataAccess(true);
+ bmp->EndDataAccess(true);
+ delete bmp;
+
+ bmp = new CFbsBitmap;
+ QVERIFY(bmp->Create(TSize(101, 89), EGray2) == KErrNone);
+ bmpimg = QVolatileImage(bmp); // inverts pixels, but should do it in place
+ QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
+ QCOMPARE(bmpimg.format(), QImage::Format_MonoLSB);
+ bmpimg.ensureFormat(QImage::Format_ARGB32_Premultiplied);
+ QVERIFY(bmpimg.constBits() != (const uchar *) bmp->DataAddress());
+ QCOMPARE(bmpimg.format(), QImage::Format_ARGB32_Premultiplied);
+ delete bmp;
+
+ // The following two formats must be optimal always.
+ bmp = new CFbsBitmap;
+ QVERIFY(bmp->Create(TSize(101, 89), EColor16MAP) == KErrNone);
+ bmpimg = QVolatileImage(bmp);
+ QCOMPARE(bmpimg.format(), QImage::Format_ARGB32_Premultiplied);
+ QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
+ bmpimg.ensureFormat(QImage::Format_ARGB32_Premultiplied);
+ QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
+ delete bmp;
+ bmp = new CFbsBitmap;
+ QVERIFY(bmp->Create(TSize(101, 89), EColor16MU) == KErrNone);
+ bmpimg = QVolatileImage(bmp);
+ QCOMPARE(bmpimg.format(), QImage::Format_RGB32);
+ QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
+ bmpimg.ensureFormat(QImage::Format_RGB32);
+ QCOMPARE(bmpimg.constBits(), (const uchar *) bmp->DataAddress());
+ delete bmp;
+
+#else
+ QSKIP("CFbsBitmap is only available on Symbian, skipping bitmap test", SkipSingle);
+#endif
+}
+
+int main(int argc, char *argv[])
+{
+ QApplication::setGraphicsSystem("openvg");
+ QApplication app(argc, argv);
+ tst_QVolatileImage tc;
+ return QTest::qExec(&tc, argc, argv);
+}
+
+#include "tst_qvolatileimage.moc"
diff --git a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
index 6cb62d0..041b61a 100644
--- a/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/benchmarks/network/ssl/qsslsocket/tst_qsslsocket.cpp
@@ -46,7 +46,7 @@
#include <qsslsocket.h>
-// #include "../../../../auto/network-settings.h"
+#include "../../../../auto/network-settings.h"
//TESTED_CLASS=
//TESTED_FILES=
@@ -65,6 +65,7 @@ public slots:
void init();
void cleanup();
private slots:
+ void rootCertLoading();
void systemCaCertificates();
};
@@ -89,6 +90,16 @@ void tst_QSslSocket::cleanup()
}
//----------------------------------------------------------------------------------
+
+void tst_QSslSocket::rootCertLoading()
+{
+ QBENCHMARK_ONCE {
+ QSslSocket socket;
+ socket.connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
+ socket.waitForEncrypted();
+ }
+}
+
void tst_QSslSocket::systemCaCertificates()
{
// The results of this test change if the benchmarking system changes too much.
diff --git a/tests/benchmarks/script/script.pro b/tests/benchmarks/script/script.pro
index d4fc822..80278d0 100644
--- a/tests/benchmarks/script/script.pro
+++ b/tests/benchmarks/script/script.pro
@@ -13,6 +13,8 @@ SUBDIRS = \
TRUSTED_BENCHMARKS += \
qscriptclass \
qscriptvalue \
- qscriptengine
+ qscriptengine \
+ qscriptobject \
+ context2d
include(../trusted-benchmarks.pri)
diff --git a/tests/benchmarks/script/sunspider/tst_sunspider.cpp b/tests/benchmarks/script/sunspider/tst_sunspider.cpp
index 0df19b6..9e2bb6f 100644
--- a/tests/benchmarks/script/sunspider/tst_sunspider.cpp
+++ b/tests/benchmarks/script/sunspider/tst_sunspider.cpp
@@ -110,7 +110,7 @@ void tst_SunSpider::benchmark_data()
void tst_SunSpider::benchmark()
{
QFETCH(QString, testName);
- QString testContents = readFile(testsDir.absoluteFilePath(testName + ".js"));
+ QString testContents = readFile(testsDir.filePath(testName + ".js"));
QVERIFY(!testContents.isEmpty());
QScriptEngine engine;
diff --git a/tests/benchmarks/script/v8/tst_v8.cpp b/tests/benchmarks/script/v8/tst_v8.cpp
index 841e2f3..b9cb859 100644
--- a/tests/benchmarks/script/v8/tst_v8.cpp
+++ b/tests/benchmarks/script/v8/tst_v8.cpp
@@ -115,10 +115,10 @@ void tst_V8::benchmark()
{
QFETCH(QString, testName);
- QString baseDotJsContents = readFile(testsDir.absoluteFilePath("base.js"));
+ QString baseDotJsContents = readFile(testsDir.filePath("base.js"));
QVERIFY(!baseDotJsContents.isEmpty());
- QString testContents = readFile(testsDir.absoluteFilePath(testName + ".js"));
+ QString testContents = readFile(testsDir.filePath(testName + ".js"));
QVERIFY(!testContents.isEmpty());
QScriptEngine engine;