diff options
5 files changed, 171 insertions, 4 deletions
diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 9a9d22b..d85b92a 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -86,6 +86,8 @@ private slots: void invalidSciFile(); void pendingRemoteRequest(); void pendingRemoteRequest_data(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: QDeclarativeEngine engine; @@ -380,6 +382,45 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest_data() QTest::newRow("sci file") << "http://localhost/none.sci"; } +void tst_qdeclarativeborderimage::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; BorderImage { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; BorderImage { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_qdeclarativeborderimage::testQtQuick11Attributes_data() +{ + QTest::addColumn<QString>("code"); + QTest::addColumn<QString>("warning"); + QTest::addColumn<QString>("error"); + + QTest::newRow("mirror") << "mirror: true" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"BorderImage.mirror\" is not available in QtQuick 1.0.\n"; + + QTest::newRow("cache") << "cache: true" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"BorderImage.cache\" is not available in QtQuick 1.0.\n"; +} + QTEST_MAIN(tst_qdeclarativeborderimage) #include "tst_qdeclarativeborderimage.moc" diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 6365ce5..40e533d 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -87,6 +87,8 @@ private slots: void test_flow_implicit_resize(); void test_conflictinganchors(); void test_vertical_qgraphicswidget(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); private: QDeclarativeView *createView(const QString &filename); }; @@ -1070,7 +1072,7 @@ void interceptWarnings(QtMsgType type, const char *msg) void tst_QDeclarativePositioners::test_conflictinganchors() { - qInstallMsgHandler(interceptWarnings); + QtMsgHandler oldMsgHandler = qInstallMsgHandler(interceptWarnings); QDeclarativeEngine engine; QDeclarativeComponent component(&engine); @@ -1151,6 +1153,7 @@ void tst_QDeclarativePositioners::test_conflictinganchors() item = qobject_cast<QDeclarativeItem*>(component.create()); QVERIFY(item); QCOMPARE(warningMessage, QString("file::2:1: QML Flow: Cannot specify anchors for items inside Flow")); + qInstallMsgHandler(oldMsgHandler); } void tst_QDeclarativePositioners::test_vertical_qgraphicswidget() @@ -1195,6 +1198,49 @@ void tst_QDeclarativePositioners::test_vertical_qgraphicswidget() delete canvas; } +void tst_QDeclarativePositioners::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; " + code.toUtf8(), QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; " + code.toUtf8(), QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_QDeclarativePositioners::testQtQuick11Attributes_data() +{ + QTest::addColumn<QString>("code"); + QTest::addColumn<QString>("warning"); + QTest::addColumn<QString>("error"); + + QTest::newRow("Flow.layoutDirection") << "Flow { layoutDirection: Qt.LeftToRight }" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Flow.layoutDirection\" is not available in QtQuick 1.0.\n"; + + QTest::newRow("Row.layoutDirection") << "Row { layoutDirection: Qt.LeftToRight }" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Row.layoutDirection\" is not available in QtQuick 1.0.\n"; + + QTest::newRow("Grid.layoutDirection") << "Grid { layoutDirection: Qt.LeftToRight }" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Grid.layoutDirection\" is not available in QtQuick 1.0.\n"; +} + QDeclarativeView *tst_QDeclarativePositioners::createView(const QString &filename) { QDeclarativeView *canvas = new QDeclarativeView(0); diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 8111cd2..320a6e7 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -470,6 +470,8 @@ void tst_qdeclarativetext::alignments() QCOMPARE(actual,expect); } #endif + + delete canvas; } //the alignment tests may be trivial o.oa @@ -962,6 +964,8 @@ void tst_qdeclarativetext::QTBUG_12291() QDeclarativeText *text = ob->findChild<QDeclarativeText*>("text"); QVERIFY(text); QVERIFY(text->boundingRect().isValid()); + + delete canvas; } class EventSender : public QGraphicsItem @@ -1054,6 +1058,8 @@ void tst_qdeclarativetext::embeddedImages() QCOMPARE(textObject->width(), 16.0); // default size of QTextDocument broken image icon QCOMPARE(textObject->height(), 16.0); } + + delete textObject; } void tst_qdeclarativetext::lineCount() @@ -1081,6 +1087,8 @@ void tst_qdeclarativetext::lineCount() QCOMPARE(myText->lineCount(), 2); QCOMPARE(myText->truncated(), true); QCOMPARE(myText->maximumLineCount(), 2); + + delete canvas; } void tst_qdeclarativetext::lineHeight() @@ -1112,6 +1120,8 @@ void tst_qdeclarativetext::lineHeight() myText->setLineHeightMode(QDeclarativeText::PixelHeight); myText->setLineHeight(10); QCOMPARE(myText->height(), myText->lineCount() * 10.0); + + delete canvas; } void tst_qdeclarativetext::implicitSize_data() @@ -1175,9 +1185,21 @@ void tst_qdeclarativetext::testQtQuick11Attributes_data() << "QDeclarativeComponent: Component is not ready" << ":1 \"Text.maximumLineCount\" is not available in QtQuick 1.0.\n"; - QTest::newRow("truncated") << "property int foo: lineCount" + QTest::newRow("lineHeight") << "lineHeight: 2" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Text.lineHeight\" is not available in QtQuick 1.0.\n"; + + QTest::newRow("lineHeightMode") << "lineHeightMode: Text.MultiplyHeight" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"Text.lineHeightMode\" is not available in QtQuick 1.0.\n"; + + QTest::newRow("lineCount") << "property int foo: lineCount" << "<Unknown File>:1: ReferenceError: Can't find variable: lineCount" << ""; + + QTest::newRow("truncated") << "property bool foo: truncated" + << "<Unknown File>:1: ReferenceError: Can't find variable: truncated" + << ""; } QTEST_MAIN(tst_qdeclarativetext) diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index b1e0cb9..1364337 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -1513,14 +1513,14 @@ void tst_qdeclarativetextedit::testQtQuick11Attributes() QObject *obj; QDeclarativeComponent valid(&engine); - valid.setData("import QtQuick 1.1; Text { " + code.toUtf8() + " }", QUrl("")); + valid.setData("import QtQuick 1.1; TextEdit { " + code.toUtf8() + " }", QUrl("")); obj = valid.create(); QVERIFY(obj); QVERIFY(valid.errorString().isEmpty()); delete obj; QDeclarativeComponent invalid(&engine); - invalid.setData("import QtQuick 1.0; Text { " + code.toUtf8() + " }", QUrl("")); + invalid.setData("import QtQuick 1.0; TextEdit { " + code.toUtf8() + " }", QUrl("")); QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); obj = invalid.create(); QCOMPARE(invalid.errorString(), error); @@ -1540,6 +1540,18 @@ void tst_qdeclarativetextedit::testQtQuick11Attributes_data() QTest::newRow("lineCount") << "property int foo: lineCount" << "<Unknown File>:1: ReferenceError: Can't find variable: lineCount" << ""; + + QTest::newRow("moveCursorSelection") << "Component.onCompleted: moveCursorSelection(0, TextEdit.SelectCharacters)" + << "<Unknown File>:1: ReferenceError: Can't find variable: moveCursorSelection" + << ""; + + QTest::newRow("deselect") << "Component.onCompleted: deselect()" + << "<Unknown File>:1: ReferenceError: Can't find variable: deselect" + << ""; + + QTest::newRow("onLinkActivated") << "onLinkActivated: {}" + << "QDeclarativeComponent: Component is not ready" + << ":1 \"TextEdit.onLinkActivated\" is not available in QtQuick 1.0.\n"; } QTEST_MAIN(tst_qdeclarativetextedit) diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 78f6693..7cdec27 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -117,6 +117,9 @@ private slots: void echoMode(); void geometrySignals(); + void testQtQuick11Attributes(); + void testQtQuick11Attributes_data(); + private: void simulateKey(QDeclarativeView *, int key); QDeclarativeView *createView(const QString &filename); @@ -1434,6 +1437,49 @@ void tst_qdeclarativetextinput::geometrySignals() delete o; } +void tst_qdeclarativetextinput::testQtQuick11Attributes() +{ + QFETCH(QString, code); + QFETCH(QString, warning); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QObject *obj; + + QDeclarativeComponent valid(&engine); + valid.setData("import QtQuick 1.1; TextInput { " + code.toUtf8() + " }", QUrl("")); + obj = valid.create(); + QVERIFY(obj); + QVERIFY(valid.errorString().isEmpty()); + delete obj; + + QDeclarativeComponent invalid(&engine); + invalid.setData("import QtQuick 1.0; TextInput { " + code.toUtf8() + " }", QUrl("")); + QTest::ignoreMessage(QtWarningMsg, warning.toUtf8()); + obj = invalid.create(); + QCOMPARE(invalid.errorString(), error); + delete obj; +} + +void tst_qdeclarativetextinput::testQtQuick11Attributes_data() +{ + QTest::addColumn<QString>("code"); + QTest::addColumn<QString>("warning"); + QTest::addColumn<QString>("error"); + + QTest::newRow("canPaste") << "property bool foo: canPaste" + << "<Unknown File>:1: ReferenceError: Can't find variable: canPaste" + << ""; + + QTest::newRow("moveCursorSelection") << "Component.onCompleted: moveCursorSelection(0, TextEdit.SelectCharacters)" + << "<Unknown File>:1: ReferenceError: Can't find variable: moveCursorSelection" + << ""; + + QTest::newRow("deselect") << "Component.onCompleted: deselect()" + << "<Unknown File>:1: ReferenceError: Can't find variable: deselect" + << ""; +} + QTEST_MAIN(tst_qdeclarativetextinput) #include "tst_qdeclarativetextinput.moc" |