diff options
Diffstat (limited to 'tests/auto')
22 files changed, 422 insertions, 49 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml index a883e85..1655905 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/compiled.qml @@ -31,6 +31,8 @@ QtObject { property string test21: g property string test22: h property bool test23: i + property color test24: j + property color test25: k property real a: 4.5 property real b: 11.2 @@ -41,4 +43,6 @@ QtObject { property variant g: 6.7 property variant h: "!" property variant i: true + property string j: "#112233" + property string k: "#aa112233" } diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 9a88237..9a8ad64 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -2090,6 +2090,8 @@ void tst_qdeclarativeecmascript::compiled() QCOMPARE(object->property("test21").toString(), QLatin1String("6.7")); QCOMPARE(object->property("test22").toString(), QLatin1String("!")); QCOMPARE(object->property("test23").toBool(), true); + QCOMPARE(qvariant_cast<QColor>(object->property("test24")), QColor(0x11,0x22,0x33)); + QCOMPARE(qvariant_cast<QColor>(object->property("test25")), QColor(0x11,0x22,0x33,0xAA)); delete object; } @@ -2102,20 +2104,21 @@ void tst_qdeclarativeecmascript::numberAssignment() QObject *object = component.create(); QVERIFY(object != 0); - QVERIFY(object->property("test1") == QVariant((qreal)6.7)); - QVERIFY(object->property("test2") == QVariant((qreal)6.7)); - QVERIFY(object->property("test3") == QVariant((qreal)6)); - QVERIFY(object->property("test4") == QVariant((qreal)6)); + QCOMPARE(object->property("test1"), QVariant((qreal)6.7)); + QCOMPARE(object->property("test2"), QVariant((qreal)6.7)); + QCOMPARE(object->property("test2"), QVariant((qreal)6.7)); + QCOMPARE(object->property("test3"), QVariant((qreal)6)); + QCOMPARE(object->property("test4"), QVariant((qreal)6)); - QVERIFY(object->property("test5") == QVariant((int)7)); - QVERIFY(object->property("test6") == QVariant((int)7)); - QVERIFY(object->property("test7") == QVariant((int)6)); - QVERIFY(object->property("test8") == QVariant((int)6)); + QCOMPARE(object->property("test5"), QVariant((int)7)); + QCOMPARE(object->property("test6"), QVariant((int)7)); + QCOMPARE(object->property("test7"), QVariant((int)6)); + QCOMPARE(object->property("test8"), QVariant((int)6)); - QVERIFY(object->property("test9") == QVariant((unsigned int)7)); - QVERIFY(object->property("test10") == QVariant((unsigned int)7)); - QVERIFY(object->property("test11") == QVariant((unsigned int)6)); - QVERIFY(object->property("test12") == QVariant((unsigned int)6)); + QCOMPARE(object->property("test9"), QVariant((unsigned int)7)); + QCOMPARE(object->property("test10"), QVariant((unsigned int)7)); + QCOMPARE(object->property("test11"), QVariant((unsigned int)6)); + QCOMPARE(object->property("test12"), QVariant((unsigned int)6)); delete object; } @@ -2427,7 +2430,6 @@ void tst_qdeclarativeecmascript::include() // Including file with ".pragma library" { QDeclarativeComponent component(&engine, TEST_FILE("include_pragma.qml")); - qDebug() << "errors:" << component.errorsString(); QObject *o = component.create(); QVERIFY(o != 0); QCOMPARE(o->property("test1").toInt(), 100); diff --git a/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml new file mode 100644 index 0000000..510fcc5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/manual-highlight.qml @@ -0,0 +1,48 @@ +import Qt 4.7 + +Item { + + ListModel { + id: model + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + ListElement { + name: "Bob Brown" + number: "555 5845" + } + } + + Component { + id: highlight + Rectangle { + objectName: "highlight" + width: 80; height: 80 + color: "lightsteelblue"; radius: 5 + y: grid.currentItem.y + x: grid.currentItem.x + } + } + + GridView { + id: grid + objectName: "grid" + anchors.fill: parent + model: model + delegate: Text { objectName: "wrapper"; text: name; width: 80; height: 80 } + + highlight: highlight + highlightFollowsCurrentItem: false + focus: true + } + +} diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 89be151..2db3ee6 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -75,6 +75,7 @@ private slots: void resetModel(); void enforceRange(); void QTBUG_8456(); + void manualHighlight(); private: QDeclarativeView *createView(); @@ -1107,6 +1108,35 @@ void tst_QDeclarativeGridView::QTBUG_8456() QTRY_COMPARE(gridview->currentIndex(), 0); } +void tst_QDeclarativeGridView::manualHighlight() +{ + QDeclarativeView *canvas = createView(); + + QString filename(SRCDIR "/data/manual-highlight.qml"); + canvas->setSource(QUrl::fromLocalFile(filename)); + + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QTRY_VERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QTRY_VERIFY(viewport != 0); + + QTRY_COMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0)); + QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x()); + + gridview->setCurrentIndex(2); + + QTRY_COMPARE(gridview->currentIndex(), 2); + QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 2)); + QTRY_COMPARE(gridview->highlightItem()->y(), gridview->currentItem()->y()); + QTRY_COMPARE(gridview->highlightItem()->x(), gridview->currentItem()->x()); +} + + QDeclarativeView *tst_QDeclarativeGridView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp index 9ae26f2..1e88255 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -534,7 +534,6 @@ void tst_qdeclarativeinstruction::dump() << "-------------------------------------------------------------------------------" << "0\t\t0\tINIT\t\t\t0\t3\t-1\t-1" << "1\t\t1\tCREATE\t\t\t0\t\t\t\"Test\"" - << "1\t\t1\tCREATE_SIMPLE\t\t-1" << "2\t\t2\tSETID\t\t\t0\t\t\t\"testId\"" << "3\t\t3\tSET_DEFAULT" << "4\t\t4\tCREATE_COMPONENT\t3" diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml new file mode 100644 index 0000000..df3de20 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.2.qml @@ -0,0 +1,11 @@ +import Qt 4.7 +import Qt 4.7 as Qt47 + +Qt.QtObject { + property Qt47.QtObject objectProperty + property list<Qt47.QtObject> objectPropertyList + + objectProperty: QtObject {} + objectPropertyList: QtObject {} +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index 200f016..011870c 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -683,6 +683,7 @@ void tst_qdeclarativelanguage::listProperties() // ### Not complete void tst_qdeclarativelanguage::dynamicObjectProperties() { + { QDeclarativeComponent component(&engine, TEST_FILE("dynamicObjectProperties.qml")); VERIFY_ERRORS(0); QObject *object = component.create(); @@ -690,6 +691,16 @@ void tst_qdeclarativelanguage::dynamicObjectProperties() QVERIFY(object->property("objectProperty") == qVariantFromValue((QObject*)0)); QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0)); + } + { + QDeclarativeComponent component(&engine, TEST_FILE("dynamicObjectProperties.2.qml")); + QEXPECT_FAIL("", "QTBUG-10822", Abort); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(object->property("objectProperty") != qVariantFromValue((QObject*)0)); + } } // Tests the declaration of dynamic signals and slots diff --git a/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml new file mode 100644 index 0000000..4913ebe --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/manual-highlight.qml @@ -0,0 +1,47 @@ +import Qt 4.7 + +Item { + + ListModel { + id: model + ListElement { + name: "Bill Smith" + number: "555 3264" + } + ListElement { + name: "John Brown" + number: "555 8426" + } + ListElement { + name: "Sam Wise" + number: "555 0473" + } + ListElement { + name: "Bob Brown" + number: "555 5845" + } + } + + Component { + id: highlight + Rectangle { + objectName: "highlight" + width: 180; height: 20 + color: "lightsteelblue"; radius: 5 + y: list.currentItem.y + } + } + + ListView { + id: list + objectName: "list" + anchors.fill: parent + model: model + delegate: Text { objectName: "wrapper"; text: name } + + highlight: highlight + highlightFollowsCurrentItem: false + focus: true + } + +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index fde2e43..203760e 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -90,6 +90,7 @@ private slots: void componentChanges(); void modelChanges(); void QTBUG_9791(); + void manualHighlight(); private: template <class T> void items(); @@ -1463,6 +1464,34 @@ void tst_QDeclarativeListView::QTBUG_9791() delete canvas; } +void tst_QDeclarativeListView::manualHighlight() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + QDeclarativeContext *ctxt = canvas->rootContext(); + + QString filename(SRCDIR "/data/manual-highlight.qml"); + canvas->setSource(QUrl::fromLocalFile(filename)); + + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QTRY_VERIFY(viewport != 0); + + QTRY_COMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0)); + QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); + + listview->setCurrentIndex(2); + + QTRY_COMPARE(listview->currentIndex(), 2); + QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 2)); + QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); +} void tst_QDeclarativeListView::qListModelInterface_items() { diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml new file mode 100644 index 0000000..f1cf86c --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_default.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +TextEdit { + focus: true + text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + selectByMouse: false +} diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml new file mode 100644 index 0000000..f1cf86c --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_false.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +TextEdit { + focus: true + text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + selectByMouse: false +} diff --git a/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml new file mode 100644 index 0000000..90383b9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextedit/data/mouseselection_true.qml @@ -0,0 +1,7 @@ +import Qt 4.7 + +TextEdit { + focus: true + text: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" + selectByMouse: true +} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml new file mode 100644 index 0000000..a66e9d6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.5.qml @@ -0,0 +1,10 @@ +import Test 1.0 +import Qt 4.7 as MyQt + +MyTypeObject { + MyQt.Component.onCompleted: { + font.capitalization = MyQt.Font.AllUppercase + } +} + + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h index 1da9990..7ed3993 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -99,7 +99,7 @@ public: m_font.setOverline(true); m_font.setStrikeOut(true); m_font.setPointSize(29); - m_font.setCapitalization(QFont::AllUppercase); + m_font.setCapitalization(QFont::AllLowercase); m_font.setLetterSpacing(QFont::AbsoluteSpacing, 10.2); m_font.setWordSpacing(19.7); } diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp index 95b9baa..53fd68c 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -838,6 +838,14 @@ void tst_qdeclarativevaluetypes::enums() QVERIFY(object->font().capitalization() == QFont::AllUppercase); delete object; } + + { + QDeclarativeComponent component(&engine, TEST_FILE("enums.5.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->font().capitalization() == QFont::AllUppercase); + delete object; + } } // Tests switching between "conflicting" bindings (eg. a binding on the core diff --git a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp index dd2f46e..b183105 100644 --- a/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp +++ b/tests/auto/declarative/qdeclarativeview/tst_qdeclarativeview.cpp @@ -45,6 +45,7 @@ #include <QtDeclarative/qdeclarativeview.h> #include <QtDeclarative/qdeclarativeitem.h> #include <QtGui/qgraphicswidget.h> +#include "../../../shared/util.h" class tst_QDeclarativeView : public QObject @@ -106,9 +107,9 @@ void tst_QDeclarativeView::resizemodedeclarativeitem() // size update from root object declarativeItem->setWidth(250); declarativeItem->setHeight(350); - qApp->processEvents(); QCOMPARE(declarativeItem->width(), 250.0); QCOMPARE(declarativeItem->height(), 350.0); + QTRY_COMPARE(canvas->size(), QSize(250, 350)); QCOMPARE(canvas->size(), QSize(250, 350)); QCOMPARE(canvas->size(), canvas->sizeHint()); QCOMPARE(sceneResizedSpy.count(), 4); @@ -134,9 +135,9 @@ void tst_QDeclarativeView::resizemodedeclarativeitem() // size update from root object declarativeItem->setWidth(80); declarativeItem->setHeight(100); - qApp->processEvents(); QCOMPARE(declarativeItem->width(), 80.0); QCOMPARE(declarativeItem->height(), 100.0); + QTRY_COMPARE(canvas->size(), QSize(80, 100)); QCOMPARE(canvas->size(), QSize(80, 100)); QCOMPARE(canvas->size(), canvas->sizeHint()); QCOMPARE(sceneResizedSpy2.count(), 2); diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 4173a44..7769979 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -268,10 +268,12 @@ void tst_qdeclarativexmllistmodel::xml() QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status))); + QVERIFY(model->errorString().isEmpty()); QCOMPARE(model->progress(), qreal(0.0)); QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading); QTRY_COMPARE(spy.count(), 1); spy.clear(); QCOMPARE(model->status(), QDeclarativeXmlListModel::Ready); + QVERIFY(model->errorString().isEmpty()); QCOMPARE(model->progress(), qreal(1.0)); QCOMPARE(model->count(), 9); @@ -284,6 +286,7 @@ void tst_qdeclarativexmllistmodel::xml() QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading); QTRY_COMPARE(spy.count(), 1); spy.clear(); QCOMPARE(model->status(), QDeclarativeXmlListModel::Ready); + QVERIFY(model->errorString().isEmpty()); QCOMPARE(model->count(), count); delete model; @@ -309,10 +312,12 @@ void tst_qdeclarativexmllistmodel::source() QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); QSignalSpy spy(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status))); + QVERIFY(model->errorString().isEmpty()); QCOMPARE(model->progress(), qreal(0.0)); QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading); QTRY_COMPARE(spy.count(), 1); spy.clear(); QCOMPARE(model->status(), QDeclarativeXmlListModel::Ready); + QVERIFY(model->errorString().isEmpty()); QCOMPARE(model->progress(), qreal(1.0)); QCOMPARE(model->count(), 9); @@ -320,6 +325,7 @@ void tst_qdeclarativexmllistmodel::source() QCOMPARE(model->progress(), qreal(0.0)); QTRY_COMPARE(spy.count(), 1); spy.clear(); QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading); + QVERIFY(model->errorString().isEmpty()); QEventLoop loop; QTimer timer; @@ -337,9 +343,12 @@ void tst_qdeclarativexmllistmodel::source() QCOMPARE(model->status(), status); QCOMPARE(model->count(), count); + if (status == QDeclarativeXmlListModel::Ready) QCOMPARE(model->progress(), qreal(1.0)); + QCOMPARE(model->errorString().isEmpty(), status == QDeclarativeXmlListModel::Ready); + delete model; } diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index dfadf48..4a9f1d1 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -336,6 +336,7 @@ private slots: void finishedWithoutStarted(); void unknownGesture(); void graphicsItemGesture(); + void graphicsView(); void graphicsItemTreeGesture(); void explicitGraphicsObjectTarget(); void gestureOverChildGraphicsItem(); @@ -859,7 +860,6 @@ void tst_Gestures::graphicsItemGesture() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -908,6 +908,71 @@ void tst_Gestures::graphicsItemGesture() QCOMPARE(item->gestureOverrideEventsReceived, 0); } +void tst_Gestures::graphicsView() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item = new GestureItem("item"); + scene.addItem(item); + item->setPos(100, 100); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + item->grabGesture(CustomGesture::GestureType); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; + + CustomEvent event; + // make sure the event is properly delivered if only the hotspot is set. + event.hotSpot = mapToGlobal(QPointF(10, 10), item, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item, &scene); + + QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item->gestureOverrideEventsReceived, 0); + + // change the viewport and try again + QWidget *newViewport = new QWidget; + view.setViewport(newViewport); + + item->reset(); + sendCustomGesture(&event, item, &scene); + + QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item->gestureOverrideEventsReceived, 0); + + // change the scene and try again + QGraphicsScene newScene; + item = new GestureItem("newItem"); + newScene.addItem(item); + item->setPos(100, 100); + view.setScene(&newScene); + + item->reset(); + // first without a gesture + sendCustomGesture(&event, item, &newScene); + + QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item->gestureEventsReceived, 0); + QCOMPARE(item->gestureOverrideEventsReceived, 0); + + // then grab the gesture and try again + item->reset(); + item->grabGesture(CustomGesture::GestureType); + sendCustomGesture(&event, item, &newScene); + + QCOMPARE(item->customEventsReceived, TotalCustomEventsCount); + QCOMPARE(item->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item->gestureOverrideEventsReceived, 0); +} + void tst_Gestures::graphicsItemTreeGesture() { QGraphicsScene scene; @@ -933,7 +998,6 @@ void tst_Gestures::graphicsItemTreeGesture() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -991,7 +1055,6 @@ void tst_Gestures::explicitGraphicsObjectTarget() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item2->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item2_child1->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); @@ -1051,7 +1114,6 @@ void tst_Gestures::gestureOverChildGraphicsItem() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item1->grabGesture(CustomGesture::GestureType); static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; @@ -1519,8 +1581,6 @@ void tst_Gestures::autoCancelGestures2() parent->setPos(0, 0); child->setPos(10, 10); scene.addItem(parent); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); - view.viewport()->grabGesture(secondGesture, Qt::DontStartGestureOnChildren); parent->grabGesture(CustomGesture::GestureType); child->grabGesture(secondGesture); @@ -1573,7 +1633,6 @@ void tst_Gestures::graphicsViewParentPropagation() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); item0->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); item1->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures | Qt::IgnoredGesturesPropagateToParent); item1_c1->grabGesture(CustomGesture::GestureType, Qt::IgnoredGesturesPropagateToParent); @@ -1644,8 +1703,6 @@ void tst_Gestures::panelPropagation() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); - static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1; @@ -1757,8 +1814,6 @@ void tst_Gestures::panelStacksBehindParent() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); - static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; CustomEvent event; @@ -1843,8 +1898,6 @@ void tst_Gestures::deleteGestureTargetItem() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); - if (propagateUpdateGesture) item2->ignoredUpdatedGestures << CustomGesture::GestureType; connect(items.value(emitter, 0), signalName, items.value(receiver, 0), slotName); @@ -1890,8 +1943,6 @@ void tst_Gestures::viewportCoordinates() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); - CustomEvent event; event.hotSpot = mapToGlobal(item1->boundingRect().center(), item1, &view); event.hasHotSpot = true; @@ -1929,8 +1980,6 @@ void tst_Gestures::partialGesturePropagation() QTest::qWaitForWindowShown(&view); view.ensureVisible(scene.sceneRect()); - view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); - item1->ignoredUpdatedGestures << CustomGesture::GestureType; CustomEvent event; diff --git a/tests/auto/qlocale/tst_qlocale.cpp b/tests/auto/qlocale/tst_qlocale.cpp index 7a5d8a6..7e9b8ec 100644 --- a/tests/auto/qlocale/tst_qlocale.cpp +++ b/tests/auto/qlocale/tst_qlocale.cpp @@ -192,6 +192,7 @@ void tst_QLocale::ctor() TEST_CTOR(French, France, QLocale::French, QLocale::France) TEST_CTOR(C, France, QLocale::C, QLocale::AnyCountry) + TEST_CTOR(Spanish, LatinAmericaAndTheCaribbean, QLocale::Spanish, QLocale::LatinAmericaAndTheCaribbean) QLocale::setDefault(QLocale(QLocale::English, QLocale::France)); @@ -323,6 +324,12 @@ void tst_QLocale::ctor() TEST_CTOR("no_NO", Norwegian, Norway) TEST_CTOR("nb_NO", Norwegian, Norway) TEST_CTOR("nn_NO", NorwegianNynorsk, Norway) + TEST_CTOR("es_ES", Spanish, Spain) + TEST_CTOR("es_419", Spanish, LatinAmericaAndTheCaribbean) + + // test default countries for languages + TEST_CTOR("mn", Mongolian, Mongolia) + TEST_CTOR("ne", Nepali, Nepal) #undef TEST_CTOR @@ -1321,10 +1328,12 @@ static const LocaleListItem g_locale_list[] = { { 9, 11}, // Armenian/Armenia { 10, 100}, // Assamese/India { 12, 15}, // Azerbaijani/Azerbaijan + { 12, 102}, // Azerbaijani/Iran { 14, 197}, // Basque/Spain { 15, 18}, // Bengali/Bangladesh { 15, 100}, // Bengali/India { 16, 25}, // Bhutani/Bhutan + { 19, 74}, // Breton/France { 20, 33}, // Bulgarian/Bulgaria { 21, 147}, // Burmese/Myanmar { 22, 20}, // Byelorussian/Belarus @@ -1354,6 +1363,7 @@ static const LocaleListItem g_locale_list[] = { { 31, 107}, // English/Jamaica { 31, 133}, // English/Malta { 31, 134}, // English/MarshallIslands + { 31, 137}, // English/Mauritius { 31, 148}, // English/Namibia { 31, 154}, // English/NewZealand { 31, 160}, // English/NorthernMarianaIslands @@ -1371,11 +1381,23 @@ static const LocaleListItem g_locale_list[] = { { 36, 73}, // Finnish/Finland { 37, 74}, // French/France { 37, 21}, // French/Belgium + { 37, 37}, // French/Cameroon { 37, 38}, // French/Canada + { 37, 41}, // French/CentralAfricanRepublic + { 37, 53}, // French/IvoryCoast + { 37, 88}, // French/Guadeloupe + { 37, 91}, // French/Guinea { 37, 125}, // French/Luxembourg + { 37, 128}, // French/Madagascar + { 37, 132}, // French/Mali + { 37, 135}, // French/Martinique { 37, 142}, // French/Monaco + { 37, 156}, // French/Niger + { 37, 176}, // French/Reunion { 37, 187}, // French/Senegal { 37, 206}, // French/Switzerland + { 37, 244}, // French/Saint Barthelemy + { 37, 245}, // French/Saint Martin { 40, 197}, // Galician/Spain { 41, 81}, // Georgian/Georgia { 42, 82}, // German/Germany @@ -1406,6 +1428,9 @@ static const LocaleListItem g_locale_list[] = { { 64, 179}, // Kinyarwanda/Rwanda { 65, 116}, // Kirghiz/Kyrgyzstan { 66, 114}, // Korean/RepublicOfKorea + { 67, 102}, // Kurdish/Iran + { 67, 103}, // Kurdish/Iraq + { 67, 207}, // Kurdish/SyrianArabRepublic { 67, 217}, // Kurdish/Turkey { 69, 117}, // Laothian/Lao { 71, 118}, // Latvian/Latvia @@ -1413,16 +1438,19 @@ static const LocaleListItem g_locale_list[] = { { 72, 50}, // Lingala/PeoplesRepublicOfCongo { 73, 124}, // Lithuanian/Lithuania { 74, 127}, // Macedonian/Macedonia + { 75, 128}, // Malagasy/Madagascar { 76, 130}, // Malay/Malaysia { 76, 32}, // Malay/BruneiDarussalam { 77, 100}, // Malayalam/India { 78, 133}, // Maltese/Malta + { 79, 154}, // Maori/NewZealand { 80, 100}, // Marathi/India { 82, 44}, // Mongolian/China { 82, 143}, // Mongolian/Mongolia { 84, 100}, // Nepali/India { 84, 150}, // Nepali/Nepal { 85, 161}, // Norwegian/Norway + { 86, 74}, // Occitan/France { 87, 100}, // Oriya/India { 88, 1}, // Pashto/Afghanistan { 89, 102}, // Persian/Iran @@ -1430,22 +1458,30 @@ static const LocaleListItem g_locale_list[] = { { 90, 172}, // Polish/Poland { 91, 173}, // Portuguese/Portugal { 91, 30}, // Portuguese/Brazil + { 91, 92}, // Portuguese/GuineaBissau + { 91, 146}, // Portuguese/Mozambique { 92, 100}, // Punjabi/India { 92, 163}, // Punjabi/Pakistan + { 94, 206}, // RhaetoRomance/Switzerland { 95, 141}, // Romanian/Moldova { 95, 177}, // Romanian/Romania { 96, 178}, // Russian/RussianFederation + { 96, 141}, // Russian/Moldova { 96, 222}, // Russian/Ukraine + { 98, 41}, // Sangho/CentralAfricanRepublic { 99, 100}, // Sanskrit/India { 100, 241}, // Serbian/SerbiaAndMontenegro { 100, 27}, // Serbian/BosniaAndHerzegowina { 100, 238}, // Serbian/Yugoslavia + { 100, 242}, // Serbian/Montenegro + { 100, 243}, // Serbian/Serbia { 101, 241}, // SerboCroatian/SerbiaAndMontenegro { 101, 27}, // SerboCroatian/BosniaAndHerzegowina { 101, 238}, // SerboCroatian/Yugoslavia { 102, 120}, // Sesotho/Lesotho { 102, 195}, // Sesotho/SouthAfrica { 103, 195}, // Setswana/SouthAfrica + { 104, 240}, // Shona/Zimbabwe { 106, 198}, // Singhalese/SriLanka { 107, 195}, // Siswati/SouthAfrica { 107, 204}, // Siswati/Swaziland @@ -1464,6 +1500,7 @@ static const LocaleListItem g_locale_list[] = { { 111, 61}, // Spanish/DominicanRepublic { 111, 63}, // Spanish/Ecuador { 111, 65}, // Spanish/ElSalvador + { 111, 66}, // Spanish/EquatorialGuinea { 111, 90}, // Spanish/Guatemala { 111, 96}, // Spanish/Honduras { 111, 139}, // Spanish/Mexico @@ -1481,9 +1518,12 @@ static const LocaleListItem g_locale_list[] = { { 114, 73}, // Swedish/Finland { 116, 209}, // Tajik/Tajikistan { 117, 100}, // Tamil/India + { 117, 198}, // Tamil/SriLanka { 118, 178}, // Tatar/RussianFederation { 119, 100}, // Telugu/India { 120, 211}, // Thai/Thailand + { 121, 44}, // Tibetan/China + { 121, 100}, // Tibetan/India { 122, 67}, // Tigrinya/Eritrea { 122, 69}, // Tigrinya/Ethiopia { 123, 214}, // Tonga/Tonga @@ -1524,9 +1564,63 @@ static const LocaleListItem g_locale_list[] = { { 160, 195}, // Venda/SouthAfrica { 161, 83}, // Ewe/Ghana { 161, 212}, // Ewe/Togo + { 162, 69}, // Walamo/Ethiopia { 163, 225}, // Hawaiian/UnitedStates { 164, 157}, // Tyap/Nigeria - { 165, 129} // Chewa/Malawi + { 165, 129}, // Chewa/Malawi + { 166, 170}, // Filipino/Philippines + { 167, 206}, // Swiss German/Switzerland + { 168, 44}, // Sichuan Yi/China + { 169, 91}, // Kpelle/Guinea + { 169, 121}, // Kpelle/Liberia + { 170, 82}, // Low German/Germany + { 171, 195}, // South Ndebele/SouthAfrica + { 172, 195}, // Northern Sotho/SouthAfrica + { 173, 73}, // Northern Sami/Finland + { 173, 161}, // Northern Sami/Norway + { 174, 208}, // Taroko/Taiwan + { 175, 111}, // Gusii/Kenya + { 176, 111}, // Taita/Kenya + { 177, 187}, // Fulah/Senegal + { 178, 111}, // Kikuyu/Kenya + { 179, 111}, // Samburu/Kenya + { 180, 146}, // Sena/Mozambique + { 181, 240}, // North Ndebele/Zimbabwe + { 182, 210}, // Rombo/Tanzania + { 183, 145}, // Tachelhit/Morocco + { 184, 3}, // Kabyle/Algeria + { 185, 221}, // Nyankole/Uganda + { 186, 210}, // Bena/Tanzania + { 187, 210}, // Vunjo/Tanzania + { 188, 132}, // Bambara/Mali + { 189, 111}, // Embu/Kenya + { 190, 225}, // Cherokee/UnitedStates + { 191, 137}, // Morisyen/Mauritius + { 192, 210}, // Makonde/Tanzania + { 193, 210}, // Langi/Tanzania + { 194, 221}, // Ganda/Uganda + { 195, 239}, // Bemba/Zambia + { 196, 39}, // Kabuverdianu/CapeVerde + { 197, 111}, // Meru/Kenya + { 198, 111}, // Kalenjin/Kenya + { 199, 148}, // Nama/Namibia + { 200, 210}, // Machame/Tanzania + { 201, 82}, // Colognian/Germany + { 202, 111}, // Masai/Kenya + { 202, 210}, // Masai/Tanzania + { 203, 221}, // Soga/Uganda + { 204, 111}, // Luyia/Kenya + { 205, 210}, // Asu/Tanzania + { 206, 111}, // Teso/Kenya + { 206, 221}, // Teso/Uganda + { 207, 67}, // Saho/Eritrea + { 208, 132}, // Koyra Chiini/Mali + { 209, 210}, // Rwa/Tanzania + { 210, 111}, // Luo/Kenya + { 211, 221}, // Chiga/Uganda + { 212, 145}, // Central Morocco Tamazight/Morocco + { 213, 132}, // Koyraboro Senni/Mali + { 214, 210} // Shambala/Tanzania }; static const int g_locale_list_count = sizeof(g_locale_list)/sizeof(g_locale_list[0]); @@ -1896,8 +1990,8 @@ void tst_QLocale::ampm() QCOMPARE(c.pmText(), QLatin1String("PM")); QLocale de("de_DE"); - QCOMPARE(de.amText(), QLatin1String("AM")); - QCOMPARE(de.pmText(), QLatin1String("PM")); + QCOMPARE(de.amText(), QLatin1String("vorm.")); + QCOMPARE(de.pmText(), QLatin1String("nachm.")); QLocale sv("sv_SE"); QCOMPARE(sv.amText(), QLatin1String("fm")); diff --git a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp index a3cccb2..e66719a 100644 --- a/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp +++ b/tests/auto/qnetworkconfiguration/tst_qnetworkconfiguration.cpp @@ -52,7 +52,7 @@ */ #include <QNetworkAccessManager> -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) #include <stdio.h> #include <iapconf.h> #endif @@ -73,7 +73,7 @@ private slots: void isRoamingAvailable(); private: -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -85,7 +85,7 @@ private: void tst_QNetworkConfiguration::initTestCase() { -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -158,7 +158,7 @@ void tst_QNetworkConfiguration::initTestCase() void tst_QNetworkConfiguration::cleanupTestCase() { -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) iapconf->clear(); delete iapconf; iapconf2->clear(); diff --git a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp index 7cc527c..c732a5b 100644 --- a/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp +++ b/tests/auto/qnetworkconfigurationmanager/tst_qnetworkconfigurationmanager.cpp @@ -45,7 +45,7 @@ #include <QtNetwork/qnetworkconfiguration.h> #include <QtNetwork/qnetworkconfigmanager.h> -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) #include <stdio.h> #include <iapconf.h> #endif @@ -67,7 +67,7 @@ private slots: void configurationFromIdentifier(); private: -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -79,7 +79,7 @@ private: void tst_QNetworkConfigurationManager::initTestCase() { -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -153,7 +153,7 @@ void tst_QNetworkConfigurationManager::initTestCase() void tst_QNetworkConfigurationManager::cleanupTestCase() { -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) iapconf->clear(); delete iapconf; iapconf2->clear(); diff --git a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp index 934a50e..e4f2486 100644 --- a/tests/auto/qnetworksession/test/tst_qnetworksession.cpp +++ b/tests/auto/qnetworksession/test/tst_qnetworksession.cpp @@ -48,7 +48,7 @@ #include <QtNetwork/qnetworkconfigmanager.h> #include <QtNetwork/qnetworksession.h> -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) #include <stdio.h> #include <iapconf.h> #endif @@ -104,7 +104,7 @@ private: int inProcessSessionManagementCount; -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) Maemo::IAPConf *iapconf; Maemo::IAPConf *iapconf2; Maemo::IAPConf *gprsiap; @@ -140,7 +140,7 @@ void tst_QNetworkSession::initTestCase() testsToRun["userChoiceSession"] = true; testsToRun["sessionOpenCloseStop"] = true; -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) iapconf = new Maemo::IAPConf("007"); iapconf->setValue("ipv4_type", "AUTO"); iapconf->setValue("wlan_wepkey1", "connt"); @@ -226,7 +226,7 @@ void tst_QNetworkSession::cleanupTestCase() "inProcessSessionManagement()"); } -#if defined(Q_WS_MAEMO_6) || defined(Q_WS_MAEMO_5) +#if defined(Q_OS_UNIX) && !defined(QT_NO_ICD) iapconf->clear(); delete iapconf; iapconf2->clear(); |