summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro1
-rw-r--r--tests/auto/gestures/tst_gestures.cpp620
-rw-r--r--tests/auto/linguist/lrelease/testdata/idbased.ts7
-rw-r--r--tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp7
-rw-r--r--tests/auto/qaudioinput/tst_qaudioinput.cpp2
-rw-r--r--tests/auto/qaudiooutput/tst_qaudiooutput.cpp2
-rw-r--r--tests/auto/qdom/tst_qdom.cpp1
-rw-r--r--tests/auto/qfiledialog2/tst_qfiledialog2.cpp48
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp200
-rw-r--r--tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp4
-rw-r--r--tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp11
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp43
-rw-r--r--tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp14
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp52
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp2
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp4
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview_2.cpp212
-rw-r--r--tests/auto/qheaderview/tst_qheaderview.cpp5
-rw-r--r--tests/auto/qhttp/tst_qhttp.cpp43
-rw-r--r--tests/auto/qlabel/qlabel.pro21
-rw-r--r--tests/auto/qlabel/tst_qlabel.cpp58
-rw-r--r--tests/auto/qlayout/tst_qlayout.cpp28
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp24
-rw-r--r--tests/auto/qlistview/tst_qlistview.cpp61
-rw-r--r--tests/auto/qpauseanimation/tst_qpauseanimation.cpp3
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp2
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp14
-rw-r--r--tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp24
-rw-r--r--tests/auto/qsqldatabase/tst_qsqldatabase.cpp9
-rw-r--r--tests/auto/qsqlquery/tst_qsqlquery.cpp16
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp106
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp35
-rw-r--r--tests/auto/qtabwidget/tst_qtabwidget.cpp6
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp14
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp56
-rw-r--r--tests/benchmarks/benchmarks.pro4
-rw-r--r--tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp236
-rw-r--r--tests/benchmarks/qnetworkreply/qnetworkreply.pro2
-rw-r--r--tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp (renamed from tests/benchmarks/qnetworkreply/main.cpp)40
-rw-r--r--tests/manual/gestures/graphicsview/main.cpp8
-rw-r--r--tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp35
-rw-r--r--tests/manual/gestures/scrollarea/main.cpp36
-rw-r--r--tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp10
43 files changed, 1856 insertions, 270 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index d9e060d..1ec4c16 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -127,6 +127,7 @@ SUBDIRS += \
qexplicitlyshareddatapointer \
qfile \
qfiledialog \
+ qfiledialog2 \
qfileinfo \
qfilesystemwatcher \
qfilesystemmodel \
diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp
index 46ed45e..92f979f 100644
--- a/tests/auto/gestures/tst_gestures.cpp
+++ b/tests/auto/gestures/tst_gestures.cpp
@@ -56,6 +56,11 @@
//TESTED_CLASS=
//TESTED_FILES=
+static QPointF mapToGlobal(const QPointF &pt, QGraphicsItem *item, QGraphicsView *view)
+{
+ return view->mapToGlobal(view->mapFromScene(item->mapToScene(pt)));
+}
+
class CustomGesture : public QGesture
{
Q_OBJECT
@@ -63,11 +68,10 @@ public:
static Qt::GestureType GestureType;
CustomGesture(QObject *parent = 0)
- : QGesture(parent), target(0), serial(0)
+ : QGesture(parent), serial(0)
{
}
- QObject *target;
int serial;
static const int SerialMaybeThreshold;
@@ -86,13 +90,13 @@ public:
CustomEvent(int serial_ = 0)
: QEvent(QEvent::Type(CustomEvent::EventType)),
- serial(serial_), targetObject(0)
+ serial(serial_), hasHotSpot(false)
{
}
int serial;
- QObject *targetObject;
- QPoint hotSpot;
+ QPointF hotSpot;
+ bool hasHotSpot;
};
int CustomEvent::EventType = 0;
@@ -101,8 +105,8 @@ class CustomGestureRecognizer : public QGestureRecognizer
public:
CustomGestureRecognizer()
{
- CustomEvent::EventType = QEvent::registerEventType();
- eventsCounter = 0;
+ if (!CustomEvent::EventType)
+ CustomEvent::EventType = QEvent::registerEventType();
}
QGesture* createGesture(QObject *)
@@ -117,9 +121,8 @@ public:
CustomGesture *g = static_cast<CustomGesture*>(state);
CustomEvent *e = static_cast<CustomEvent*>(event);
g->serial = e->serial;
- g->setTargetObject(e->targetObject);
- g->setHotSpot(e->hotSpot);
- ++eventsCounter;
+ if (e->hasHotSpot)
+ g->setHotSpot(e->hotSpot);
if (g->serial >= CustomGesture::SerialFinishedThreshold)
result |= QGestureRecognizer::GestureFinished;
else if (g->serial >= CustomGesture::SerialStartedThreshold)
@@ -139,16 +142,57 @@ public:
g->serial = 0;
QGestureRecognizer::reset(state);
}
+};
+
+// same as CustomGestureRecognizer but triggers early without the maybe state
+class CustomContinuousGestureRecognizer : public QGestureRecognizer
+{
+public:
+ CustomContinuousGestureRecognizer()
+ {
+ if (!CustomEvent::EventType)
+ CustomEvent::EventType = QEvent::registerEventType();
+ }
+
+ QGesture* createGesture(QObject *)
+ {
+ return new CustomGesture;
+ }
+
+ QGestureRecognizer::Result filterEvent(QGesture *state, QObject*, QEvent *event)
+ {
+ if (event->type() == CustomEvent::EventType) {
+ QGestureRecognizer::Result result = QGestureRecognizer::ConsumeEventHint;
+ CustomGesture *g = static_cast<CustomGesture*>(state);
+ CustomEvent *e = static_cast<CustomEvent*>(event);
+ g->serial = e->serial;
+ if (e->hasHotSpot)
+ g->setHotSpot(e->hotSpot);
+ if (g->serial >= CustomGesture::SerialFinishedThreshold)
+ result |= QGestureRecognizer::GestureFinished;
+ else if (g->serial >= CustomGesture::SerialMaybeThreshold)
+ result |= QGestureRecognizer::GestureTriggered;
+ else
+ result = QGestureRecognizer::NotGesture;
+ return result;
+ }
+ return QGestureRecognizer::Ignore;
+ }
- int eventsCounter;
- QString name;
+ void reset(QGesture *state)
+ {
+ CustomGesture *g = static_cast<CustomGesture*>(state);
+ g->serial = 0;
+ QGestureRecognizer::reset(state);
+ }
};
class GestureWidget : public QWidget
{
Q_OBJECT
public:
- GestureWidget(const char *name = 0)
+ GestureWidget(const char *name = 0, QWidget *parent = 0)
+ : QWidget(parent)
{
if (name)
setObjectName(QLatin1String(name));
@@ -162,6 +206,7 @@ public:
gestureOverrideEventsReceived = 0;
events.clear();
overrideEvents.clear();
+ ignoredGestures.clear();
}
int customEventsReceived;
@@ -186,14 +231,18 @@ public:
} events, overrideEvents;
bool acceptGestureOverride;
+ QSet<Qt::GestureType> ignoredGestures;
protected:
bool event(QEvent *event)
{
Events *eventsPtr = 0;
if (event->type() == QEvent::Gesture) {
+ QGestureEvent *e = static_cast<QGestureEvent*>(event);
++gestureEventsReceived;
eventsPtr = &events;
+ foreach(Qt::GestureType type, ignoredGestures)
+ e->ignore(e->gesture(type));
} else if (event->type() == QEvent::GestureOverride) {
++gestureOverrideEventsReceived;
eventsPtr = &overrideEvents;
@@ -231,14 +280,15 @@ protected:
}
};
-static void sendCustomGesture(QObject *object)
+static void sendCustomGesture(CustomEvent *event, QObject *object, QGraphicsScene *scene = 0)
{
- CustomEvent ev;
- ev.targetObject = object;
for (int i = CustomGesture::SerialMaybeThreshold;
i <= CustomGesture::SerialFinishedThreshold; ++i) {
- ev.serial = i;
- QApplication::sendEvent(object, &ev);
+ event->serial = i;
+ if (scene)
+ scene->sendEvent(qobject_cast<QGraphicsObject *>(object), event);
+ else
+ QApplication::sendEvent(object, event);
}
}
@@ -265,6 +315,13 @@ private slots:
void finishedWithoutStarted();
void unknownGesture();
void graphicsItemGesture();
+ void graphicsItemTreeGesture();
+ void explicitGraphicsObjectTarget();
+ void gestureOverChildGraphicsItem();
+ void twoGesturesOnDifferentLevel();
+ void multipleGesturesInTree();
+ void multipleGesturesInComplexTree();
+ void testMapToScene();
};
tst_Gestures::tst_Gestures()
@@ -298,7 +355,8 @@ void tst_Gestures::customGesture()
{
GestureWidget widget;
widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture);
- sendCustomGesture(&widget);
+ CustomEvent event;
+ sendCustomGesture(&event, &widget);
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
@@ -343,7 +401,8 @@ void tst_Gestures::gestureOverChild()
widget.grabGesture(CustomGesture::GestureType, Qt::WidgetGesture);
- sendCustomGesture(child);
+ CustomEvent event;
+ sendCustomGesture(&event, child);
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
@@ -361,7 +420,7 @@ void tst_Gestures::gestureOverChild()
widget.reset();
child->reset();
- sendCustomGesture(child);
+ sendCustomGesture(&event, child);
QCOMPARE(child->customEventsReceived, TotalCustomEventsCount);
QCOMPARE(widget.customEventsReceived, 0);
@@ -392,7 +451,8 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree()
static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
// sending events to the child and making sure there is no conflict
- sendCustomGesture(child);
+ CustomEvent event;
+ sendCustomGesture(&event, child);
QCOMPARE(child->customEventsReceived, TotalCustomEventsCount);
QCOMPARE(parent.customEventsReceived, 0);
@@ -405,7 +465,7 @@ void tst_Gestures::multipleWidgetOnlyGestureInTree()
child->reset();
// same for the parent widget
- sendCustomGesture(&parent);
+ sendCustomGesture(&event, &parent);
QCOMPARE(child->customEventsReceived, 0);
QCOMPARE(parent.customEventsReceived, TotalCustomEventsCount);
@@ -432,10 +492,11 @@ void tst_Gestures::conflictingGestures()
child->acceptGestureOverride = true;
// sending events to the child and making sure there is no conflict
- sendCustomGesture(child);
+ CustomEvent event;
+ sendCustomGesture(&event, child);
- QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount);
- QCOMPARE(child->gestureEventsReceived, 0);
+ QCOMPARE(child->gestureOverrideEventsReceived, 1);
+ QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount);
QCOMPARE(parent.gestureOverrideEventsReceived, 0);
QCOMPARE(parent.gestureEventsReceived, 0);
@@ -447,12 +508,12 @@ void tst_Gestures::conflictingGestures()
child->acceptGestureOverride = false;
// sending events to the child and making sure there is no conflict
- sendCustomGesture(child);
+ sendCustomGesture(&event, child);
- QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(child->gestureOverrideEventsReceived, 1);
QCOMPARE(child->gestureEventsReceived, 0);
- QCOMPARE(parent.gestureOverrideEventsReceived, TotalGestureEventsCount);
- QCOMPARE(parent.gestureEventsReceived, 0);
+ QCOMPARE(parent.gestureOverrideEventsReceived, 1);
+ QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount);
parent.reset();
child->reset();
@@ -460,13 +521,31 @@ void tst_Gestures::conflictingGestures()
// nobody accepts the override, we will send normal events to the closest context (to the child)
parent.acceptGestureOverride = false;
child->acceptGestureOverride = false;
+ child->ignoredGestures << CustomGesture::GestureType;
// sending events to the child and making sure there is no conflict
- sendCustomGesture(child);
+ sendCustomGesture(&event, child);
- QCOMPARE(child->gestureOverrideEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(child->gestureOverrideEventsReceived, 1);
QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount);
- QCOMPARE(parent.gestureOverrideEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(parent.gestureOverrideEventsReceived, 1);
+ QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount);
+
+ parent.reset();
+ child->reset();
+
+ Qt::GestureType ContinuousGesture = qApp->registerGestureRecognizer(new CustomContinuousGestureRecognizer);
+ static const int ContinuousGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
+ child->grabGesture(ContinuousGesture);
+ // child accepts override. And it also receives another custom gesture.
+ parent.acceptGestureOverride = false;
+ child->acceptGestureOverride = true;
+ sendCustomGesture(&event, child);
+
+ QCOMPARE(child->gestureOverrideEventsReceived, 1);
+ QVERIFY(child->gestureEventsReceived > TotalGestureEventsCount);
+ QCOMPARE(child->events.all.count(), TotalGestureEventsCount + ContinuousGestureEventsCount);
+ QCOMPARE(parent.gestureOverrideEventsReceived, 0);
QCOMPARE(parent.gestureEventsReceived, 0);
}
@@ -497,18 +576,28 @@ void tst_Gestures::unknownGesture()
widget.grabGesture(Qt::CustomGesture, Qt::WidgetGesture);
widget.grabGesture(Qt::GestureType(Qt::PanGesture+512), Qt::WidgetGesture);
- sendCustomGesture(&widget);
+ CustomEvent event;
+ sendCustomGesture(&event, &widget);
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
QCOMPARE(widget.gestureEventsReceived, TotalGestureEventsCount);
}
+static const QColor InstanceColors[] = {
+ Qt::blue, Qt::red, Qt::green, Qt::gray, Qt::yellow
+};
+
class GestureItem : public QGraphicsObject
{
+ static int InstanceCount;
+
public:
- GestureItem()
+ GestureItem(const char *name = 0)
{
+ instanceNumber = InstanceCount++;
+ if (name)
+ setObjectName(QLatin1String(name));
size = QRectF(0, 0, 100, 100);
customEventsReceived = 0;
gestureEventsReceived = 0;
@@ -517,6 +606,10 @@ public:
overrideEvents.clear();
acceptGestureOverride = false;
}
+ ~GestureItem()
+ {
+ --InstanceCount;
+ }
int customEventsReceived;
int gestureEventsReceived;
@@ -540,8 +633,20 @@ public:
} events, overrideEvents;
bool acceptGestureOverride;
+ QSet<Qt::GestureType> ignoredGestures;
QRectF size;
+ int instanceNumber;
+
+ void reset()
+ {
+ customEventsReceived = 0;
+ gestureEventsReceived = 0;
+ gestureOverrideEventsReceived = 0;
+ events.clear();
+ overrideEvents.clear();
+ ignoredGestures.clear();
+ }
protected:
QRectF boundingRect() const
@@ -550,7 +655,8 @@ protected:
}
void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *)
{
- p->fillRect(boundingRect(), Qt::blue);
+ QColor color = InstanceColors[instanceNumber % (sizeof(InstanceColors)/sizeof(InstanceColors[0]))];
+ p->fillRect(boundingRect(), color);
}
bool event(QEvent *event)
@@ -559,6 +665,9 @@ protected:
if (event->type() == QEvent::Gesture) {
++gestureEventsReceived;
eventsPtr = &events;
+ QGestureEvent *e = static_cast<QGestureEvent *>(event);
+ foreach(Qt::GestureType type, ignoredGestures)
+ e->ignore(e->gesture(type));
} else if (event->type() == QEvent::GestureOverride) {
++gestureOverrideEventsReceived;
eventsPtr = &overrideEvents;
@@ -595,23 +704,46 @@ protected:
return true;
}
};
+int GestureItem::InstanceCount = 0;
void tst_Gestures::graphicsItemGesture()
{
QGraphicsScene scene;
QGraphicsView view(&scene);
- GestureItem *item = new GestureItem;
+ GestureItem *item = new GestureItem("item");
scene.addItem(item);
item->setPos(100, 100);
- item->grabGesture(CustomGesture::GestureType);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
- sendCustomGesture(item);
+ view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture);
+ item->grabGesture(CustomGesture::GestureType);
static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
+ CustomEvent event;
+ // gesture without hotspot should not be delivered to items in the view
+ QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture");
+ QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture");
+ QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture");
+ QTest::ignoreMessage(QtWarningMsg, "QGestureManager::deliverEvent: could not find the target for gesture");
+ sendCustomGesture(&event, item, &scene);
+
+ QCOMPARE(item->customEventsReceived, TotalCustomEventsCount);
+ QCOMPARE(item->gestureEventsReceived, 0);
+ QCOMPARE(item->gestureOverrideEventsReceived, 0);
+
+ item->reset();
+
+ // 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);
@@ -622,6 +754,416 @@ void tst_Gestures::graphicsItemGesture()
QCOMPARE(item->events.updated.size(), TotalGestureEventsCount - 2);
QCOMPARE(item->events.finished.size(), 1);
QCOMPARE(item->events.canceled.size(), 0);
+
+ item->reset();
+
+ // send gesture to the item which ignores it.
+ item->ignoredGestures << CustomGesture::GestureType;
+
+ 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);
+}
+
+void tst_Gestures::graphicsItemTreeGesture()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ GestureItem *item1 = new GestureItem("item1");
+ item1->setPos(100, 100);
+ item1->size = QRectF(0, 0, 350, 200);
+ scene.addItem(item1);
+
+ GestureItem *item1_child1 = new GestureItem("item1_child1");
+ item1_child1->setPos(50, 50);
+ item1_child1->size = QRectF(0, 0, 100, 100);
+ item1_child1->setParentItem(item1);
+
+ GestureItem *item1_child2 = new GestureItem("item1_child2");
+ item1_child2->size = QRectF(0, 0, 100, 100);
+ item1_child2->setPos(200, 50);
+ item1_child2->setParentItem(item1);
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
+
+ view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture);
+ item1->grabGesture(CustomGesture::GestureType);
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+
+ CustomEvent event;
+ event.hotSpot = mapToGlobal(QPointF(10, 10), item1_child1, &view);
+ event.hasHotSpot = true;
+
+ item1->ignoredGestures << CustomGesture::GestureType;
+ sendCustomGesture(&event, item1_child1, &scene);
+ QCOMPARE(item1_child1->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item1_child1->gestureEventsReceived, 0);
+ QCOMPARE(item1_child2->gestureEventsReceived, 0);
+ QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount);
+
+ item1->reset(); item1_child1->reset(); item1_child2->reset();
+
+ item1_child1->grabGesture(CustomGesture::GestureType);
+
+ item1->ignoredGestures << CustomGesture::GestureType;
+ item1_child1->ignoredGestures << CustomGesture::GestureType;
+ sendCustomGesture(&event, item1_child1, &scene);
+ QCOMPARE(item1_child1->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item1_child1->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item1_child2->gestureEventsReceived, 0);
+ QCOMPARE(item1_child2->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount);
+}
+
+void tst_Gestures::explicitGraphicsObjectTarget()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ GestureItem *item1 = new GestureItem("item1");
+ scene.addItem(item1);
+ item1->setPos(100, 100);
+ item1->setZValue(1);
+
+ GestureItem *item2 = new GestureItem("item2");
+ scene.addItem(item2);
+ item2->setPos(100, 100);
+ item2->setZValue(5);
+
+ GestureItem *item2_child1 = new GestureItem("item2_child1");
+ scene.addItem(item2_child1);
+ item2_child1->setParentItem(item2);
+ item2_child1->setPos(10, 10);
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
+
+ view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture);
+ item1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture);
+ item2->grabGesture(CustomGesture::GestureType, Qt::ItemGesture);
+ item2_child1->grabGesture(CustomGesture::GestureType, Qt::ItemGesture);
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+
+ // sending events to item1, but the hotSpot is set to item2
+ CustomEvent event;
+ event.hotSpot = mapToGlobal(QPointF(15, 15), item2, &view);
+ event.hasHotSpot = true;
+
+ sendCustomGesture(&event, item1, &scene);
+
+ QCOMPARE(item1->gestureEventsReceived, 0);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item2_child1->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item2_child1->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item2_child1->events.all.size(), TotalGestureEventsCount);
+ for(int i = 0; i < item2_child1->events.all.size(); ++i)
+ QCOMPARE(item2_child1->events.all.at(i), CustomGesture::GestureType);
+ QCOMPARE(item2_child1->events.started.size(), 1);
+ QCOMPARE(item2_child1->events.updated.size(), TotalGestureEventsCount - 2);
+ QCOMPARE(item2_child1->events.finished.size(), 1);
+ QCOMPARE(item2_child1->events.canceled.size(), 0);
+ QCOMPARE(item2->gestureEventsReceived, 0);
+ QCOMPARE(item2->gestureOverrideEventsReceived, 1);
+}
+
+void tst_Gestures::gestureOverChildGraphicsItem()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ GestureItem *item0 = new GestureItem("item0");
+ scene.addItem(item0);
+ item0->setPos(0, 0);
+ item0->grabGesture(CustomGesture::GestureType);
+ item0->setZValue(1);
+
+ GestureItem *item1 = new GestureItem("item1");
+ scene.addItem(item1);
+ item1->setPos(100, 100);
+ item1->setZValue(5);
+
+ GestureItem *item2 = new GestureItem("item2");
+ scene.addItem(item2);
+ item2->setPos(100, 100);
+ item2->setZValue(10);
+
+ GestureItem *item2_child1 = new GestureItem("item2_child1");
+ scene.addItem(item2_child1);
+ item2_child1->setParentItem(item2);
+ item2_child1->setPos(0, 0);
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
+
+ view.viewport()->grabGesture(CustomGesture::GestureType, Qt::WidgetGesture);
+ item1->grabGesture(CustomGesture::GestureType);
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+ static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
+
+ CustomEvent event;
+ event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item0, &scene);
+
+ QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount);
+ QCOMPARE(item2_child1->gestureEventsReceived, 0);
+ QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item2->gestureEventsReceived, 0);
+ QCOMPARE(item2->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 0);
+
+ item0->reset(); item1->reset(); item2->reset(); item2_child1->reset();
+ item2->grabGesture(CustomGesture::GestureType);
+ item2->ignoredGestures << CustomGesture::GestureType;
+
+ event.hotSpot = mapToGlobal(QPointF(10, 10), item2_child1, &view);
+ event.hasHotSpot = true;
+ sendCustomGesture(&event, item0, &scene);
+
+ QCOMPARE(item0->customEventsReceived, TotalCustomEventsCount);
+ QCOMPARE(item2_child1->gestureEventsReceived, 0);
+ QCOMPARE(item2_child1->gestureOverrideEventsReceived, 0);
+ QCOMPARE(item2->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item2->gestureOverrideEventsReceived, 1);
+ QCOMPARE(item1->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(item1->gestureOverrideEventsReceived, 1);
+}
+
+void tst_Gestures::twoGesturesOnDifferentLevel()
+{
+ GestureWidget parent("parent");
+ QVBoxLayout *l = new QVBoxLayout(&parent);
+ GestureWidget *child = new GestureWidget("child");
+ l->addWidget(child);
+
+ Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+
+ parent.grabGesture(CustomGesture::GestureType, Qt::WidgetWithChildrenGesture);
+ child->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture);
+
+ CustomEvent event;
+ // sending events that form a gesture to one widget, but they will be
+ // filtered by two different gesture recognizers and will generate two
+ // QGesture objects. Check that those gesture objects are delivered to
+ // different widgets properly.
+ sendCustomGesture(&event, child);
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+ static const int TotalCustomEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialMaybeThreshold + 1;
+
+ QCOMPARE(child->customEventsReceived, TotalCustomEventsCount);
+ QCOMPARE(child->gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(child->gestureOverrideEventsReceived, 0);
+ QCOMPARE(child->events.all.size(), TotalGestureEventsCount);
+ for(int i = 0; i < child->events.all.size(); ++i)
+ QCOMPARE(child->events.all.at(i), SecondGesture);
+
+ QCOMPARE(parent.gestureEventsReceived, TotalGestureEventsCount);
+ QCOMPARE(parent.gestureOverrideEventsReceived, 0);
+ QCOMPARE(parent.events.all.size(), TotalGestureEventsCount);
+ for(int i = 0; i < child->events.all.size(); ++i)
+ QCOMPARE(parent.events.all.at(i), CustomGesture::GestureType);
+}
+
+void tst_Gestures::multipleGesturesInTree()
+{
+ GestureWidget a("A");
+ GestureWidget *A = &a;
+ GestureWidget *B = new GestureWidget("B", A);
+ GestureWidget *C = new GestureWidget("C", B);
+ GestureWidget *D = new GestureWidget("D", C);
+
+ Qt::GestureType FirstGesture = CustomGesture::GestureType;
+ Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType ThirdGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+
+ A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1 3]
+ A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // |
+ B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // B [ 2 3]
+ B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // |
+ C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // C [1 2 3]
+ C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // |
+ C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // D [1 3]
+ D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture);
+ D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture);
+
+ // make sure all widgets ignore events, so they get propagated.
+ A->ignoredGestures << FirstGesture << ThirdGesture;
+ B->ignoredGestures << SecondGesture << ThirdGesture;
+ C->ignoredGestures << FirstGesture << SecondGesture << ThirdGesture;
+ D->ignoredGestures << FirstGesture << ThirdGesture;
+
+ CustomEvent event;
+ sendCustomGesture(&event, D);
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+
+ // gesture override events
+ QCOMPARE(D->overrideEvents.all.count(FirstGesture), 1);
+ QCOMPARE(D->overrideEvents.all.count(SecondGesture), 0);
+ QCOMPARE(D->overrideEvents.all.count(ThirdGesture), 1);
+
+ QCOMPARE(C->overrideEvents.all.count(FirstGesture), 1);
+ QCOMPARE(C->overrideEvents.all.count(SecondGesture), 1);
+ QCOMPARE(C->overrideEvents.all.count(ThirdGesture), 1);
+
+ QCOMPARE(B->overrideEvents.all.count(FirstGesture), 0);
+ QCOMPARE(B->overrideEvents.all.count(SecondGesture), 1);
+ QCOMPARE(B->overrideEvents.all.count(ThirdGesture), 1);
+
+ QCOMPARE(A->overrideEvents.all.count(FirstGesture), 1);
+ QCOMPARE(A->overrideEvents.all.count(SecondGesture), 0);
+ QCOMPARE(A->overrideEvents.all.count(ThirdGesture), 1);
+
+ // normal gesture events
+ QCOMPARE(D->events.all.count(FirstGesture), TotalGestureEventsCount);
+ QCOMPARE(D->events.all.count(SecondGesture), 0);
+ QCOMPARE(D->events.all.count(ThirdGesture), TotalGestureEventsCount);
+
+ QCOMPARE(C->events.all.count(FirstGesture), TotalGestureEventsCount);
+ QCOMPARE(C->events.all.count(SecondGesture), TotalGestureEventsCount);
+ QCOMPARE(C->events.all.count(ThirdGesture), TotalGestureEventsCount);
+
+ QCOMPARE(B->events.all.count(FirstGesture), 0);
+ QCOMPARE(B->events.all.count(SecondGesture), TotalGestureEventsCount);
+ QCOMPARE(B->events.all.count(ThirdGesture), TotalGestureEventsCount);
+
+ QCOMPARE(A->events.all.count(FirstGesture), TotalGestureEventsCount);
+ QCOMPARE(A->events.all.count(SecondGesture), 0);
+ QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount);
+}
+
+void tst_Gestures::multipleGesturesInComplexTree()
+{
+ GestureWidget a("A");
+ GestureWidget *A = &a;
+ GestureWidget *B = new GestureWidget("B", A);
+ GestureWidget *C = new GestureWidget("C", B);
+ GestureWidget *D = new GestureWidget("D", C);
+
+ Qt::GestureType FirstGesture = CustomGesture::GestureType;
+ Qt::GestureType SecondGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType ThirdGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType FourthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType FifthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType SixthGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+ Qt::GestureType SeventhGesture = qApp->registerGestureRecognizer(new CustomGestureRecognizer);
+
+ A->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // A [1,3,4]
+ A->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // |
+ A->grabGesture(FourthGesture, Qt::WidgetWithChildrenGesture); // B [2,3,5]
+ B->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture); // |
+ B->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture); // C [1,2,3,6]
+ B->grabGesture(FifthGesture, Qt::WidgetWithChildrenGesture); // |
+ C->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture); // D [1,3,7]
+ C->grabGesture(SecondGesture, Qt::WidgetWithChildrenGesture);
+ C->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture);
+ C->grabGesture(SixthGesture, Qt::WidgetWithChildrenGesture);
+ D->grabGesture(FirstGesture, Qt::WidgetWithChildrenGesture);
+ D->grabGesture(ThirdGesture, Qt::WidgetWithChildrenGesture);
+ D->grabGesture(SeventhGesture, Qt::WidgetWithChildrenGesture);
+
+ // make sure all widgets ignore events, so they get propagated.
+ QSet<Qt::GestureType> allGestureTypes;
+ allGestureTypes << FirstGesture << SecondGesture << ThirdGesture
+ << FourthGesture << FifthGesture << SixthGesture << SeventhGesture;
+ A->ignoredGestures = B->ignoredGestures = allGestureTypes;
+ C->ignoredGestures = D->ignoredGestures = allGestureTypes;
+
+ CustomEvent event;
+ sendCustomGesture(&event, D);
+
+ static const int TotalGestureEventsCount = CustomGesture::SerialFinishedThreshold - CustomGesture::SerialStartedThreshold + 1;
+
+ // gesture override events
+ QCOMPARE(D->overrideEvents.all.count(FirstGesture), 1);
+ QCOMPARE(D->overrideEvents.all.count(SecondGesture), 0);
+ QCOMPARE(D->overrideEvents.all.count(ThirdGesture), 1);
+
+ QCOMPARE(C->overrideEvents.all.count(FirstGesture), 1);
+ QCOMPARE(C->overrideEvents.all.count(SecondGesture), 1);
+ QCOMPARE(C->overrideEvents.all.count(ThirdGesture), 1);
+
+ QCOMPARE(B->overrideEvents.all.count(FirstGesture), 0);
+ QCOMPARE(B->overrideEvents.all.count(SecondGesture), 1);
+ QCOMPARE(B->overrideEvents.all.count(ThirdGesture), 1);
+
+ QCOMPARE(A->overrideEvents.all.count(FirstGesture), 1);
+ QCOMPARE(A->overrideEvents.all.count(SecondGesture), 0);
+ QCOMPARE(A->overrideEvents.all.count(ThirdGesture), 1);
+
+ // normal gesture events
+ QCOMPARE(D->events.all.count(FirstGesture), TotalGestureEventsCount);
+ QCOMPARE(D->events.all.count(SecondGesture), 0);
+ QCOMPARE(D->events.all.count(ThirdGesture), TotalGestureEventsCount);
+ QCOMPARE(D->events.all.count(FourthGesture), 0);
+ QCOMPARE(D->events.all.count(FifthGesture), 0);
+ QCOMPARE(D->events.all.count(SixthGesture), 0);
+ QCOMPARE(D->events.all.count(SeventhGesture), TotalGestureEventsCount);
+
+ QCOMPARE(C->events.all.count(FirstGesture), TotalGestureEventsCount);
+ QCOMPARE(C->events.all.count(SecondGesture), TotalGestureEventsCount);
+ QCOMPARE(C->events.all.count(ThirdGesture), TotalGestureEventsCount);
+ QCOMPARE(C->events.all.count(FourthGesture), 0);
+ QCOMPARE(C->events.all.count(FifthGesture), 0);
+ QCOMPARE(C->events.all.count(SixthGesture), TotalGestureEventsCount);
+ QCOMPARE(C->events.all.count(SeventhGesture), 0);
+
+ QCOMPARE(B->events.all.count(FirstGesture), 0);
+ QCOMPARE(B->events.all.count(SecondGesture), TotalGestureEventsCount);
+ QCOMPARE(B->events.all.count(ThirdGesture), TotalGestureEventsCount);
+ QCOMPARE(B->events.all.count(FourthGesture), 0);
+ QCOMPARE(B->events.all.count(FifthGesture), TotalGestureEventsCount);
+ QCOMPARE(B->events.all.count(SixthGesture), 0);
+ QCOMPARE(B->events.all.count(SeventhGesture), 0);
+
+ QCOMPARE(A->events.all.count(FirstGesture), TotalGestureEventsCount);
+ QCOMPARE(A->events.all.count(SecondGesture), 0);
+ QCOMPARE(A->events.all.count(ThirdGesture), TotalGestureEventsCount);
+ QCOMPARE(A->events.all.count(FourthGesture), TotalGestureEventsCount);
+ QCOMPARE(A->events.all.count(FifthGesture), 0);
+ QCOMPARE(A->events.all.count(SixthGesture), 0);
+ QCOMPARE(A->events.all.count(SeventhGesture), 0);
+}
+
+void tst_Gestures::testMapToScene()
+{
+ QGesture gesture;
+ QList<QGesture*> list;
+ list << &gesture;
+ QGestureEvent event(list);
+ QCOMPARE(event.mapToScene(gesture.hotSpot()), QPointF()); // not set, can't do much
+
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+
+ GestureItem *item0 = new GestureItem;
+ scene.addItem(item0);
+ item0->setPos(14, 16);
+
+ view.show(); // need to show to give it a global coordinate
+ QTest::qWaitForWindowShown(&view);
+ view.ensureVisible(scene.sceneRect());
+
+ QPoint origin = view.mapToGlobal(QPoint());
+ event.setWidget(view.viewport());
+
+ QCOMPARE(event.mapToScene(origin + QPoint(100, 200)), view.mapToScene(QPoint(100, 200)));
}
QTEST_MAIN(tst_Gestures)
diff --git a/tests/auto/linguist/lrelease/testdata/idbased.ts b/tests/auto/linguist/lrelease/testdata/idbased.ts
index 61497de..c7555c8 100644
--- a/tests/auto/linguist/lrelease/testdata/idbased.ts
+++ b/tests/auto/linguist/lrelease/testdata/idbased.ts
@@ -9,6 +9,7 @@
</message>
<message id="untranslated_id">
<source>This has no translation.</source>
+ <translation type="unfinished"></translation>
</message>
<message id="this_another_id">
<source>Foo bar.</source>
@@ -17,5 +18,11 @@
<message>
<source>Drop me!</source>
</message>
+ <message id="one_id">
+ <source></source>
+ </message>
+ <message id="two_id">
+ <source></source>
+ </message>
</context>
</TS>
diff --git a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
index ecc0594..4b62302 100644
--- a/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
+++ b/tests/auto/q3sqlcursor/tst_q3sqlcursor.cpp
@@ -152,10 +152,10 @@ void tst_Q3SqlCursor::createTestTables( QSqlDatabase db )
if ( tst_Databases::isSqlServer( db ) ) {
//workaround for SQL SERVER since he can store unicode only in nvarchar fields
QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode") + " (id int not null, "
- "t_varchar nvarchar(40) not null, t_char nchar(40) )" ));
+ "t_varchar nvarchar(80) not null, t_char nchar(80) )" ));
} else {
QVERIFY_SQL(q, exec("create table " + qTableName("qtest_unicode") + " (id int not null, "
- "t_varchar varchar(40) not null," "t_char char(40))" ));
+ "t_varchar varchar(100) not null," "t_char char(100))" ));
}
if (tst_Databases::isMSAccess(db)) {
@@ -521,8 +521,7 @@ void tst_Q3SqlCursor::unicode()
QSqlDatabase db = QSqlDatabase::database( dbName );
CHECK_DATABASE( db );
- static const unsigned short utf8arr[] = { 0xd792,0xd79c,0xd792,0xd79c,0xd799,0x20,0xd7a9,0xd799,0x00 };
- static const QString utf8str = QString::fromUcs2( utf8arr );
+ static const QString utf8str = QString::fromUtf8( "ὕαλον ϕαγεῖν δύναμαι· τοῦτο οὔ με βλάπτει." );
if ( !db.driver()->hasFeature( QSqlDriver::Unicode ) ) {
QSKIP( "DBMS not Unicode capable", SkipSingle );
}
diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp
index 3945364..3efc346 100644
--- a/tests/auto/qaudioinput/tst_qaudioinput.cpp
+++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp
@@ -146,7 +146,7 @@ void tst_QAudioInput::pullFile()
// Check state and periodSize() are valid non-zero values.
QVERIFY(audio->state() == QAudio::ActiveState);
QVERIFY(audio->error() == QAudio::NoError);
- QVERIFY(audio->clock() > 0);
+ QVERIFY(audio->clock() > 10000 && audio->clock() < 800000);
QVERIFY(audio->periodSize() > 0);
QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState
diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
index b46f88d..b001af1 100644
--- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
+++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
@@ -150,7 +150,7 @@ void tst_QAudioOutput::pullFile()
QVERIFY(audio->state() == QAudio::ActiveState);
QVERIFY(audio->error() == QAudio::NoError);
QVERIFY(audio->periodSize() > 0);
- QVERIFY(audio->clock() > 0);
+ QVERIFY(audio->clock() > 10000 && audio->clock() < 800000);
QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState
// Wait until finished...
diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp
index 6637202..0d58554e 100644
--- a/tests/auto/qdom/tst_qdom.cpp
+++ b/tests/auto/qdom/tst_qdom.cpp
@@ -322,6 +322,7 @@ void tst_QDom::toString_01_data()
*/
void tst_QDom::toString_01()
{
+ QFAIL("make test fail instead of timing out, will be fixed later (QT-2357)");
QFETCH(QString, fileName);
QFile f(fileName);
diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
index 18f94a9..83ddd39 100644
--- a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
+++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
@@ -136,7 +136,10 @@ private:
};
tst_QFiledialog::tst_QFiledialog()
-{
+{
+#if defined(Q_OS_WINCE)
+ qApp->setAutoMaximizeThreshold(-1);
+#endif
}
tst_QFiledialog::~tst_QFiledialog()
@@ -168,13 +171,21 @@ void tst_QFiledialog::cleanup()
void tst_QFiledialog::listRoot()
{
#if defined QT_BUILD_INTERNAL
+ QFileInfoGatherer fileInfoGatherer;
+ fileInfoGatherer.start();
+ QTest::qWait(1500);
+
QFileInfoGatherer::fetchedRoot = false;
QString dir(QDir::currentPath());
QNonNativeFileDialog fd(0, QString(), dir);
fd.show();
QCOMPARE(QFileInfoGatherer::fetchedRoot,false);
fd.setDirectory("");
+#ifdef Q_OS_WINCE
+ QTest::qWait(1500);
+#else
QTest::qWait(500);
+#endif
QCOMPARE(QFileInfoGatherer::fetchedRoot,true);
#endif
}
@@ -297,6 +308,7 @@ void tst_QFiledialog::emptyUncPath()
void tst_QFiledialog::task178897_minimumSize()
{
QNonNativeFileDialog fd;
+ QSize oldMs = fd.layout()->minimumSize();
QStringList history = fd.history();
history << QDir::toNativeSeparators("/verylongdirectory/"
"aaaaaaaaaabbbbbbbbcccccccccccddddddddddddddeeeeeeeeeeeeffffffffffgggtggggggggghhhhhhhhiiiiiijjjk");
@@ -304,7 +316,7 @@ void tst_QFiledialog::task178897_minimumSize()
fd.show();
QSize ms = fd.layout()->minimumSize();
- QVERIFY(ms.width() < 400);
+ QVERIFY(ms.width() <= oldMs.width());
}
void tst_QFiledialog::task180459_lastDirectory_data()
@@ -653,22 +665,33 @@ void tst_QFiledialog::task228844_ensurePreviousSorting()
fd.setDirectory(current.absolutePath());
fd.setViewMode(QFileDialog::Detail);
fd.show();
+#if defined(Q_OS_WINCE)
+ QTest::qWait(1500);
+#else
QTest::qWait(500);
+#endif
QTreeView *tree = qFindChild<QTreeView*>(&fd, "treeView");
tree->header()->setSortIndicator(3,Qt::DescendingOrder);
QTest::qWait(200);
QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
QPushButton *button = buttonBox->button(QDialogButtonBox::Open);
QTest::mouseClick(button, Qt::LeftButton);
+#if defined(Q_OS_WINCE)
+ QTest::qWait(1500);
+#else
QTest::qWait(500);
-
+#endif
QNonNativeFileDialog fd2;
fd2.setFileMode(QFileDialog::Directory);
fd2.restoreState(fd.saveState());
current.cd("aaaaaaaaaaaaaaaaaa");
fd2.setDirectory(current.absolutePath());
fd2.show();
+#if defined(Q_OS_WINCE)
+ QTest::qWait(1500);
+#else
QTest::qWait(500);
+#endif
QTreeView *tree2 = qFindChild<QTreeView*>(&fd2, "treeView");
tree2->setFocus();
@@ -678,15 +701,22 @@ void tst_QFiledialog::task228844_ensurePreviousSorting()
QPushButton *button2 = buttonBox2->button(QDialogButtonBox::Open);
fd2.selectFile("g");
QTest::mouseClick(button2, Qt::LeftButton);
+#if defined(Q_OS_WINCE)
+ QTest::qWait(1500);
+#else
QTest::qWait(500);
-
+#endif
QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QChar('/') + QLatin1String("g"));
QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName());
fd3.restoreState(fd.saveState());
fd3.setFileMode(QFileDialog::Directory);
fd3.show();
+#if defined(Q_OS_WINCE)
+ QTest::qWait(1500);
+#else
QTest::qWait(500);
+#endif
QTreeView *tree3 = qFindChild<QTreeView*>(&fd3, "treeView");
tree3->setFocus();
@@ -695,8 +725,11 @@ void tst_QFiledialog::task228844_ensurePreviousSorting()
QDialogButtonBox *buttonBox3 = qFindChild<QDialogButtonBox*>(&fd3, "buttonBox");
QPushButton *button3 = buttonBox3->button(QDialogButtonBox::Open);
QTest::mouseClick(button3, Qt::LeftButton);
+#if defined(Q_OS_WINCE)
+ QTest::qWait(1500);
+#else
QTest::qWait(500);
-
+#endif
QCOMPARE(fd3.selectedFiles().first(), tempFile->fileName());
current.cd("aaaaaaaaaaaaaaaaaa");
@@ -777,7 +810,12 @@ void tst_QFiledialog::task251321_sideBarHiddenEntries()
sidebar->setFocus();
sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
+ // give the background processes more time on windows mobile
+#ifdef Q_OS_WINCE
+ QTest::qWait(1000);
+#else
QTest::qWait(250);
+#endif
QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2);
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 286ea2d..7b87969 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -49,6 +49,14 @@
class tst_QGraphicsAnchorLayout : public QObject {
Q_OBJECT;
+public:
+ tst_QGraphicsAnchorLayout() : QObject() {
+ hasSimplification = qgetenv("QT_ANCHORLAYOUT_NO_SIMPLIFICATION").isEmpty();
+ }
+
+private:
+ bool hasSimplification;
+
private slots:
void simple();
void simple_center();
@@ -73,6 +81,7 @@ private slots:
void expandingSequenceFairDistribution();
void expandingParallel();
void floatConflict();
+ void infiniteMaxSizes();
};
class RectWidget : public QGraphicsWidget
@@ -152,6 +161,15 @@ static bool layoutHasConflict(QGraphicsAnchorLayout *l)
return QGraphicsAnchorLayoutPrivate::get(l)->hasConflicts();
}
+static bool usedSimplex(QGraphicsAnchorLayout *l, Qt::Orientation o)
+{
+ QGraphicsAnchorLayoutPrivate::Orientation oo = (o == Qt::Horizontal) ?
+ QGraphicsAnchorLayoutPrivate::Horizontal :
+ QGraphicsAnchorLayoutPrivate::Vertical;
+
+ return QGraphicsAnchorLayoutPrivate::get(l)->lastCalculationUsedSimplex[oo];
+}
+
void tst_QGraphicsAnchorLayout::simple()
{
QGraphicsWidget *w1 = createItem();
@@ -169,10 +187,16 @@ void tst_QGraphicsAnchorLayout::simple()
l->addAnchors(l, w1, Qt::Vertical);
l->addAnchors(l, w2, Qt::Vertical);
+ QCOMPARE(l->count(), 2);
+
QGraphicsWidget p;
p.setLayout(l);
+ p.adjustSize();
- QCOMPARE(l->count(), 2);
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::simple_center()
@@ -212,6 +236,11 @@ void tst_QGraphicsAnchorLayout::simple_center()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize, QSizeF(200, 20));
+ if (hasSimplification) {
+ QVERIFY(usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
+
delete p;
}
@@ -309,6 +338,9 @@ void tst_QGraphicsAnchorLayout::layoutDirection()
QCOMPARE(checkReverseDirection(p), true);
+ QVERIFY(usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+
delete p;
delete view;
}
@@ -397,6 +429,11 @@ void tst_QGraphicsAnchorLayout::diagonal()
QCOMPARE(e->geometry(), QRectF(100.0, 200.0, 75.0, 100.0));
QCOMPARE(p.size(), testA);
+ if (hasSimplification) {
+ QVERIFY(usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
+
QCOMPARE(checkReverseDirection(&p), true);
c->setMinimumWidth(300);
@@ -473,6 +510,9 @@ void tst_QGraphicsAnchorLayout::parallel()
QCOMPARE(f->geometry(), QRectF(350, 500, 100, 100));
QCOMPARE(p.size(), layoutMinimumSize);
+ if (!hasSimplification)
+ return;
+
p.resize(layoutPreferredSize);
QCOMPARE(a->geometry(), QRectF(0, 0, 150, 100));
QCOMPARE(b->geometry(), QRectF(150, 100, 150, 100));
@@ -493,6 +533,9 @@ void tst_QGraphicsAnchorLayout::parallel()
QCOMPARE(e->geometry(), QRectF(375, 400, 175, 100));
QCOMPARE(f->geometry(), QRectF(550, 500, 200, 100));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
}
void tst_QGraphicsAnchorLayout::parallel2()
@@ -538,6 +581,11 @@ void tst_QGraphicsAnchorLayout::parallel2()
p.resize(layoutMaximumSize);
QCOMPARE(p.size(), layoutMaximumSize);
+
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::snake()
@@ -729,6 +777,8 @@ void tst_QGraphicsAnchorLayout::fairDistribution()
QCOMPARE(layoutMaximumSize, QSizeF(300.0, 400.0));
p.resize(layoutMinimumSize);
+ if (!hasSimplification)
+ QEXPECT_FAIL("", "Without simplification there is no fair distribution.", Abort);
QCOMPARE(a->geometry(), QRectF(0.0, 0.0, 20.0, 100.0));
QCOMPARE(b->geometry(), QRectF(20.0, 100.0, 20.0, 100.0));
QCOMPARE(c->geometry(), QRectF(40.0, 200.0, 20.0, 100.0));
@@ -748,6 +798,11 @@ void tst_QGraphicsAnchorLayout::fairDistribution()
QCOMPARE(c->geometry(), QRectF(200.0, 200.0, 100.0, 100.0));
QCOMPARE(d->geometry(), QRectF(0.0, 300.0, 300.0, 100.0));
QCOMPARE(p.size(), layoutMaximumSize);
+
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
@@ -804,6 +859,9 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
QCOMPARE(layoutPreferredSize, QSizeF(220.0, 500.0));
QCOMPARE(layoutMaximumSize, QSizeF(400.0, 500.0));
+ if (!hasSimplification)
+ return;
+
p.resize(layoutMinimumSize);
QCOMPARE(a->size(), b->size());
QCOMPARE(a->size(), c->size());
@@ -824,6 +882,9 @@ void tst_QGraphicsAnchorLayout::fairDistributionOppositeDirections()
QCOMPARE(a->size(), d->size());
QCOMPARE(e->size().width(), 4 * a->size().width());
QCOMPARE(p.size(), layoutMaximumSize);
+
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
}
void tst_QGraphicsAnchorLayout::proportionalPreferred()
@@ -886,6 +947,11 @@ void tst_QGraphicsAnchorLayout::proportionalPreferred()
QCOMPARE(a->size().width(), 10 * factor);
QCOMPARE(c->size().width(), 14 * factor);
QCOMPARE(p.size(), QSizeF(12, 400));
+
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::example()
@@ -969,6 +1035,11 @@ void tst_QGraphicsAnchorLayout::example()
QCOMPARE(a->size(), e->size());
QCOMPARE(b->size(), d->size());
QCOMPARE(f->size(), g->size());
+
+ if (hasSimplification) {
+ QVERIFY(usedSimplex(l, Qt::Horizontal));
+ QVERIFY(usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::setSpacing()
@@ -1225,19 +1296,8 @@ void tst_QGraphicsAnchorLayout::sizePolicy()
l->setSpacing(0);
l->setContentsMargins(0, 0, 0, 0);
- // horizontal
- QGraphicsAnchor *anchor = l->addAnchor(l, Qt::AnchorLeft, w1, Qt::AnchorLeft);
- anchor->setSpacing(0);
-
- anchor = l->addAnchor(w1, Qt::AnchorRight, l, Qt::AnchorRight);
- anchor->setSpacing(0);
-
- // vertical
- anchor = l->addAnchor(l, Qt::AnchorTop, w1, Qt::AnchorTop);
- anchor->setSpacing(0);
-
- anchor = l->addAnchor(w1, Qt::AnchorBottom, l, Qt::AnchorBottom);
- anchor->setSpacing(0);
+ // horizontal and vertical
+ l->addAnchors(l, w1);
QGraphicsWidget *p = new QGraphicsWidget;
p->setLayout(l);
@@ -1287,9 +1347,53 @@ void tst_QGraphicsAnchorLayout::sizePolicy()
w1->adjustSize();
QCOMPARE(l->effectiveSizeHint(Qt::MinimumSize), QSizeF(0, 0));
- QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(100, 100));
+ QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(0, 0));
QCOMPARE(l->effectiveSizeHint(Qt::MaximumSize), QSizeF(100, 100));
+ // Anchor size policies
+ w1->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ QGraphicsAnchor *anchor = l->anchor(l, Qt::AnchorLeft, w1, Qt::AnchorLeft);
+ anchor->setSpacing(10);
+
+ // QSizePolicy::Minimum
+ anchor->setSizePolicy(QSizePolicy::Minimum);
+ QApplication::processEvents();
+
+ QCOMPARE(l->effectiveSizeHint(Qt::MinimumSize), QSizeF(60, 50));
+ QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(60, 50));
+ // The layout has a maximum size of QWIDGETSIZE_MAX, so the result won't exceed that value.
+ QCOMPARE(l->effectiveSizeHint(Qt::MaximumSize), QSizeF(QWIDGETSIZE_MAX, 50));
+
+ // QSizePolicy::Preferred
+ anchor->setSizePolicy(QSizePolicy::Preferred);
+ QApplication::processEvents();
+
+ QCOMPARE(l->effectiveSizeHint(Qt::MinimumSize), QSizeF(50, 50));
+ QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(60, 50));
+ // The layout has a maximum size of QWIDGETSIZE_MAX, so the result won't exceed that value.
+ QCOMPARE(l->effectiveSizeHint(Qt::MaximumSize), QSizeF(QWIDGETSIZE_MAX, 50));
+
+ // QSizePolicy::Maximum
+ anchor->setSizePolicy(QSizePolicy::Maximum);
+ QApplication::processEvents();
+
+ QCOMPARE(l->effectiveSizeHint(Qt::MinimumSize), QSizeF(50, 50));
+ QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(60, 50));
+ QCOMPARE(l->effectiveSizeHint(Qt::MaximumSize), QSizeF(60, 50));
+
+ // QSizePolicy::Ignored
+ anchor->setSizePolicy(QSizePolicy::Ignored);
+ QApplication::processEvents();
+
+ QCOMPARE(l->effectiveSizeHint(Qt::MinimumSize), QSizeF(50, 50));
+ QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(50, 50));
+ QCOMPARE(l->effectiveSizeHint(Qt::MaximumSize), QSizeF(QWIDGETSIZE_MAX, 50));
+
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
+
delete p;
delete view;
}
@@ -1380,6 +1484,11 @@ void tst_QGraphicsAnchorLayout::expandingSequence()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize.width(), qreal(200));
+
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution()
@@ -1441,6 +1550,11 @@ void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution()
QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize);
QCOMPARE(layoutMaximumSize.width(), qreal(400));
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
+
// Now we change D to have more "room for growth" from its preferred size
// to its maximum size. We expect a proportional fair distribution. Note that
// this seems to not conform with what QGraphicsLinearLayout does.
@@ -1463,6 +1577,11 @@ void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution()
QCOMPARE(b->geometry().size(), pref + QSizeF(25, 0));
QCOMPARE(c->geometry().size(), pref);
QCOMPARE(d->geometry().size(), pref + QSizeF(50, 0));
+
+ if (hasSimplification) {
+ QVERIFY(!usedSimplex(l, Qt::Horizontal));
+ QVERIFY(!usedSimplex(l, Qt::Vertical));
+ }
}
void tst_QGraphicsAnchorLayout::expandingParallel()
@@ -1585,5 +1704,56 @@ void tst_QGraphicsAnchorLayout::floatConflict()
delete p;
}
+void tst_QGraphicsAnchorLayout::infiniteMaxSizes()
+{
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
+ l->setContentsMargins(0, 0, 0, 0);
+ l->setSpacing(0);
+
+ QSizeF min(10, 10);
+ QSizeF pref(50, 10);
+ QSizeF max(QWIDGETSIZE_MAX, 10);
+
+ QGraphicsWidget *a = createItem(min, pref, max, "a");
+ QGraphicsWidget *b = createItem(min, pref, max, "b");
+ QGraphicsWidget *c = createItem(min, pref, max, "c");
+ QGraphicsWidget *d = createItem(min, pref, max, "d");
+
+ //<!-- Trunk -->
+ setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0);
+ setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0);
+ setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0);
+ setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0);
+ setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 0);
+
+ a->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+ c->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
+
+ QGraphicsWidget p;
+ p.setLayout(l);
+
+ p.resize(200, 10);
+ QCOMPARE(a->geometry(), QRectF(0, 0, 50, 10));
+ QCOMPARE(b->geometry(), QRectF(50, 0, 50, 10));
+ QCOMPARE(c->geometry(), QRectF(100, 0, 50, 10));
+ QCOMPARE(d->geometry(), QRectF(150, 0, 50, 10));
+
+ if (!hasSimplification)
+ QEXPECT_FAIL("", "Without simplification there is no fair distribution.", Abort);
+
+ p.resize(1000, 10);
+ QCOMPARE(a->geometry(), QRectF(0, 0, 450, 10));
+ QCOMPARE(b->geometry(), QRectF(450, 0, 50, 10));
+ QCOMPARE(c->geometry(), QRectF(500, 0, 450, 10));
+ QCOMPARE(d->geometry(), QRectF(950, 0, 50, 10));
+
+ qreal expMaxSize = (QWIDGETSIZE_MAX - 100.0) / 2;
+ p.resize(QWIDGETSIZE_MAX, 10);
+ QCOMPARE(a->geometry(), QRectF(0, 0, expMaxSize, 10));
+ QCOMPARE(b->geometry(), QRectF(expMaxSize, 0, 50, 10));
+ QCOMPARE(c->geometry(), QRectF(expMaxSize + 50, 0, expMaxSize, 10));
+ QCOMPARE(d->geometry(), QRectF(QWIDGETSIZE_MAX - 50, 0, 50, 10));
+}
+
QTEST_MAIN(tst_QGraphicsAnchorLayout)
#include "tst_qgraphicsanchorlayout.moc"
diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
index 148b2c8..1c7a159 100644
--- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
@@ -435,7 +435,7 @@ void tst_QGraphicsAnchorLayout1::testAddAndRemoveAnchor()
layout->removeAnchor(layout, Qt::AnchorLeft, widget1, Qt::AnchorLeft);
QCOMPARE( layout->count(), 4 );
- QCOMPARE( (int)widget1->parentLayoutItem(), 0 );
+ QVERIFY( !widget1->parentLayoutItem() );
// test that item is not removed from layout if other anchors remain set
layout->setAnchor(widget2, Qt::AnchorLeft, widget3, Qt::AnchorRight, 10);
@@ -1711,8 +1711,6 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
// Validate
for (int i = 0; i < result.count(); ++i) {
- if (i == 1)
- QEXPECT_FAIL("Two, mixed", "Works with simplification disabled.", Continue);
const BasicLayoutTestResult item = result[i];
QCOMPARE(widgets[item.index]->geometry(), item.rect);
}
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 554292f..e33c7b6 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -104,6 +104,7 @@ private slots:
void defaultStretchFactors();
void geometries_data();
void geometries();
+ void avoidRecursionInInsertItem();
void task236367_maxSizeHint();
};
@@ -2081,6 +2082,16 @@ void tst_QGraphicsGridLayout::geometries()
delete widget;
}
+void tst_QGraphicsGridLayout::avoidRecursionInInsertItem()
+{
+ QGraphicsWidget window(0, Qt::Window);
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout(&window);
+ QCOMPARE(layout->count(), 0);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsGridLayout::addItem: cannot insert itself");
+ layout->addItem(layout, 0, 0);
+ QCOMPARE(layout->count(), 0);
+}
+
void tst_QGraphicsGridLayout::task236367_maxSizeHint()
{
QGraphicsWidget *widget = new QGraphicsWidget;
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 0a6f60e..dcad8e1 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -398,6 +398,7 @@ private slots:
void modality_mouseGrabber();
void modality_clickFocus();
void modality_keyEvents();
+ void itemIsInFront();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -9541,5 +9542,47 @@ void tst_QGraphicsItem::modality_keyEvents()
QCOMPARE(rect1Spy.counts[QEvent::KeyRelease], 0);
}
+void tst_QGraphicsItem::itemIsInFront()
+{
+ QGraphicsScene scene;
+ QGraphicsRectItem *rect1 = new QGraphicsRectItem;
+ rect1->setData(0, "rect1");
+ scene.addItem(rect1);
+
+ QGraphicsRectItem *rect1child1 = new QGraphicsRectItem(rect1);
+ rect1child1->setZValue(1);
+ rect1child1->setData(0, "rect1child1");
+
+ QGraphicsRectItem *rect1child2 = new QGraphicsRectItem(rect1);
+ rect1child2->setParentItem(rect1);
+ rect1child2->setData(0, "rect1child2");
+
+ QGraphicsRectItem *rect1child1_1 = new QGraphicsRectItem(rect1child1);
+ rect1child1_1->setData(0, "rect1child1_1");
+
+ QGraphicsRectItem *rect1child1_2 = new QGraphicsRectItem(rect1child1);
+ rect1child1_2->setFlag(QGraphicsItem::ItemStacksBehindParent);
+ rect1child1_2->setData(0, "rect1child1_2");
+
+ QGraphicsRectItem *rect2 = new QGraphicsRectItem;
+ rect2->setData(0, "rect2");
+ scene.addItem(rect2);
+
+ QGraphicsRectItem *rect2child1 = new QGraphicsRectItem(rect2);
+ rect2child1->setData(0, "rect2child1");
+
+ QCOMPARE(qt_closestItemFirst(rect1, rect1), false);
+ QCOMPARE(qt_closestItemFirst(rect1, rect2), false);
+ QCOMPARE(qt_closestItemFirst(rect1child1, rect2child1), false);
+ QCOMPARE(qt_closestItemFirst(rect1child1, rect1child2), true);
+ QCOMPARE(qt_closestItemFirst(rect1child1_1, rect1child2), true);
+ QCOMPARE(qt_closestItemFirst(rect1child1_1, rect1child1), true);
+ QCOMPARE(qt_closestItemFirst(rect1child1_2, rect1child2), true);
+ QCOMPARE(qt_closestItemFirst(rect1child1_2, rect1child1), false);
+ QCOMPARE(qt_closestItemFirst(rect1child1_2, rect1), true);
+ QCOMPARE(qt_closestItemFirst(rect1child1_2, rect2), false);
+ QCOMPARE(qt_closestItemFirst(rect1child1_2, rect2child1), false);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 4f28df4..546f92d 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -101,6 +101,7 @@ private slots:
void updateGeometry();
void layoutDirection();
void removeLayout();
+ void avoidRecursionInInsertItem();
// Task specific tests
void task218400_insertStretchCrash();
@@ -146,7 +147,7 @@ void tst_QGraphicsLinearLayout::initTestCase()
// since the style will influence the results, we have to ensure
// that the tests are run using the same style on all platforms
#ifdef Q_WS_S60
- QApplication::setStyle(new QWindowsStyle);
+ QApplication::setStyle(new QWindowsStyle);
#else
QApplication::setStyle(new QPlastiqueStyle);
#endif
@@ -332,6 +333,7 @@ void tst_QGraphicsLinearLayout::alignment()
widget->resize(newSize);
view.show();
widget->show();
+ QTest::qWaitForWindowShown(&view);
QApplication::processEvents();
int x = 0;
@@ -1431,6 +1433,16 @@ void tst_QGraphicsLinearLayout::removeLayout()
QCOMPARE(pushButton->geometry(), r2);
}
+void tst_QGraphicsLinearLayout::avoidRecursionInInsertItem()
+{
+ QGraphicsWidget window(0, Qt::Window);
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(&window);
+ QCOMPARE(layout->count(), 0);
+ QTest::ignoreMessage(QtWarningMsg, "QGraphicsLinearLayout::insertItem: cannot insert itself");
+ layout->insertItem(0, layout);
+ QCOMPARE(layout->count(), 0);
+}
+
void tst_QGraphicsLinearLayout::task218400_insertStretchCrash()
{
QGraphicsScene *scene = new QGraphicsScene;
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 013a028..9269164 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -1287,6 +1287,7 @@ void tst_QGraphicsProxyWidget::paintEvent()
QGraphicsView view(&scene);
view.show();
QTest::qWaitForWindowShown(&view);
+ QTest::qWait(70);
SubQGraphicsProxyWidget proxy;
@@ -1297,14 +1298,14 @@ void tst_QGraphicsProxyWidget::paintEvent()
w->show();
QTest::qWaitForWindowShown(w);
QApplication::processEvents();
- QTest::qWait(50);
+ QTest::qWait(100);
proxy.setWidget(w);
scene.addItem(&proxy);
//make sure we flush all the paint events
QTest::qWait(70);
QTRY_VERIFY(proxy.paintCount > 1);
- QTest::qWait(70);
+ QTest::qWait(110);
proxy.paintCount = 0;
w->update();
@@ -2006,8 +2007,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
edit1->setText("QLineEdit 1");
QLineEdit *edit2 = new QLineEdit;
edit2->setText("QLineEdit 2");
+ QFontComboBox *fontComboBox = new QFontComboBox;
QVBoxLayout *vlayout = new QVBoxLayout;
vlayout->addWidget(edit1);
+ vlayout->addWidget(fontComboBox);
vlayout->addWidget(edit2);
QGroupBox *box = new QGroupBox("QGroupBox");
@@ -2019,8 +2022,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
edit1_2->setText("QLineEdit 1_2");
QLineEdit *edit2_2 = new QLineEdit;
edit2_2->setText("QLineEdit 2_2");
+ QFontComboBox *fontComboBox2 = new QFontComboBox;
vlayout = new QVBoxLayout;
vlayout->addWidget(edit1_2);
+ vlayout->addWidget(fontComboBox2);
vlayout->addWidget(edit2_2);
QGroupBox *box_2 = new QGroupBox("QGroupBox 2");
@@ -2061,8 +2066,10 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
EventSpy eventSpy(edit1);
EventSpy eventSpy2(edit2);
+ EventSpy eventSpy3(fontComboBox);
EventSpy eventSpy1_2(edit1_2);
EventSpy eventSpy2_2(edit2_2);
+ EventSpy eventSpy2_3(fontComboBox2);
EventSpy eventSpyBox(box);
// Tab into group box
@@ -2083,11 +2090,24 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1);
QCOMPARE(eventSpy.counts[QEvent::FocusOut], 0);
+ // Tab to the font combobox
+ QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
+ QApplication::processEvents();
+ fontComboBox->hasFocus();
+ QVERIFY(!edit2->hasFocus());
+ QCOMPARE(eventSpy3.counts[QEvent::FocusIn], 1);
+ QCOMPARE(eventSpy3.counts[QEvent::FocusOut], 0);
+ QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1);
+ QCOMPARE(eventSpy.counts[QEvent::FocusOut], 1);
+
// Tab into line edit 2
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
QApplication::processEvents();
edit2->hasFocus();
QVERIFY(!edit1->hasFocus());
+ QCOMPARE(eventSpy2.counts[QEvent::FocusIn], 1);
+ QCOMPARE(eventSpy2.counts[QEvent::FocusOut], 0);
+ QCOMPARE(eventSpy3.counts[QEvent::FocusOut], 1);
QCOMPARE(eventSpy.counts[QEvent::FocusIn], 1);
QCOMPARE(eventSpy.counts[QEvent::FocusOut], 1);
@@ -2105,6 +2125,16 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1);
QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 0);
+ // Tab into right font combobox
+ QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
+ QApplication::processEvents();
+ QVERIFY(!edit1_2->hasFocus());
+ fontComboBox2->hasFocus();
+ QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1);
+ QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 1);
+ QCOMPARE(eventSpy2_3.counts[QEvent::FocusIn], 1);
+ QCOMPARE(eventSpy2_3.counts[QEvent::FocusOut], 0);
+
// Tab into right bottom line edit
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Tab);
QApplication::processEvents();
@@ -2112,6 +2142,8 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
edit2_2->hasFocus();
QCOMPARE(eventSpy1_2.counts[QEvent::FocusIn], 1);
QCOMPARE(eventSpy1_2.counts[QEvent::FocusOut], 1);
+ QCOMPARE(eventSpy2_3.counts[QEvent::FocusIn], 1);
+ QCOMPARE(eventSpy2_3.counts[QEvent::FocusOut], 1);
QCOMPARE(eventSpy2_2.counts[QEvent::FocusIn], 1);
QCOMPARE(eventSpy2_2.counts[QEvent::FocusOut], 0);
@@ -2128,6 +2160,12 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
QVERIFY(!rightDial->hasFocus());
edit2_2->hasFocus();
+ // Backtab into the right font combobox
+ QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab);
+ QApplication::processEvents();
+ QVERIFY(!edit2_2->hasFocus());
+ fontComboBox2->hasFocus();
+
// Backtab into line edit 1
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab);
QApplication::processEvents();
@@ -2146,10 +2184,16 @@ void tst_QGraphicsProxyWidget::tabFocus_complexTwoWidgets()
QVERIFY(!rightDial->hasFocus());
edit2->hasFocus();
- // Backtab into line edit 1
+ // Backtab into the font combobox
QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab);
QApplication::processEvents();
QVERIFY(!edit2->hasFocus());
+ fontComboBox->hasFocus();
+
+ // Backtab into line edit 1
+ QTest::keyPress(QApplication::focusWidget(), Qt::Key_Backtab);
+ QApplication::processEvents();
+ QVERIFY(!fontComboBox->hasFocus());
edit1->hasFocus();
// Backtab into line box
@@ -2705,7 +2749,7 @@ void tst_QGraphicsProxyWidget::windowOpacity()
view.show();
QTest::qWaitForWindowShown(&view);
QApplication::sendPostedEvents();
- QTest::qWait(50);
+ QTest::qWait(150);
qRegisterMetaType<QList<QRectF> >("QList<QRectF>");
QSignalSpy signalSpy(&scene, SIGNAL(changed(const QList<QRectF> &)));
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index b407fef..eb5c099 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -88,7 +88,7 @@ static QTransform transform2D(const QGraphicsTransform& t)
{
QMatrix4x4 m;
t.applyTo(&m);
- return m.toTransform();
+ return m.toTransform(0);
}
void tst_QGraphicsTransform::scale()
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 389200b..dc08d0e 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -3664,6 +3664,10 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not implement mouse tracking at this point", SkipAll);
+#endif
+
QGraphicsScene scene(-100, -100, 200, 200);
scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue));
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview_2.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview_2.cpp
index 9567f9e..1bfaf51 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview_2.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview_2.cpp
@@ -43,6 +43,20 @@
#include <QRectF>
#include <QTransform>
+#ifdef Q_OS_WINCE
+#include <qguifunctions_wince.h>
+
+bool qt_wince_is_high_dpi() {
+ HDC deviceContext = GetDC(0);
+ int dpi = GetDeviceCaps(deviceContext, LOGPIXELSX);
+ ReleaseDC(0, deviceContext);
+ if ((dpi < 1000) && (dpi > 0))
+ return dpi > 96;
+ else
+ return false;
+}
+#endif
+
Q_DECLARE_METATYPE(QList<int>)
Q_DECLARE_METATYPE(QList<QRectF>)
Q_DECLARE_METATYPE(QMatrix)
@@ -51,7 +65,7 @@ Q_DECLARE_METATYPE(QPointF)
Q_DECLARE_METATYPE(QRectF)
Q_DECLARE_METATYPE(Qt::ScrollBarPolicy)
-static void _scrollBarRanges_data_1()
+static void _scrollBarRanges_data_1(int offset)
{
// No motif, flat frame
QTest::newRow("1") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform()
@@ -59,73 +73,73 @@ static void _scrollBarRanges_data_1()
<< 0 << 0 << 0 << 0 << false << false;
QTest::newRow("2") << QSize(150, 100) << QRectF(0, 0, 200, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16) << 0 << 16 << false << false;
+ << 0 << (50 + offset) << 0 << offset << false << false;
QTest::newRow("3") << QSize(150, 100) << QRectF(0, 0, 200, 200) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16) << 0 << (100 + 16) << false << false;
+ << 0 << (50 + offset) << 0 << (100 + offset) << false << false;
QTest::newRow("4") << QSize(150, 100) << QRectF(-100, -100, 150, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
<< 0 << 0 << 0 << 0 << false << false;
QTest::newRow("5") << QSize(150, 100) << QRectF(-100, -100, 200, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -100 << (16-50) << -100 << (-100 + 16) << false << false;
+ << -100 << (offset -50) << -100 << (-100 + offset) << false << false;
QTest::newRow("6") << QSize(150, 100) << QRectF(-100, -100, 200, 200) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -100 << (16-50) << -100 << 16 << false << false;
+ << -100 << (offset -50) << -100 << offset << false << false;
QTest::newRow("7") << QSize(150, 100) << QRectF(0, 0, 151, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << 17 << 0 << 17 << false << false;
+ << 0 << (offset + 1) << 0 << offset + 1 << false << false;
QTest::newRow("8") << QSize(150, 100) << QRectF(0, 0, 201, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 17) << 0 << 17 << false << false;
+ << 0 << (50 + offset + 1) << 0 << offset + 1 << false << false;
QTest::newRow("9") << QSize(150, 100) << QRectF(0, 0, 201, 201) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 17) << 0 << (100 + 17) << false << false;
+ << 0 << (50 + offset + 1) << 0 << (100 + offset + 1) << false << false;
QTest::newRow("10") << QSize(150, 100) << QRectF(-101, -101, 151, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -101 << (-100 + 16) << -101 << (-100 + 16) << false << false;
+ << -101 << (-100 + offset) << -101 << (-100 + offset) << false << false;
QTest::newRow("11") << QSize(150, 100) << QRectF(-101, -101, 201, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-101) << (16-50) << -101 << (-100 + 16) << false << false;
+ << (-101) << (offset + -50) << -101 << (-100 + offset) << false << false;
QTest::newRow("12") << QSize(150, 100) << QRectF(-101, -101, 201, 201) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-101) << (16-50) << (-101) << 16 << false << false;
+ << (-101) << (offset -50) << (-101) << offset << false << false;
QTest::newRow("13") << QSize(150, 100) << QRectF(0, 0, 166, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (16 + 16) << 0 << (16 + 16) << false << false;
+ << 0 << (offset + 16) << 0 << (offset + 16) << false << false;
QTest::newRow("14") << QSize(150, 100) << QRectF(0, 0, 216, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 16) << 0 << (16 + 16) << false << false;
+ << 0 << (50 + offset + 16) << 0 << (offset + 16) << false << false;
QTest::newRow("15") << QSize(150, 100) << QRectF(0, 0, 216, 216) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 16) << 0 << (100 + 16 + 16) << false << false;
+ << 0 << (50 + offset + 16) << 0 << (100 + offset + 16) << false << false;
QTest::newRow("16") << QSize(150, 100) << QRectF(-116, -116, 166, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (-100 + 16) << (-100 - 16) << (-100 + 16) << false << false;
+ << (-100 - 16) << (-100 + offset) << (-100 - 16 ) << (-100 + offset) << false << false;
QTest::newRow("17") << QSize(150, 100) << QRectF(-116, -116, 216, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (16-50) << (-100 - 16) << (-100 + 16) << false << false;
+ << (-100 - 16) << (offset -50) << (-100 - 16) << (-100 + offset) << false << false;
QTest::newRow("18") << QSize(150, 100) << QRectF(-116, -116, 216, 216) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (16-50) << (-100 - 16) << 16 << false << false;
+ << (-100 - 16) << (offset -50) << (-100 - 16) << offset << false << false;
QTest::newRow("1 x2") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (150 + 16) << 0 << (100 + 16) << false << false;
+ << 0 << (150 + offset) << 0 << (100 + offset) << false << false;
QTest::newRow("2 x2") << QSize(150, 100) << QRectF(0, 0, 200, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (250 + 16) << 0 << (100 + 16) << false << false;
+ << 0 << (250 + offset) << 0 << (100 + offset) << false << false;
QTest::newRow("3 x2") << QSize(150, 100) << QRectF(0, 0, 200, 200) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (250 + 16) << 0 << (300 + 16) << false << false;
+ << 0 << (250 + offset) << 0 << (300 + offset) << false << false;
QTest::newRow("4 x2") << QSize(150, 100) << QRectF(-100, -100, 150, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (-50 + 16) << -200 << (-100 + 16) << false << false;
+ << -200 << (-50 + offset) << -200 << (-100 + offset) << false << false;
QTest::newRow("5 x2") << QSize(150, 100) << QRectF(-100, -100, 200, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (50 + 16) << -200 << (-100 + 16) << false << false;
+ << -200 << (50 + offset) << -200 << (-100 + offset) << false << false;
QTest::newRow("6 x2") << QSize(150, 100) << QRectF(-100, -100, 200, 200) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (50 + 16) << -200 << (100 + 16) << false << false;
+ << -200 << (50 + offset) << -200 << (100 + offset) << false << false;
QTest::newRow("1 No ScrollBars") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform()
<< Qt::ScrollBarAlwaysOff << Qt::ScrollBarAlwaysOff
<< 0 << 0 << 0 << 0 << false << false;
@@ -272,7 +286,7 @@ static void _scrollBarRanges_data_1()
<< -200 << (50 + 16) << -200 << (100 + 16) << false << false;
}
-static void _scrollBarRanges_data_2()
+static void _scrollBarRanges_data_2(int offset)
{
// Motif, flat frame
QTest::newRow("Motif, 1") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform()
@@ -280,73 +294,73 @@ static void _scrollBarRanges_data_2()
<< 0 << 0 << 0 << 0 << true << false;
QTest::newRow("Motif, 2") << QSize(150, 100) << QRectF(0, 0, 200, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16) << 0 << 16 << true << false;
+ << 0 << (50 + offset) << 0 << offset << true << false;
QTest::newRow("Motif, 3") << QSize(150, 100) << QRectF(0, 0, 200, 200) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16) << 0 << (100 + 16) << true << false;
+ << 0 << (50 + offset) << 0 << (100 + offset) << true << false;
QTest::newRow("Motif, 4") << QSize(150, 100) << QRectF(-100, -100, 150, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
<< 0 << 0 << 0 << 0 << true << false;
QTest::newRow("Motif, 5") << QSize(150, 100) << QRectF(-100, -100, 200, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -100 << (16-50) << -100 << (-100 + 16) << true << false;
+ << -100 << (offset-50) << -100 << (-100 + offset) << true << false;
QTest::newRow("Motif, 6") << QSize(150, 100) << QRectF(-100, -100, 200, 200) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -100 << (16-50) << -100 << 16 << true << false;
+ << -100 << (offset-50) << -100 << offset << true << false;
QTest::newRow("Motif, 7") << QSize(150, 100) << QRectF(0, 0, 151, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << 17 << 0 << 17 << true << false;
+ << 0 << offset + 1 << 0 << offset + 1 << true << false;
QTest::newRow("Motif, 8") << QSize(150, 100) << QRectF(0, 0, 201, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 17) << 0 << 17 << true << false;
+ << 0 << (50 + offset + 1) << 0 << offset + 1 << true << false;
QTest::newRow("Motif, 9") << QSize(150, 100) << QRectF(0, 0, 201, 201) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 17) << 0 << (100 + 17) << true << false;
+ << 0 << (50 + offset + 1) << 0 << (100 + offset + 1) << true << false;
QTest::newRow("Motif, 10") << QSize(150, 100) << QRectF(-101, -101, 151, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -101 << (-100 + 16) << -101 << (-100 + 16) << true << false;
+ << -101 << (-100 + offset) << -101 << (-100 + offset) << true << false;
QTest::newRow("Motif, 11") << QSize(150, 100) << QRectF(-101, -101, 201, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-101) << (16-50) << -101 << (-100 + 16) << true << false;
+ << (-101) << (offset-50) << -101 << (-100 + offset) << true << false;
QTest::newRow("Motif, 12") << QSize(150, 100) << QRectF(-101, -101, 201, 201) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-101) << (16-50) << (-101) << 16 << true << false;
+ << (-101) << (offset-50) << (-101) << offset << true << false;
QTest::newRow("Motif, 13") << QSize(150, 100) << QRectF(0, 0, 166, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (16 + 16) << 0 << (16 + 16) << true << false;
+ << 0 << (offset + 16) << 0 << (offset + 16) << true << false;
QTest::newRow("Motif, 14") << QSize(150, 100) << QRectF(0, 0, 216, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 16) << 0 << (16 + 16) << true << false;
+ << 0 << (50 + offset + 16) << 0 << (offset + 16) << true << false;
QTest::newRow("Motif, 15") << QSize(150, 100) << QRectF(0, 0, 216, 216) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 16) << 0 << (100 + 16 + 16) << true << false;
+ << 0 << (50 + offset + 16) << 0 << (100 + offset + 16) << true << false;
QTest::newRow("Motif, 16") << QSize(150, 100) << QRectF(-116, -116, 166, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (-100 + 16) << (-100 - 16) << (-100 + 16) << true << false;
+ << (-100 - 16) << (-100 + offset) << (-100 - 16) << (-100 + offset) << true << false;
QTest::newRow("Motif, 17") << QSize(150, 100) << QRectF(-116, -116, 216, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (16-50) << (-100 - 16) << (-100 + 16) << true << false;
+ << (-100 - 16) << (offset-50) << (-100 - 16) << (-100 + offset) << true << false;
QTest::newRow("Motif, 18") << QSize(150, 100) << QRectF(-116, -116, 216, 216) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (16-50) << (-100 - 16) << 16 << true << false;
+ << (-100 - 16) << (offset-50) << (-100 - 16) << offset << true << false;
QTest::newRow("Motif, 1 x2") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (150 + 16) << 0 << (100 + 16) << true << false;
+ << 0 << (150 + offset) << 0 << (100 + offset) << true << false;
QTest::newRow("Motif, 2 x2") << QSize(150, 100) << QRectF(0, 0, 200, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (250 + 16) << 0 << (100 + 16) << true << false;
+ << 0 << (250 + offset) << 0 << (100 + offset) << true << false;
QTest::newRow("Motif, 3 x2") << QSize(150, 100) << QRectF(0, 0, 200, 200) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (250 + 16) << 0 << (300 + 16) << true << false;
+ << 0 << (250 + offset) << 0 << (300 + offset) << true << false;
QTest::newRow("Motif, 4 x2") << QSize(150, 100) << QRectF(-100, -100, 150, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (-50 + 16) << -200 << (-100 + 16) << true << false;
+ << -200 << (-50 + offset) << -200 << (-100 + offset) << true << false;
QTest::newRow("Motif, 5 x2") << QSize(150, 100) << QRectF(-100, -100, 200, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (50 + 16) << -200 << (-100 + 16) << true << false;
+ << -200 << (50 + offset) << -200 << (-100 + offset) << true << false;
QTest::newRow("Motif, 6 x2") << QSize(150, 100) << QRectF(-100, -100, 200, 200) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (50 + 16) << -200 << (100 + 16) << true << false;
+ << -200 << (50 + offset) << -200 << (100 + offset) << true << false;
QTest::newRow("Motif, 1 No ScrollBars") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform()
<< Qt::ScrollBarAlwaysOff << Qt::ScrollBarAlwaysOff
<< 0 << 0 << 0 << 0 << true << false;
@@ -493,7 +507,7 @@ static void _scrollBarRanges_data_2()
<< -200 << (50 + 16) << -200 << (100 + 16) << true << false;
}
-static void _scrollBarRanges_data_3()
+static void _scrollBarRanges_data_3(int offset)
{
// No motif, styled panel
QTest::newRow("Styled, 1") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform()
@@ -501,73 +515,73 @@ static void _scrollBarRanges_data_3()
<< 0 << 0 << 0 << 0 << false << true;
QTest::newRow("Styled, 2") << QSize(150, 100) << QRectF(0, 0, 200, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16) << 0 << 16 << false << true;
+ << 0 << (50 + offset) << 0 << offset << false << true;
QTest::newRow("Styled, 3") << QSize(150, 100) << QRectF(0, 0, 200, 200) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16) << 0 << (100 + 16) << false << true;
+ << 0 << (50 + offset) << 0 << (100 + offset) << false << true;
QTest::newRow("Styled, 4") << QSize(150, 100) << QRectF(-100, -100, 150, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
<< 0 << 0 << 0 << 0 << false << true;
QTest::newRow("Styled, 5") << QSize(150, 100) << QRectF(-100, -100, 200, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -100 << (16-50) << -100 << (-100 + 16) << false << true;
+ << -100 << (offset-50) << -100 << (-100 + offset) << false << true;
QTest::newRow("Styled, 6") << QSize(150, 100) << QRectF(-100, -100, 200, 200) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -100 << (16-50) << -100 << 16 << false << true;
+ << -100 << (offset-50) << -100 << offset << false << true;
QTest::newRow("Styled, 7") << QSize(150, 100) << QRectF(0, 0, 151, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << 17 << 0 << 17 << false << true;
+ << 0 << offset + 1 << 0 << offset + 1 << false << true;
QTest::newRow("Styled, 8") << QSize(150, 100) << QRectF(0, 0, 201, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 17) << 0 << 17 << false << true;
+ << 0 << (50 + offset + 1) << 0 << offset + 1 << false << true;
QTest::newRow("Styled, 9") << QSize(150, 100) << QRectF(0, 0, 201, 201) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 17) << 0 << (100 + 17) << false << true;
+ << 0 << (50 + offset + 1) << 0 << (100 + offset + 1) << false << true;
QTest::newRow("Styled, 10") << QSize(150, 100) << QRectF(-101, -101, 151, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -101 << (-100 + 16) << -101 << (-100 + 16) << false << true;
+ << -101 << (-100 + offset) << -101 << (-100 + offset) << false << true;
QTest::newRow("Styled, 11") << QSize(150, 100) << QRectF(-101, -101, 201, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-101) << (16-50) << -101 << (-100 + 16) << false << true;
+ << (-101) << (offset-50) << -101 << (-100 + offset) << false << true;
QTest::newRow("Styled, 12") << QSize(150, 100) << QRectF(-101, -101, 201, 201) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-101) << (16-50) << (-101) << 16 << false << true;
+ << (-101) << (offset-50) << (-101) << offset << false << true;
QTest::newRow("Styled, 13") << QSize(150, 100) << QRectF(0, 0, 166, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (16 + 16) << 0 << (16 + 16) << false << true;
+ << 0 << (offset + 16) << 0 << (offset + 16) << false << true;
QTest::newRow("Styled, 14") << QSize(150, 100) << QRectF(0, 0, 216, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 16) << 0 << (16 + 16) << false << true;
+ << 0 << (50 + offset + 16) << 0 << (offset + 16) << false << true;
QTest::newRow("Styled, 15") << QSize(150, 100) << QRectF(0, 0, 216, 216) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 16) << 0 << (100 + 16 + 16) << false << true;
+ << 0 << (50 + offset + 16) << 0 << (100 + offset + 16) << false << true;
QTest::newRow("Styled, 16") << QSize(150, 100) << QRectF(-116, -116, 166, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (-100 + 16) << (-100 - 16) << (-100 + 16) << false << true;
+ << (-100 - 16) << (-100 + offset) << (-100 - 16) << (-100 + offset) << false << true;
QTest::newRow("Styled, 17") << QSize(150, 100) << QRectF(-116, -116, 216, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (16-50) << (-100 - 16) << (-100 + 16) << false << true;
+ << (-100 - 16) << (offset-50) << (-100 - 16) << (-100 + offset) << false << true;
QTest::newRow("Styled, 18") << QSize(150, 100) << QRectF(-116, -116, 216, 216) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (16-50) << (-100 - 16) << 16 << false << true;
+ << (-100 - 16) << (offset-50) << (-100 - 16) << offset << false << true;
QTest::newRow("Styled, 1 x2") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (150 + 16) << 0 << (100 + 16) << false << true;
+ << 0 << (150 + offset) << 0 << (100 + offset) << false << true;
QTest::newRow("Styled, 2 x2") << QSize(150, 100) << QRectF(0, 0, 200, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (250 + 16) << 0 << (100 + 16) << false << true;
+ << 0 << (250 + offset) << 0 << (100 + offset) << false << true;
QTest::newRow("Styled, 3 x2") << QSize(150, 100) << QRectF(0, 0, 200, 200) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (250 + 16) << 0 << (300 + 16) << false << true;
+ << 0 << (250 + offset) << 0 << (300 + offset) << false << true;
QTest::newRow("Styled, 4 x2") << QSize(150, 100) << QRectF(-100, -100, 150, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (-50 + 16) << -200 << (-100 + 16) << false << true;
+ << -200 << (-50 + offset) << -200 << (-100 + offset) << false << true;
QTest::newRow("Styled, 5 x2") << QSize(150, 100) << QRectF(-100, -100, 200, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (50 + 16) << -200 << (-100 + 16) << false << true;
+ << -200 << (50 + offset) << -200 << (-100 + offset) << false << true;
QTest::newRow("Styled, 6 x2") << QSize(150, 100) << QRectF(-100, -100, 200, 200) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (50 + 16) << -200 << (100 + 16) << false << true;
+ << -200 << (50 + offset) << -200 << (100 + offset) << false << true;
QTest::newRow("Styled, 1 No ScrollBars") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform()
<< Qt::ScrollBarAlwaysOff << Qt::ScrollBarAlwaysOff
<< 0 << 0 << 0 << 0 << false << true;
@@ -714,7 +728,7 @@ static void _scrollBarRanges_data_3()
<< -200 << (50 + 16) << -200 << (100 + 16) << false << true;
}
-static void _scrollBarRanges_data_4()
+static void _scrollBarRanges_data_4(int offset)
{
// Motif, styled panel
QTest::newRow("Motif, Styled, 1") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform()
@@ -722,73 +736,73 @@ static void _scrollBarRanges_data_4()
<< 0 << 0 << 0 << 0 << true << true;
QTest::newRow("Motif, Styled, 2") << QSize(150, 100) << QRectF(0, 0, 200, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 4) << 0 << (16 + 4) << true << true;
+ << 0 << (50 + offset + 4) << 0 << (offset + 4) << true << true;
QTest::newRow("Motif, Styled, 3") << QSize(150, 100) << QRectF(0, 0, 200, 200) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 4) << 0 << (100 + 16 + 4) << true << true;
+ << 0 << (50 + offset + 4) << 0 << (100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 4") << QSize(150, 100) << QRectF(-100, -100, 150, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
<< 0 << 0 << 0 << 0 << true << true;
QTest::newRow("Motif, Styled, 5") << QSize(150, 100) << QRectF(-100, -100, 200, 100) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -100 << (16 + 4 - 50) << -100 << (-100 + 16 + 4) << true << true;
+ << -100 << (offset + 4 - 50) << -100 << (-100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 6") << QSize(150, 100) << QRectF(-100, -100, 200, 200) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -100 << (16 + 4 - 50) << -100 << (16 + 4) << true << true;
+ << -100 << (offset + 4 - 50) << -100 << (offset + 4) << true << true;
QTest::newRow("Motif, Styled, 7") << QSize(150, 100) << QRectF(0, 0, 151, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (17 + 4) << 0 << (17 + 4) << true << true;
+ << 0 << (offset + 1 + 4) << 0 << (offset + 1 + 4) << true << true;
QTest::newRow("Motif, Styled, 8") << QSize(150, 100) << QRectF(0, 0, 201, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 17 + 4) << 0 << (17 + 4) << true << true;
+ << 0 << (50 + offset + 1 + 4) << 0 << (offset + 1 + 4) << true << true;
QTest::newRow("Motif, Styled, 9") << QSize(150, 100) << QRectF(0, 0, 201, 201) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 17 + 4) << 0 << (100 + 17 + 4) << true << true;
+ << 0 << (50 + offset + 1 + 4) << 0 << (100 + offset + 1 + 4) << true << true;
QTest::newRow("Motif, Styled, 10") << QSize(150, 100) << QRectF(-101, -101, 151, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -101 << (-100 + 16 + 4) << -101 << (-100 + 16 + 4) << true << true;
+ << -101 << (-100 + offset + 4) << -101 << (-100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 11") << QSize(150, 100) << QRectF(-101, -101, 201, 101) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-101) << (16 + 4 - 50) << -101 << (-100 + 16 + 4) << true << true;
+ << (-101) << (offset + 4 - 50) << -101 << (-100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 12") << QSize(150, 100) << QRectF(-101, -101, 201, 201) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-101) << (16 + 4 - 50) << (-101) << (16 + 4) << true << true;
+ << (-101) << (offset + 4 - 50) << (-101) << (offset + 4) << true << true;
QTest::newRow("Motif, Styled, 13") << QSize(150, 100) << QRectF(0, 0, 166, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (16 + 16 + 4) << 0 << (16 + 16 + 4) << true << true;
+ << 0 << (offset + 16 + 4) << 0 << (offset + 16 + 4) << true << true;
QTest::newRow("Motif, Styled, 14") << QSize(150, 100) << QRectF(0, 0, 216, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 16 + 4) << 0 << (16 + 16 + 4) << true << true;
+ << 0 << (50 + offset + 16 + 4) << 0 << (offset + 16 + 4) << true << true;
QTest::newRow("Motif, Styled, 15") << QSize(150, 100) << QRectF(0, 0, 216, 216) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (50 + 16 + 16 + 4) << 0 << (100 + 16 + 16 + 4) << true << true;
+ << 0 << (50 + offset + 16 + 4) << 0 << (100 + offset + 16 + 4) << true << true;
QTest::newRow("Motif, Styled, 16") << QSize(150, 100) << QRectF(-116, -116, 166, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (-100 + 16 + 4) << (-100 - 16) << (-100 + 16 + 4) << true << true;
+ << (-100 - 16) << (-100 + offset + 4) << (-100 - 16) << (-100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 17") << QSize(150, 100) << QRectF(-116, -116, 216, 116) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (16 + 4 - 50) << (-100 - 16) << (-100 + 16 + 4) << true << true;
+ << (-100 - 16) << (offset + 4 - 50) << (-100 - 16) << (-100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 18") << QSize(150, 100) << QRectF(-116, -116, 216, 216) << QTransform()
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << (-100 - 16) << (16 + 4 - 50) << (-100 - 16) << (16 + 4) << true << true;
+ << (-100 - 16) << (offset + 4 - 50) << (-100 - 16) << (offset + 4) << true << true;
QTest::newRow("Motif, Styled, 1 x2") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (150 + 16 + 4) << 0 << (100 + 16 + 4) << true << true;
+ << 0 << (150 + offset + 4) << 0 << (100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 2 x2") << QSize(150, 100) << QRectF(0, 0, 200, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (250 + 16 + 4) << 0 << (100 + 16 + 4) << true << true;
+ << 0 << (250 + offset + 4) << 0 << (100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 3 x2") << QSize(150, 100) << QRectF(0, 0, 200, 200) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << 0 << (250 + 16 + 4) << 0 << (300 + 16 + 4) << true << true;
+ << 0 << (250 + offset + 4) << 0 << (300 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 4 x2") << QSize(150, 100) << QRectF(-100, -100, 150, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (-50 + 16 + 4) << -200 << (-100 + 16 + 4) << true << true;
+ << -200 << (-50 + offset + 4) << -200 << (-100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 5 x2") << QSize(150, 100) << QRectF(-100, -100, 200, 100) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (50 + 16 + 4) << -200 << (-100 + 16 + 4) << true << true;
+ << -200 << (50 + offset + 4) << -200 << (-100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 6 x2") << QSize(150, 100) << QRectF(-100, -100, 200, 200) << QTransform().scale(2, 2)
<< Qt::ScrollBarAsNeeded << Qt::ScrollBarAsNeeded
- << -200 << (50 + 16 + 4) << -200 << (100 + 16 + 4) << true << true;
+ << -200 << (50 + offset + 4) << -200 << (100 + offset + 4) << true << true;
QTest::newRow("Motif, Styled, 1 No ScrollBars") << QSize(150, 100) << QRectF(0, 0, 150, 100) << QTransform()
<< Qt::ScrollBarAlwaysOff << Qt::ScrollBarAlwaysOff
<< 0 << 0 << 0 << 0 << true << true;
@@ -949,8 +963,14 @@ void _scrollBarRanges_data()
QTest::addColumn<bool>("useMotif");
QTest::addColumn<bool>("useStyledPanel");
- _scrollBarRanges_data_1();
- _scrollBarRanges_data_2();
- _scrollBarRanges_data_3();
- _scrollBarRanges_data_4();
+ int offset = 16;
+#ifdef Q_OS_WINCE
+ if (qt_wince_is_high_dpi())
+ offset *= 2;
+#endif
+
+ _scrollBarRanges_data_1(offset);
+ _scrollBarRanges_data_2(offset);
+ _scrollBarRanges_data_3(offset);
+ _scrollBarRanges_data_4(offset);
}
diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp
index 3286768..c13e829 100644
--- a/tests/auto/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/qheaderview/tst_qheaderview.cpp
@@ -682,9 +682,12 @@ void tst_QHeaderView::visualIndexAt()
void tst_QHeaderView::length()
{
-#ifdef Q_OS_WINCE
+#if defined(Q_OS_WINCE)
QFont font(QLatin1String("Tahoma"), 7);
view->setFont(font);
+#elif defined(Q_OS_SYMBIAN)
+ QFont font(QLatin1String("Series 60 Sans"), 6);
+ view->setFont(font);
#endif
view->setStretchLastSection(true);
view->show();
diff --git a/tests/auto/qhttp/tst_qhttp.cpp b/tests/auto/qhttp/tst_qhttp.cpp
index f6d5e3e..0ea0d15 100644
--- a/tests/auto/qhttp/tst_qhttp.cpp
+++ b/tests/auto/qhttp/tst_qhttp.cpp
@@ -484,6 +484,7 @@ void tst_QHttp::post_data()
QTest::addColumn<bool>("useProxy");
QTest::addColumn<QString>("host");
QTest::addColumn<int>("port");
+ QTest::addColumn<bool>("ssl");
QTest::addColumn<QString>("path");
QTest::addColumn<QByteArray>("result");
@@ -491,25 +492,48 @@ void tst_QHttp::post_data()
md5sum = "d41d8cd98f00b204e9800998ecf8427e";
QTest::newRow("empty-data")
<< QString() << false << false
- << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
+ << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
QTest::newRow("empty-device")
<< QString() << true << false
- << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
+ << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
QTest::newRow("proxy-empty-data")
<< QString() << false << true
- << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
+ << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
md5sum = "b3e32ac459b99d3f59318f3ac31e4bee";
QTest::newRow("data") << "rfc3252.txt" << false << false
- << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi"
+ << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi"
<< md5sum;
QTest::newRow("device") << "rfc3252.txt" << true << false
- << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi"
+ << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi"
<< md5sum;
QTest::newRow("proxy-data") << "rfc3252.txt" << false << true
- << QtNetworkSettings::serverName() << 80 << "/qtest/cgi-bin/md5sum.cgi"
+ << QtNetworkSettings::serverName() << 80 << false << "/qtest/cgi-bin/md5sum.cgi"
<< md5sum;
+#ifndef QT_NO_OPENSSL
+ md5sum = "d41d8cd98f00b204e9800998ecf8427e";
+ QTest::newRow("empty-data-ssl")
+ << QString() << false << false
+ << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
+ QTest::newRow("empty-device-ssl")
+ << QString() << true << false
+ << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
+ QTest::newRow("proxy-empty-data-ssl")
+ << QString() << false << true
+ << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi" << md5sum;
+ md5sum = "b3e32ac459b99d3f59318f3ac31e4bee";
+ QTest::newRow("data-ssl") << "rfc3252.txt" << false << false
+ << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi"
+ << md5sum;
+ QTest::newRow("device-ssl") << "rfc3252.txt" << true << false
+ << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi"
+ << md5sum;
+ QTest::newRow("proxy-data-ssl") << "rfc3252.txt" << false << true
+ << QtNetworkSettings::serverName() << 443 << true << "/qtest/cgi-bin/md5sum.cgi"
+ << md5sum;
+#endif
+
// the following test won't work. See task 185996
/*
QTest::newRow("proxy-device") << "rfc3252.txt" << true << true
@@ -525,14 +549,19 @@ void tst_QHttp::post()
QFETCH(bool, useProxy);
QFETCH(QString, host);
QFETCH(int, port);
+ QFETCH(bool, ssl);
QFETCH(QString, path);
http = newHttp(useProxy);
+#ifndef QT_NO_OPENSSL
+ QObject::connect(http, SIGNAL(sslErrors(const QList<QSslError> &)),
+ http, SLOT(ignoreSslErrors()));
+#endif
QCOMPARE(http->currentId(), 0);
QCOMPARE((int)http->state(), (int)QHttp::Unconnected);
if (useProxy)
addRequest(QHttpRequestHeader(), http->setProxy(QtNetworkSettings::serverName(), 3129));
- addRequest(QHttpRequestHeader(), http->setHost(host, port));
+ addRequest(QHttpRequestHeader(), http->setHost(host, (ssl ? QHttp::ConnectionModeHttps : QHttp::ConnectionModeHttp), port));
// add the POST request
QFile file(SRCDIR + source);
diff --git a/tests/auto/qlabel/qlabel.pro b/tests/auto/qlabel/qlabel.pro
index 6d55c13..297f868 100644
--- a/tests/auto/qlabel/qlabel.pro
+++ b/tests/auto/qlabel/qlabel.pro
@@ -1,19 +1,10 @@
load(qttest_p4)
-SOURCES += tst_qlabel.cpp
-
-wince*:{
- DEFINES += SRCDIR=\\\"\\\"
-} else:!symbian {
- DEFINES += SRCDIR=\\\"$$PWD/\\\"
-}
-
-wince*|symbian {
- addFiles.sources = *.png testdata
+SOURCES += tst_qlabel.cpp
+wince*::DEFINES += SRCDIR=\\\"\\\"
+else:!symbian:DEFINES += SRCDIR=\\\"$$PWD/\\\"
+wince*|symbian {
+ addFiles.sources = *.png \
+ testdata
addFiles.path = .
DEPLOYMENT += addFiles
}
-
-
-
-
-
diff --git a/tests/auto/qlabel/tst_qlabel.cpp b/tests/auto/qlabel/tst_qlabel.cpp
index dd03ef3..9eae9c9 100644
--- a/tests/auto/qlabel/tst_qlabel.cpp
+++ b/tests/auto/qlabel/tst_qlabel.cpp
@@ -50,6 +50,7 @@
#include <qlineedit.h>
#include <qmovie.h>
#include <qpicture.h>
+#include <qmessagebox.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -112,6 +113,9 @@ private slots:
void task226479_movieResize();
void emptyPixmap();
+ void unicodeText_data();
+ void unicodeText();
+
private:
QLabel *testWidget;
QPointer<Widget> test_box;
@@ -451,5 +455,59 @@ void tst_QLabel::emptyPixmap()
QCOMPARE(label1.sizeHint(), label4.sizeHint());
}
+/**
+ Test for QTBUG-4848 - unicode data corrupting QLabel display
+*/
+void tst_QLabel::unicodeText_data()
+{
+ QTest::addColumn<QString>("text");
+ QTest::addColumn<QString>("languageName");
+
+ /*
+ The "glass" phrase in Thai was the initial report for bug QTBUG-4848, was
+ originally found on http://www.columbia.edu/kermit/utf8.html.
+
+ The phrase is from an internet tradition regarding a striking phrase
+ that is translated into many different languages. The utf8 strings
+ below were generated by using http://translate.google.com.
+
+ The glass phrase in Thai contains the ้ว character which manifests bug
+ QTBUG-4848
+
+ The last long phrase is an excerpt from Churchills "on the beaches"
+ speech, also translated using http://translate.google.com.
+ */
+
+ QTest::newRow("english") << QString::fromUtf8("I can eat glass and it doesn't hurt me.") << QString("english");
+ QTest::newRow("thai") << QString::fromUtf8("ฉันจะกินแก้วและไม่เจ็บฉัน") << QString("thai");
+ QTest::newRow("chinese") << QString::fromUtf8("我可以吃玻璃,并没有伤害我。") << QString("chinese");
+ QTest::newRow("arabic") << QString::fromUtf8("أستطيع أكل الزجاج ، وأنه لا يؤذيني.") << QString("arabic");
+ QTest::newRow("russian") << QString::fromUtf8("Я могу есть стекло, и не больно.") << QString("russian");
+ QTest::newRow("korean") << QString::fromUtf8("유리를 먹을 수있는, 그리고 그게 날 다치게하지 않습니다.") << QString("korean");
+ QTest::newRow("greek") << QString::fromUtf8("Μπορώ να φάτε γυαλί και δεν μου κάνει κακό.") << QString("greek");
+ QTest::newRow("german") << QString::fromUtf8("Ich kann Glas essen und es macht mich nicht heiß.") << QString("german");
+
+ QTest::newRow("thai_long") << QString::fromUtf8("เราจะต่อสู้ในทะเลและมหาสมุทร. เราจะต่อสู้ด้วยความมั่นใจเติบโตและความเจริญเติบโตในอากาศเราจะปกป้องเกาะของเราค่าใช้จ่ายใดๆอาจ."
+ "เราจะต่อสู้บนชายหาดเราจะต่อสู้ในบริเวณเชื่อมโยงไปถึงเราจะต่อสู้ในช่องและในถนนที่เราจะต่อสู้ในภูเขานั้นเราจะไม่ยอม.")
+ << QString("thai_long");
+}
+
+void tst_QLabel::unicodeText()
+{
+ const QString testDataPath("testdata/unicodeText");
+ QFETCH(QString, text);
+ QFETCH(QString, languageName);
+ QFrame frame;
+ QVBoxLayout *layout = new QVBoxLayout();
+ QLabel *label = new QLabel(text, &frame);
+ layout->addWidget(label);
+ layout->setMargin(8);
+ frame.setLayout(layout);
+ frame.show();
+ QTest::qWaitForWindowShown(&frame);
+ QVERIFY(frame.isVisible()); // was successfully sized and shown
+ testWidget->show();
+}
+
QTEST_MAIN(tst_QLabel)
#include "tst_qlabel.moc"
diff --git a/tests/auto/qlayout/tst_qlayout.cpp b/tests/auto/qlayout/tst_qlayout.cpp
index 9d6110d..efe14c3 100644
--- a/tests/auto/qlayout/tst_qlayout.cpp
+++ b/tests/auto/qlayout/tst_qlayout.cpp
@@ -83,6 +83,7 @@ private slots:
void layoutItemRect();
void warnIfWrongParent();
void controlTypes();
+ void adjustSizeShouldMakeSureLayoutIsActivated();
};
tst_QLayout::tst_QLayout()
@@ -110,8 +111,8 @@ void tst_QLayout::getSetCheck()
class SizeHinterFrame : public QFrame
{
public:
- SizeHinterFrame(const QSize &s)
- : QFrame(0), sh(s) {
+ SizeHinterFrame(const QSize &sh, const QSize &msh = QSize())
+ : QFrame(0), sh(sh), msh(msh) {
setFrameStyle(QFrame::Box | QFrame::Plain);
}
@@ -119,9 +120,11 @@ public:
void setSizeHint(const QSize &s) { sh = s; }
QSize sizeHint() const { return sh; }
+ QSize minimumSizeHint() const { return msh; }
private:
QSize sh;
+ QSize msh;
};
@@ -333,5 +336,26 @@ void tst_QLayout::controlTypes()
}
+void tst_QLayout::adjustSizeShouldMakeSureLayoutIsActivated()
+{
+ QWidget main;
+
+ QVBoxLayout *const layout = new QVBoxLayout(&main);
+ layout->setMargin(0);
+ SizeHinterFrame *frame = new SizeHinterFrame(QSize(200, 10), QSize(200, 8));
+ frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ layout->addWidget(frame);
+
+ SizeHinterFrame *frame2 = new SizeHinterFrame(QSize(200, 10), QSize(200, 8));
+ frame2->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ layout->addWidget(frame2);
+
+ main.show();
+
+ frame2->hide();
+ main.adjustSize();
+ QCOMPARE(main.size(), QSize(200, 10));
+}
+
QTEST_MAIN(tst_QLayout)
#include "tst_qlayout.moc"
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index 8368114..c676959 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -3304,41 +3304,45 @@ void tst_QLineEdit::task174640_editingFinished()
layout->addWidget(le2);
mw.show();
- QTest::qWait(200);
+ QApplication::setActiveWindow(&mw);
mw.activateWindow();
+ QTest::qWaitForWindowShown(&mw);
QSignalSpy editingFinishedSpy(le1, SIGNAL(editingFinished()));
le1->setFocus();
- QTest::qWait(200);
- QVERIFY(le1->hasFocus());
+ QTest::qWait(20);
+ QTRY_VERIFY(le1->hasFocus());
QCOMPARE(editingFinishedSpy.count(), 0);
le2->setFocus();
- QTest::qWait(200);
- QVERIFY(le2->hasFocus());
+ QTest::qWait(20);
+ QTRY_VERIFY(le2->hasFocus());
QCOMPARE(editingFinishedSpy.count(), 1);
editingFinishedSpy.clear();
le1->setFocus();
- QTest::qWait(200);
- QVERIFY(le1->hasFocus());
+ QTest::qWait(20);
+ QTRY_VERIFY(le1->hasFocus());
QMenu *testMenu1 = new QMenu(le1);
testMenu1->addAction("foo");
testMenu1->addAction("bar");
testMenu1->show();
- QTest::qWait(200);
+ QTest::qWaitForWindowShown(testMenu1);
+ QTest::qWait(20);
mw.activateWindow();
+
delete testMenu1;
QCOMPARE(editingFinishedSpy.count(), 0);
- QVERIFY(le1->hasFocus());
+ QTRY_VERIFY(le1->hasFocus());
QMenu *testMenu2 = new QMenu(le2);
testMenu2->addAction("foo2");
testMenu2->addAction("bar2");
testMenu2->show();
- QTest::qWait(200);
+ QTest::qWaitForWindowShown(testMenu2);
+ QTest::qWait(20);
mw.activateWindow();
delete testMenu2;
QCOMPARE(editingFinishedSpy.count(), 1);
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp
index 7599ce6a06..6e211ae 100644
--- a/tests/auto/qlistview/tst_qlistview.cpp
+++ b/tests/auto/qlistview/tst_qlistview.cpp
@@ -116,6 +116,9 @@ private slots:
void keyboardSearch();
void shiftSelectionWithNonUniformItemSizes();
void clickOnViewportClearsSelection();
+ void task262152_setModelColumnNavigate();
+ void taskQTBUG_2233_scrollHiddenItems_data();
+ void taskQTBUG_2233_scrollHiddenItems();
};
// Testing get/set functions
@@ -1767,6 +1770,64 @@ void tst_QListView::clickOnViewportClearsSelection()
}
+void tst_QListView::task262152_setModelColumnNavigate()
+{
+ QListView view;
+ QStandardItemModel model(3,2);
+ model.setItem(0,1,new QStandardItem("[0,1]"));
+ model.setItem(1,1,new QStandardItem("[1,1]"));
+ model.setItem(2,1,new QStandardItem("[2,1]"));
+
+ view.setModel(&model);
+ view.setModelColumn(1);
+
+ view.show();
+ QTest::qWait(100);
+ QTest::keyClick(&view, Qt::Key_Down);
+ QTest::qWait(100);
+ QCOMPARE(view.currentIndex(), model.index(1,1));
+ QTest::keyClick(&view, Qt::Key_Down);
+ QTest::qWait(100);
+ QCOMPARE(view.currentIndex(), model.index(2,1));
+
+}
+
+void tst_QListView::taskQTBUG_2233_scrollHiddenItems_data()
+{
+ QTest::addColumn<int>("flow");
+
+ QTest::newRow("TopToBottom") << static_cast<int>(QListView::TopToBottom);
+ QTest::newRow("LeftToRight") << static_cast<int>(QListView::LeftToRight);
+}
+
+void tst_QListView::taskQTBUG_2233_scrollHiddenItems()
+{
+ QFETCH(int, flow);
+ const int rowCount = 200;
+
+ QListView view;
+ QStringListModel model(&view);
+ QStringList list;
+ for (int i = 0; i < rowCount; ++i)
+ list << QString::fromAscii("Item %1").arg(i);
+
+ model.setStringList(list);
+ view.setModel(&model);
+ view.setViewMode(QListView::ListMode);
+ for (int i = 0; i < rowCount / 2; ++i)
+ view.setRowHidden(2 * i, true);
+ view.setFlow(static_cast<QListView::Flow>(flow));
+ view.resize(130, 130);
+
+ for (int i = 0; i < 10; ++i) {
+ (view.flow() == QListView::TopToBottom
+ ? view.verticalScrollBar()
+ : view.horizontalScrollBar())->setValue(i);
+ QModelIndex index = view.indexAt(QPoint(0,0));
+ QVERIFY(index.isValid());
+ QCOMPARE(index.row(), 2 * i + 1);
+ }
+}
QTEST_MAIN(tst_QListView)
#include "tst_qlistview.moc"
diff --git a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
index 62b43c4..b11efa0 100644
--- a/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
+++ b/tests/auto/qpauseanimation/tst_qpauseanimation.cpp
@@ -169,7 +169,7 @@ void tst_QPauseAnimation::noTimerUpdates()
animation.start();
QTest::qWait(animation.totalDuration() + 100);
QVERIFY(animation.state() == QAbstractAnimation::Stopped);
- QCOMPARE(animation.m_updateCurrentTimeCount, 2);
+ QCOMPARE(animation.m_updateCurrentTimeCount, 1 + loopCount);
timer->setConsistentTiming(false);
}
@@ -399,6 +399,7 @@ void tst_QPauseAnimation::multipleSequentialGroups()
void tst_QPauseAnimation::zeroDuration()
{
TestablePauseAnimation animation;
+ animation.setDuration(0);
animation.start();
QTest::qWait(animation.totalDuration() + 100);
QVERIFY(animation.state() == QAbstractAnimation::Stopped);
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 36c1518..9f5aee2 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -1144,7 +1144,7 @@ void tst_QPixmap::fromSymbianCFbsBitmap_data()
// QTest::newRow("EColor16MA small trans") << EColor16MA << smallWidth << smallHeight << QColor(255, 255, 0, 0);
// QTest::newRow("EColor16MA big trans") << EColor16MA << largeWidth << largeHeight << QColor(255, 255, 0, 0);
-#if !defined(__SERIES60_31__) && !defined(__S60_32__)
+#if !defined(__SERIES60_31__)
QTest::newRow("EColor16MAP small") << EColor16MAP << smallWidth << smallHeight << QColor(Qt::red);
QTest::newRow("EColor16MAP big") << EColor16MAP << largeWidth << largeHeight << QColor(Qt::red);
#endif
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index 51ef2da..7dd17e5 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -130,6 +130,7 @@ private slots:
void valueChanged();
void twoAnimations();
void deletedInUpdateCurrentTime();
+ void totalDuration();
};
tst_QPropertyAnimation::tst_QPropertyAnimation()
@@ -1199,5 +1200,18 @@ void tst_QPropertyAnimation::deletedInUpdateCurrentTime()
QCOMPARE(o.value(), 1000);
}
+void tst_QPropertyAnimation::totalDuration()
+{
+ QPropertyAnimation anim;
+ QCOMPARE(anim.totalDuration(), 250);
+ anim.setLoopCount(2);
+ QCOMPARE(anim.totalDuration(), 2*250);
+ anim.setLoopCount(-1);
+ QCOMPARE(anim.totalDuration(), -1);
+ anim.setDuration(0);
+ QCOMPARE(anim.totalDuration(), 0);
+}
+
+
QTEST_MAIN(tst_QPropertyAnimation)
#include "tst_qpropertyanimation.moc"
diff --git a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
index 320a429..44adf7e 100644
--- a/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
+++ b/tests/auto/qscriptextqobject/tst_qscriptextqobject.cpp
@@ -317,6 +317,11 @@ public:
Q_INVOKABLE QObject* myInvokableReturningMyQObjectAsQObject()
{ m_qtFunctionInvoked = 57; return this; }
+ Q_INVOKABLE QObjectList findObjects() const
+ { return findChildren<QObject *>(); }
+ Q_INVOKABLE QList<int> myInvokableNumbers() const
+ { return QList<int>() << 1 << 2 << 3; }
+
void emitMySignal()
{ emit mySignal(); }
void emitMySignalWithIntArg(int arg)
@@ -493,6 +498,7 @@ protected slots:
}
private slots:
+ void registeredTypes();
void getSetStaticProperty();
void getSetDynamicProperty();
void getSetChildren();
@@ -543,6 +549,24 @@ void tst_QScriptExtQObject::cleanup()
delete m_myObject;
}
+// this test has to be first and test that some types are automatically registered
+void tst_QScriptExtQObject::registeredTypes()
+{
+ QScriptEngine e;
+ QObject *t = new MyQObject;
+ QObject *c = new QObject(t);
+ c->setObjectName ("child1");
+
+ e.globalObject().setProperty("MyTest", e.newQObject(t));
+
+ QScriptValue v1 = e.evaluate("MyTest.findObjects()[0].objectName;");
+ QCOMPARE(v1.toString(), c->objectName());
+
+ QScriptValue v2 = e.evaluate("MyTest.myInvokableNumbers()");
+ QCOMPARE(qscriptvalue_cast<QList<int> >(v2), (QList<int>() << 1 << 2 << 3));
+}
+
+
static QScriptValue getSetProperty(QScriptContext *ctx, QScriptEngine *)
{
if (ctx->argumentCount() != 0)
diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
index 13d68ff..82b6066 100644
--- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
+++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp
@@ -1072,17 +1072,20 @@ void tst_QSqlDatabase::recordMySQL()
int revision = tst_Databases::getMySqlVersion( db ).section( QChar('.'), 2, 2 ).toInt();
int vernum = (major << 16) + (minor << 8) + revision;
-#ifdef QT3_SUPPORT
/* The below is broken in mysql below 5.0.15
see http://dev.mysql.com/doc/refman/5.0/en/binary-varbinary.html
specifically: Before MySQL 5.0.15, the pad value is space. Values are right-padded
with space on insert, and trailing spaces are removed on select.
*/
if( vernum >= ((5 << 16) + 15) ) {
+#ifdef QT3_SUPPORT
bin10 = FieldDef("binary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abc ")));
varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abcv ")));
- }
+#else
+ bin10 = FieldDef("binary(10)", QVariant::ByteArray, QString("123abc "));
+ varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QString("123abcv "));
#endif
+ }
static QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0));
static const FieldDef fieldDefs[] = {
@@ -2468,7 +2471,7 @@ void tst_QSqlDatabase::mysql_savepointtest()
QFETCH(QString, dbName);
QSqlDatabase db = QSqlDatabase::database(dbName);
CHECK_DATABASE(db);
- if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 1 ).toInt()<4.1 )
+ if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 1 ).toDouble()<4.1 )
QSKIP( "Test requires MySQL >= 4.1", SkipSingle );
QSqlQuery q(db);
diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp
index 546c105..8fe6f2e 100644
--- a/tests/auto/qsqlquery/tst_qsqlquery.cpp
+++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp
@@ -194,7 +194,6 @@ private slots:
void sqlServerReturn0_data() { generic_data(); }
void sqlServerReturn0();
-
private:
// returns all database connections
void generic_data(const QString &engine=QString());
@@ -397,7 +396,7 @@ void tst_QSqlQuery::char1SelectUnicode()
QSKIP("Needs someone with more Unicode knowledge than I have to fix", SkipSingle);
if ( db.driver()->hasFeature( QSqlDriver::Unicode ) ) {
- QString uniStr( QChar( 0xfb50 ) );
+ QString uniStr( QChar( 'का' ) );
QSqlQuery q( db );
if ( db.driverName().startsWith( "QMYSQL" ) && tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 )
@@ -510,9 +509,7 @@ void tst_QSqlQuery::mysqlOutValues()
QVERIFY_SQL( q, exec( "create procedure " + qTableName( "qtestproc" ) + " () "
"BEGIN select * from " + qTableName( "qtest" ) + " order by id; END" ) );
QVERIFY_SQL( q, exec( "call " + qTableName( "qtestproc" ) + "()" ) );
- QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue);
QVERIFY_SQL( q, next() );
- QEXPECT_FAIL("", "There's a mysql bug that means only selects think they return data when running in prepared mode", Continue);
QCOMPARE( q.value( 1 ).toString(), QString( "VarChar1" ) );
QVERIFY_SQL( q, exec( "drop procedure " + qTableName( "qtestproc" ) ) );
@@ -1633,8 +1630,7 @@ void tst_QSqlQuery::prepare_bind_exec()
{
// new scope for SQLITE
- static const unsigned short utf8arr[] = { 0xfb50,0xfb60,0xfb70,0xfb80,0xfbe0,0xfbf0,0x00 };
- static const QString utf8str = QString::fromUtf16( utf8arr );
+ static const QString utf8str = QString::fromUtf8( "काचं शक्नोम्यत्तुम् । नोपहिनस्ति माम् ॥" );
static const QString values[6] = { "Harry", "Trond", "Mark", "Ma?rk", "?", ":id" };
@@ -1651,11 +1647,11 @@ void tst_QSqlQuery::prepare_bind_exec()
QVERIFY_SQL( q, exec("set client_min_messages='warning'"));
if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QTDS" ) )
- createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int primary key, name nvarchar(20) null)";
- else if ( db.driverName().startsWith( "QMYSQL" ) && useUnicode )
- createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(20) character set utf8)";
+ createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int primary key, name nvarchar(200) null)";
+ else if ( tst_Databases::isMySQL(db) && useUnicode )
+ createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(200) character set utf8)";
else
- createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(20))";
+ createQuery = "create table " + qTableName( "qtest_prepare" ) + " (id int not null primary key, name varchar(200))";
QVERIFY_SQL( q, exec( createQuery ) );
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 6efe440..2bd1684 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -170,6 +170,7 @@ private slots:
void setEmptyKey();
void spontaneousWrite();
void setReadBufferSize();
+ void setReadBufferSize_task_250027();
void waitForMinusOne();
void verifyMode();
void verifyDepth();
@@ -182,6 +183,7 @@ private slots:
void ignoreSslErrorsListWithSlot_data();
void ignoreSslErrorsListWithSlot();
void readFromClosedSocket();
+ void writeBigChunk();
static void exitLoop()
{
@@ -1240,6 +1242,66 @@ void tst_QSslSocket::setReadBufferSize()
QVERIFY(receiver->bytesAvailable() > oldBytesAvailable);
}
+class SetReadBufferSize_task_250027_handler : public QObject {
+ Q_OBJECT
+public slots:
+ void readyReadSlot() {
+ QTestEventLoop::instance().exitLoop();
+ }
+ void waitSomeMore(QSslSocket *socket) {
+ QTime t;
+ t.start();
+ while (!socket->encryptedBytesAvailable()) {
+ QCoreApplication::processEvents(QEventLoop::AllEvents | QEventLoop::WaitForMoreEvents, 250);
+ if (t.elapsed() > 1000 || socket->state() != QAbstractSocket::ConnectedState)
+ return;
+ }
+ }
+};
+
+void tst_QSslSocket::setReadBufferSize_task_250027()
+{
+ // do not execute this when a proxy is set.
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QSslSocketPtr socket = newSocket();
+ socket->setReadBufferSize(1000); // limit to 1 kb/sec
+ socket->ignoreSslErrors();
+ socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
+ socket->ignoreSslErrors();
+ QVERIFY(socket->waitForConnected(10*1000));
+ QVERIFY(socket->waitForEncrypted(10*1000));
+
+ // exit the event loop as soon as we receive a readyRead()
+ SetReadBufferSize_task_250027_handler setReadBufferSize_task_250027_handler;
+ connect(socket, SIGNAL(readyRead()), &setReadBufferSize_task_250027_handler, SLOT(readyReadSlot()));
+
+ // provoke a response by sending a request
+ socket->write("GET /gif/fluke.gif HTTP/1.0\n"); // this file is 27 KB
+ socket->write("Host: ");
+ socket->write(QtNetworkSettings::serverName().toLocal8Bit().constData());
+ socket->write("\n");
+ socket->write("Connection: close\n");
+ socket->write("\n");
+ socket->flush();
+
+ QTestEventLoop::instance().enterLoop(10);
+ setReadBufferSize_task_250027_handler.waitSomeMore(socket);
+ QByteArray firstRead = socket->readAll();
+ // First read should be some data, but not the whole file
+ QVERIFY(firstRead.size() > 0 && firstRead.size() < 20*1024);
+
+ QTestEventLoop::instance().enterLoop(10);
+ setReadBufferSize_task_250027_handler.waitSomeMore(socket);
+ QByteArray secondRead = socket->readAll();
+ // second read should be some more data
+ QVERIFY(secondRead.size() > 0);
+
+ socket->close();
+}
+
class SslServer3 : public QTcpServer
{
Q_OBJECT
@@ -1698,6 +1760,50 @@ void tst_QSslSocket::readFromClosedSocket()
QVERIFY(!socket->bytesToWrite());
}
+void tst_QSslSocket::writeBigChunk()
+{
+ if (!QSslSocket::supportsSsl())
+ return;
+
+ QSslSocketPtr socket = newSocket();
+ this->socket = socket;
+
+ connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot()));
+ socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
+
+ QByteArray data;
+ data.resize(1024*1024*10); // 10 MB
+ // init with garbage. needed so ssl cannot compress it in an efficient way.
+ for (int i = 0; i < data.size() / sizeof(int); i++) {
+ int r = qrand();
+ data.data()[i*sizeof(int)] = r;
+ }
+
+ QVERIFY(socket->waitForEncrypted(10000));
+ QString errorBefore = socket->errorString();
+
+ int ret = socket->write(data.constData(), data.size());
+ QVERIFY(data.size() == ret);
+
+ // spin the event loop once so QSslSocket::transmit() gets called
+ QCoreApplication::processEvents();
+ QString errorAfter = socket->errorString();
+
+ // no better way to do this right now since the error is the same as the default error.
+ if (socket->errorString().startsWith(QLatin1String("Unable to write data")))
+ {
+ qWarning() << socket->error() << socket->errorString();
+ QFAIL("Error while writing! Check if the OpenSSL BIO size is limited?!");
+ }
+ // also check the error string. If another error (than UnknownError) occured, it should be different than before
+ QVERIFY(errorBefore == errorAfter);
+
+ // check that everything has been written to OpenSSL
+ QVERIFY(socket->bytesToWrite() == 0);
+
+ socket->close();
+}
+
#endif // QT_NO_OPENSSL
QTEST_MAIN(tst_QSslSocket)
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index d75cfa7..d8110e1 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -1195,6 +1195,13 @@ void tst_QTableView::moveCursorStrikesBack_data()
<< 0 << 5 << (IntList() << int(QtTestTableView::MoveNext))
<< 1 << 0;
+ QTest::newRow("Last column disabled. Task QTBUG-3878") << -1 << -1
+ << IntList()
+ << (IntList() << 6)
+ << QRect()
+ << 1 << 0 << (IntList() << int(QtTestTableView::MovePrevious))
+ << 0 << 5;
+
QTest::newRow("Span, anchor column hidden") << -1 << 1
<< IntList()
<< IntList()
@@ -1250,6 +1257,24 @@ void tst_QTableView::moveCursorStrikesBack_data()
<< QRect(1, 2, 2, 3)
<< 5 << 2 << (IntList() << int(QtTestTableView::MoveUp) << int(QtTestTableView::MoveUp))
<< 1 << 2;
+
+ IntList fullList;
+ for (int i = 0; i < 7; ++i)
+ fullList << i;
+
+ QTest::newRow("All disabled, wrap forward. Timeout => FAIL") << -1 << -1
+ << fullList
+ << fullList
+ << QRect()
+ << 1 << 0 << (IntList() << int(QtTestTableView::MoveNext))
+ << 1 << 0;
+
+ QTest::newRow("All disabled, wrap backwards. Timeout => FAIL") << -1 << -1
+ << fullList
+ << fullList
+ << QRect()
+ << 1 << 0 << (IntList() << int(QtTestTableView::MovePrevious))
+ << 1 << 0;
}
void tst_QTableView::moveCursorStrikesBack()
@@ -1272,11 +1297,6 @@ void tst_QTableView::moveCursorStrikesBack()
view.hideRow(hideRow);
view.hideColumn(hideColumn);
- foreach (int row, disableRows)
- model.disableRow(row);
- foreach (int column, disableColumns)
- model.disableColumn(column);
-
if (span.height() && span.width())
view.setSpan(span.top(), span.left(), span.height(), span.width());
view.show();
@@ -1284,6 +1304,11 @@ void tst_QTableView::moveCursorStrikesBack()
QModelIndex index = model.index(startRow, startColumn);
view.setCurrentIndex(index);
+ foreach (int row, disableRows)
+ model.disableRow(row);
+ foreach (int column, disableColumns)
+ model.disableColumn(column);
+
int newRow = -1;
int newColumn = -1;
foreach (int cursorMoveAction, cursorMoveActions) {
diff --git a/tests/auto/qtabwidget/tst_qtabwidget.cpp b/tests/auto/qtabwidget/tst_qtabwidget.cpp
index 27c19df..1387a92 100644
--- a/tests/auto/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/qtabwidget/tst_qtabwidget.cpp
@@ -590,9 +590,11 @@ void tst_QTabWidget::paintEventCount()
QTest::qWait(1000);
- // Mac and Windows get multiple repaints on the first show, so use those as a starting point.
+ // Mac, Windows and Windows CE get multiple repaints on the first show, so use those as a starting point.
static const int MaxInitialPaintCount =
-#if defined(Q_WS_WIN)
+#if defined(Q_OS_WINCE)
+ 4;
+#elif defined(Q_WS_WIN)
2;
#elif defined(Q_WS_MAC)
5;
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index 91b2cc5..da58725 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -172,6 +172,7 @@ private slots:
void expandAndCollapse_data();
void expandAndCollapse();
void expandAndCollapseAll();
+ void expandWithNoChildren();
void keyboardNavigation();
void headerSections();
void moveCursor_data();
@@ -1548,6 +1549,19 @@ void tst_QTreeView::expandAndCollapseAll()
// QCOMPARE(collapsedSpy.count(), count);
}
+void tst_QTreeView::expandWithNoChildren()
+{
+ QTreeView tree;
+ QStandardItemModel model(1,1);
+ tree.setModel(&model);
+ tree.setAnimated(true);
+ tree.doItemsLayout();
+ //this test should not output warnings
+ tree.expand(model.index(0,0));
+}
+
+
+
void tst_QTreeView::keyboardNavigation()
{
const int rows = 10;
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 1b898f4..050d1c5 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -69,6 +69,9 @@
#include <QtGui/qpaintengine.h>
#include <private/qbackingstore_p.h>
+#include <QtGui/QGraphicsView>
+#include <QtGui/QGraphicsProxyWidget>
+
#include "../../shared/util.h"
@@ -290,6 +293,7 @@ private slots:
#ifdef Q_WS_X11
void minAndMaxSizeWithX11BypassWindowManagerHint();
void showHideShow();
+ void clean_qt_x11_enforce_cursor();
#endif
void compatibilityChildInsertedEvents();
@@ -4387,12 +4391,27 @@ void tst_QWidget::winIdChangeEvent()
{
// Changing parent of a native widget
+ // Should cause winId of child to change, on all platforms
QWidget parent1, parent2;
WinIdChangeWidget child(&parent1);
const WId winIdBefore = child.winId();
QCOMPARE(child.m_winIdChangeEventCount, 1);
child.setParent(&parent2);
const WId winIdAfter = child.internalWinId();
+ QVERIFY(winIdBefore != winIdAfter);
+ QCOMPARE(child.m_winIdChangeEventCount, 2);
+ }
+
+ {
+ // Changing grandparent of a native widget
+ // Should cause winId of grandchild to change only on Symbian
+ QWidget grandparent1, grandparent2;
+ QWidget parent(&grandparent1);
+ WinIdChangeWidget child(&parent);
+ const WId winIdBefore = child.winId();
+ QCOMPARE(child.m_winIdChangeEventCount, 1);
+ parent.setParent(&grandparent2);
+ const WId winIdAfter = child.internalWinId();
#ifdef Q_OS_SYMBIAN
QVERIFY(winIdBefore != winIdAfter);
QCOMPARE(child.m_winIdChangeEventCount, 2);
@@ -6194,6 +6213,35 @@ void tst_QWidget::showHideShow()
QVERIFY(w.gotExpectedMapNotify);
}
+
+void tst_QWidget::clean_qt_x11_enforce_cursor()
+{
+ {
+ QWidget window;
+ QWidget *w = new QWidget(&window);
+ QWidget *child = new QWidget(w);
+ child->setAttribute(Qt::WA_SetCursor, true);
+
+ window.show();
+ QApplication::setActiveWindow(&window);
+ QTest::qWaitForWindowShown(&window);
+ QTest::qWait(100);
+ QCursor::setPos(window.geometry().center());
+ QTest::qWait(100);
+
+ child->setFocus();
+ QApplication::processEvents();
+ QTest::qWait(100);
+
+ delete w;
+ }
+
+ QGraphicsScene scene;
+ QLineEdit *edit = new QLineEdit;
+ scene.addWidget(edit);
+
+ // If the test didn't crash, then it passed.
+}
#endif
class EventRecorder : public QObject
@@ -7605,11 +7653,11 @@ void tst_QWidget::updateWhileMinimized()
QTest::qWaitForWindowShown(&widget);
QApplication::processEvents();
QTRY_VERIFY(widget.numPaintEvents > 0);
- QTest::qWait(50);
+ QTest::qWait(150);
// Minimize window.
widget.showMinimized();
- QTest::qWait(70);
+ QTest::qWait(110);
widget.reset();
@@ -8310,7 +8358,7 @@ public:
static bool firstTime = true;
if (firstTime)
- QTimer::singleShot(150, this, SLOT(resizeMe()));
+ QTimer::singleShot(250, this, SLOT(resizeMe()));
firstTime = false;
}
@@ -8327,7 +8375,7 @@ void tst_QWidget::moveInResizeEvent()
testWidget.setGeometry(50, 50, 200, 200);
testWidget.show();
QTest::qWaitForWindowShown(&testWidget);
- QTest::qWait(160);
+ QTest::qWait(300);
QRect expectedGeometry(100,100, 100, 100);
QTRY_COMPARE(testWidget.geometry(), expectedGeometry);
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index 124f909..1d954c9 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -9,8 +9,8 @@ SUBDIRS = containers-associative \
qiodevice \
qpixmap \
blendbench \
- qstring \
- qstringlist \
+ qstring \
+ qstringlist \
qmatrix4x4 \
qnetworkreply \
qobject \
diff --git a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index 000ab6e..81064d7 100644
--- a/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/benchmarks/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -41,6 +41,7 @@
#include <QtTest/QtTest>
#include <QtGui/qgraphicsanchorlayout.h>
+#include <QtGui/qgraphicslinearlayout.h>
#include <QtGui/qgraphicswidget.h>
#include <QtGui/qgraphicsview.h>
@@ -54,6 +55,12 @@ public:
private slots:
void s60_hard_complex_data();
void s60_hard_complex();
+ void linearVsAnchorSizeHints_data();
+ void linearVsAnchorSizeHints();
+ void linearVsAnchorSetGeometry_data();
+ void linearVsAnchorSetGeometry();
+ void linearVsAnchorNested_data();
+ void linearVsAnchorNested();
};
@@ -192,6 +199,235 @@ void tst_QGraphicsAnchorLayout::s60_hard_complex()
}
}
+static QGraphicsLayout* createLayouts(int whichLayout)
+{
+ QSizeF min(0, 10);
+ QSizeF pref(50, 10);
+ QSizeF max(100, 10);
+
+ QGraphicsWidget *a = createItem(min, pref, max, "a");
+ QGraphicsWidget *b = createItem(min, pref, max, "b");
+ QGraphicsWidget *c = createItem(min, pref, max, "c");
+ QGraphicsWidget *d = createItem(min, pref, max, "d");
+
+ QGraphicsLayout *l;
+ if (whichLayout == 0) {
+ l = new QGraphicsLinearLayout;
+ QGraphicsLinearLayout *linear = static_cast<QGraphicsLinearLayout *>(l);
+ linear->setContentsMargins(0, 0, 0, 0);
+
+ linear->addItem(a);
+ linear->addItem(b);
+ linear->addItem(c);
+ linear->addItem(d);
+ } else {
+ l = new QGraphicsAnchorLayout;
+ QGraphicsAnchorLayout *anchor = static_cast<QGraphicsAnchorLayout *>(l);
+ anchor->setContentsMargins(0, 0, 0, 0);
+
+ // Horizontal
+ setAnchor(anchor, anchor, Qt::AnchorLeft, a, Qt::AnchorLeft, 0);
+ setAnchor(anchor, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0);
+ setAnchor(anchor, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0);
+ setAnchor(anchor, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0);
+ setAnchor(anchor, d, Qt::AnchorRight, anchor, Qt::AnchorRight, 0);
+
+ // Vertical
+ anchor->addAnchors(anchor, a, Qt::Vertical);
+ anchor->addAnchors(anchor, b, Qt::Vertical);
+ anchor->addAnchors(anchor, c, Qt::Vertical);
+ anchor->addAnchors(anchor, d, Qt::Vertical);
+ }
+
+ return l;
+}
+
+void tst_QGraphicsAnchorLayout::linearVsAnchorSizeHints_data()
+{
+ QTest::addColumn<int>("whichLayout");
+ QTest::addColumn<int>("whichSizeHint");
+
+ QTest::newRow("QGraphicsLinearLayout::minimum")
+ << 0 << int(Qt::MinimumSize);
+ QTest::newRow("QGraphicsLinearLayout::preferred")
+ << 0 << int(Qt::PreferredSize);
+ QTest::newRow("QGraphicsLinearLayout::maximum")
+ << 0 << int(Qt::MaximumSize);
+ QTest::newRow("QGraphicsLinearLayout::noSizeHint")
+ << 0 << -1;
+
+ QTest::newRow("QGraphicsAnchorLayout::minimum")
+ << 1 << int(Qt::MinimumSize);
+ QTest::newRow("QGraphicsAnchorLayout::preferred")
+ << 1 << int(Qt::PreferredSize);
+ QTest::newRow("QGraphicsAnchorLayout::maximum")
+ << 1 << int(Qt::MaximumSize);
+ QTest::newRow("QGraphicsAnchorLayout::noSizeHint")
+ << 1 << -1;
+}
+
+void tst_QGraphicsAnchorLayout::linearVsAnchorSizeHints()
+{
+ QFETCH(int, whichSizeHint);
+ QFETCH(int, whichLayout);
+
+ QGraphicsLayout *l = createLayouts(whichLayout);
+
+ QSizeF sizeHint;
+ // warm up instruction cache
+ l->invalidate();
+ sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint);
+ // ...then measure...
+
+ QBENCHMARK {
+ l->invalidate();
+ sizeHint = l->effectiveSizeHint((Qt::SizeHint)whichSizeHint);
+ }
+}
+
+void tst_QGraphicsAnchorLayout::linearVsAnchorSetGeometry_data()
+{
+ QTest::addColumn<int>("whichLayout");
+
+ QTest::newRow("QGraphicsLinearLayout")
+ << 0;
+ QTest::newRow("QGraphicsAnchorLayout")
+ << 1;
+}
+
+void tst_QGraphicsAnchorLayout::linearVsAnchorSetGeometry()
+{
+ QFETCH(int, whichLayout);
+
+ QGraphicsLayout *l = createLayouts(whichLayout);
+
+ QRectF sizeHint;
+ qreal maxWidth;
+ qreal increment;
+ // warm up instruction cache
+ l->invalidate();
+ sizeHint.setSize(l->effectiveSizeHint(Qt::MinimumSize));
+ maxWidth = l->effectiveSizeHint(Qt::MaximumSize).width();
+ increment = (maxWidth - sizeHint.width()) / 100;
+ l->setGeometry(sizeHint);
+ // ...then measure...
+
+ QBENCHMARK {
+ l->invalidate();
+ for (qreal width = sizeHint.width(); width <= maxWidth; width += increment) {
+ sizeHint.setWidth(width);
+ l->setGeometry(sizeHint);
+ }
+ }
+}
+
+void tst_QGraphicsAnchorLayout::linearVsAnchorNested_data()
+{
+ QTest::addColumn<int>("whichLayout");
+ QTest::newRow("LinearLayout")
+ << 0;
+ QTest::newRow("AnchorLayout setup with null-anchors knot")
+ << 1;
+ QTest::newRow("AnchorLayout setup easy to simplificate")
+ << 2;
+}
+
+void tst_QGraphicsAnchorLayout::linearVsAnchorNested()
+{
+ QFETCH(int, whichLayout);
+
+ QSizeF min(10, 10);
+ QSizeF pref(80, 80);
+ QSizeF max(150, 150);
+
+ QGraphicsWidget *a = createItem(min, pref, max, "a");
+ QGraphicsWidget *b = createItem(min, pref, max, "b");
+ QGraphicsWidget *c = createItem(min, pref, max, "c");
+ QGraphicsWidget *d = createItem(min, pref, max, "d");
+
+ QGraphicsLayout *layout;
+
+ if (whichLayout == 0) {
+ QGraphicsLinearLayout *linear1 = new QGraphicsLinearLayout;
+ QGraphicsLinearLayout *linear2 = new QGraphicsLinearLayout(Qt::Vertical);
+ QGraphicsLinearLayout *linear3 = new QGraphicsLinearLayout;
+
+ linear1->addItem(a);
+ linear1->addItem(linear2);
+ linear2->addItem(b);
+ linear2->addItem(linear3);
+ linear3->addItem(c);
+ linear3->addItem(d);
+
+ layout = linear1;
+ } else if (whichLayout == 1) {
+ QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout;
+
+ // A
+ anchor->addCornerAnchors(a, Qt::TopLeftCorner, anchor, Qt::TopLeftCorner);
+ anchor->addCornerAnchors(a, Qt::TopRightCorner, b, Qt::TopLeftCorner);
+ anchor->addCornerAnchors(a, Qt::BottomLeftCorner, anchor, Qt::BottomLeftCorner);
+ anchor->addCornerAnchors(a, Qt::BottomRightCorner, c, Qt::BottomLeftCorner);
+
+ // B
+ anchor->addCornerAnchors(b, Qt::TopRightCorner, anchor, Qt::TopRightCorner);
+ anchor->addCornerAnchors(b, Qt::BottomLeftCorner, c, Qt::TopLeftCorner);
+ anchor->addCornerAnchors(b, Qt::BottomRightCorner, d, Qt::TopRightCorner);
+
+ // C
+ anchor->addCornerAnchors(c, Qt::TopRightCorner, d, Qt::TopLeftCorner);
+ anchor->addCornerAnchors(c, Qt::BottomRightCorner, d, Qt::BottomLeftCorner);
+
+ // D
+ anchor->addCornerAnchors(d, Qt::BottomRightCorner, anchor, Qt::BottomRightCorner);
+
+ layout = anchor;
+ } else {
+ QGraphicsAnchorLayout *anchor = new QGraphicsAnchorLayout;
+
+ // A
+ anchor->addAnchor(a, Qt::AnchorLeft, anchor, Qt::AnchorLeft);
+ anchor->addAnchors(a, anchor, Qt::Vertical);
+ anchor->addAnchor(a, Qt::AnchorRight, b, Qt::AnchorLeft);
+ anchor->addAnchor(a, Qt::AnchorRight, c, Qt::AnchorLeft);
+
+ // B
+ anchor->addAnchor(b, Qt::AnchorTop, anchor, Qt::AnchorTop);
+ anchor->addAnchor(b, Qt::AnchorRight, anchor, Qt::AnchorRight);
+ anchor->addAnchor(b, Qt::AnchorBottom, c, Qt::AnchorTop);
+ anchor->addAnchor(b, Qt::AnchorBottom, d, Qt::AnchorTop);
+
+ // C
+ anchor->addAnchor(c, Qt::AnchorRight, d, Qt::AnchorLeft);
+ anchor->addAnchor(c, Qt::AnchorBottom, anchor, Qt::AnchorBottom);
+
+ // D
+ anchor->addAnchor(d, Qt::AnchorRight, anchor, Qt::AnchorRight);
+ anchor->addAnchor(d, Qt::AnchorBottom, anchor, Qt::AnchorBottom);
+
+ layout = anchor;
+ }
+
+ QSizeF sizeHint;
+ // warm up instruction cache
+ layout->invalidate();
+ sizeHint = layout->effectiveSizeHint(Qt::PreferredSize);
+
+ // ...then measure...
+ QBENCHMARK {
+ // To ensure that all sizeHints caches are invalidated in
+ // the LinearLayout setup, we must call updateGeometry on the
+ // children. If we didn't, only the top level layout would be
+ // re-calculated.
+ static_cast<QGraphicsLayoutItem *>(a)->updateGeometry();
+ static_cast<QGraphicsLayoutItem *>(b)->updateGeometry();
+ static_cast<QGraphicsLayoutItem *>(c)->updateGeometry();
+ static_cast<QGraphicsLayoutItem *>(d)->updateGeometry();
+ layout->invalidate();
+ sizeHint = layout->effectiveSizeHint(Qt::PreferredSize);
+ }
+}
+
QTEST_MAIN(tst_QGraphicsAnchorLayout)
#include "tst_qgraphicsanchorlayout.moc"
diff --git a/tests/benchmarks/qnetworkreply/qnetworkreply.pro b/tests/benchmarks/qnetworkreply/qnetworkreply.pro
index 060acf5..1e67d81 100644
--- a/tests/benchmarks/qnetworkreply/qnetworkreply.pro
+++ b/tests/benchmarks/qnetworkreply/qnetworkreply.pro
@@ -10,4 +10,4 @@ QT += network
CONFIG += release
# Input
-SOURCES += main.cpp
+SOURCES += tst_qnetworkreply.cpp
diff --git a/tests/benchmarks/qnetworkreply/main.cpp b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp
index 666e4f1..993db52 100644
--- a/tests/benchmarks/qnetworkreply/main.cpp
+++ b/tests/benchmarks/qnetworkreply/tst_qnetworkreply.cpp
@@ -54,6 +54,10 @@ class tst_qnetworkreply : public QObject
private slots:
void httpLatency();
+#ifndef QT_NO_OPENSSL
+ void echoPerformance_data();
+ void echoPerformance();
+#endif
};
void tst_qnetworkreply::httpLatency()
@@ -69,6 +73,40 @@ void tst_qnetworkreply::httpLatency()
}
}
+#ifndef QT_NO_OPENSSL
+void tst_qnetworkreply::echoPerformance_data()
+{
+ QTest::addColumn<bool>("ssl");
+ QTest::newRow("no_ssl") << false;
+ QTest::newRow("ssl") << true;
+}
+
+void tst_qnetworkreply::echoPerformance()
+{
+ QFETCH(bool, ssl);
+ QNetworkAccessManager manager;
+ QNetworkRequest request(QUrl((ssl ? "https://" : "http://") + QtNetworkSettings::serverName() + "/qtest/cgi-bin/echo.cgi"));
+
+ QByteArray data;
+ data.resize(1024*1024*10); // 10 MB
+ // init with garbage. needed so ssl cannot compress it in an efficient way.
+ for (int i = 0; i < data.size() / sizeof(int); i++) {
+ int r = qrand();
+ data.data()[i*sizeof(int)] = r;
+ }
+
+ QBENCHMARK{
+ QNetworkReply* reply = manager.post(request, data);
+ connect(reply, SIGNAL(sslErrors( const QList<QSslError> &)), reply, SLOT(ignoreSslErrors()));
+ connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop()), Qt::QueuedConnection);
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(reply->error() == QNetworkReply::NoError);
+ delete reply;
+ }
+}
+#endif
+
QTEST_MAIN(tst_qnetworkreply)
-#include "main.moc"
+#include "tst_qnetworkreply.moc"
diff --git a/tests/manual/gestures/graphicsview/main.cpp b/tests/manual/gestures/graphicsview/main.cpp
index 263a963..e9065eb 100644
--- a/tests/manual/gestures/graphicsview/main.cpp
+++ b/tests/manual/gestures/graphicsview/main.cpp
@@ -66,11 +66,11 @@ protected:
default: qDebug("view: Pan: <unknown state>"); break;
}
- const QSizeF offset = pan->offset();
+ const QPointF offset = pan->offset();
QScrollBar *vbar = verticalScrollBar();
QScrollBar *hbar = horizontalScrollBar();
- vbar->setValue(vbar->value() - offset.height());
- hbar->setValue(hbar->value() - offset.width());
+ vbar->setValue(vbar->value() - offset.y());
+ hbar->setValue(hbar->value() - offset.x());
ge->accept(pan);
return true;
}
@@ -126,6 +126,8 @@ public:
scene = new QGraphicsScene(this);
scene->setSceneRect(-2000, -2000, 4000, 4000);
view = new QGraphicsView(scene, 0);
+ view->viewport()->grabGesture(Qt::PanGesture);
+ view->viewport()->grabGesture(ThreeFingerSlideGesture::Type);
QVBoxLayout *l = new QVBoxLayout(this);
l->addWidget(view);
}
diff --git a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp
index 0e7f538..6cdbe12 100644
--- a/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp
+++ b/tests/manual/gestures/graphicsview/mousepangesturerecognizer.cpp
@@ -42,6 +42,8 @@
#include "mousepangesturerecognizer.h"
#include <QEvent>
+#include <QVariant>
+#include <QGraphicsSceneMouseEvent>
#include <QMouseEvent>
#include <QGesture>
@@ -57,21 +59,36 @@ QGesture* MousePanGestureRecognizer::createGesture(QObject *)
QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *state, QObject *, QEvent *event)
{
QPanGesture *g = static_cast<QPanGesture *>(state);
- QMouseEvent *me = static_cast<QMouseEvent *>(event);
+ QPoint globalPos;
+ switch (event->type()) {
+ case QEvent::GraphicsSceneMousePress:
+ case QEvent::GraphicsSceneMouseDoubleClick:
+ case QEvent::GraphicsSceneMouseMove:
+ case QEvent::GraphicsSceneMouseRelease:
+ globalPos = static_cast<QGraphicsSceneMouseEvent *>(event)->screenPos();
+ break;
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseMove:
+ case QEvent::MouseButtonRelease:
+ globalPos = static_cast<QMouseEvent *>(event)->globalPos();
+ break;
+ default:
+ break;
+ }
if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick
|| event->type() == QEvent::GraphicsSceneMousePress || event->type() == QEvent::GraphicsSceneMouseDoubleClick) {
- g->setHotSpot(me->globalPos());
- g->setProperty("lastPos", me->globalPos());
+ g->setHotSpot(globalPos);
+ g->setProperty("lastPos", globalPos);
g->setProperty("pressed", QVariant::fromValue<bool>(true));
return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint;
} else if (event->type() == QEvent::MouseMove || event->type() == QEvent::GraphicsSceneMouseMove) {
if (g->property("pressed").toBool()) {
- QPoint pos = me->globalPos();
+ QPoint pos = globalPos;
QPoint lastPos = g->property("lastPos").toPoint();
g->setLastOffset(g->offset());
lastPos = pos - lastPos;
- g->setOffset(QSizeF(lastPos.x(), lastPos.y()));
- g->setTotalOffset(g->totalOffset() + QSizeF(lastPos.x(), lastPos.y()));
+ g->setOffset(QPointF(lastPos.x(), lastPos.y()));
+ g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y()));
g->setProperty("lastPos", pos);
return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint;
}
@@ -85,9 +102,9 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat
void MousePanGestureRecognizer::reset(QGesture *state)
{
QPanGesture *g = static_cast<QPanGesture *>(state);
- g->setTotalOffset(QSizeF());
- g->setLastOffset(QSizeF());
- g->setOffset(QSizeF());
+ g->setTotalOffset(QPointF());
+ g->setLastOffset(QPointF());
+ g->setOffset(QPointF());
g->setAcceleration(0);
g->setProperty("lastPos", QVariant());
g->setProperty("pressed", QVariant::fromValue<bool>(false));
diff --git a/tests/manual/gestures/scrollarea/main.cpp b/tests/manual/gestures/scrollarea/main.cpp
index 2796637..f90f6c6 100644
--- a/tests/manual/gestures/scrollarea/main.cpp
+++ b/tests/manual/gestures/scrollarea/main.cpp
@@ -87,23 +87,23 @@ protected:
if (outside)
return;
- const QSizeF offset = pan->offset();
- const QSizeF totalOffset = pan->totalOffset();
+ const QPointF offset = pan->offset();
+ const QPointF totalOffset = pan->totalOffset();
QScrollBar *vbar = verticalScrollBar();
QScrollBar *hbar = horizontalScrollBar();
- if ((vbar->value() == vbar->minimum() && totalOffset.height() > 10) ||
- (vbar->value() == vbar->maximum() && totalOffset.height() < -10)) {
+ if ((vbar->value() == vbar->minimum() && totalOffset.y() > 10) ||
+ (vbar->value() == vbar->maximum() && totalOffset.y() < -10)) {
outside = true;
return;
}
- if ((hbar->value() == hbar->minimum() && totalOffset.width() > 10) ||
- (hbar->value() == hbar->maximum() && totalOffset.width() < -10)) {
+ if ((hbar->value() == hbar->minimum() && totalOffset.x() > 10) ||
+ (hbar->value() == hbar->maximum() && totalOffset.x() < -10)) {
outside = true;
return;
}
- vbar->setValue(vbar->value() - offset.height());
- hbar->setValue(hbar->value() - offset.width());
+ vbar->setValue(vbar->value() - offset.y());
+ hbar->setValue(hbar->value() - offset.x());
event->accept(pan);
}
}
@@ -147,28 +147,28 @@ protected:
event->ignore(pan);
if (outside)
return;
- const QSizeF offset = pan->offset();
- const QSizeF totalOffset = pan->totalOffset();
+ const QPointF offset = pan->offset();
+ const QPointF totalOffset = pan->totalOffset();
if (orientation() == Qt::Horizontal) {
- if ((value() == minimum() && totalOffset.width() < -10) ||
- (value() == maximum() && totalOffset.width() > 10)) {
+ if ((value() == minimum() && totalOffset.x() < -10) ||
+ (value() == maximum() && totalOffset.x() > 10)) {
outside = true;
return;
}
- if (totalOffset.height() < 40 && totalOffset.height() > -40) {
- setValue(value() + offset.width());
+ if (totalOffset.y() < 40 && totalOffset.y() > -40) {
+ setValue(value() + offset.x());
event->accept(pan);
} else {
outside = true;
}
} else if (orientation() == Qt::Vertical) {
- if ((value() == maximum() && totalOffset.height() < -10) ||
- (value() == minimum() && totalOffset.height() > 10)) {
+ if ((value() == maximum() && totalOffset.y() < -10) ||
+ (value() == minimum() && totalOffset.y() > 10)) {
outside = true;
return;
}
- if (totalOffset.width() < 40 && totalOffset.width() > -40) {
- setValue(value() - offset.height());
+ if (totalOffset.x() < 40 && totalOffset.x() > -40) {
+ setValue(value() - offset.y());
event->accept(pan);
} else {
outside = true;
diff --git a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp
index 79b633e..5f94dbc 100644
--- a/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp
+++ b/tests/manual/gestures/scrollarea/mousepangesturerecognizer.cpp
@@ -69,8 +69,8 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat
QPoint lastPos = g->property("lastPos").toPoint();
g->setLastOffset(g->offset());
lastPos = pos - lastPos;
- g->setOffset(QSizeF(lastPos.x(), lastPos.y()));
- g->setTotalOffset(g->totalOffset() + QSizeF(lastPos.x(), lastPos.y()));
+ g->setOffset(QPointF(lastPos.x(), lastPos.y()));
+ g->setTotalOffset(g->totalOffset() + QPointF(lastPos.x(), lastPos.y()));
g->setProperty("lastPos", pos);
return QGestureRecognizer::GestureTriggered | QGestureRecognizer::ConsumeEventHint;
}
@@ -84,9 +84,9 @@ QGestureRecognizer::Result MousePanGestureRecognizer::filterEvent(QGesture *stat
void MousePanGestureRecognizer::reset(QGesture *state)
{
QPanGesture *g = static_cast<QPanGesture *>(state);
- g->setTotalOffset(QSizeF());
- g->setLastOffset(QSizeF());
- g->setOffset(QSizeF());
+ g->setTotalOffset(QPointF());
+ g->setLastOffset(QPointF());
+ g->setOffset(QPointF());
g->setAcceleration(0);
g->setProperty("lastPos", QVariant());
g->setProperty("pressed", QVariant::fromValue<bool>(false));