diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-04 15:10:05 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-04 15:10:05 (GMT) |
commit | 2a41fe19491e8ca28f8a8b4415dd9575c3608f46 (patch) | |
tree | e07c33872b469c7e1c1c11dab4c08dce2ae3ce45 /tests | |
parent | 8bc0456491e5a7e1fc677fce6e76932ab0d923e8 (diff) | |
parent | c3d5e6703777f294e5af12a0871defd339f1c1ff (diff) | |
download | Qt-2a41fe19491e8ca28f8a8b4415dd9575c3608f46.zip Qt-2a41fe19491e8ca28f8a8b4415dd9575c3608f46.tar.gz Qt-2a41fe19491e8ca28f8a8b4415dd9575c3608f46.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (63 commits)
doc: Fixed some qdoc errors.
Setting ImhHiddenText for NoEcho line edits is not 100% correct, but still way better than fully visible text.
Allow building documentation without all of Qt
Added a documentation for the new enum value in gesture api.
Remove the OBJECTS_DIR variable assignment from some projets in Qt.
Fix compile
qmake/MinGw: Link statically for Qt Creator to be able to detect it.
Enable two fast path for blend_tiled_rgb565
Avoid QString reallocation for smallcaps fonts in Itemizer::generate()
Make QLabel::text a reloadable property
remove non wifi interfaces from being handled.
Disable auto-uppercasing and predictive text for password line edits.
Avoid QString reallocation in QTextEngine::itemize()
Remove the Qt 4.7 #if guards that were needed for 4.6
Always redraw the complete control when an input event comes in.
Make sure not to crash if createStandardContextMenu() returns 0 (e.g. on Maemo5)
Fix compilation: include QString in order to use QString.
Fix compile
Block the Maemo5 window attribute values from being assigned to something else on other platforms.
be more verbose when warning about incompatible libraries
...
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gestures/tst_gestures.cpp | 98 | ||||
-rw-r--r-- | tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro | 5 | ||||
-rw-r--r-- | tests/auto/qlist/tst_qlist.cpp | 34 |
3 files changed, 129 insertions, 8 deletions
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index a2058cd..f8ecca3 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -58,7 +58,7 @@ static QPointF mapToGlobal(const QPointF &pt, QGraphicsItem *item, QGraphicsView *view) { - return view->mapToGlobal(view->mapFromScene(item->mapToScene(pt))); + return view->viewport()->mapToGlobal(view->mapFromScene(item->mapToScene(pt))); } class CustomGesture : public QGesture @@ -353,6 +353,8 @@ private slots: void deleteGestureTargetWidget(); void deleteGestureTargetItem_data(); void deleteGestureTargetItem(); + void viewportCoordinates(); + void partialGesturePropagation(); }; tst_Gestures::tst_Gestures() @@ -742,7 +744,6 @@ public: ignoredFinishedGestures.clear(); } -protected: QRectF boundingRect() const { return size; @@ -1771,7 +1772,6 @@ void tst_Gestures::panelStacksBehindParent() void tst_Gestures::deleteGestureTargetWidget() { - } void tst_Gestures::deleteGestureTargetItem_data() @@ -1857,5 +1857,97 @@ void tst_Gestures::deleteGestureTargetItem() sendCustomGesture(&event, item1, &scene); } +class GraphicsView : public QGraphicsView +{ +public: + GraphicsView(QGraphicsScene *scene, QWidget *parent = 0) + : QGraphicsView(scene, parent) + { + } + + using QGraphicsView::setViewportMargins; +}; + +// just making sure that even if the graphicsview has margins hotspot still +// works properly. It should use viewport for converting global coordinates to +// scene coordinates. +void tst_Gestures::viewportCoordinates() +{ + QGraphicsScene scene; + GraphicsView view(&scene); + view.setViewportMargins(10,20,15,25); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item1 = new GestureItem("item1"); + item1->grabGesture(CustomGesture::GestureType); + item1->size = QRectF(0, 0, 3, 3); + item1->setZValue(2); + scene.addItem(item1); + + view.show(); + 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; + sendCustomGesture(&event, item1, &scene); + QVERIFY(item1->gestureEventsReceived != 0); +} + +void tst_Gestures::partialGesturePropagation() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + view.setWindowFlags(Qt::X11BypassWindowManagerHint); + + GestureItem *item1 = new GestureItem("item1"); + item1->grabGesture(CustomGesture::GestureType); + item1->setZValue(8); + scene.addItem(item1); + + GestureItem *item2 = new GestureItem("item2[partial]"); + item2->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); + item2->setZValue(6); + scene.addItem(item2); + + GestureItem *item3 = new GestureItem("item3"); + item3->grabGesture(CustomGesture::GestureType); + item3->setZValue(4); + scene.addItem(item3); + + GestureItem *item4 = new GestureItem("item4[partial]"); + item4->grabGesture(CustomGesture::GestureType, Qt::ReceivePartialGestures); + item4->setZValue(2); + scene.addItem(item4); + + view.show(); + QTest::qWaitForWindowShown(&view); + view.ensureVisible(scene.sceneRect()); + + view.viewport()->grabGesture(CustomGesture::GestureType, Qt::DontStartGestureOnChildren); + + item1->ignoredUpdatedGestures << CustomGesture::GestureType; + + CustomEvent event; + event.hotSpot = mapToGlobal(QPointF(5, 5), item1, &view); + event.hasHotSpot = true; + sendCustomGesture(&event, item1, &scene); + + static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1; + + QCOMPARE(item1->gestureOverrideEventsReceived, 1); + QCOMPARE(item2->gestureOverrideEventsReceived, 1); + QCOMPARE(item3->gestureOverrideEventsReceived, 1); + QCOMPARE(item4->gestureOverrideEventsReceived, 1); + + QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount); + QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount-2); // except for started and finished + QCOMPARE(item3->gestureEventsReceived, 0); + QCOMPARE(item4->gestureEventsReceived, 0); +} + QTEST_MAIN(tst_Gestures) #include "tst_gestures.moc" diff --git a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro index 93a03db..e8b1ce9 100644 --- a/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro +++ b/tests/auto/qapplication/desktopsettingsaware/desktopsettingsaware.pro @@ -13,8 +13,3 @@ wince*|symbian*:TARGET = ../desktopsettingsaware SOURCES += main.cpp CONFIG += qt warn_on create_prl link_prl CONFIG -= app_bundle - -!symbian*: { -OBJECTS_DIR=.obj/debug-shared -MOC_DIR=.moc/debug-shared -} diff --git a/tests/auto/qlist/tst_qlist.cpp b/tests/auto/qlist/tst_qlist.cpp index a590fca..e2944cc 100644 --- a/tests/auto/qlist/tst_qlist.cpp +++ b/tests/auto/qlist/tst_qlist.cpp @@ -60,6 +60,7 @@ private slots: void length() const; void lengthSignature() const; void append() const; + void prepend() const; void mid() const; }; @@ -130,6 +131,39 @@ void tst_QList::append() const } +void tst_QList::prepend() const +{ + QList<QString *> list; + QString *str1 = new QString; + list.prepend(str1); + QVERIFY(list.size() == 1); + QVERIFY(list.at(0) == str1); + QString *str2 = new QString; + list.prepend(str2); + QVERIFY(list.size() == 2); + QVERIFY(list.at(0) == str2); + QVERIFY(list.at(1) == str1); + QString *str3 = new QString; + list.prepend(str3); + QVERIFY(list.size() == 3); + QVERIFY(list.at(0) == str3); + QVERIFY(list.at(1) == str2); + QVERIFY(list.at(2) == str1); + list.removeAll(str2); + delete str2; + QVERIFY(list.size() == 2); + QVERIFY(list.at(0) == str3); + QVERIFY(list.at(1) == str1); + QString *str4 = new QString; + list.prepend(str4); + QVERIFY(list.size() == 3); + QVERIFY(list.at(0) == str4); + QVERIFY(list.at(1) == str3); + QVERIFY(list.at(2) == str1); + qDeleteAll(list); + list.clear(); +} + void tst_QList::mid() const { QList<QString> list; |