summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml14
-rw-r--r--tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp32
-rw-r--r--tests/auto/moc/tst_moc.cpp8
-rw-r--r--tests/auto/q3table/tst_q3table.cpp8
-rw-r--r--tests/auto/qcompleter/tst_qcompleter.cpp4
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp20
-rw-r--r--tests/auto/qobject/tst_qobject.cpp8
-rw-r--r--tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp4
10 files changed, 86 insertions, 16 deletions
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
index d4d8bf6..5fd373c 100644
--- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
+++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp
@@ -604,6 +604,8 @@ void tst_QDeclarativeGridView::currentIndex()
// no wrap
gridview->setCurrentIndex(0);
QCOMPARE(gridview->currentIndex(), 0);
+ // confirm that the velocity is updated
+ QTRY_VERIFY(gridview->verticalVelocity() != 0.0);
gridview->moveCurrentIndexUp();
QCOMPARE(gridview->currentIndex(), 0);
diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
index e4b59a7..cd17fad 100644
--- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
+++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp
@@ -1016,6 +1016,8 @@ void tst_QDeclarativeListView::currentIndex()
// no wrap
listview->setCurrentIndex(0);
QCOMPARE(listview->currentIndex(), 0);
+ // confirm that the velocity is updated
+ QTRY_VERIFY(listview->verticalVelocity() != 0.0);
listview->incrementCurrentIndex();
QCOMPARE(listview->currentIndex(), 1);
diff --git a/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml
new file mode 100644
index 0000000..9cddf1b
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativemousearea/data/doubleclick.qml
@@ -0,0 +1,14 @@
+import Qt 4.7
+
+Item {
+ id: root
+ property int clicked: 0
+ property int doubleClicked: 0
+
+ MouseArea {
+ width: 200; height: 200
+ onClicked: { root.clicked++ }
+ onDoubleClicked: { root.doubleClicked++ }
+ }
+}
+
diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
index c9bb467..e4ec01f 100644
--- a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
+++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp
@@ -62,6 +62,7 @@ private slots:
void updateMouseAreaPosOnResize();
void noOnClickedWithPressAndHold();
void onMousePressRejected();
+ void doubleClick();
private:
QDeclarativeView *createView();
@@ -390,6 +391,37 @@ void tst_QDeclarativeMouseArea::onMousePressRejected()
QVERIFY(!canvas->rootObject()->property("mr2_released").toBool());
}
+void tst_QDeclarativeMouseArea::doubleClick()
+{
+ QDeclarativeView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/doubleclick.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QVERIFY(canvas->rootObject() != 0);
+
+ QGraphicsScene *scene = canvas->scene();
+ QGraphicsSceneMouseEvent pressEvent(QEvent::GraphicsSceneMousePress);
+ pressEvent.setScenePos(QPointF(100, 100));
+ pressEvent.setButton(Qt::LeftButton);
+ pressEvent.setButtons(Qt::LeftButton);
+ QApplication::sendEvent(scene, &pressEvent);
+
+ QGraphicsSceneMouseEvent releaseEvent(QEvent::GraphicsSceneMouseRelease);
+ releaseEvent.setScenePos(QPointF(100, 100));
+ releaseEvent.setButton(Qt::LeftButton);
+ releaseEvent.setButtons(Qt::LeftButton);
+ QApplication::sendEvent(scene, &releaseEvent);
+
+ QGraphicsSceneMouseEvent dblClickEvent(QEvent::GraphicsSceneMouseDoubleClick);
+ dblClickEvent.setScenePos(QPointF(100, 100));
+ dblClickEvent.setButton(Qt::LeftButton);
+ dblClickEvent.setButtons(Qt::LeftButton);
+ QApplication::sendEvent(scene, &dblClickEvent);
+
+ QCOMPARE(canvas->rootObject()->property("clicked").toInt(), 1);
+ QCOMPARE(canvas->rootObject()->property("doubleClicked").toInt(), 1);
+}
+
QTEST_MAIN(tst_QDeclarativeMouseArea)
#include "tst_qdeclarativemousearea.moc"
diff --git a/tests/auto/moc/tst_moc.cpp b/tests/auto/moc/tst_moc.cpp
index f9c3ccb..bb23f49 100644
--- a/tests/auto/moc/tst_moc.cpp
+++ b/tests/auto/moc/tst_moc.cpp
@@ -1077,10 +1077,10 @@ void tst_Moc::qprivateslots()
class PrivatePropertyTest : public QObject
{
Q_OBJECT
- Q_PROPERTY(int foo READ foo WRITE setFoo);
- Q_PRIVATE_PROPERTY(d, int bar READ bar WRITE setBar);
- Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int plop READ plop WRITE setPlop);
- Q_PRIVATE_PROPERTY(PrivatePropertyTest::d_func(), int baz READ baz WRITE setBaz);
+ Q_PROPERTY(int foo READ foo WRITE setFoo)
+ Q_PRIVATE_PROPERTY(d, int bar READ bar WRITE setBar)
+ Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int plop READ plop WRITE setPlop)
+ Q_PRIVATE_PROPERTY(PrivatePropertyTest::d_func(), int baz READ baz WRITE setBaz)
class MyDPointer {
public:
MyDPointer() : mBar(0), mPlop(0) {}
diff --git a/tests/auto/q3table/tst_q3table.cpp b/tests/auto/q3table/tst_q3table.cpp
index 90bf806..93de251 100644
--- a/tests/auto/q3table/tst_q3table.cpp
+++ b/tests/auto/q3table/tst_q3table.cpp
@@ -502,7 +502,7 @@ void tst_Q3Table::pageUpDownNavigation()
void tst_Q3Table::simpleKeyboardNavigation()
{
QApplication::setActiveWindow(testWidget);
- QTRY_COMPARE(QApplication::activeWindow(), testWidget);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(testWidget));
QWidget *w;
// Test for task #24726
@@ -1208,7 +1208,7 @@ void tst_Q3Table::editCheck()
table.show();
QApplication::setActiveWindow(&table);
QTest::qWaitForWindowShown(&table);
- QTRY_COMPARE(QApplication::activeWindow(), &table);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&table));
table.setCurrentCell(0, 0);
#ifdef WAITS
QTest::qWait(50);
@@ -1345,7 +1345,7 @@ void tst_Q3Table::valueChanged()
testWidget->show();
QApplication::setActiveWindow(testWidget);
QTest::qWaitForWindowShown(testWidget);
- QTRY_COMPARE(QApplication::activeWindow(), testWidget);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(testWidget));
#ifdef WAITS
QTest::qWait(50);
#endif
@@ -1395,7 +1395,7 @@ void tst_Q3Table::dateTimeEdit()
testWidget->show();
QApplication::setActiveWindow(testWidget);
QTest::qWaitForWindowShown(testWidget);
- QTRY_COMPARE(QApplication::activeWindow(), testWidget);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(testWidget));
#ifdef WAITS
QTest::qWait(50);
#endif
diff --git a/tests/auto/qcompleter/tst_qcompleter.cpp b/tests/auto/qcompleter/tst_qcompleter.cpp
index a62720b..1590528 100644
--- a/tests/auto/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/qcompleter/tst_qcompleter.cpp
@@ -1324,7 +1324,7 @@ void tst_QCompleter::task253125_lineEditCompletion()
#endif
QTest::qWait(10);
QApplication::setActiveWindow(&edit);
- QTRY_COMPARE(QApplication::activeWindow(), &edit);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&edit));
QTest::keyClick(&edit, 'i');
QCOMPARE(edit.completer()->currentCompletion(), QString("iota"));
@@ -1362,7 +1362,7 @@ void tst_QCompleter::task247560_keyboardNavigation()
QTest::qWait(10);
QApplication::setActiveWindow(&edit);
- QTRY_COMPARE(QApplication::activeWindow(), &edit);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&edit));
QTest::keyClick(&edit, 'r');
QTest::keyClick(edit.completer()->popup(), Qt::Key_Down);
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index c145623..b8e729e 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -287,6 +287,7 @@ private slots:
void taskQTBUG_5904_crashWithDeviceCoordinateCache();
void taskQT657_paintIntoCacheWithTransparentParts();
void taskQTBUG_7863_paintIntoCacheWithTransparentParts();
+ void taskQT_3674_doNotCrash();
};
void tst_QGraphicsScene::initTestCase()
@@ -4565,6 +4566,25 @@ void tst_QGraphicsScene::taskQTBUG_7863_paintIntoCacheWithTransparentParts()
}
}
+void tst_QGraphicsScene::taskQT_3674_doNotCrash()
+{
+ QGraphicsScene scene;
+
+ QGraphicsView view(&scene);
+ view.resize(200, 200);
+
+ QPixmap pixmap(view.size());
+ QPainter painter(&pixmap);
+ view.render(&painter);
+ painter.end();
+
+ scene.addItem(new QGraphicsWidget);
+ scene.setBackgroundBrush(Qt::green);
+
+ QApplication::processEvents();
+ QApplication::processEvents();
+}
+
void tst_QGraphicsScene::zeroScale()
{
//should not crash
diff --git a/tests/auto/qobject/tst_qobject.cpp b/tests/auto/qobject/tst_qobject.cpp
index 08b7c19..5f6262e 100644
--- a/tests/auto/qobject/tst_qobject.cpp
+++ b/tests/auto/qobject/tst_qobject.cpp
@@ -3243,16 +3243,16 @@ void tst_QObject::overloads()
QCOMPARE(obj2.s_num, 101);
emit obj1.sig(&obj2, &obj3); //this signal is connected
QCOMPARE(obj1.s_num, 11);
- QCOMPARE(obj1.o1_obj, &obj2);
+ QCOMPARE(obj1.o1_obj, (QObject *)&obj2);
QCOMPARE(obj1.o2_obj, &obj3);
QCOMPARE(obj1.o3_obj, (QObject *)0); //default arg of the signal
- QCOMPARE(obj1.o4_obj, qApp); //default arg of the slot
+ QCOMPARE(obj1.o4_obj, (QObject *)qApp); //default arg of the slot
QCOMPARE(obj2.s_num, 111);
- QCOMPARE(obj2.o1_obj, &obj2);
+ QCOMPARE(obj2.o1_obj, (QObject *)&obj2);
QCOMPARE(obj2.o2_obj, &obj3);
QCOMPARE(obj2.o3_obj, (QObject *)0); //default arg of the signal
- QCOMPARE(obj2.o4_obj, qApp); //default arg of the slot
+ QCOMPARE(obj2.o4_obj, (QObject *)qApp); //default arg of the slot
}
class ManySignals : public QObject
diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
index e154528..e16be8b 100644
--- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
+++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp
@@ -381,7 +381,7 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation()
QCOMPARE(a1_s_o2->currentLoopTime(), 250);
QCOMPARE(notTimeDriven->currentLoopTime(), 0);
QCOMPARE(loopsForever->currentLoopTime(), 0);
- QCOMPARE(group.currentAnimation(), notTimeDriven);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation *>(notTimeDriven));
// Current time = 505
group.setCurrentTime(505);
@@ -391,7 +391,7 @@ void tst_QSequentialAnimationGroup::setCurrentTimeWithUncontrolledAnimation()
QCOMPARE(a1_s_o2->currentLoopTime(), 250);
QCOMPARE(notTimeDriven->currentLoopTime(), 5);
QCOMPARE(loopsForever->currentLoopTime(), 0);
- QCOMPARE(group.currentAnimation(), notTimeDriven);
+ QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation *>(notTimeDriven));
QCOMPARE(sequence->state(), QAnimationGroup::Stopped);
QCOMPARE(a1_s_o1->state(), QAnimationGroup::Stopped);
QCOMPARE(a1_s_o2->state(), QAnimationGroup::Stopped);