diff options
author | Olivier Goffart <olivier.goffart@nokia.com> | 2010-09-10 18:04:39 (GMT) |
---|---|---|
committer | Olivier Goffart <olivier.goffart@nokia.com> | 2010-09-10 18:04:39 (GMT) |
commit | b3981fd1f7b82742857c613af6dfbe41b5493577 (patch) | |
tree | 957b84d8f1792f9e5a43c879274469c4f07168ea /tests/auto | |
parent | e0ef11578048620b3f107b7a357fed3aade0d21e (diff) | |
parent | 72cc21e597f2d77ea1be3c1a3f7df36d8909d2fc (diff) | |
download | Qt-b3981fd1f7b82742857c613af6dfbe41b5493577.zip Qt-b3981fd1f7b82742857c613af6dfbe41b5493577.tar.gz Qt-b3981fd1f7b82742857c613af6dfbe41b5493577.tar.bz2 |
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts:
bin/syncqt
demos/declarative/snake/content/snake.js
demos/declarative/snake/snake.qml
doc/src/development/qmake-manual.qdoc
src/corelib/plugin/plugin.pri
src/gui/kernel/qapplication_win.cpp
src/gui/kernel/qdesktopwidget_win.cpp
src/gui/painting/qdrawhelper.cpp
tests/auto/qdir/tst_qdir.cpp
tools/qdoc3/test/assistant.qdocconf
tools/qdoc3/test/designer.qdocconf
tools/qdoc3/test/linguist.qdocconf
Diffstat (limited to 'tests/auto')
65 files changed, 3422 insertions, 94 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml index 804559c..d41add3 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/qtbug12295.qml @@ -11,7 +11,7 @@ Rectangle { width: 100 height: 100 Behavior on x { - NumberAnimation {} + NumberAnimation { duration: 500 } } } } diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index 5028ba1..dca5205 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -480,7 +480,7 @@ void tst_qdeclarativedom::loadDynamicProperty() DP_TEST(0, a, QVariant::Int, 25, 14, "int"); DP_TEST(1, b, QVariant::Bool, 44, 15, "bool"); - DP_TEST(2, c, QVariant::Double, 64, 17, "double"); + DP_TEST(2, c, QMetaType::QReal, 64, 17, "double"); DP_TEST(3, d, QMetaType::QReal, 86, 15, "real"); DP_TEST(4, e, QVariant::String, 106, 17, "string"); DP_TEST(5, f, QVariant::Url, 128, 14, "url"); diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml new file mode 100644 index 0000000..6d23e5f7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deleteLater.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +QtObject { + id: root + property bool test: false + + Component.onCompleted: { + try { + root.deleteLater() + } catch(e) { + test = true; + } + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/in.qml b/tests/auto/declarative/qdeclarativeecmascript/data/in.qml new file mode 100644 index 0000000..0b5b0ba --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/in.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +Item { + id: root + property bool test1: "x" in root + property bool test2: !("foo" in root) +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml new file mode 100644 index 0000000..d5d3329 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectArg.qml @@ -0,0 +1,9 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + Component.onCompleted: { + root.myinvokable(root); + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml new file mode 100644 index 0000000..29d7d01 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/invokableObjectRet.qml @@ -0,0 +1,11 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + property bool test: false + Component.onCompleted: { + test = (root.returnme() == root) + } +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml new file mode 100644 index 0000000..024d82e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/nonscriptable.qml @@ -0,0 +1,19 @@ +import Qt.test 1.0 +import Qt 4.7 + +MyQmlObject { + id: root + + property bool readOk: false; + property bool writeOk: false + + Component.onCompleted: { + readOk = (root.nonscriptable == undefined); + + try { + root.nonscriptable = 10 + } catch (e) { + writeOk = true; + } + } +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h index 37d6dbd..220318d 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -92,9 +92,10 @@ class MyQmlObject : public QObject Q_PROPERTY(QDeclarativeListProperty<QObject> objectListProperty READ objectListProperty CONSTANT) Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) Q_PROPERTY(QRegExp regExp READ regExp WRITE setRegExp) + Q_PROPERTY(int nonscriptable READ nonscriptable WRITE setNonscriptable SCRIPTABLE false); public: - MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} + MyQmlObject(): myinvokableObject(0), m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} enum MyEnum { EnumValue1 = 0, EnumValue2 = 1 }; enum MyEnum2 { EnumValue3 = 2, EnumValue4 = 3 }; @@ -144,6 +145,13 @@ public: void setRegExp(const QRegExp ®Exp) { m_regExp = regExp; } int console() const { return 11; } + + int nonscriptable() const { return 0; } + void setNonscriptable(int) {} + + MyQmlObject *myinvokableObject; + Q_INVOKABLE MyQmlObject *returnme() { return this; } + signals: void basicSignal(); void argumentSignal(int a, QString b, qreal c); @@ -157,6 +165,7 @@ public slots: void methodNoArgs() { m_methodCalled = true; } void method(int a) { if(a == 163) m_methodIntCalled = true; } void setString(const QString &s) { m_string = s; } + void myinvokable(MyQmlObject *o) { myinvokableObject = o; } private: friend class tst_qdeclarativeecmascript; diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index a6d2dac..33bf7ea 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -157,10 +157,15 @@ private slots: void qtbug_10696(); void qtbug_11606(); void qtbug_11600(); + void nonscriptable(); + void deleteLater(); + void in(); void include(); void callQtInvokables(); + void invokableObjectArg(); + void invokableObjectRet(); private: QDeclarativeEngine engine; }; @@ -1730,6 +1735,31 @@ void tst_qdeclarativeecmascript::callQtInvokables() QCOMPARE(o.actuals().at(0), QVariant(9)); } +// QTBUG-13047 (check that you can pass registered object types as args) +void tst_qdeclarativeecmascript::invokableObjectArg() +{ + QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectArg.qml")); + + QObject *o = component.create(); + QVERIFY(o); + MyQmlObject *qmlobject = qobject_cast<MyQmlObject *>(o); + QVERIFY(qmlobject); + QCOMPARE(qmlobject->myinvokableObject, qmlobject); + + delete o; +} + +// QTBUG-13047 (check that you can return registered object types from methods) +void tst_qdeclarativeecmascript::invokableObjectRet() +{ + QDeclarativeComponent component(&engine, TEST_FILE("invokableObjectRet.qml")); + + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + // QTBUG-5675 void tst_qdeclarativeecmascript::listToVariant() { @@ -2530,6 +2560,36 @@ void tst_qdeclarativeecmascript::qtbug_11600() delete o; } +// Reading and writing non-scriptable properties should fail +void tst_qdeclarativeecmascript::nonscriptable() +{ + QDeclarativeComponent component(&engine, TEST_FILE("nonscriptable.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("readOk").toBool(), true); + QCOMPARE(o->property("writeOk").toBool(), true); + delete o; +} + +// deleteLater() should not be callable from QML +void tst_qdeclarativeecmascript::deleteLater() +{ + QDeclarativeComponent component(&engine, TEST_FILE("deleteLater.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + +void tst_qdeclarativeecmascript::in() +{ + QDeclarativeComponent component(&engine, TEST_FILE("in.qml")); + QObject *o = component.create(); + QVERIFY(o != 0); + QCOMPARE(o->property("test1").toBool(), true); + QCOMPARE(o->property("test2").toBool(), true); + delete o; +} QTEST_MAIN(tst_qdeclarativeecmascript) diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 896d69e..d4d8bf6 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -655,6 +655,15 @@ void tst_QDeclarativeGridView::currentIndex() gridview->setFlow(QDeclarativeGridView::TopToBottom); + qApp->setActiveWindow(canvas); +#ifdef Q_WS_X11 + // to be safe and avoid failing setFocus with window managers + qt_x11_wait_for_window_manager(canvas); +#endif + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); + qApp->processEvents(); + QTest::keyClick(canvas, Qt::Key_Right); QCOMPARE(gridview->currentIndex(), 5); diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 8cfb487..2686127 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -52,7 +52,9 @@ #include <private/qdeclarativeloader_p.h> #include <QtDeclarative/qdeclarativecontext.h> #include <QtDeclarative/qdeclarativeexpression.h> +#include <QtTest/QSignalSpy> +#include "../../../shared/util.h" #include "../shared/testhttpserver.h" #ifdef Q_OS_SYMBIAN @@ -63,18 +65,7 @@ #define SERVER_PORT 14451 #define SERVER_ADDR "http://127.0.0.1:14451" -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 60; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - class tst_qdeclarativeimage : public QObject - { Q_OBJECT public: @@ -91,6 +82,7 @@ private slots: void svg(); void big(); void tiling_QTBUG_6716(); + void noLoading(); private: template<typename T> @@ -173,18 +165,18 @@ void tst_qdeclarativeimage::imageSource() QVERIFY(obj->asynchronous() == true); if (remote || async) - TRY_WAIT(obj->status() == QDeclarativeImage::Loading); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); QCOMPARE(obj->source(), remote ? source : QUrl(source)); if (error.isEmpty()) { - TRY_WAIT(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); QCOMPARE(obj->width(), qreal(width)); QCOMPARE(obj->height(), qreal(height)); QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); QCOMPARE(obj->progress(), 1.0); } else { - TRY_WAIT(obj->status() == QDeclarativeImage::Error); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Error); } delete obj; @@ -355,6 +347,54 @@ void tst_qdeclarativeimage::tiling_QTBUG_6716() } } +void tst_qdeclarativeimage::noLoading() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png"); + + QString componentStr = "import Qt 4.7\nImage { source: srcImage }"; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart.png")); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + QVERIFY(obj->status() == QDeclarativeImage::Ready); + + QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(const QUrl &))); + QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal))); + QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QDeclarativeImageBase::Status))); + + // Loading local file + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + QTRY_COMPARE(sourceSpy.count(), 1); + QTRY_COMPARE(progressSpy.count(), 0); + QTRY_COMPARE(statusSpy.count(), 0); + + // Loading remote file + ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/oldcolors.png"); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading); + QTRY_VERIFY(obj->progress() == 0.0); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + QTRY_COMPARE(sourceSpy.count(), 2); + QTRY_COMPARE(progressSpy.count(), 2); + QTRY_COMPARE(statusSpy.count(), 2); + + // Loading remote file again - should not go through 'Loading' state. + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/oldcolors.png"); + QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready); + QTRY_VERIFY(obj->progress() == 1.0); + QTRY_COMPARE(sourceSpy.count(), 4); + QTRY_COMPARE(progressSpy.count(), 2); + QTRY_COMPARE(statusSpy.count(), 2); +} + /* Find an item with the specified objectName. If index is supplied then the item must also evaluate the {index} expression equal to index diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro index bdb6423..3bf0ea1 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -8,11 +8,7 @@ SOURCES += tst_qdeclarativeimageprovider.cpp # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov -symbian: { - importFiles.sources = data - importFiles.path = . - DEPLOYMENT = importFiles -} else { +!symbian: { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index 6d5a357..d0afc8a 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -389,6 +389,7 @@ void tst_qdeclarativeimageprovider::threadTest() } provider->ok = true; provider->cond.wakeAll(); + QTest::qWait(250); foreach(QDeclarativeImage *img, images) { TRY_WAIT(img->status() == QDeclarativeImage::Ready); } diff --git a/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml b/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml new file mode 100644 index 0000000..1f8eac8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/DontDoubleCallClassBeginItem.qml @@ -0,0 +1,4 @@ +import Test 1.0 + +MyParserStatus { +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml new file mode 100644 index 0000000..59afe58 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/aliasPropertiesAndSignals.qml @@ -0,0 +1,14 @@ +import Qt 4.7 + +QtObject { + id: root + + property bool test: false + property alias myalias: root.objectName + signal go + onGo: test = true + + Component.onCompleted: { + root.go(); + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml b/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml new file mode 100644 index 0000000..df048cc --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/dontDoubleCallClassBegin.qml @@ -0,0 +1,5 @@ +import Qt 4.7 + +Item { + property QtObject object: DontDoubleCallClassBeginItem {} +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt new file mode 100644 index 0000000..93652a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.errors.txt @@ -0,0 +1 @@ +5:23:Invalid alias location diff --git a/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml new file mode 100644 index 0000000..2a09648 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAlias.7.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + id: root + property alias a: root.nonScriptable +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt index 6e11786..53e752b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt @@ -1,2 +1,2 @@ -4:5:Unable to create type NestedErrorsType +4:5:Type NestedErrorsType unavailable 4:8:Invalid property assignment: number expected diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt new file mode 100644 index 0000000..cdfa4b2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.errors.txt @@ -0,0 +1 @@ +4:5:Cannot assign to non-existent property "nonScriptable" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml new file mode 100644 index 0000000..bd59bc8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonScriptableProperty.qml @@ -0,0 +1,5 @@ +import Test 1.0 + +MyQmlObject { + nonScriptable: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml new file mode 100644 index 0000000..e7aaf16 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/variantNotify.qml @@ -0,0 +1,13 @@ +import Qt 4.7 + +QtObject { + property int notifyCount: 0 + + property variant foo + onFooChanged: notifyCount++ + + Component.onCompleted: { + foo = 1; + foo = 1; + } +} diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index 5d87404..20cd976 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -50,6 +50,7 @@ void registerTypes() qmlRegisterType<MyDotPropertyObject>("Test",1,0,"MyDotPropertyObject"); qmlRegisterType<MyNamespace::MyNamespacedType>("Test",1,0,"MyNamespacedType"); qmlRegisterType<MyNamespace::MySecondNamespacedType>("Test",1,0,"MySecondNamespacedType"); + qmlRegisterType<MyParserStatus>("Test",1,0,"MyParserStatus"); qmlRegisterType<MyGroupedObject>(); qmlRegisterCustomType<MyCustomParserType>("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser); diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h index acbe219..ac55bae 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -112,6 +112,7 @@ class MyQmlObject : public QObject, public MyInterface Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType) Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) + Q_PROPERTY(int nonScriptable READ nonScriptable WRITE setNonScriptable SCRIPTABLE false); Q_INTERFACES(MyInterface) public: @@ -150,6 +151,9 @@ public: int propertyWithNotify() const { return m_propertyWithNotify; } void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); } + + int nonScriptable() const { return 0; } + void setNonScriptable(int) {} public slots: void basicSlot() { qWarning("MyQmlObject::basicSlot"); } void basicSlotWithArgs(int v) { qWarning("MyQmlObject::basicSlotWithArgs(%d)", v); } @@ -170,7 +174,6 @@ private: QML_DECLARE_TYPE(MyQmlObject) QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) - class MyGroupedObject : public QObject { Q_OBJECT @@ -576,6 +579,22 @@ public: void setCustomData(QObject *, const QByteArray &) {} }; +class MyParserStatus : public QObject, public QDeclarativeParserStatus +{ + Q_OBJECT +public: + MyParserStatus() : m_cbc(0), m_ccc(0) {} + + int classBeginCount() const { return m_cbc; } + int componentCompleteCount() const { return m_ccc; } + + virtual void classBegin() { m_cbc++; } + virtual void componentComplete() { m_ccc++; } +private: + int m_cbc; + int m_ccc; +}; + void registerTypes(); #endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index fcdf926..1825991 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -118,6 +118,7 @@ private slots: void valueTypes(); void cppnamespace(); void aliasProperties(); + void aliasPropertiesAndSignals(); void componentCompositeType(); void i18n(); void i18n_data(); @@ -126,6 +127,7 @@ private slots: void scriptString(); void defaultPropertyListOrder(); void declaredPropertyValues(); + void dontDoubleCallClassBegin(); void basicRemote_data(); void basicRemote(); @@ -141,8 +143,8 @@ private slots: void importsOrder(); void qmlAttachedPropertiesObjectMethod(); - void customOnProperty(); + void variantNotify(); // regression tests for crashes void crash1(); @@ -342,6 +344,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("invalidAlias.4") << "invalidAlias.4.qml" << "invalidAlias.4.errors.txt" << false; QTest::newRow("invalidAlias.5") << "invalidAlias.5.qml" << "invalidAlias.5.errors.txt" << false; QTest::newRow("invalidAlias.6") << "invalidAlias.6.qml" << "invalidAlias.6.errors.txt" << false; + QTest::newRow("invalidAlias.7") << "invalidAlias.7.qml" << "invalidAlias.7.errors.txt" << false; QTest::newRow("invalidAttachedProperty.1") << "invalidAttachedProperty.1.qml" << "invalidAttachedProperty.1.errors.txt" << false; QTest::newRow("invalidAttachedProperty.2") << "invalidAttachedProperty.2.qml" << "invalidAttachedProperty.2.errors.txt" << false; @@ -372,6 +375,7 @@ void tst_qdeclarativelanguage::errors_data() QTest::newRow("assignToNamespace") << "assignToNamespace.qml" << "assignToNamespace.errors.txt" << false; QTest::newRow("invalidOn") << "invalidOn.qml" << "invalidOn.errors.txt" << false; QTest::newRow("invalidProperty") << "invalidProperty.qml" << "invalidProperty.errors.txt" << false; + QTest::newRow("nonScriptableProperty") << "nonScriptableProperty.qml" << "nonScriptableProperty.errors.txt" << false; } @@ -1048,6 +1052,17 @@ void tst_qdeclarativelanguage::aliasProperties() } } +// QTBUG-13374 Test that alias properties and signals can coexist +void tst_qdeclarativelanguage::aliasPropertiesAndSignals() +{ + QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertiesAndSignals.qml")); + VERIFY_ERRORS(0); + QObject *o = component.create(); + QVERIFY(o); + QCOMPARE(o->property("test").toBool(), true); + delete o; +} + // Test that the root element in a composite type can be a Component void tst_qdeclarativelanguage::componentCompositeType() { @@ -1192,6 +1207,20 @@ void tst_qdeclarativelanguage::declaredPropertyValues() VERIFY_ERRORS(0); } +void tst_qdeclarativelanguage::dontDoubleCallClassBegin() +{ + QDeclarativeComponent component(&engine, TEST_FILE("dontDoubleCallClassBegin.qml")); + QObject *o = component.create(); + QVERIFY(o); + + MyParserStatus *o2 = qobject_cast<MyParserStatus *>(qvariant_cast<QObject *>(o->property("object"))); + QVERIFY(o2); + QCOMPARE(o2->classBeginCount(), 1); + QCOMPARE(o2->componentCompleteCount(), 1); + + delete o; +} + // Check that first child of qml is of given type. Empty type insists on error. void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type, const QString& expectederror) { @@ -1668,6 +1697,20 @@ void tst_qdeclarativelanguage::customOnProperty() delete object; } +// QTBUG-12601 +void tst_qdeclarativelanguage::variantNotify() +{ + QDeclarativeComponent component(&engine, TEST_FILE("variantNotify.qml")); + + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("notifyCount").toInt(), 1); + + delete object; +} + void tst_qdeclarativelanguage::initTestCase() { registerTypes(); diff --git a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml index 3b2db5e..d5d3365 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listviewtest.qml @@ -4,6 +4,12 @@ Rectangle { width: 240 height: 320 color: "#ffffff" + + property real hr: list.visibleArea.heightRatio + function heightRatio() { + return list.visibleArea.heightRatio + } + function checkProperties() { testObject.error = false; if (list.model != testModel) { diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index bf4754d..e4b59a7 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -98,6 +98,7 @@ private slots: void manualHighlight(); void QTBUG_11105(); void footer(); + void resizeView(); private: template <class T> void items(); @@ -223,6 +224,13 @@ public: emit itemsRemoved(index, 1); } + void removeItems(int index, int count) { + int c = count; + while (c--) + list.removeAt(index); + emit itemsRemoved(index, count); + } + void moveItem(int from, int to) { list.move(from, to); emit itemsMoved(from, to, 1); @@ -289,6 +297,13 @@ public: emit endRemoveRows(); } + void removeItems(int index, int count) { + emit beginRemoveRows(QModelIndex(), index, index+count-1); + while (count--) + list.removeAt(index); + emit endRemoveRows(); + } + void moveItem(int from, int to) { emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); list.move(from, to); @@ -519,7 +534,7 @@ void tst_QDeclarativeListView::removed(bool animated) QDeclarativeView *canvas = createView(); T model; - for (int i = 0; i < 30; i++) + for (int i = 0; i < 50; i++) model.addItem("Item" + QString::number(i), ""); QDeclarativeContext *ctxt = canvas->rootContext(); @@ -642,6 +657,21 @@ void tst_QDeclarativeListView::removed(bool animated) QTRY_COMPARE(listview->currentIndex(), 7); QTRY_VERIFY(listview->currentItem() == oldCurrent); + listview->setContentY(80); + QTest::qWait(300); + + model.removeItems(1, 17); + QTest::qWait(300); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i+2); + if (!item) qWarning() << "Item" << i+2 << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),80+i*20.0); + } + delete canvas; } @@ -1591,6 +1621,48 @@ void tst_QDeclarativeListView::footer() QTRY_COMPARE(footer->y(), 0.0); } +void tst_QDeclarativeListView::resizeView() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 40; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listviewtest.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QTRY_VERIFY(contentItem != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(contentItem, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); + } + + QVariant heightRatio; + QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio)); + QCOMPARE(heightRatio.toReal(), 0.4); + + listview->setHeight(200); + + QMetaObject::invokeMethod(canvas->rootObject(), "heightRatio", Q_RETURN_ARG(QVariant, heightRatio)); + QCOMPARE(heightRatio.toReal(), 0.25); +} + void tst_QDeclarativeListView::qListModelInterface_items() { items<TestModel>(); diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index b0b7a3b..3baf848 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -146,7 +146,7 @@ void tst_QDeclarativeLoader::component() void tst_QDeclarativeLoader::invalidUrl() { - QTest::ignoreMessage(QtWarningMsg, QString("<Unknown File>: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString()).toUtf8().constData()); + QTest::ignoreMessage(QtWarningMsg, QString(QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ": File not found").toUtf8().constData()); QDeclarativeComponent component(&engine); component.setData(QByteArray("import Qt 4.7\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); @@ -508,7 +508,7 @@ void tst_QDeclarativeLoader::failNetworkRequest() QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: Network error for URL http://127.0.0.1:14450/IDontExist.qml"); + QTest::ignoreMessage(QtWarningMsg, "http://127.0.0.1:14450/IDontExist.qml: File not found"); QDeclarativeComponent component(&engine); component.setData(QByteArray("import Qt 4.7\nLoader { property int did_load: 123; source: \"http://127.0.0.1:14450/IDontExist.qml\"; onLoaded: did_load=456 }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index e2ccfd2..74d2f0a 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -367,9 +367,11 @@ void tst_QDeclarativePathView::dataModel() QCOMPARE(item->y(), 10.0); model.insertItem(4, "orange", "10"); + QTest::qWait(100); - int itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 10); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 10); + + QVERIFY(pathview->currentIndex() == 0); QDeclarativeText *text = findItem<QDeclarativeText>(pathview, "myText", 4); QVERIFY(text); @@ -384,26 +386,27 @@ void tst_QDeclarativePathView::dataModel() QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); QVERIFY(testObject->error() == false); - itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5); QDeclarativeRectangle *testItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 4); QVERIFY(testItem != 0); testItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 5); QVERIFY(testItem == 0); + pathview->setCurrentIndex(1); + model.insertItem(2, "pink", "2"); + QTest::qWait(100); - itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5); + QVERIFY(pathview->currentIndex() == 1); text = findItem<QDeclarativeText>(pathview, "myText", 2); QVERIFY(text); QCOMPARE(text->text(), model.name(2)); model.removeItem(3); - itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); + QTRY_COMPARE(findItems<QDeclarativeItem>(pathview, "wrapper").count(), 5); text = findItem<QDeclarativeText>(pathview, "myText", 3); QVERIFY(text); QCOMPARE(text->text(), model.name(3)); diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp index 6b36224..b20d8ec 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp +++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -42,6 +42,7 @@ #include <QtTest/QtTest> #include <private/qdeclarativepixmapcache_p.h> #include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativeimageprovider.h> #include <QNetworkReply> #include "testhttpserver.h" #include "../../../shared/util.h" @@ -72,6 +73,7 @@ private slots: void parallel_data(); void massive(); void cancelcrash(); + void shrinkcache(); private: QDeclarativeEngine engine; @@ -326,6 +328,31 @@ void tst_qdeclarativepixmapcache::cancelcrash() } } +class MyPixmapProvider : public QDeclarativeImageProvider +{ +public: + MyPixmapProvider() + : QDeclarativeImageProvider(Pixmap) {} + + virtual QPixmap requestPixmap(const QString &d, QSize *, const QSize &) { + QPixmap pix(800, 600); + pix.fill(Qt::red); + return pix; + } +}; + +// QTBUG-13345 +void tst_qdeclarativepixmapcache::shrinkcache() +{ + QDeclarativeEngine engine; + engine.addImageProvider(QLatin1String("mypixmaps"), new MyPixmapProvider); + + for (int ii = 0; ii < 4000; ++ii) { + QUrl url("image://mypixmaps/" + QString::number(ii)); + QDeclarativePixmap p(&engine, url); + } +} + QTEST_MAIN(tst_qdeclarativepixmapcache) #include "tst_qdeclarativepixmapcache.moc" diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 658f381..f683d98 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -608,6 +608,17 @@ void tst_qdeclarativetext::style() QCOMPARE((int)textObject->style(), (int)styles.at(i)); QCOMPARE(textObject->styleColor(), QColor("white")); } + QString componentStr = "import Qt 4.7\nText { text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QRectF brPre = textObject->boundingRect(); + textObject->setStyle(QDeclarativeText::Outline); + QRectF brPost = textObject->boundingRect(); + + QVERIFY(brPre.width() < brPost.width()); + QVERIFY(brPre.height() < brPost.height()); } void tst_qdeclarativetext::color() diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 56a3121..84f4230 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -777,7 +777,7 @@ void tst_qdeclarativetextedit::delegateLoading_data() // import installed QTest::newRow("pass") << "cursorHttpTestPass.qml" << ""; - QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "<Unknown File>: Network error for URL http://localhost:42332/FailItem.qml "; + QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << "http://localhost:42332/FailItem.qml: Remote host closed the connection "; QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type "; } diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml index a798f77..c5e945a 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml @@ -4,12 +4,16 @@ ListView { width: 100 height: 100 anchors.fill: parent - model: myModel - delegate: Component { - Rectangle { - height: 25 - width: 100 - Text { objectName: "display"; text: display } + model: VisualDataModel { + id: visualModel + objectName: "visualModel" + model: myModel + delegate: Component { + Rectangle { + height: 25 + width: 100 + Text { objectName: "display"; text: display } + } } } } diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index 3cd786f..95ef4fc 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -84,6 +84,7 @@ public: private slots: void rootIndex(); void updateLayout(); + void childChanged(); void objectListModel(); private: @@ -174,22 +175,82 @@ void tst_qdeclarativevisualdatamodel::updateLayout() QVERIFY(contentItem != 0); QDeclarativeText *name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 1 Item")); name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 2 Item")); name = findItem<QDeclarativeText>(contentItem, "display", 2); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 3 Item")); model.invisibleRootItem()->sortChildren(0, Qt::DescendingOrder); name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 3 Item")); name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 2 Item")); name = findItem<QDeclarativeText>(contentItem, "display", 2); + QVERIFY(name); QCOMPARE(name->text(), QString("Row 1 Item")); } +void tst_qdeclarativevisualdatamodel::childChanged() +{ + QDeclarativeView view; + + QStandardItemModel model; + initStandardTreeModel(&model); + + view.rootContext()->setContextProperty("myModel", &model); + + view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml")); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + QDeclarativeVisualDataModel *vdm = listview->findChild<QDeclarativeVisualDataModel*>("visualModel"); + vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0)))); + + QDeclarativeText *name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 Child Item")); + + model.item(1,0)->child(0,0)->setText("Row 2 updated child"); + + name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 updated child")); + + model.item(1,0)->appendRow(new QStandardItem(QLatin1String("Row 2 Child Item 2"))); + QTest::qWait(300); + + name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), QString("Row 2 Child Item 2")); + + model.item(1,0)->takeRow(1); + name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name == 0); + + vdm->setRootIndex(QVariant::fromValue(QModelIndex())); + QTest::qWait(300); + name = findItem<QDeclarativeText>(contentItem, "display", 0); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 1 Item")); + name = findItem<QDeclarativeText>(contentItem, "display", 1); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 2 Item")); + name = findItem<QDeclarativeText>(contentItem, "display", 2); + QVERIFY(name); + QCOMPARE(name->text(), QString("Row 3 Item")); +} + void tst_qdeclarativevisualdatamodel::objectListModel() { QDeclarativeView view; diff --git a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp index 8ba9d45..0f6d531 100644 --- a/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp +++ b/tests/auto/declarative/qmetaobjectbuilder/tst_qmetaobjectbuilder.cpp @@ -558,7 +558,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(prop1.isWritable()); QVERIFY(!prop1.isResettable()); QVERIFY(!prop1.isDesignable()); - QVERIFY(!prop1.isScriptable()); + QVERIFY(prop1.isScriptable()); QVERIFY(!prop1.isStored()); QVERIFY(!prop1.isEditable()); QVERIFY(!prop1.isUser()); @@ -577,7 +577,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(prop2.isWritable()); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); @@ -599,7 +599,7 @@ void tst_QMetaObjectBuilder::property() prop1.setWritable(false); prop1.setResettable(true); prop1.setDesignable(true); - prop1.setScriptable(true); + prop1.setScriptable(false); prop1.setStored(true); prop1.setEditable(true); prop1.setUser(true); @@ -614,7 +614,7 @@ void tst_QMetaObjectBuilder::property() QVERIFY(!prop1.isWritable()); QVERIFY(prop1.isResettable()); QVERIFY(prop1.isDesignable()); - QVERIFY(prop1.isScriptable()); + QVERIFY(!prop1.isScriptable()); QVERIFY(prop1.isStored()); QVERIFY(prop1.isEditable()); QVERIFY(prop1.isUser()); @@ -627,7 +627,7 @@ void tst_QMetaObjectBuilder::property() QCOMPARE(prop2.type(), QByteArray("int")); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); @@ -643,7 +643,7 @@ void tst_QMetaObjectBuilder::property() QCOMPARE(prop2.type(), QByteArray("int")); QVERIFY(!prop2.isResettable()); QVERIFY(!prop2.isDesignable()); - QVERIFY(!prop2.isScriptable()); + QVERIFY(prop2.isScriptable()); QVERIFY(!prop2.isStored()); QVERIFY(!prop2.isEditable()); QVERIFY(!prop2.isUser()); diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.0.png b/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.0.png Binary files differnew file mode 100644 index 0000000..16adc51 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.0.png diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.qml b/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.qml new file mode 100644 index 0000000..0cc98ce --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug13398/data/qtbug13398.qml @@ -0,0 +1,447 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 32 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 48 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 64 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 80 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 96 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 112 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 128 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 144 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 160 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 176 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 192 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 208 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 224 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 240 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 256 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 272 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 288 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 304 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 320 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 336 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 352 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 368 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 384 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 400 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 416 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 432 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 448 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 464 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 480 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 496 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 220; y: 270 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 512 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 528 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 544 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 560 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 576 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Mouse { + type: 5 + button: 0 + buttons: 1 + x: 220; y: 271 + modifiers: 0 + sendToViewport: true + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 220; y: 271 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 592 + hash: "2452007928bf86b9c42e666c7a7afc89" + } + Frame { + msec: 608 + hash: "96e8e81d61bffe02b8f41f47a4a7e8fc" + } + Frame { + msec: 624 + hash: "75881a2779bd7d7f683f87c4a7393769" + } + Frame { + msec: 640 + hash: "2ef628328d2a6393095e78db80b0513f" + } + Frame { + msec: 656 + hash: "390926f2c2c27dfa10c9b393ee466ce6" + } + Frame { + msec: 672 + hash: "ea07d93e7d8a53f56cff19d9d3b282a4" + } + Frame { + msec: 688 + hash: "8aa6be919b1ef4b7e102a319a453707e" + } + Frame { + msec: 704 + hash: "6ebc518fb53ffe42fca20b9f16a21b36" + } + Frame { + msec: 720 + hash: "ee7a93b157e24e22efa84604e7e44fe6" + } + Frame { + msec: 736 + hash: "de3bf8f67e51b036db4976fd3b4b6c3c" + } + Frame { + msec: 752 + hash: "648be4298ebe3bbc7e5c4a4c9c46f193" + } + Frame { + msec: 768 + hash: "1ccf3b73e22a4b98ce1df098af9466f2" + } + Frame { + msec: 784 + hash: "73a2fb047728b2b8e613f0fb8dfe429d" + } + Frame { + msec: 800 + hash: "bbb4cabec4b98ea8ca94dff91a0d8c99" + } + Frame { + msec: 816 + hash: "3337e86bd9fcfbce939389928fb1fb72" + } + Frame { + msec: 832 + hash: "cb4a2a330e8470c61de9e9b6d2dc4597" + } + Frame { + msec: 848 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 864 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 880 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 896 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 912 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 928 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 944 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 960 + image: "qtbug13398.0.png" + } + Frame { + msec: 976 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 992 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1008 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1024 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1040 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1056 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1072 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1088 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1104 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1120 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1136 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1152 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1168 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1184 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1200 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1216 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1232 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Mouse { + type: 2 + button: 1 + buttons: 1 + x: 220; y: 271 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1248 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1264 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1280 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1296 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1312 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1328 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Mouse { + type: 3 + button: 1 + buttons: 0 + x: 220; y: 271 + modifiers: 0 + sendToViewport: true + } + Frame { + msec: 1344 + hash: "e09a359578935b988ac1cc8c40b25547" + } + Frame { + msec: 1360 + hash: "697a4fd182ff90cd557f224174bad43a" + } + Frame { + msec: 1376 + hash: "99e5ca9a77df1acfed628f31b9050179" + } + Frame { + msec: 1392 + hash: "1f0dc00d3e3536b40a6becf775b31cee" + } + Frame { + msec: 1408 + hash: "5b81ddd35d74be222bc8a40d2573884b" + } + Frame { + msec: 1424 + hash: "4e236f5de69048e87add0e4380f2c3e6" + } + Frame { + msec: 1440 + hash: "a901c9c0c77e03d98a2b95267cca8514" + } + Frame { + msec: 1456 + hash: "78bbdf6781c2968c67982ffdb747dbbe" + } + Frame { + msec: 1472 + hash: "a245ca593649f60980be982eb8fda57e" + } + Frame { + msec: 1488 + hash: "c27fddc147749da24eaeb92aeaf61738" + } + Frame { + msec: 1504 + hash: "b9674af46b618dc1eedabd4f18253b11" + } + Frame { + msec: 1520 + hash: "8ae3c0cc0888fd0a607bc5b537a9ce0a" + } + Frame { + msec: 1536 + hash: "f1981bd3fb08233622a4078e2f717011" + } + Frame { + msec: 1552 + hash: "4dce834c9e3988fe535391fedc942add" + } + Frame { + msec: 1568 + hash: "ca7356dee61e156d04b0b46ea033498e" + } + Frame { + msec: 1584 + hash: "97499f6e04cbe690bc12458aef4b66a5" + } + Frame { + msec: 1600 + hash: "2452007928bf86b9c42e666c7a7afc89" + } +} diff --git a/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml b/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml new file mode 100644 index 0000000..8f388bc --- /dev/null +++ b/tests/auto/declarative/qmlvisual/animation/qtbug13398/qtbug13398.qml @@ -0,0 +1,68 @@ +import Qt 4.7 + +Item { + width: 300 + height: 400 + + Rectangle { + id: root + color: "darkkhaki" + + x: 50 + y: 50 + + width: 200 + height: 300 + + Rectangle { + id: statusbar + color: "chocolate" + + height: 30 + + anchors.top: root.top + anchors.left: root.left + anchors.right: root.right + } + + Rectangle { + id: titlebar + color: "crimson" + + height: 60 + + anchors.top: statusbar.bottom + anchors.left: root.left + anchors.right: root.right + } + + MouseArea { + anchors.fill: parent + onClicked: { + root.state = root.state ? "" : "fullscreen"; + } + } + + states: [ + State { + name: "fullscreen" + AnchorChanges { + target: statusbar + anchors.top: undefined + anchors.bottom: titlebar.top + } + AnchorChanges { + target: titlebar + anchors.top: undefined + anchors.bottom: root.top + } + } + ] + + transitions: [ + Transition { + AnchorAnimation { } + } + ] + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png Binary files differnew file mode 100644 index 0000000..bf02e1a --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.0.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png Binary files differnew file mode 100644 index 0000000..ae71dc8 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.1.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png Binary files differnew file mode 100644 index 0000000..6f631b0 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.2.png diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml new file mode 100644 index 0000000..3124973 --- /dev/null +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/data/smoothedfollow.qml @@ -0,0 +1,795 @@ +import Qt.VisualTest 4.7 + +VisualTest { + Frame { + msec: 0 + } + Frame { + msec: 16 + hash: "2c6600b50a18c415032fa95fe5089da6" + } + Frame { + msec: 32 + hash: "aefd5a2570cc0252be102644ec1e49e3" + } + Frame { + msec: 48 + hash: "6183d0554a8b812bee02719dc4df21d1" + } + Frame { + msec: 64 + hash: "e1b3a94d033626338de0e04dba7b6df9" + } + Frame { + msec: 80 + hash: "7d1a5a265fb20ac4d741d76ab7b3a41f" + } + Frame { + msec: 96 + hash: "0ce7d2acda3e5ccb7b2364e2a7b409a4" + } + Frame { + msec: 112 + hash: "21f3a66ee80fcb2dd4dce0d1666aa4dd" + } + Frame { + msec: 128 + hash: "ea5b81ff2805210111cb388ab9be0d8f" + } + Frame { + msec: 144 + hash: "a8a54a3c524dcf6777b71d99ae2d50bd" + } + Frame { + msec: 160 + hash: "6b658c468af8a88e4a282d57fdcbc3b0" + } + Frame { + msec: 176 + hash: "986121c9d928cc9ceb912a975f75760a" + } + Frame { + msec: 192 + hash: "4bf3593d0edc4347cf77670a48ba4440" + } + Frame { + msec: 208 + hash: "ea00f25295fb019f949930fb7109ceb4" + } + Frame { + msec: 224 + hash: "ad6cc7563e2720c405842317d0ce731a" + } + Frame { + msec: 240 + hash: "8a03a1207cdb5bd92f5227b25a7b638e" + } + Frame { + msec: 256 + hash: "f355321aa47d18e8b6dde503565d0e97" + } + Frame { + msec: 272 + hash: "e18f671cac8e68948f32a468bf2630cf" + } + Frame { + msec: 288 + hash: "264bca92fba53f25439d240afef62880" + } + Frame { + msec: 304 + hash: "a1a226c73fb97d5302ce683f901ee5c4" + } + Frame { + msec: 320 + hash: "05578552476372fc58e463e84a147ddd" + } + Frame { + msec: 336 + hash: "0a3e0a651f9eb3e6a44a55a6786e60ff" + } + Frame { + msec: 352 + hash: "4ca362f079f96a01360ee8062fbb8238" + } + Frame { + msec: 368 + hash: "ba512c117d97ce16ff92d03ce2b08056" + } + Frame { + msec: 384 + hash: "8688355f0f97afe000d02f71c841d5dc" + } + Frame { + msec: 400 + hash: "a2ea6ad008da95a67d3bc70e11e3811d" + } + Frame { + msec: 416 + hash: "83bc9c444ab8618438dc2b8b14716f7b" + } + Frame { + msec: 432 + hash: "fafbba34fc8f9d33b559e6fcd0c5f1c6" + } + Frame { + msec: 448 + hash: "92d245951b759f74182602a7a337cb0f" + } + Frame { + msec: 464 + hash: "e0634d25088a6855df8d86d84fe37cd7" + } + Frame { + msec: 480 + hash: "7f4d05f4c3b1a365732e448f2c751740" + } + Frame { + msec: 496 + hash: "fcd6f55929f753f77b1617c0984b8690" + } + Frame { + msec: 512 + hash: "7e88f100a7012d739cd3c97c4e7f4b45" + } + Frame { + msec: 528 + hash: "8f9d029b3850ee2f11cdf6630d100682" + } + Frame { + msec: 544 + hash: "b915f712b24f187ee759b3337fb0df7a" + } + Frame { + msec: 560 + hash: "eae400a0c72d38156f7ae0f16ab9ee66" + } + Frame { + msec: 576 + hash: "e913a1e317cca355b06a393f44cc0243" + } + Frame { + msec: 592 + hash: "abf075ea63a6f5cce43c38e20dbcdbb2" + } + Frame { + msec: 608 + hash: "a6e85caa1eb933343a4605bc434e2841" + } + Frame { + msec: 624 + hash: "8e33e2582dd127d3f04017bf493b0ac6" + } + Frame { + msec: 640 + hash: "959e4062262bcc759abfc7b0bf3e10b6" + } + Frame { + msec: 656 + hash: "9529e2241df0d90ea640fdb3752b0837" + } + Frame { + msec: 672 + hash: "5595b64495996ce66b5f6892e9457456" + } + Frame { + msec: 688 + hash: "532259c3577553622093eba907ae82d3" + } + Frame { + msec: 704 + hash: "85c4332100b6f5256702b594c83f4eff" + } + Frame { + msec: 720 + hash: "b96292d85b12fa8e68c5de3deb29b980" + } + Frame { + msec: 736 + hash: "64febec9c8b58e2b93249f19c57b7aba" + } + Frame { + msec: 752 + hash: "88e588af29131cf942e02b1080e564e5" + } + Frame { + msec: 768 + hash: "07f911478be2f36d0c1b9cb878f4fe47" + } + Frame { + msec: 784 + hash: "8ffbf2381efefcbca413f6e3455018fb" + } + Frame { + msec: 800 + hash: "6e456af680e40799d3f38bdde29a85f9" + } + Frame { + msec: 816 + hash: "48a8dbc64d7823164c992f55b270115d" + } + Frame { + msec: 832 + hash: "a6d28eb1d0aafd387e35ca7b362bec53" + } + Frame { + msec: 848 + hash: "2e9f2b2ebf1b24f01fc986ded320d7c9" + } + Frame { + msec: 864 + hash: "d0cafd9be3263193c207c39eeb051bb8" + } + Frame { + msec: 880 + hash: "8dee1a5365fa3ccd7036c8afa6a805cc" + } + Frame { + msec: 896 + hash: "42f893afb80633f0ffb82f1725bb097f" + } + Frame { + msec: 912 + hash: "f466a404940abcd4c8f3180696da1a29" + } + Frame { + msec: 928 + hash: "e5746e33b3eb155a354bc5900b7593ee" + } + Frame { + msec: 944 + hash: "a1c2eb7048356f4ebc803d9d5439db24" + } + Frame { + msec: 960 + image: "smoothedfollow.0.png" + } + Frame { + msec: 976 + hash: "338aec0e679a8f2e79f6a5503dfbd6c3" + } + Frame { + msec: 992 + hash: "59321f1eb26c379e9e2a37b6890d922d" + } + Frame { + msec: 1008 + hash: "f37a821b9cf9f67fd011c6790a2757f0" + } + Frame { + msec: 1024 + hash: "c3f1b8722c616ecd55d8496e76a9bf06" + } + Frame { + msec: 1040 + hash: "ca6aff9addda2e3ac51e5e2013393365" + } + Frame { + msec: 1056 + hash: "17d1aa7821ce8169a3100a3cd3a0df2b" + } + Frame { + msec: 1072 + hash: "d85dd272f35868d6832316e862db4ec1" + } + Frame { + msec: 1088 + hash: "8bce5bdadfa974655dc7e020ad43edeb" + } + Frame { + msec: 1104 + hash: "b97f71587a5187d5175e5d9f1409c00a" + } + Frame { + msec: 1120 + hash: "53d438e601c25aebfd2ecb0064cdf5cc" + } + Frame { + msec: 1136 + hash: "18c43dd35b3e0d8f9ab5c8de3e48886a" + } + Frame { + msec: 1152 + hash: "e4ab585684d083de118b7862ef5cbd63" + } + Frame { + msec: 1168 + hash: "48ab046a2e2ca1a1225574b94925482e" + } + Frame { + msec: 1184 + hash: "c4bd06a5c329ef6975a60453f588bce7" + } + Frame { + msec: 1200 + hash: "864393a984dce3e9dd2daec56ddb3fe7" + } + Frame { + msec: 1216 + hash: "fcdf4cfcd8a6d8667868ba9633475fe0" + } + Frame { + msec: 1232 + hash: "5ac2b96158045c9b9eb35f1cbabe5b1f" + } + Frame { + msec: 1248 + hash: "83c409e5d3e6fe9e953d9ce14d731b3b" + } + Frame { + msec: 1264 + hash: "01805526b04e17b89238e7b929be48dd" + } + Frame { + msec: 1280 + hash: "4708345219b3732f9aaf8b40645f65d2" + } + Frame { + msec: 1296 + hash: "12716f84b6f648df2cbe08cfea58764c" + } + Frame { + msec: 1312 + hash: "6cce1e6354bd338f364bcca84a5fd081" + } + Frame { + msec: 1328 + hash: "c5da6f6b00402e0de00490792b963cdf" + } + Frame { + msec: 1344 + hash: "0eacadf69c0818e818abaf3aaf823aff" + } + Frame { + msec: 1360 + hash: "c68cd79bf0d329a3c672896b9ce2044d" + } + Frame { + msec: 1376 + hash: "26786f921ddddd9d2f975e1193943d2d" + } + Frame { + msec: 1392 + hash: "68c7c1779bb19ee5cd9370b5c06f4ce7" + } + Frame { + msec: 1408 + hash: "5e87c3e00ef7fab01c17d9e89c661aab" + } + Frame { + msec: 1424 + hash: "0b459122be303c38d3564dd7fea53fc1" + } + Frame { + msec: 1440 + hash: "3b13101a45b470fd04fa02f34548984b" + } + Frame { + msec: 1456 + hash: "6308fa1ed015bb698251af0d1b9be084" + } + Frame { + msec: 1472 + hash: "f219427d8fdf826f33351ba64db55d33" + } + Frame { + msec: 1488 + hash: "0c9ad8c5224d3cdefb8ac793cac3ca79" + } + Frame { + msec: 1504 + hash: "38438307162bceef76afb043c82b6a82" + } + Frame { + msec: 1520 + hash: "78b367e6bab0463fe08f5e634cfbced2" + } + Frame { + msec: 1536 + hash: "81e56f9d3bb9b360a07dc85697a59340" + } + Frame { + msec: 1552 + hash: "cef4fdb8c12485d3590e598090312297" + } + Frame { + msec: 1568 + hash: "8ea0c90a100c583558f92843030543cc" + } + Frame { + msec: 1584 + hash: "0037f0f17a50bdfe3bf0de810ff837f1" + } + Frame { + msec: 1600 + hash: "2b060ac0dfa045b916d3fd5ff6f84bfb" + } + Frame { + msec: 1616 + hash: "b20705dcc6176efd83cff6927991ff0a" + } + Frame { + msec: 1632 + hash: "0af69e490bdc54f27d3e50c1fdfd12a8" + } + Frame { + msec: 1648 + hash: "8e4cceadc01de5b51082889efabcbb7e" + } + Frame { + msec: 1664 + hash: "b64958786a7007686fb1734783d553f5" + } + Frame { + msec: 1680 + hash: "e0b9d98bb3a596fd235d58b6a761a0e0" + } + Frame { + msec: 1696 + hash: "1a5d7dc4dfd3ee86a36978d4effd299c" + } + Frame { + msec: 1712 + hash: "4946561f008635599651bf24b9aa0594" + } + Frame { + msec: 1728 + hash: "8427d33046af64c6e63939238c101e86" + } + Frame { + msec: 1744 + hash: "cdcfab5cea86c33f276c3613d76067c4" + } + Frame { + msec: 1760 + hash: "966005d62bd69b53d77459e5ab65116c" + } + Frame { + msec: 1776 + hash: "8a3c4ff083a973325c4ab09e09027ef6" + } + Frame { + msec: 1792 + hash: "737ffd6f52fa3d812ecaf835a30495af" + } + Frame { + msec: 1808 + hash: "6731007c97ba3ba60e73ab50803868e5" + } + Frame { + msec: 1824 + hash: "caa4ea08c5c330e77a7445cc1adf1666" + } + Frame { + msec: 1840 + hash: "73778bfbae55a81557a128acb4a197c8" + } + Frame { + msec: 1856 + hash: "7d8609f1336ddf4e25b505e54142114e" + } + Frame { + msec: 1872 + hash: "d8b4514d2bd77dbe67e27d400dc1a2f3" + } + Frame { + msec: 1888 + hash: "ac3e7040f1e9fc680f52f46d25eb3faa" + } + Frame { + msec: 1904 + hash: "509c21774f0fca9dde0657133a1cc363" + } + Frame { + msec: 1920 + image: "smoothedfollow.1.png" + } + Frame { + msec: 1936 + hash: "545bcb0c362a083ee698a5c8cd225014" + } + Frame { + msec: 1952 + hash: "77370c9b2880c55fecf07457dd0d455b" + } + Frame { + msec: 1968 + hash: "6c44209f31f5f010f1b3e05490468821" + } + Frame { + msec: 1984 + hash: "2dffac0c44e52f2984525d3d3700e6ed" + } + Frame { + msec: 2000 + hash: "d70f2db1b166b2de3bef74bc4bf94a80" + } + Frame { + msec: 2016 + hash: "50e4f6a82f498066fc9b6588762f59f9" + } + Frame { + msec: 2032 + hash: "956a7d7db9aef1b7abefac1a69622f02" + } + Frame { + msec: 2048 + hash: "13f19d5baefb6c8c9f71c16163663a27" + } + Frame { + msec: 2064 + hash: "076ff84405ddb29a12ed30d27cee558b" + } + Frame { + msec: 2080 + hash: "6af0261639f809da8f7e4831559596d3" + } + Frame { + msec: 2096 + hash: "a0500b18e99bfe3a48d52cc62b4a946b" + } + Frame { + msec: 2112 + hash: "bb0ea576c9136fb70720d4540731d2ca" + } + Frame { + msec: 2128 + hash: "d9b12ad9bf54d7db0ef1b36297a6dd6c" + } + Frame { + msec: 2144 + hash: "2de77e082872f072a849ba9ea93e3aec" + } + Frame { + msec: 2160 + hash: "69e186c3e8e6b2c75da2ca87043129da" + } + Frame { + msec: 2176 + hash: "0c2f23b0cbedb45a68f0cbe6132b4820" + } + Frame { + msec: 2192 + hash: "533bad00e5624611ea8a15d5fa98f0f2" + } + Frame { + msec: 2208 + hash: "d9c60bc821205aa4ea38d846e5b00f3a" + } + Frame { + msec: 2224 + hash: "d4de041edf15c6b6806d7f5992146711" + } + Frame { + msec: 2240 + hash: "100145df5271efaaee1d619bd50b69fc" + } + Frame { + msec: 2256 + hash: "22905b794fee24f3a25e4944d5505e96" + } + Frame { + msec: 2272 + hash: "aeed7adea08fe6e8b60310082cf87b6c" + } + Frame { + msec: 2288 + hash: "82bf8d40b6ed8aae9d6172eae76d1859" + } + Frame { + msec: 2304 + hash: "b1881778936744db3df0898638e4b0df" + } + Frame { + msec: 2320 + hash: "87195016996f8786a8a2430c54f13494" + } + Frame { + msec: 2336 + hash: "56f99b14320662b90eb10e77845bba30" + } + Frame { + msec: 2352 + hash: "69a84022d8d2b3cdb1d7eae6ce5ccef2" + } + Frame { + msec: 2368 + hash: "578ca8c66da6aa64392b253ab6cccbc0" + } + Frame { + msec: 2384 + hash: "4c2058e4708001f82f3bcb8110d6a54f" + } + Frame { + msec: 2400 + hash: "a838be752168bc6feb3151327147bb23" + } + Frame { + msec: 2416 + hash: "bf6cde06f0ee814cd4a23f3d43e7d270" + } + Frame { + msec: 2432 + hash: "9162ec43bc84261c0eb9ea2425da0b8a" + } + Frame { + msec: 2448 + hash: "7be19df0ee54f9bb31ebee2d786addc8" + } + Frame { + msec: 2464 + hash: "542a4c004f5b1b8efa7588b27cc2ba43" + } + Frame { + msec: 2480 + hash: "f9e2edd343be212a9679f1e2ad0e73b3" + } + Frame { + msec: 2496 + hash: "b6d4e9169fc4446cdbd3a36f485b943b" + } + Frame { + msec: 2512 + hash: "0d3b7a652a94162b71e88ed213559af4" + } + Frame { + msec: 2528 + hash: "9d4a2383a4d43ac94ff0a344f217b22d" + } + Frame { + msec: 2544 + hash: "719d402379c40de5cd6d4c8fa92f5472" + } + Frame { + msec: 2560 + hash: "78fb55f5b9c2033a91e41100229e4465" + } + Frame { + msec: 2576 + hash: "0a9ec91eee6c7c770ce2e414fa881229" + } + Frame { + msec: 2592 + hash: "5d9f81f1becf486a09f086e15a64d1f0" + } + Frame { + msec: 2608 + hash: "0f5e18af1eac31e6993ea2df51a143f0" + } + Frame { + msec: 2624 + hash: "08a292373756b06c3a624b8f3bf06236" + } + Frame { + msec: 2640 + hash: "f3c8101429753ce8f0ee094fe0db98ac" + } + Frame { + msec: 2656 + hash: "1603ad220d68ae0a2f613687533c2ebc" + } + Frame { + msec: 2672 + hash: "e2b8049d18fd36fff0180bd4bc199732" + } + Frame { + msec: 2688 + hash: "d1bfeadaa9046ec5013734938a8f4af1" + } + Frame { + msec: 2704 + hash: "3cb3a0e9dc73e76101288395ffeb2b7b" + } + Frame { + msec: 2720 + hash: "104a10e6bd48dacfedf5c98cf641ae93" + } + Frame { + msec: 2736 + hash: "f04a2985e7c203dd6fce46b60fcb23fc" + } + Frame { + msec: 2752 + hash: "30cb747f4604c208d7dc697d5fe2af6b" + } + Frame { + msec: 2768 + hash: "b9eca6ee8fe29351cadeb9a2caf36fa6" + } + Frame { + msec: 2784 + hash: "7bc56e712d713a00a684e07cf3d09907" + } + Frame { + msec: 2800 + hash: "0d7a5e2ff588b71e77abb72723c763b2" + } + Frame { + msec: 2816 + hash: "0d961843e54cbe5ba76c11bcd634bc39" + } + Frame { + msec: 2832 + hash: "6328b52965a002944c501d9888928caa" + } + Frame { + msec: 2848 + hash: "63e668a7688167b604b641929843d0cf" + } + Frame { + msec: 2864 + hash: "7f5e71332268be68de9dcb25f173d2e0" + } + Frame { + msec: 2880 + image: "smoothedfollow.2.png" + } + Frame { + msec: 2896 + hash: "dc6e83fcc5a403913a94c498f1571098" + } + Frame { + msec: 2912 + hash: "8deb275bd08df9b3abdcf3e2796a0601" + } + Frame { + msec: 2928 + hash: "6c08a25a442b97a8cb359792b6a01641" + } + Frame { + msec: 2944 + hash: "5f7ccd5706c77f0b0ddced41ed6352d8" + } + Frame { + msec: 2960 + hash: "6668d1936524f0fdc490720a962a3698" + } + Frame { + msec: 2976 + hash: "e36f901fb4b8ad754592642a7575e4ee" + } + Frame { + msec: 2992 + hash: "7453182980e458d827f3ff83aa3f2c88" + } + Frame { + msec: 3008 + hash: "0e15d75b2a7f2e4a39906093b930d6a8" + } + Frame { + msec: 3024 + hash: "822ccc6c629eabf38fd5ac56abb638f5" + } + Frame { + msec: 3040 + hash: "331ef5b3e3dd5642f8532d337fd22def" + } + Frame { + msec: 3056 + hash: "3c29aae83f28239f31125ef02f523d02" + } + Frame { + msec: 3072 + hash: "56ed674bf2d345861eb235a4239078e2" + } + Frame { + msec: 3088 + hash: "5412b9ad01a6780b67bc59b80a274cd5" + } + Frame { + msec: 3104 + hash: "a6f9ae09a7386f06a84c251083660dd6" + } + Frame { + msec: 3120 + hash: "83f07277c9bec7419dd6a4d40d8accf7" + } + Frame { + msec: 3136 + hash: "e6cb74961dfef68a32f255176e0ebff3" + } + Frame { + msec: 3152 + hash: "9e6c3ac0190beaf30754155a5d64b81c" + } +} diff --git a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml index 0df727b..63dba47 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativesmoothedanimation/smoothedfollow.qml @@ -1,15 +1,15 @@ import Qt 4.7 Rectangle { - width: 800; height: 240; color: "gray" + width: 800; height: 720; color: "gray" Rectangle { id: rect width: 50; height: 20; y: 30; color: "black" SequentialAnimation on x { loops: Animation.Infinite - NumberAnimation { from: 50; to: 700; duration: 2000 } - NumberAnimation { from: 700; to: 50; duration: 2000 } + NumberAnimation { from: 50; to: 700; duration: 1000 } + NumberAnimation { from: 700; to: 50; duration: 1000 } } } @@ -25,16 +25,104 @@ Rectangle { Rectangle { width: 50; height: 20; x: rect.x; y: 120; color: "green" - Behavior on x { SmoothedAnimation { reversingMode: SmoothedAnimation.Sync } } + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } } Rectangle { width: 50; height: 20; x: rect.x; y: 150; color: "purple" - Behavior on x { SmoothedAnimation { maximumEasingTime: 200 } } + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } } Rectangle { width: 50; height: 20; x: rect.x; y: 180; color: "blue" - Behavior on x { SmoothedAnimation { duration: 300 } } + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } + } + + //rect2 has jerky movement, but the rects following it should be smooth + Rectangle { + id: rect2 + property int dir: 1 + width: 50; height: 20; x:50; y: 240; color: "black" + function advance(){ + if(x >= 700) + dir = -1; + if(x <= 50) + dir = 1; + x += 130.0 * dir; + } + } + Timer{ + interval: 200 + running: true + repeat: true + onTriggered: rect2.advance(); + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 270; color: "red" + Behavior on x { SmoothedAnimation { velocity: 400 } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 300; color: "yellow" + Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 330; color: "green" + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 360; color: "purple" + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } + } + + Rectangle { + width: 50; height: 20; x: rect2.x; y: 390; color: "blue" + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } + } + + //rect3 just jumps , but the rects following it should be smooth + Rectangle { + id: rect3 + width: 50; height: 20; x:50; y: 480; color: "black" + function advance(){ + if(x == 50) + x = 700; + else + x = 50; + } + } + Timer{ + interval: 1000 + running: true + repeat: true + onTriggered: rect3.advance(); + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 510; color: "red" + Behavior on x { SmoothedAnimation { velocity: 400 } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 540; color: "yellow" + Behavior on x { SmoothedAnimation { velocity: 300; reversingMode: SmoothedAnimation.Immediate } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 570; color: "green" + Behavior on x { SmoothedAnimation { velocity: 200; reversingMode: SmoothedAnimation.Sync } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 600; color: "purple" + Behavior on x { SmoothedAnimation { velocity: 200; maximumEasingTime: 100 } } + } + + Rectangle { + width: 50; height: 20; x: rect3.x; y: 630; color: "blue" + Behavior on x { SmoothedAnimation { velocity: -1; duration: 300 } } } } diff --git a/tests/auto/linguist/lconvert/data/test-refs.po b/tests/auto/linguist/lconvert/data/test-refs.po new file mode 100644 index 0000000..e149a38 --- /dev/null +++ b/tests/auto/linguist/lconvert/data/test-refs.po @@ -0,0 +1,23 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Language: de_DE\n" + +#: themer/kdmlabel.cpp:285 +#, no-c-format +msgctxt "date format" +msgid "%a %d %B" +msgstr "%a %d %B" + +#: foo.bar.baz +#, no-c-format +msgid "full java class name" +msgstr "" + +#: foo.car:123 monks:here file/gar.c:17:19 no:monks:here +#, no-c-format +msgid "some excessive locations" +msgstr "" diff --git a/tests/auto/linguist/lconvert/data/test20.ts b/tests/auto/linguist/lconvert/data/test20.ts index f042edf..0e38b4b 100644 --- a/tests/auto/linguist/lconvert/data/test20.ts +++ b/tests/auto/linguist/lconvert/data/test20.ts @@ -158,5 +158,14 @@ <comment>comment with | and ~ and so~</comment> <translation type="unfinished"></translation> </message> + <message> + <source>just something obsolete</source> + <translation type="obsolete">translated obsoletion</translation> + </message> + <message> + <source>something else obsolete</source> + <comment>comment with | and ~ and so~</comment> + <translation type="obsolete">another translated obsoletion</translation> + </message> </context> </TS> diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 998f588..a3c29d8 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -317,6 +317,8 @@ void tst_lconvert::roundtrips_data() QTest::newRow("po-xliff-po (plural-2)") << "plural-2.po" << poXlfPo << noArgs; QTest::newRow("po-xliff-po (plural-3)") << "plural-3.po" << poXlfPo << noArgs; + QTest::newRow("po-ts-po (references)") << "test-refs.po" << poTsPo << noArgs; + QTest::newRow("ts20-ts11-ts20 (utf8)") << "codec-utf8.ts" << tsTs11Ts << noArgs; QTest::newRow("ts20-ts11-ts20 (cp1252)") << "codec-cp1252.ts" << tsTs11Ts << noArgs; QTest::newRow("ts20-ts11-ts20 (dual-encoding)") << "dual-encoding.ts" << tsTs11Ts << noArgs; diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml new file mode 100644 index 0000000..172bd65 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/main.qml @@ -0,0 +1,97 @@ +import Qt 4.7 + +QtObject { + function translate() { + qsTr("One"); + qsTranslate("FooContext", "Two"); + + var greeting_strings = [ + QT_TR_NOOP("Hello"), + QT_TRANSLATE_NOOP("FooContext", "Goodbye") + ]; + + qsTr("One", "not the same one"); + + //: My first comment. + qsTr("See comment"); + + //: My second comment. + qsTranslate("BarContext", "See other comment"); + + //: My third comment + //: spans two lines. + qsTr("The comment explains it all"); + + //: My fourth comment + //: spans a whopping + //: three lines. + qsTranslate("BazContext", "It should be clear by now"); + + /*: C-style comment. */ + qsTr("I love C++"); + + /*: Another C-style comment. */ + qsTranslate("FooContext", "I really love C++"); + + /*: C-style comment, followed by */ + /*: another one. */ + qsTr("Qt is the best"); + + /*: Another C-style comment, followed by */ + /*: yet another one. */ + qsTranslate("BarContext", "Qt is the very best"); + + // This comment doesn't have any effect. + qsTr("The comment had no effect"); + + // This comment doesn't have any effect either. + qsTranslate("BazContext", "The comment had no effect, really"); + + /* This C-style comment doesn't have any effect. */ + qsTr("No comment to your comment"); + + /* This C-style comment doesn't have any effect either. */ + qsTranslate("FooContext", "I refuse to comment on that"); + + //= id_foo + qsTr("This string has an identifier"); + + //= id_bar + qsTranslate("BarContext", "This string also has an identifier"); + + //~ loc-blank False + qsTr("This string has meta-data"); + + //~ loc-layout_id foo_dialog + qsTranslate("BazContext", "This string also has meta-data"); + + // This comment is to be ignored. + //: This is a comment for the translator. + //= id_baz + //~ foo 123 + //~ magic-stuff This means something special. + qsTr("This string has a lot of information"); + + // This comment is also to be ignored. + //: This is another comment for the translator. + //= id_babar + //~ foo-bar Important stuff + //~ needle-in-haystack Found + //~ overflow True + qsTranslate("FooContext", "This string has even more information"); + + qsTr("This string has disambiguation", "Disambiguation"); + + qsTranslate("BarContext", "This string also has disambiguation", "Another disambiguation"); + + qsTr("This string contains plurals", "", 10); + + qsTrId("qtn_foo_bar"); + + var more_greeting_strings = [ QT_TRID_NOOP("qtn_needle"), QT_TRID_NOOP("qtn_haystack") ]; + + //: qsTrId() with comment, meta-data and plurals. + //~ well-tested True + qsTrId("qtn_bar_baz", 10); + } +} diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro new file mode 100644 index 0000000..1040e22 --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.pro @@ -0,0 +1,3 @@ +SOURCES += main.qml + +TRANSLATIONS = project.ts diff --git a/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result new file mode 100644 index 0000000..7dac8cb --- /dev/null +++ b/tests/auto/linguist/lupdate/testdata/good/parseqml/project.ts.result @@ -0,0 +1,195 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0"> +<context> + <name></name> + <message id="qtn_foo_bar"> + <location filename="main.qml" line="89"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_needle"> + <location filename="main.qml" line="91"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_haystack"> + <location filename="main.qml" line="91"/> + <source></source> + <translation type="unfinished"></translation> + </message> + <message id="qtn_bar_baz" numerus="yes"> + <location filename="main.qml" line="95"/> + <source></source> + <extracomment>qsTrId() with comment, meta-data and plurals.</extracomment> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + <extra-well-tested>True</extra-well-tested> + </message> +</context> +<context> + <name>BarContext</name> + <message> + <location filename="main.qml" line="19"/> + <source>See other comment</source> + <extracomment>My second comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="42"/> + <source>Qt is the very best</source> + <extracomment>Another C-style comment, followed by yet another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message id="id_bar"> + <location filename="main.qml" line="60"/> + <source>This string also has an identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="85"/> + <source>This string also has disambiguation</source> + <comment>Another disambiguation</comment> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>BazContext</name> + <message> + <location filename="main.qml" line="28"/> + <source>It should be clear by now</source> + <extracomment>My fourth comment spans a whopping three lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="48"/> + <source>The comment had no effect, really</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="66"/> + <source>This string also has meta-data</source> + <translation type="unfinished"></translation> + <extra-loc-layout_id>foo_dialog</extra-loc-layout_id> + </message> +</context> +<context> + <name>FooContext</name> + <message> + <location filename="main.qml" line="6"/> + <source>Two</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="10"/> + <source>Goodbye</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="34"/> + <source>I really love C++</source> + <extracomment>Another C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="54"/> + <source>I refuse to comment on that</source> + <translation type="unfinished"></translation> + </message> + <message id="id_babar"> + <location filename="main.qml" line="81"/> + <source>This string has even more information</source> + <extracomment>This is another comment for the translator.</extracomment> + <translation type="unfinished"></translation> + <extra-needle-in-haystack>Found</extra-needle-in-haystack> + <extra-overflow>True</extra-overflow> + <extra-foo-bar>Important stuff</extra-foo-bar> + </message> +</context> +<context> + <name>main</name> + <message> + <location filename="main.qml" line="5"/> + <source>One</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="9"/> + <source>Hello</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="13"/> + <source>One</source> + <comment>not the same one</comment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="16"/> + <source>See comment</source> + <extracomment>My first comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="23"/> + <source>The comment explains it all</source> + <extracomment>My third comment spans two lines.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="31"/> + <source>I love C++</source> + <extracomment>C-style comment.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="38"/> + <source>Qt is the best</source> + <extracomment>C-style comment, followed by another one.</extracomment> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="45"/> + <source>The comment had no effect</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="51"/> + <source>No comment to your comment</source> + <translation type="unfinished"></translation> + </message> + <message id="id_foo"> + <location filename="main.qml" line="57"/> + <source>This string has an identifier</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="main.qml" line="63"/> + <source>This string has meta-data</source> + <translation type="unfinished"></translation> + <extra-loc-blank>False</extra-loc-blank> + </message> + <message id="id_baz"> + <location filename="main.qml" line="73"/> + <source>This string has a lot of information</source> + <extracomment>This is a comment for the translator.</extracomment> + <translation type="unfinished"></translation> + <extra-foo>123</extra-foo> + <extra-magic-stuff>This means something special.</extra-magic-stuff> + </message> + <message> + <location filename="main.qml" line="83"/> + <source>This string has disambiguation</source> + <comment>Disambiguation</comment> + <translation type="unfinished"></translation> + </message> + <message numerus="yes"> + <location filename="main.qml" line="87"/> + <source>This string contains plurals</source> + <translation type="unfinished"> + <numerusform></numerusform> + </translation> + </message> +</context> +</TS> diff --git a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp index 6f158f0..dbcccc9 100644 --- a/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -1208,6 +1208,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent() QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QPersistentModelIndex persistentSource = sourceIndex; ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); moveCommand->setAncestorRowNumbers(QList<int>() << 5); @@ -1228,7 +1229,7 @@ void tst_QAbstractItemModel::testMoveToGrandParent() QCOMPARE(beforeSignal.at(4).toInt(), destRow); QCOMPARE(afterSignal.size(), 5); - QCOMPARE(afterSignal.at(0).value<QModelIndex>(), sourceIndex); + QCOMPARE(afterSignal.at(0).value<QModelIndex>(), static_cast<QModelIndex>(persistentSource)); QCOMPARE(afterSignal.at(1).toInt(), startRow); QCOMPARE(afterSignal.at(2).toInt(), endRow); QCOMPARE(afterSignal.at(3).value<QModelIndex>(), QModelIndex()); @@ -1351,6 +1352,7 @@ void tst_QAbstractItemModel::testMoveToSibling() QSignalSpy beforeSpy(m_model, SIGNAL(rowsAboutToBeMoved(const QModelIndex &, int, int, const QModelIndex &, int))); QSignalSpy afterSpy(m_model, SIGNAL(rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int))); + QPersistentModelIndex persistentDest = destIndex; ModelMoveCommand *moveCommand = new ModelMoveCommand(m_model, this); moveCommand->setNumCols(4); @@ -1374,7 +1376,7 @@ void tst_QAbstractItemModel::testMoveToSibling() QCOMPARE(afterSignal.at(0).value<QModelIndex>(), sourceIndex); QCOMPARE(afterSignal.at(1).toInt(), startRow); QCOMPARE(afterSignal.at(2).toInt(), endRow); - QCOMPARE(afterSignal.at(3).value<QModelIndex>(), destIndex); + QCOMPARE(afterSignal.at(3).value<QModelIndex>(), static_cast<QModelIndex>(persistentDest)); QCOMPARE(afterSignal.at(4).toInt(), destRow); for (int i = 0; i < indexList.size(); i++) diff --git a/tests/auto/qdir/tst_qdir.cpp b/tests/auto/qdir/tst_qdir.cpp index 661a4c7..9678868 100644 --- a/tests/auto/qdir/tst_qdir.cpp +++ b/tests/auto/qdir/tst_qdir.cpp @@ -173,6 +173,8 @@ private slots: void updateFileLists(); + void detachingOperations(); + #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) void isRoot_data(); void isRoot(); @@ -1561,6 +1563,103 @@ void tst_QDir::updateFileLists() QCOMPARE(dir.entryList(), QStringList() << "sub-dir1" << "sub-dir2" << "file1.txt"); } +void tst_QDir::detachingOperations() +{ + QString const defaultPath("."); + QStringList const defaultNameFilters = QStringList("*"); + QDir::SortFlags const defaultSorting = QDir::Name | QDir::IgnoreCase; + QDir::Filters const defaultFilter = QDir::AllEntries; + + QString const path1(".."); + QString const path2("./foo"); + QStringList const nameFilters = QStringList(QString("*.txt")); + QDir::SortFlags const sorting = QDir::Name | QDir::DirsLast | QDir::Reversed; + QDir::Filters const filter = QDir::Writable; + + QDir dir1; + + QCOMPARE(dir1.path(), defaultPath); + QCOMPARE(dir1.filter(), defaultFilter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setPath(path1); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), defaultFilter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setFilter(filter); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), defaultNameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setNameFilters(nameFilters); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), defaultSorting); + + dir1.setSorting(sorting); + QCOMPARE(dir1.path(), path1); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + dir1.setPath(path2); + QCOMPARE(dir1.path(), path2); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + { + QDir dir2(dir1); + QCOMPARE(dir2.path(), path2); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + } + + { + QDir dir2; + QCOMPARE(dir2.path(), defaultPath); + QCOMPARE(dir2.filter(), defaultFilter); + QCOMPARE(dir2.nameFilters(), defaultNameFilters); + QCOMPARE(dir2.sorting(), defaultSorting); + + dir2 = dir1; + QCOMPARE(dir2.path(), path2); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + + dir2 = path1; + QCOMPARE(dir2.path(), path1); + QCOMPARE(dir2.filter(), filter); + QCOMPARE(dir2.nameFilters(), nameFilters); + QCOMPARE(dir2.sorting(), sorting); + } + + dir1.refresh(); + QCOMPARE(dir1.path(), path2); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + QString const currentPath = QDir::currentPath(); + QVERIFY(dir1.cd(currentPath)); + QCOMPARE(dir1.path(), currentPath); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); + + QVERIFY(dir1.cdUp()); + QCOMPARE(dir1.filter(), filter); + QCOMPARE(dir1.nameFilters(), nameFilters); + QCOMPARE(dir1.sorting(), sorting); +} + #if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN) void tst_QDir::isRoot_data() { diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp index 124f900..2411ab6 100644 --- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp @@ -153,19 +153,19 @@ void tst_QEasingCurve::propertyDefaults() QEasingCurve curve(QEasingCurve::InElastic); QCOMPARE(curve.period(), 0.3); QCOMPARE(curve.amplitude(), 1.0); - QCOMPARE(curve.overshoot(), qreal(1.70158f)); + QCOMPARE(curve.overshoot(), qreal(1.70158)); curve.setType(QEasingCurve::InBounce); QCOMPARE(curve.period(), 0.3); QCOMPARE(curve.amplitude(), 1.0); - QCOMPARE(curve.overshoot(), qreal(1.70158f)); + QCOMPARE(curve.overshoot(), qreal(1.70158)); curve.setType(QEasingCurve::Linear); QCOMPARE(curve.period(), 0.3); QCOMPARE(curve.amplitude(), 1.0); - QCOMPARE(curve.overshoot(), qreal(1.70158f)); + QCOMPARE(curve.overshoot(), qreal(1.70158)); curve.setType(QEasingCurve::InElastic); QCOMPARE(curve.period(), 0.3); QCOMPARE(curve.amplitude(), 1.0); - QCOMPARE(curve.overshoot(), qreal(1.70158f)); + QCOMPARE(curve.overshoot(), qreal(1.70158)); curve.setPeriod(0.4); curve.setAmplitude(0.6); curve.setOvershoot(1.0); @@ -490,7 +490,7 @@ void tst_QEasingCurve::operators() // operator== curve.setType(QEasingCurve::InBack); curve2 = curve; - curve2.setOvershoot(qreal(1.70158f)); + curve2.setOvershoot(qreal(1.70158)); QCOMPARE(curve.overshoot(), curve2.overshoot()); QVERIFY(curve2 == curve); @@ -505,6 +505,15 @@ void tst_QEasingCurve::operators() curve2.setType(QEasingCurve::InBack); QCOMPARE(curve.overshoot(), curve2.overshoot()); QVERIFY(curve2 == curve); + + QEasingCurve curve3; + QEasingCurve curve4; + curve4.setAmplitude(curve4.amplitude()); + QEasingCurve curve5; + curve5.setAmplitude(0.12345); + QVERIFY(curve3 == curve4); // default value and not assigned + QVERIFY(curve3 != curve5); // unassinged and other value + QVERIFY(curve4 != curve5); } class tst_QEasingProperties : public QObject @@ -527,7 +536,7 @@ void tst_QEasingCurve::properties() tst_QEasingProperties obj; QEasingCurve inOutBack(QEasingCurve::InOutBack); - qreal overshoot = 1.5f; + qreal overshoot = 1.5; inOutBack.setOvershoot(overshoot); qreal amplitude = inOutBack.amplitude(); qreal period = inOutBack.period(); diff --git a/tests/auto/qfileinfo/tst_qfileinfo.cpp b/tests/auto/qfileinfo/tst_qfileinfo.cpp index a074f4b..7659a75 100644 --- a/tests/auto/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/qfileinfo/tst_qfileinfo.cpp @@ -181,6 +181,8 @@ private slots: void equalOperator() const; void equalOperatorWithDifferentSlashes() const; void notEqualOperator() const; + + void detachingOperations(); }; tst_QFileInfo::tst_QFileInfo() @@ -247,13 +249,13 @@ void tst_QFileInfo::copy() QFileInfo info2(info); QFileInfoPrivate *privateInfo = getPrivate(info); QFileInfoPrivate *privateInfo2 = getPrivate(info2); - QCOMPARE(privateInfo->data, privateInfo2->data); + QCOMPARE(privateInfo, privateInfo2); //operator = QFileInfo info3 = info; QFileInfoPrivate *privateInfo3 = getPrivate(info3); - QCOMPARE(privateInfo->data, privateInfo3->data); - QCOMPARE(privateInfo2->data, privateInfo3->data); + QCOMPARE(privateInfo, privateInfo3); + QCOMPARE(privateInfo2, privateInfo3); //refreshing info3 will detach it QFile file(info.absoluteFilePath()); @@ -275,9 +277,10 @@ void tst_QFileInfo::copy() QTest::qWait(5000); #endif info3.refresh(); - QVERIFY(privateInfo->data != privateInfo3->data); - QVERIFY(privateInfo2->data != privateInfo3->data); - QCOMPARE(privateInfo->data, privateInfo2->data); + privateInfo3 = getPrivate(info3); + QVERIFY(privateInfo != privateInfo3); + QVERIFY(privateInfo2 != privateInfo3); + QCOMPARE(privateInfo, privateInfo2); } void tst_QFileInfo::isFile_data() @@ -1241,8 +1244,8 @@ void tst_QFileInfo::isLocalFs() QFileInfo info(path); QFileInfoPrivate *privateInfo = getPrivate(info); - QVERIFY(privateInfo->data->fileEngine); - QCOMPARE(bool(privateInfo->data->fileEngine->fileFlags(QAbstractFileEngine::LocalDiskFlag) + QVERIFY(privateInfo->fileEngine); + QCOMPARE(bool(privateInfo->fileEngine->fileFlags(QAbstractFileEngine::LocalDiskFlag) & QAbstractFileEngine::LocalDiskFlag), isLocalFs); } @@ -1544,5 +1547,51 @@ void tst_QFileInfo::notEqualOperator() const QVERIFY(QFileInfo() != QFileInfo()); } +void tst_QFileInfo::detachingOperations() +{ + QFileInfo info1; + QVERIFY(info1.caching()); + info1.setCaching(false); + + { + QFileInfo info2 = info1; + + QVERIFY(!info1.caching()); + QVERIFY(!info2.caching()); + + info2.setCaching(true); + QVERIFY(info2.caching()); + + info1.setFile("foo"); + QVERIFY(!info1.caching()); + } + + { + QFile file("foo"); + info1.setFile(file); + QVERIFY(!info1.caching()); + } + + info1.setFile(QDir(), "foo"); + QVERIFY(!info1.caching()); + + { + QFileInfo info3; + QVERIFY(info3.caching()); + + info3 = info1; + QVERIFY(!info3.caching()); + } + + info1.refresh(); + QVERIFY(!info1.caching()); + + QVERIFY(info1.makeAbsolute()); + QVERIFY(!info1.caching()); + + info1.detach(); + QVERIFY(!info1.caching()); +} + QTEST_MAIN(tst_QFileInfo) #include "tst_qfileinfo.moc" diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 3634ce9..4476084 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -4578,7 +4578,7 @@ void tst_QGraphicsItem::itemChange() QCOMPARE(tester.changes.at(tester.changes.size() - 1), QGraphicsItem::ItemFlagsHaveChanged); QVariant expectedFlags = qVariantFromValue<quint32>(QGraphicsItem::GraphicsItemFlags(QGraphicsItem::ItemIsSelectable | QGraphicsItem::ItemSendsGeometryChanges)); QCOMPARE(tester.values.at(tester.values.size() - 2), expectedFlags); - QCOMPARE(tester.values.at(tester.values.size() - 1), qVariantFromValue<quint32>(QGraphicsItem::ItemIsSelectable)); + QCOMPARE(tester.values.at(tester.values.size() - 1), qVariantFromValue<quint32>((quint32)QGraphicsItem::ItemIsSelectable)); } { // ItemSelectedChange diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 46bc6e7..6b8028c 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -162,14 +162,14 @@ void tst_QImage::create() { bool cr = true; #if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) - try { + QT_TRY { #endif //QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian); QImage image(7000000, 7000000, QImage::Format_Indexed8); image.setColorCount(256); cr = !image.isNull(); #if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE) - } catch (...) { + } QT_CATCH (...) { } #endif QVERIFY( !cr ); diff --git a/tests/auto/qinputcontext/qinputcontext.pro b/tests/auto/qinputcontext/qinputcontext.pro index b3ea8c2..ec6831e 100644 --- a/tests/auto/qinputcontext/qinputcontext.pro +++ b/tests/auto/qinputcontext/qinputcontext.pro @@ -1,2 +1,6 @@ load(qttest_p4) SOURCES += tst_qinputcontext.cpp + +symbian { + LIBS += -lws32 -lcone +} diff --git a/tests/auto/qinputcontext/tst_qinputcontext.cpp b/tests/auto/qinputcontext/tst_qinputcontext.cpp index 644b463..d077bc1 100644 --- a/tests/auto/qinputcontext/tst_qinputcontext.cpp +++ b/tests/auto/qinputcontext/tst_qinputcontext.cpp @@ -48,17 +48,27 @@ #include <qlayout.h> #include <qradiobutton.h> #include <qwindowsstyle.h> +#include <qdesktopwidget.h> +#include <qpushbutton.h> + +#ifdef Q_OS_SYMBIAN +#include <private/qt_s60_p.h> +#include <private/qcoefepinputcontext_p.h> + +#include <w32std.h> +#include <coecntrl.h> +#endif class tst_QInputContext : public QObject { Q_OBJECT public: - tst_QInputContext() {} + tst_QInputContext() : m_phoneIsQwerty(false) {} virtual ~tst_QInputContext() {} public slots: - void initTestCase() {} + void initTestCase(); void cleanupTestCase() {} void init() {} void cleanup() {} @@ -69,8 +79,178 @@ private slots: void closeSoftwareInputPanel(); void selections(); void focusProxy(); + void symbianTestCoeFepInputContext_data(); + void symbianTestCoeFepInputContext(); + void symbianTestCoeFepAutoCommit_data(); + void symbianTestCoeFepAutoCommit(); + +private: + bool m_phoneIsQwerty; +}; + +#ifdef Q_OS_SYMBIAN +class KeyEvent : public TWsEvent +{ +public: + KeyEvent(QWidget *w, TInt type, TInt scanCode, TUint code, TUint modifiers, TInt repeats) { + iHandle = w->effectiveWinId()->DrawableWindow()->WindowGroupId(); + iType = type; + SetTimeNow(); + TKeyEvent *keyEvent = reinterpret_cast<TKeyEvent *>(iEventData); + keyEvent->iScanCode = scanCode; + keyEvent->iCode = code; + keyEvent->iModifiers = modifiers; + keyEvent->iRepeats = repeats; + } +}; + +class FepReplayEvent +{ +public: + enum Type { + Pause, + Key, + CompleteKey + }; + + FepReplayEvent(int msecsToPause) + : m_type(Pause) + , m_msecsToPause(msecsToPause) + { + } + + FepReplayEvent(TInt keyType, TInt scanCode, TUint code, TUint modifiers, TInt repeats) + : m_type(Key) + , m_keyType(keyType) + , m_scanCode(scanCode) + , m_code(code) + , m_modifiers(modifiers) + , m_repeats(repeats) + { + } + + FepReplayEvent(TInt scanCode, TUint code, TUint modifiers, TInt repeats) + : m_type(CompleteKey) + , m_scanCode(scanCode) + , m_code(code) + , m_modifiers(modifiers) + , m_repeats(repeats) + { + } + + void sendEvent(QWidget *w, TInt type, TInt scanCode, TUint code, TUint modifiers, TInt repeats) + { + KeyEvent event(w, type, scanCode, code, modifiers, repeats); + S60->wsSession().SendEventToWindowGroup(w->effectiveWinId()->DrawableWindow()->WindowGroupId(), event); + } + + void pause(int msecs) + { + // Don't use qWait here. The polling nature of that function screws up the test. + QTimer timer; + QEventLoop loop; + QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + timer.setSingleShot(true); + timer.start(msecs); + loop.exec(); + } + + // For some reason, the test fails if using processEvents instead of an event loop + // with a zero timer to quit it, so use the timer. +#define KEY_WAIT 0 + + void replay(QWidget *w) + { + if (m_type == Pause) { + pause(m_msecsToPause); + } else if (m_type == Key) { + sendEvent(w, m_keyType, m_scanCode, m_code, m_modifiers, m_repeats); + if (m_keyType != EEventKeyDown) + // EEventKeyDown events should have no pause before the EEventKey event. + pause(KEY_WAIT); + } else if (m_type == CompleteKey) { + sendEvent(w, EEventKeyDown, m_scanCode, 0, m_modifiers, m_repeats); + // EEventKeyDown events should have no pause before the EEventKey event. + sendEvent(w, EEventKey, m_scanCode, m_code, m_modifiers, m_repeats); + pause(KEY_WAIT); + sendEvent(w, EEventKeyUp, m_scanCode, 0, m_modifiers, m_repeats); + pause(KEY_WAIT); + } + } + +private: + Type m_type; + int m_msecsToPause; + TInt m_keyType; + TInt m_scanCode; + TUint m_code; + TUint m_modifiers; + TInt m_repeats; }; +Q_DECLARE_METATYPE(QList<FepReplayEvent>) +Q_DECLARE_METATYPE(Qt::InputMethodHints) +Q_DECLARE_METATYPE(QLineEdit::EchoMode); + +#endif // Q_OS_SYMBIAN + +void tst_QInputContext::initTestCase() +{ +#ifdef Q_OS_SYMBIAN + // Sanity test. Checks FEP for: + // - T9 mode is default (it will attempt to fix this) + // - Language is English (it cannot fix this; bail out if not correct) + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *lineedit = new QLineEdit; + layout->addWidget(lineedit); + lineedit->setFocus(); +#ifdef QT_KEYPAD_NAVIGATION + lineedit->setEditFocus(true); +#endif + w.show(); + + QDesktopWidget desktop; + QRect screenSize = desktop.screenGeometry(&w); + if (screenSize.width() > screenSize.height()) { + // Crude way of finding out we are running on a qwerty phone. + m_phoneIsQwerty = true; + return; + } + + for (int iterations = 0; iterations < 16; iterations++) { + QTest::qWait(500); + + QList<FepReplayEvent> keyEvents; + + keyEvents << FepReplayEvent('9', '9', 0, 0); + keyEvents << FepReplayEvent('6', '6', 0, 0); + keyEvents << FepReplayEvent('8', '8', 0, 0); + keyEvents << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); + + foreach(FepReplayEvent event, keyEvents) { + event.replay(lineedit); + } + + QApplication::processEvents(); + + if (lineedit->text().endsWith("you", Qt::CaseInsensitive)) { + // Success! + return; + } + + // Try changing modes. + // After 8 iterations, try to press the mode switch twice before typing. + for (int c = 0; c <= iterations / 8; c++) { + FepReplayEvent(EStdKeyHash, '#', 0, 0).replay(lineedit); + } + } + + QFAIL("FEP sanity test failed. Either the phone is not set to English, or the test was unable to enable T9"); +#endif +} + void tst_QInputContext::maximumTextLength() { QLineEdit le; @@ -271,7 +451,6 @@ void tst_QInputContext::focusProxy() QInputContext *gic = qApp->inputContext(); QVERIFY(gic); - qDebug() << gic->focusWidget() << &proxy; QCOMPARE(gic->focusWidget(), &proxy); // then change the focus proxy and check that input context is valid @@ -285,5 +464,622 @@ void tst_QInputContext::focusProxy() QCOMPARE(gic->focusWidget(), &proxy); } +void tst_QInputContext::symbianTestCoeFepInputContext_data() +{ +#ifdef Q_OS_SYMBIAN + QTest::addColumn<bool> ("inputMethodEnabled"); + QTest::addColumn<Qt::InputMethodHints> ("inputMethodHints"); + QTest::addColumn<int> ("maxLength"); // Zero for no limit + QTest::addColumn<QLineEdit::EchoMode> ("echoMode"); + QTest::addColumn<QList<FepReplayEvent> > ("keyEvents"); + QTest::addColumn<QString> ("finalString"); + QTest::addColumn<QString> ("preeditString"); + QList<FepReplayEvent> events; + + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('6', '6', 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent('1', '1', 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent('2', '2', 0, 0); + events << FepReplayEvent('1', '1', 0, 0); + QTest::newRow("Numbers (no FEP)") + << false + << Qt::InputMethodHints(Qt::ImhNone) + << 0 + << QLineEdit::Normal + << events + << QString("521") + << QString(""); + QTest::newRow("Numbers and password mode (no FEP)") + << false + << Qt::InputMethodHints(Qt::ImhNone) + << 0 + << QLineEdit::Password + << events + << QString("521") + << QString(""); + QTest::newRow("Numbers") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Normal + << events + << QString("521") + << QString(""); + QTest::newRow("Numbers max length (no FEP)") + << false + << Qt::InputMethodHints(Qt::ImhNone) + << 2 + << QLineEdit::Normal + << events + << QString("21") + << QString(""); + QTest::newRow("Numbers max length") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 2 + << QLineEdit::Normal + << events + << QString("21") + << QString(""); + events.clear(); + + events << FepReplayEvent(EEventKeyDown, '5', 0, 0, 0); + events << FepReplayEvent(EEventKey, '5', '5', 0, 0); + events << FepReplayEvent(EEventKey, '5', '5', 0, 1); + events << FepReplayEvent(EEventKey, '5', '5', 0, 1); + events << FepReplayEvent(EEventKeyUp, '5', 0, 0, 0); + QTest::newRow("Numbers and autorepeat (no FEP)") + << false + << Qt::InputMethodHints(Qt::ImhNone) + << 0 + << QLineEdit::Normal + << events + << QString("555") + << QString(""); + events.clear(); + + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + events << FepReplayEvent('2', '2', 0, 0); + events << FepReplayEvent('3', '3', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + QTest::newRow("Multitap") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("Adh") + << QString(""); + QTest::newRow("Multitap with no auto uppercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhNoAutoUppercase) + << 0 + << QLineEdit::Normal + << events + << QString("adh") + << QString(""); + QTest::newRow("Multitap with uppercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferUppercase) + << 0 + << QLineEdit::Normal + << events + << QString("ADH") + << QString(""); + QTest::newRow("Multitap with lowercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("adh") + << QString(""); + QTest::newRow("Multitap with forced uppercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhUppercaseOnly) + << 0 + << QLineEdit::Normal + << events + << QString("ADH") + << QString(""); + QTest::newRow("Multitap with forced lowercase") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhLowercaseOnly) + << 0 + << QLineEdit::Normal + << events + << QString("adh") + << QString(""); + events.clear(); + + events << FepReplayEvent(EStdKeyHash, '#', 0, 0); + events << FepReplayEvent('2', '2', 0, 0); + events << FepReplayEvent('2', '2', 0, 0); + events << FepReplayEvent('3', '3', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent('5', '5', 0, 0); + events << FepReplayEvent(EStdKeyBackspace, EKeyBackspace, 0, 0); + QTest::newRow("Multitap with mode switch") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("bdh") + << QString(""); + events.clear(); + + events << FepReplayEvent('7', '7', 0, 0); + events << FepReplayEvent('7', '7', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + QTest::newRow("Multitap with unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("Qt") + << QString("x"); + events << FepReplayEvent(2000); + QTest::newRow("Multitap with committed text") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("Qtx") + << QString(""); + events.clear(); + + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + // Simulate holding down hash key. + events << FepReplayEvent(EEventKeyDown, EStdKeyHash, 0, 0, 0); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 0); + events << FepReplayEvent(500); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKeyUp, EStdKeyHash, 0, 0, 0); + events << FepReplayEvent('7', '7', 0, 0); + events << FepReplayEvent('7', '7', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + // QTBUG-9867: Switch back as well to make sure we don't get extra symbols + events << FepReplayEvent(EEventKeyDown, EStdKeyHash, 0, 0, 0); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 0); + events << FepReplayEvent(500); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKey, EStdKeyHash, '#', 0, 1); + events << FepReplayEvent(EEventKeyUp, EStdKeyHash, 0, 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + events << FepReplayEvent('6', '6', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + events << FepReplayEvent(2000); + events << FepReplayEvent(EStdKeyDevice3, EKeyDevice3, 0, 0); // Select key + QTest::newRow("Multitap and numbers") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText) + << 0 + << QLineEdit::Normal + << events + << QString("H778wmt") + << QString(""); + QTest::newRow("T9 and numbers") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("hi778you") + << QString(""); + events.clear(); + + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent(EStdKeyDevice3, EKeyDevice3, 0, 0); // Select key + QTest::newRow("T9") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("hi") + << QString(""); + QTest::newRow("T9 with uppercase") + << true + << Qt::InputMethodHints(Qt::ImhPreferUppercase) + << 0 + << QLineEdit::Normal + << events + << QString("HI") + << QString(""); + QTest::newRow("T9 with forced lowercase") + << true + << Qt::InputMethodHints(Qt::ImhLowercaseOnly) + << 0 + << QLineEdit::Normal + << events + << QString("hi") + << QString(""); + QTest::newRow("T9 with forced uppercase") + << true + << Qt::InputMethodHints(Qt::ImhUppercaseOnly) + << 0 + << QLineEdit::Normal + << events + << QString("HI") + << QString(""); + QTest::newRow("T9 with maxlength") + << true + << Qt::InputMethodHints(Qt::ImhLowercaseOnly) + << 1 + << QLineEdit::Normal + << events + << QString("i") + << QString(""); + events.clear(); + + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent(EStdKeyLeftArrow, EKeyLeftArrow, 0, 0); + events << FepReplayEvent(EStdKeyLeftArrow, EKeyLeftArrow, 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + events << FepReplayEvent('6', '6', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + events << FepReplayEvent('0', '0', 0, 0); + events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); + events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + QTest::newRow("T9 with movement and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("you hi") + << QString("tv"); + QTest::newRow("T9 with movement, password and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Password + << events + << QString("wmt h") + << QString("u"); + QTest::newRow("T9 with movement, maxlength, password and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Password + << events + << QString("wh") + << QString(""); + QTest::newRow("T9 with movement, maxlength and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Normal + << events + << QString("hi") + << QString(""); + QTest::newRow("Multitap with movement and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("wmt h") + << QString("u"); + QTest::newRow("Multitap with movement, maxlength and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Normal + << events + << QString("wh") + << QString(""); + QTest::newRow("Numbers with movement") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Normal + << events + << QString("96804488") + << QString(""); + QTest::newRow("Numbers with movement and maxlength") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 2 + << QLineEdit::Normal + << events + << QString("44") + << QString(""); + QTest::newRow("Numbers with movement, password and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Password + << events + << QString("9680448") + << QString("8"); + QTest::newRow("Numbers with movement, maxlength, password and unfinished text") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 2 + << QLineEdit::Password + << events + << QString("44") + << QString(""); + events << FepReplayEvent(EStdKeyRightArrow, EKeyRightArrow, 0, 0); + QTest::newRow("T9 with movement") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("you htvi") + << QString(""); + QTest::newRow("T9 with movement and password") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Password + << events + << QString("wmt hu") + << QString(""); + QTest::newRow("T9 with movement, maxlength and password") + << true + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Password + << events + << QString("wh") + << QString(""); + QTest::newRow("Multitap with movement") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 0 + << QLineEdit::Normal + << events + << QString("wmt hu") + << QString(""); + QTest::newRow("Multitap with movement and maxlength") + << true + << Qt::InputMethodHints(Qt::ImhNoPredictiveText | Qt::ImhPreferLowercase) + << 2 + << QLineEdit::Normal + << events + << QString("wh") + << QString(""); + QTest::newRow("Numbers with movement and password") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Password + << events + << QString("96804488") + << QString(""); + QTest::newRow("Numbers with movement, maxlength and password") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 2 + << QLineEdit::Password + << events + << QString("44") + << QString(""); + events.clear(); + + // Test that the symbol key successfully does nothing when in number-only mode. + events << FepReplayEvent(EEventKeyDown, EStdKeyLeftFunc, 0, 0, 0); + events << FepReplayEvent(EEventKeyUp, EStdKeyLeftFunc, 0, 0, 0); + QTest::newRow("Dead symbols key") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Normal + << events + << QString("") + << QString(""); + QTest::newRow("Dead symbols key and password") + << true + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << 0 + << QLineEdit::Password + << events + << QString("") + << QString(""); + events.clear(); +#endif +} + +void tst_QInputContext::symbianTestCoeFepInputContext() +{ +#ifndef Q_OS_SYMBIAN + QSKIP("This is a Symbian-only test", SkipAll); +#else + QCoeFepInputContext *ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext()); + if (!ic) { + QSKIP("coefep is not the active input context; skipping test", SkipAll); + } + + QFETCH(bool, inputMethodEnabled); + QFETCH(Qt::InputMethodHints, inputMethodHints); + QFETCH(int, maxLength); + QFETCH(QLineEdit::EchoMode, echoMode); + QFETCH(QList<FepReplayEvent>, keyEvents); + QFETCH(QString, finalString); + QFETCH(QString, preeditString); + + if (inputMethodEnabled && m_phoneIsQwerty) { + QSKIP("Skipping advanced input method tests on QWERTY phones", SkipSingle); + } + + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *lineedit = new QLineEdit; + layout->addWidget(lineedit); + lineedit->setFocus(); +#ifdef QT_KEYPAD_NAVIGATION + lineedit->setEditFocus(true); +#endif + w.show(); + + lineedit->setAttribute(Qt::WA_InputMethodEnabled, inputMethodEnabled); + lineedit->setInputMethodHints(inputMethodHints); + if (maxLength > 0) + lineedit->setMaxLength(maxLength); + lineedit->setEchoMode(echoMode); + + QTest::qWait(200); + + foreach(FepReplayEvent event, keyEvents) { + event.replay(lineedit); + } + + QApplication::processEvents(); + + QCOMPARE(lineedit->text(), finalString); + QCOMPARE(ic->m_preeditString, preeditString); +#endif +} + +void tst_QInputContext::symbianTestCoeFepAutoCommit_data() +{ +#ifdef Q_OS_SYMBIAN + QTest::addColumn<Qt::InputMethodHints> ("inputMethodHints"); + QTest::addColumn<QLineEdit::EchoMode> ("echoMode"); + QTest::addColumn<QList<FepReplayEvent> > ("keyEvents"); + QTest::addColumn<QString> ("finalString"); + + QList<FepReplayEvent> events; + + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('4', '4', 0, 0); + events << FepReplayEvent('0', '0', 0, 0); + events << FepReplayEvent('9', '9', 0, 0); + events << FepReplayEvent('6', '6', 0, 0); + events << FepReplayEvent('8', '8', 0, 0); + QTest::newRow("Numbers") + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << QLineEdit::Normal + << events + << QString("440968"); + QTest::newRow("Numbers and password") + << Qt::InputMethodHints(Qt::ImhDigitsOnly) + << QLineEdit::Password + << events + << QString("440968"); + QTest::newRow("Multitap") + << Qt::InputMethodHints(Qt::ImhPreferLowercase | Qt::ImhNoPredictiveText) + << QLineEdit::Normal + << events + << QString("h wmt"); + QTest::newRow("T9") + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << QLineEdit::Normal + << events + << QString("hi you"); + QTest::newRow("Multitap with password") + << Qt::InputMethodHints(Qt::ImhPreferLowercase | Qt::ImhNoPredictiveText) + << QLineEdit::Password + << events + << QString("h wmt"); + QTest::newRow("T9 with password") + << Qt::InputMethodHints(Qt::ImhPreferLowercase) + << QLineEdit::Password + << events + << QString("h wmt"); +#endif +} + +void tst_QInputContext::symbianTestCoeFepAutoCommit() +{ +#ifndef Q_OS_SYMBIAN + QSKIP("This is a Symbian-only test", SkipAll); +#else + QCoeFepInputContext *ic = qobject_cast<QCoeFepInputContext *>(qApp->inputContext()); + if (!ic) { + QSKIP("coefep is not the active input context; skipping test", SkipAll); + } + + QFETCH(Qt::InputMethodHints, inputMethodHints); + QFETCH(QLineEdit::EchoMode, echoMode); + QFETCH(QList<FepReplayEvent>, keyEvents); + QFETCH(QString, finalString); + + if (m_phoneIsQwerty) { + QSKIP("Skipping advanced input method tests on QWERTY phones", SkipSingle); + } + + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *lineedit = new QLineEdit; + layout->addWidget(lineedit); + lineedit->setFocus(); +#ifdef QT_KEYPAD_NAVIGATION + lineedit->setEditFocus(true); +#endif + QPushButton *pushButton = new QPushButton("Done"); + layout->addWidget(pushButton); + QAction softkey("Done", &w); + softkey.setSoftKeyRole(QAction::PositiveSoftKey); + w.addAction(&softkey); + w.show(); + + lineedit->setInputMethodHints(inputMethodHints); + lineedit->setEchoMode(echoMode); + + QTest::qWait(200); + foreach(FepReplayEvent event, keyEvents) { + event.replay(lineedit); + } + QApplication::processEvents(); + + QTest::mouseClick(pushButton, Qt::LeftButton); + + QCOMPARE(lineedit->text(), finalString); + QVERIFY(ic->m_preeditString.isEmpty()); + +#ifdef Q_WS_S60 + lineedit->inputContext()->reset(); + lineedit->clear(); + lineedit->setFocus(); +#ifdef QT_KEYPAD_NAVIGATION + lineedit->setEditFocus(true); +#endif + + QTest::qWait(200); + foreach(FepReplayEvent event, keyEvents) { + event.replay(lineedit); + } + QApplication::processEvents(); + + FepReplayEvent(EStdKeyDevice0, EKeyDevice0, 0, 0).replay(lineedit); // Left softkey + + QCOMPARE(lineedit->text(), finalString); + QVERIFY(ic->m_preeditString.isEmpty()); + +#endif // Q_WS_S60 +#endif // Q_OS_SYMBIAN +} + QTEST_MAIN(tst_QInputContext) #include "tst_qinputcontext.moc" diff --git a/tests/auto/qkeysequence/tst_qkeysequence.cpp b/tests/auto/qkeysequence/tst_qkeysequence.cpp index 1faae6a..60f022f 100644 --- a/tests/auto/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/qkeysequence/tst_qkeysequence.cpp @@ -532,20 +532,20 @@ void tst_QKeySequence::translated_data() QTest::addColumn<QString>("transKey"); QTest::addColumn<QString>("compKey"); - QTest::newRow("Shift++") << QString(tr("Shift++")) << QString("Umschalt++"); - QTest::newRow("Ctrl++") << QString(tr("Ctrl++")) << QString("Strg++"); - QTest::newRow("Alt++") << QString(tr("Alt++")) << QString("Alt++"); - QTest::newRow("Meta++") << QString(tr("Meta++")) << QString("Meta++"); - - QTest::newRow("Shift+,, Shift++") << QString(tr("Shift+,, Shift++")) << QString("Umschalt+,, Umschalt++"); - QTest::newRow("Shift+,, Ctrl++") << QString(tr("Shift+,, Ctrl++")) << QString("Umschalt+,, Strg++"); - QTest::newRow("Shift+,, Alt++") << QString(tr("Shift+,, Alt++")) << QString("Umschalt+,, Alt++"); - QTest::newRow("Shift+,, Meta++") << QString(tr("Shift+,, Meta++")) << QString("Umschalt+,, Meta++"); - - QTest::newRow("Ctrl+,, Shift++") << QString(tr("Ctrl+,, Shift++")) << QString("Strg+,, Umschalt++"); - QTest::newRow("Ctrl+,, Ctrl++") << QString(tr("Ctrl+,, Ctrl++")) << QString("Strg+,, Strg++"); - QTest::newRow("Ctrl+,, Alt++") << QString(tr("Ctrl+,, Alt++")) << QString("Strg+,, Alt++"); - QTest::newRow("Ctrl+,, Meta++") << QString(tr("Ctrl+,, Meta++")) << QString("Strg+,, Meta++"); + QTest::newRow("Shift++") << tr("Shift++") << QString("Umschalt++"); + QTest::newRow("Ctrl++") << tr("Ctrl++") << QString("Strg++"); + QTest::newRow("Alt++") << tr("Alt++") << QString("Alt++"); + QTest::newRow("Meta++") << tr("Meta++") << QString("Meta++"); + + QTest::newRow("Shift+,, Shift++") << tr("Shift+,, Shift++") << QString("Umschalt+,, Umschalt++"); + QTest::newRow("Shift+,, Ctrl++") << tr("Shift+,, Ctrl++") << QString("Umschalt+,, Strg++"); + QTest::newRow("Shift+,, Alt++") << tr("Shift+,, Alt++") << QString("Umschalt+,, Alt++"); + QTest::newRow("Shift+,, Meta++") << tr("Shift+,, Meta++") << QString("Umschalt+,, Meta++"); + + QTest::newRow("Ctrl+,, Shift++") << tr("Ctrl+,, Shift++") << QString("Strg+,, Umschalt++"); + QTest::newRow("Ctrl+,, Ctrl++") << tr("Ctrl+,, Ctrl++") << QString("Strg+,, Strg++"); + QTest::newRow("Ctrl+,, Alt++") << tr("Ctrl+,, Alt++") << QString("Strg+,, Alt++"); + QTest::newRow("Ctrl+,, Meta++") << tr("Ctrl+,, Meta++") << QString("Strg+,, Meta++"); qApp->removeTranslator(ourTranslator); qApp->removeTranslator(qtTranslator); diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 717b32d..bfa9406 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -275,6 +275,7 @@ private slots: #endif void taskQTBUG_7395_readOnlyShortcut(); void QTBUG697_paletteCurrentColorGroup(); + void QTBUG13520_textNotVisible(); #ifdef QT3_SUPPORT void validateAndSet_data(); @@ -3034,6 +3035,8 @@ public: }; State state; + + friend class tst_QLineEdit; }; Q_DECLARE_METATYPE(LineEdit::State); @@ -3741,5 +3744,21 @@ void tst_QLineEdit::QTBUG697_paletteCurrentColorGroup() QCOMPARE(img.pixel(10, le.height()/2), QColor(Qt::red).rgb()); } +void tst_QLineEdit::QTBUG13520_textNotVisible() +{ + LineEdit le; + le.setAlignment( Qt::AlignRight | Qt::AlignVCenter);
+ le.show();
+ QTest::qWaitForWindowShown(&le);
+ le.setText("01-ST16-01SIL-MPL001wfgsdfgsdgsdfgsdfgsdfgsdfgsdfg");
+ le.setCursorPosition(0);
+ QTest::qWait(100); //just make sure we get he lineedit correcly painted
+
+ QVERIFY(le.cursorRect().center().x() < le.width() / 2);
+
+ +} + + QTEST_MAIN(tst_QLineEdit) #include "tst_qlineedit.moc" diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 6def23e..b035492 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -174,6 +174,10 @@ private slots: void reentrency(); void newFixedStaticScopeObject(); void newGrowingStaticScopeObject(); + void dateRoundtripJSQtJS(); + void dateRoundtripQtJSQt(); + void dateConversionJSQt(); + void dateConversionQtJS(); }; tst_QScriptEngine::tst_QScriptEngine() @@ -5067,6 +5071,68 @@ void tst_QScriptEngine::qRegExpInport() } } +// QScriptValue::toDateTime() returns a local time, whereas JS dates +// are always stored as UTC. QtScript must respect the current time +// zone, and correctly adjust for daylight saving time that may be in +// effect at a given date (QTBUG-9770). +void tst_QScriptEngine::dateRoundtripJSQtJS() +{ + uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t(); + QScriptEngine eng; + for (int i = 0; i < 8000; ++i) { + QScriptValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0)); + QDateTime qtDate = jsDate.toDateTime(); + QScriptValue jsDate2 = eng.newDate(qtDate); + if (jsDate2.toNumber() != jsDate.toNumber()) + QFAIL(qPrintable(jsDate.toString())); + secs += 2*60*60; + } +} + +void tst_QScriptEngine::dateRoundtripQtJSQt() +{ + QDateTime qtDate = QDateTime(QDate(2009, 1, 1)); + QScriptEngine eng; + for (int i = 0; i < 8000; ++i) { + QScriptValue jsDate = eng.newDate(qtDate); + QDateTime qtDate2 = jsDate.toDateTime(); + if (qtDate2 != qtDate) + QFAIL(qPrintable(qtDate.toString())); + qtDate = qtDate.addSecs(2*60*60); + } +} + +void tst_QScriptEngine::dateConversionJSQt() +{ + uint secs = QDateTime(QDate(2009, 1, 1)).toUTC().toTime_t(); + QScriptEngine eng; + for (int i = 0; i < 8000; ++i) { + QScriptValue jsDate = eng.evaluate(QString::fromLatin1("new Date(%0)").arg(secs * 1000.0)); + QDateTime qtDate = jsDate.toDateTime(); + QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); + QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString(); + jsUTCDateStr.chop(5); // get rid of milliseconds (".000Z") + if (qtUTCDateStr != jsUTCDateStr) + QFAIL(qPrintable(jsDate.toString())); + secs += 2*60*60; + } +} + +void tst_QScriptEngine::dateConversionQtJS() +{ + QDateTime qtDate = QDateTime(QDate(2009, 1, 1)); + QScriptEngine eng; + for (int i = 0; i < 8000; ++i) { + QScriptValue jsDate = eng.newDate(qtDate); + QString jsUTCDateStr = jsDate.property("toISOString").call(jsDate).toString(); + jsUTCDateStr.chop(5); // get rid of milliseconds (".000Z") + QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); + if (jsUTCDateStr != qtUTCDateStr) + QFAIL(qPrintable(qtDate.toString())); + qtDate = qtDate.addSecs(2*60*60); + } +} + static QScriptValue createAnotherEngine(QScriptContext *, QScriptEngine *) { QScriptEngine eng; diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index 6c1dd8f..d6a7a01 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -183,6 +183,7 @@ private slots: void ignoreSslErrorsListWithSlot(); void readFromClosedSocket(); void writeBigChunk(); + void setEmptyDefaultConfiguration(); static void exitLoop() { @@ -1835,6 +1836,21 @@ void tst_QSslSocket::writeBigChunk() socket->close(); } +void tst_QSslSocket::setEmptyDefaultConfiguration() +{ + // used to produce a crash in QSslConfigurationPrivate::deepCopyDefaultConfiguration, QTBUG-13265 + + if (!QSslSocket::supportsSsl()) + return; + + QSslConfiguration emptyConf; + QSslConfiguration::setDefaultConfiguration(emptyConf); + + QSslSocketPtr socket = newSocket(); + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + +} + #endif // QT_NO_OPENSSL QTEST_MAIN(tst_QSslSocket) diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 6498ae4..49d6633 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -73,6 +73,8 @@ private slots: void prepareToCorrectData(); void prepareToWrongData(); + void copyConstructor(); + void translatedPainter(); void rotatedPainter(); void scaledPainter(); @@ -107,6 +109,31 @@ void tst_QStaticText::constructionAndDestruction() QStaticText text("My text"); } +void tst_QStaticText::copyConstructor() +{ + QStaticText text(QLatin1String("My text")); + + QTextOption textOption(Qt::AlignRight); + text.setTextOption(textOption); + + text.setPerformanceHint(QStaticText::AggressiveCaching); + text.setTextWidth(123.456); + text.setTextFormat(Qt::PlainText); + + QStaticText copiedText(text); + copiedText.setText(QLatin1String("Other text")); + + QCOMPARE(copiedText.textOption().alignment(), Qt::AlignRight); + QCOMPARE(copiedText.performanceHint(), QStaticText::AggressiveCaching); + QCOMPARE(copiedText.textWidth(), 123.456); + QCOMPARE(copiedText.textFormat(), Qt::PlainText); + + QStaticText otherCopiedText(copiedText); + otherCopiedText.setTextWidth(789); + + QCOMPARE(otherCopiedText.text(), QString::fromLatin1("Other text")); +} + Q_DECLARE_METATYPE(QStaticText::PerformanceHint) void tst_QStaticText::drawToPoint_data() { diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 8d213ed..b651187 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -161,8 +161,9 @@ void tst_QTimer::singleShotTimeout() QCOMPARE(helper.count, 1); } -#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) -// Increase wait as emulator startup can cause unexpected delays +#if defined(Q_OS_SYMBIAN) +// Increase wait as emulator startup can cause unexpected delays, and +// on hardware there are sometimes spikes right after process startup. #define TIMEOUT_TIMEOUT 2000 #else #define TIMEOUT_TIMEOUT 200 diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index b2b28bd..8091607 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -196,6 +196,7 @@ private slots: void task_199967(); void task_240612(); void taskQTBUG_6962(); + void taskQTBUG_8701(); #ifdef QT3_SUPPORT void dirPath(); @@ -2276,7 +2277,9 @@ void tst_QUrl::ipv6() QCOMPARE(url.isValid(), isValid); if (url.isValid()) { - QCOMPARE(url.toString(), ipv6Auth); + QCOMPARE(url.toString(), ipv6Auth); + url.setHost(url.host()); + QCOMPARE(url.toString(), ipv6Auth); } }; @@ -2300,6 +2303,8 @@ void tst_QUrl::ipv6_2() QUrl url(input); QCOMPARE(url.toString(), output); + url.setHost(url.host()); + QCOMPARE(url.toString(), output); } void tst_QUrl::moreIpv6() @@ -3961,5 +3966,17 @@ void tst_QUrl::taskQTBUG_6962() QCOMPARE(url.authority(), QString()); } +void tst_QUrl::taskQTBUG_8701() +{ + //bug 8701: foo:///bar mangled to foo:/bar + QString foo_triple_bar("foo:///bar"), foo_uni_bar("foo:/bar"); + + QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar).toString()); + QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar).toString()); + + QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar, QUrl::StrictMode).toString()); // fails + QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString()); +} + QTEST_MAIN(tst_QUrl) #include "tst_qurl.moc" diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 04d047f..902c8ff 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -402,6 +402,8 @@ private slots: #endif // QT_MAC_USE_COCOA #endif + void nativeChildFocus(); + private: bool ensureScreenSize(int width, int height); QWidget *testWidget; @@ -10505,5 +10507,28 @@ void tst_QWidget::taskQTBUG_11373() #endif // QT_MAC_USE_COCOA #endif +void tst_QWidget::nativeChildFocus() +{ + QWidget w; + QLayout *layout = new QVBoxLayout; + w.setLayout(layout); + QLineEdit *p1 = new QLineEdit; + QLineEdit *p2 = new QLineEdit; + layout->addWidget(p1); + layout->addWidget(p2); + p1->setObjectName("p1"); + p2->setObjectName("p2"); + w.show(); + w.activateWindow(); + p1->setFocus(); + p1->setAttribute(Qt::WA_NativeWindow); + p2->setAttribute(Qt::WA_NativeWindow); + QApplication::processEvents(); + QTest::qWaitForWindowShown(&w); + + QCOMPARE(QApplication::activeWindow(), &w); + QCOMPARE(QApplication::focusWidget(), p1); +} + QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" |