diff options
Diffstat (limited to 'tests')
9 files changed, 89 insertions, 155 deletions
diff --git a/tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt b/tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt index daa9c2b4..5dd9860c 100644 --- a/tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt +++ b/tests/auto/bic/data/QtDeclarative.5.0.0.linux-gcc-ia32.txt @@ -4203,157 +4203,6 @@ QAccessibleTableModelChangeEvent (0xb3963ca8) 0 QAccessibleEvent (0xb388eab8) 0 primary-for QAccessibleTableModelChangeEvent (0xb3963ca8) -Vtable for QAccessibleTextInterface -QAccessibleTextInterface::_ZTV24QAccessibleTextInterface: 20u entries -0 (int (*)(...))0 -4 (int (*)(...))(& _ZTI24QAccessibleTextInterface) -8 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface -12 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface -16 (int (*)(...))__cxa_pure_virtual -20 (int (*)(...))__cxa_pure_virtual -24 (int (*)(...))__cxa_pure_virtual -28 (int (*)(...))__cxa_pure_virtual -32 (int (*)(...))__cxa_pure_virtual -36 (int (*)(...))__cxa_pure_virtual -40 (int (*)(...))__cxa_pure_virtual -44 (int (*)(...))__cxa_pure_virtual -48 (int (*)(...))QAccessibleTextInterface::textBeforeOffset -52 (int (*)(...))QAccessibleTextInterface::textAfterOffset -56 (int (*)(...))QAccessibleTextInterface::textAtOffset -60 (int (*)(...))__cxa_pure_virtual -64 (int (*)(...))__cxa_pure_virtual -68 (int (*)(...))__cxa_pure_virtual -72 (int (*)(...))__cxa_pure_virtual -76 (int (*)(...))__cxa_pure_virtual - -Class QAccessibleTextInterface - size=4 align=4 - base size=4 base align=4 -QAccessibleTextInterface (0xb38a10a8) 0 nearly-empty - vptr=((& QAccessibleTextInterface::_ZTV24QAccessibleTextInterface) + 8u) - -Vtable for QAccessibleEditableTextInterface -QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface: 7u entries -0 (int (*)(...))0 -4 (int (*)(...))(& _ZTI32QAccessibleEditableTextInterface) -8 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface -12 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface -16 (int (*)(...))__cxa_pure_virtual -20 (int (*)(...))__cxa_pure_virtual -24 (int (*)(...))__cxa_pure_virtual - -Class QAccessibleEditableTextInterface - size=4 align=4 - base size=4 base align=4 -QAccessibleEditableTextInterface (0xb38a1310) 0 nearly-empty - vptr=((& QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface) + 8u) - -Vtable for QAccessibleValueInterface -QAccessibleValueInterface::_ZTV25QAccessibleValueInterface: 9u entries -0 (int (*)(...))0 -4 (int (*)(...))(& _ZTI25QAccessibleValueInterface) -8 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface -12 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface -16 (int (*)(...))__cxa_pure_virtual -20 (int (*)(...))__cxa_pure_virtual -24 (int (*)(...))__cxa_pure_virtual -28 (int (*)(...))__cxa_pure_virtual -32 (int (*)(...))__cxa_pure_virtual - -Class QAccessibleValueInterface - size=4 align=4 - base size=4 base align=4 -QAccessibleValueInterface (0xb38a1578) 0 nearly-empty - vptr=((& QAccessibleValueInterface::_ZTV25QAccessibleValueInterface) + 8u) - -Vtable for QAccessibleTableCellInterface -QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface: 13u entries -0 (int (*)(...))0 -4 (int (*)(...))(& _ZTI29QAccessibleTableCellInterface) -8 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface -12 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface -16 (int (*)(...))__cxa_pure_virtual -20 (int (*)(...))__cxa_pure_virtual -24 (int (*)(...))__cxa_pure_virtual -28 (int (*)(...))__cxa_pure_virtual -32 (int (*)(...))__cxa_pure_virtual -36 (int (*)(...))__cxa_pure_virtual -40 (int (*)(...))__cxa_pure_virtual -44 (int (*)(...))__cxa_pure_virtual -48 (int (*)(...))__cxa_pure_virtual - -Class QAccessibleTableCellInterface - size=4 align=4 - base size=4 base align=4 -QAccessibleTableCellInterface (0xb38a17e0) 0 nearly-empty - vptr=((& QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface) + 8u) - -Vtable for QAccessibleTableInterface -QAccessibleTableInterface::_ZTV25QAccessibleTableInterface: 23u entries -0 (int (*)(...))0 -4 (int (*)(...))(& _ZTI25QAccessibleTableInterface) -8 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface -12 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface -16 (int (*)(...))__cxa_pure_virtual -20 (int (*)(...))__cxa_pure_virtual -24 (int (*)(...))__cxa_pure_virtual -28 (int (*)(...))__cxa_pure_virtual -32 (int (*)(...))__cxa_pure_virtual -36 (int (*)(...))__cxa_pure_virtual -40 (int (*)(...))__cxa_pure_virtual -44 (int (*)(...))__cxa_pure_virtual -48 (int (*)(...))__cxa_pure_virtual -52 (int (*)(...))__cxa_pure_virtual -56 (int (*)(...))__cxa_pure_virtual -60 (int (*)(...))__cxa_pure_virtual -64 (int (*)(...))__cxa_pure_virtual -68 (int (*)(...))__cxa_pure_virtual -72 (int (*)(...))__cxa_pure_virtual -76 (int (*)(...))__cxa_pure_virtual -80 (int (*)(...))__cxa_pure_virtual -84 (int (*)(...))__cxa_pure_virtual -88 (int (*)(...))__cxa_pure_virtual - -Class QAccessibleTableInterface - size=4 align=4 - base size=4 base align=4 -QAccessibleTableInterface (0xb38a1a48) 0 nearly-empty - vptr=((& QAccessibleTableInterface::_ZTV25QAccessibleTableInterface) + 8u) - -Vtable for QAccessibleActionInterface -QAccessibleActionInterface::_ZTV26QAccessibleActionInterface: 9u entries -0 (int (*)(...))0 -4 (int (*)(...))(& _ZTI26QAccessibleActionInterface) -8 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface -12 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface -16 (int (*)(...))__cxa_pure_virtual -20 (int (*)(...))QAccessibleActionInterface::localizedActionName -24 (int (*)(...))QAccessibleActionInterface::localizedActionDescription -28 (int (*)(...))__cxa_pure_virtual -32 (int (*)(...))__cxa_pure_virtual - -Class QAccessibleActionInterface - size=4 align=4 - base size=4 base align=4 -QAccessibleActionInterface (0xb38a1cb0) 0 nearly-empty - vptr=((& QAccessibleActionInterface::_ZTV26QAccessibleActionInterface) + 8u) - -Vtable for QAccessibleImageInterface -QAccessibleImageInterface::_ZTV25QAccessibleImageInterface: 7u entries -0 (int (*)(...))0 -4 (int (*)(...))(& _ZTI25QAccessibleImageInterface) -8 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface -12 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface -16 (int (*)(...))__cxa_pure_virtual -20 (int (*)(...))__cxa_pure_virtual -24 (int (*)(...))__cxa_pure_virtual - -Class QAccessibleImageInterface - size=4 align=4 - base size=4 base align=4 -QAccessibleImageInterface (0xb38a1118) 0 nearly-empty - vptr=((& QAccessibleImageInterface::_ZTV25QAccessibleImageInterface) + 8u) - Vtable for QAccessibleBridge QAccessibleBridge::_ZTV17QAccessibleBridge: 6u entries 0 (int (*)(...))0 diff --git a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h index 57d8a3d2..a08d9b55 100644 --- a/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h +++ b/tests/auto/declarative/qdeclarativedebughelper/private_headers/qdeclarativedebughelper_p.h @@ -44,8 +44,6 @@ #include <QtCore/qglobal.h> -QT_BEGIN_HEADER - QT_BEGIN_NAMESPACE class QScriptEngine; @@ -66,6 +64,4 @@ public: QT_END_NAMESPACE -QT_END_HEADER - #endif // QDECLARATIVEDEBUGHELPER_P_H diff --git a/tests/auto/declarative/qdeclarativelanguage/data/LocalLast2.qml b/tests/auto/declarative/qdeclarativelanguage/data/LocalLast2.qml new file mode 100644 index 00000000..4bf7eb2e --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/LocalLast2.qml @@ -0,0 +1,2 @@ +import QtQuick 1.0 +MouseArea {} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/MyComponentType.qml b/tests/auto/declarative/qdeclarativelanguage/data/MyComponentType.qml new file mode 100644 index 00000000..9ba0d612 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/MyComponentType.qml @@ -0,0 +1,5 @@ +import QtQuick 1.0 + +Item { + property int test: 11 +} diff --git a/tests/auto/declarative/qdeclarativelanguage/data/localOrderTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/localOrderTest.qml new file mode 100644 index 00000000..d3b31a3d --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/localOrderTest.qml @@ -0,0 +1,7 @@ +import QtQuick 1.0 +import org.qtproject.installedtest 1.0 + +LocalLast2 { + property Item item: LocalLast {} +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/data/qmlComponentType.qml b/tests/auto/declarative/qdeclarativelanguage/data/qmlComponentType.qml new file mode 100644 index 00000000..532bc319 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/qmlComponentType.qml @@ -0,0 +1,4 @@ +import QtQuick 1.0 +import Test 1.0 + +MyComponentType {} diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp index ee01235b..f812110d 100644 --- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -69,7 +69,9 @@ void registerTypes() qmlRegisterCustomType<MyCustomParserType>("Test", 1, 0, "MyCustomParserType", new MyCustomParserTypeParser); +#ifdef QT_BUILD_INTERNAL qmlRegisterTypeNotAvailable("Test",1,0,"UnavailableType", "UnavailableType is unavailable for testing"); +#endif } QVariant myCustomVariantTypeConverter(const QString &data) diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index b37873b2..1574aa4a 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -99,6 +99,7 @@ private slots: void assignLiteralToVariant(); void customParserTypes(); void rootAsQmlComponent(); + void qmlComponentType(); void inlineQmlComponents(); void idProperty(); void autoNotifyConnection(); @@ -132,6 +133,7 @@ private slots: void reservedWords(); void inlineAssignmentsOverrideBindings(); void nestedComponentRoots(); + void implicitImportsLast(); void basicRemote_data(); void basicRemote(); @@ -403,7 +405,9 @@ void tst_qdeclarativelanguage::errors_data() 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; +#ifdef QT_BUILD_INTERNAL QTest::newRow("notAvailable") << "notAvailable.qml" << "notAvailable.errors.txt" << false; +#endif QTest::newRow("singularProperty") << "singularProperty.qml" << "singularProperty.errors.txt" << false; QTest::newRow("singularProperty.2") << "singularProperty.2.qml" << "singularProperty.2.errors.txt" << false; QTest::newRow("incorrectCase") << "incorrectCase.qml" @@ -627,6 +631,16 @@ void tst_qdeclarativelanguage::rootAsQmlComponent() QCOMPARE(object->getChildren()->count(), 2); } +// Tests that types can be specified from a QML only component +void tst_qdeclarativelanguage::qmlComponentType() +{ + QDeclarativeComponent component(&engine, testFileUrl("qmlComponentType.qml")); + VERIFY_ERRORS(0); + QObject *object = qobject_cast<QObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->property("test"), QVariant(11)); +} + // Tests that components can be specified inline void tst_qdeclarativelanguage::inlineQmlComponents() { @@ -1806,6 +1820,11 @@ void tst_qdeclarativelanguage::importsOrder_data() "LocalLast {}" << (!qmlCheckTypes()?"QDeclarativeRectangle":"")// i.e. from org.qtproject.installedtest, not data/LocalLast.qml << (!qmlCheckTypes()?"":"LocalLast is ambiguous. Found in lib/org/qtproject/installedtest and in local directory"); + QTest::newRow("local last 3") << + "import org.qtproject.installedtest 1.0\n" + "LocalLast {LocalLast2{}}" + << (!qmlCheckTypes()?"QDeclarativeRectangle":"")// i.e. from org.qtproject.installedtest, not data/LocalLast.qml + << (!qmlCheckTypes()?"":"LocalLast is ambiguous. Found in lib/org/qtproject/installedtest and in local directory"); } void tst_qdeclarativelanguage::importsOrder() @@ -1959,6 +1978,8 @@ void tst_qdeclarativelanguage::initTestCase() { QDeclarativeDataTest::initTestCase(); registerTypes(); + // Registered here because it uses testFileUrl + qmlRegisterType(testFileUrl("MyComponentType.qml"), "Test", 1, 0, "MyComponentType"); // Registering the TestType class in other modules should have no adverse effects qmlRegisterType<TestType>("org.qtproject.TestPre", 1, 0, "Test"); @@ -2021,6 +2042,23 @@ void tst_qdeclarativelanguage::compatibilitySemicolon() QVERIFY(o != 0); } +// Tests that the implicit import has lowest precedence, in the case where +// there are conflicting types and types only found in the local import. +// Tests that just check one (or the root) type are in ::importsOrder +void tst_qdeclarativelanguage::implicitImportsLast() +{ + if (qmlCheckTypes()) + QSKIP("This test is about maintaining the same choice when type is ambiguous."); + QDeclarativeComponent component(&engine, testFileUrl("localOrderTest.qml")); + VERIFY_ERRORS(0); + QObject *object = qobject_cast<QObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(QString(object->metaObject()->className()).startsWith(QLatin1String("QDeclarativeMouseArea"))); + QObject* object2 = object->property("item").value<QObject*>(); + QVERIFY(object2 != 0); + QCOMPARE(QString(object2->metaObject()->className()), QLatin1String("QDeclarativeRectangle")); +} + QTEST_MAIN(tst_qdeclarativelanguage) #include "tst_qdeclarativelanguage.moc" diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 5c00ac95..eb0e0948 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -85,6 +85,7 @@ private slots: void enforceRange(); void spacing(); void sections(); + void currentSection(); void sectionsDelegate(); void cacheBuffer(); void positionViewAtIndex(); @@ -1049,6 +1050,36 @@ void tst_QDeclarativeListView::sections() delete canvas; } +void tst_QDeclarativeListView::currentSection() +{ + // QTBUG-29712 + // update currentSection correctly if model modifications + // do not trigger a refill + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 5; i++) + model.addItem("Item" + QString::number(i), QString::number(i)); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + // make sure the listView won't trigger refill when removing the first row + QTRY_VERIFY(listview->height() > model.count() * 40); + + QTRY_COMPARE(listview->currentSection(), QString("0")); + model.removeItem(0); + QTRY_COMPARE(listview->currentSection(), QString("1")); + + delete canvas; +} + void tst_QDeclarativeListView::sectionsDelegate() { QDeclarativeView *canvas = createView(); |