summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/graphicsview
diff options
context:
space:
mode:
authorJason McDonald <jason.mcdonald@nokia.com>2011-11-15 11:36:18 +1000
committerQt by Nokia <qt-info@nokia.com>2011-11-18 01:51:57 +0100
commita8fd0c3654f8352773638633778cd8003680cbc7 (patch)
tree4815cca9daf879b96a92a3de95621b56ac5ba868 /tests/auto/widgets/graphicsview
parentd90d57bb8b995c7a66e7f9b7b2515447fbe11de0 (diff)
Don't depend on moc to disable test functions.
The moc tool is not aware of all defines (particularly those that are compiler builtins) and does not correctly evaluate others that depend on compiler builtins, such as Q_OS_FOO. This commit reverts parts of the following commits, but is not a complete fix as there were many instances of this problem in the tests prior to those commits: 924d810dbdcd5b5b0fa860922b2487ea9062d002 8aaff6751038b88d17e23be6fcee945771297c5b 338d3f11973412047c2c9cd41cbd0c961d738ef3 a55034062ba2bf73a9f1ed3d9cf31745b38149e3 253497b7446c7d723aa3bdd7152e25d6852f2604 7cfad460c56319ba89c4a3a0bbcb2e54ab1cdbc6 9d2ff58f3642828e494e7e9b2df7dbb8e2cd408f 0cf6baa2d61ebaad2a2a0530c37f27e719b68f4b Change-Id: I947d797fe3ec76139ba1b55561cea569895662c5 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Diffstat (limited to 'tests/auto/widgets/graphicsview')
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp16
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp19
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp7
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp35
4 files changed, 38 insertions, 39 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 26b8616231..2247173c7f 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -61,16 +61,12 @@ private slots:
void qgraphicsgridlayout();
void addItem_data();
void addItem();
-#ifndef Q_WS_MAC
void alignment_data();
void alignment();
-#endif
void alignment2();
void alignment2_data();
-#ifndef Q_WS_MAC
void columnAlignment_data();
void columnAlignment();
-#endif
void columnCount_data();
void columnCount();
void columnMaximumWidth_data();
@@ -494,8 +490,6 @@ void tst_QGraphicsGridLayout::addItem()
delete layout;
}
-// Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac.
-#ifndef Q_WS_MAC
void tst_QGraphicsGridLayout::alignment_data()
{
QTest::addColumn<bool>("hasHeightForWidth");
@@ -507,6 +501,9 @@ void tst_QGraphicsGridLayout::alignment_data()
// public Qt::Alignment alignment(QGraphicsLayoutItem* item) const
void tst_QGraphicsGridLayout::alignment()
{
+#ifdef Q_WS_MAC
+ QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac");
+#endif
QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
@@ -565,10 +562,7 @@ void tst_QGraphicsGridLayout::alignment()
delete widget;
}
-#endif
-// Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac.
-#ifndef Q_WS_MAC
void tst_QGraphicsGridLayout::columnAlignment_data()
{
QTest::addColumn<bool>("hasHeightForWidth");
@@ -581,6 +575,9 @@ void tst_QGraphicsGridLayout::columnAlignment_data()
// public Qt::Alignment columnAlignment(int column) const
void tst_QGraphicsGridLayout::columnAlignment()
{
+#ifdef Q_WS_MAC
+ QSKIP("Resizing a QGraphicsWidget to effectiveSizeHint(Qt::MaximumSize) is currently not supported on mac");
+#endif
QFETCH(bool, hasHeightForWidth);
QGraphicsScene scene;
QGraphicsView view(&scene);
@@ -633,7 +630,6 @@ void tst_QGraphicsGridLayout::columnAlignment()
delete widget;
}
-#endif
void tst_QGraphicsGridLayout::columnCount_data()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 0e86c0ab48..f943daf411 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -118,10 +118,8 @@ private slots:
void focusNextPrevChild();
void focusOutEvent_data();
void focusOutEvent();
-#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))
void hoverEnterLeaveEvent_data();
void hoverEnterLeaveEvent();
-#endif
void hoverMoveEvent_data();
void hoverMoveEvent();
void keyPressEvent_data();
@@ -159,9 +157,7 @@ private slots:
void setFocus_complexTwoWidgets();
void popup_basic();
void popup_subwidget();
-#if !defined(QT_NO_CURSOR) && (!defined(Q_OS_WINCE) || defined(GWES_ICONCURS))
void changingCursor_basic();
-#endif
void tooltip_basic();
void childPos_data();
void childPos();
@@ -944,8 +940,6 @@ protected:
}
};
-// protected void hoverEnterEvent(QGraphicsSceneHoverEvent* event)
-#if !defined(Q_OS_WINCE) || (defined(GWES_ICONCURS) && !defined(QT_NO_CURSOR))
void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data()
{
QTest::addColumn<bool>("hasWidget");
@@ -956,11 +950,16 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data()
QTest::newRow("no widget, hover") << false << true;
}
+// protected void hoverEnterEvent(QGraphicsSceneHoverEvent* event)
void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
{
QFETCH(bool, hasWidget);
QFETCH(bool, hoverEnabled);
+#if defined(Q_OS_WINCE) && (!defined(GWES_ICONCURS) || defined(QT_NO_CURSOR))
+ QSKIP("hover events not supported on this platform");
+#endif
+
// proxy should translate this into events that the widget would expect
QGraphicsScene scene;
@@ -1007,7 +1006,6 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent()
if (!hasWidget)
delete widget;
}
-#endif
void tst_QGraphicsProxyWidget::hoverMoveEvent_data()
{
@@ -2548,9 +2546,12 @@ void tst_QGraphicsProxyWidget::popup_subwidget()
QCOMPARE(popup->size(), child->size().toSize());
}
-#if !defined(QT_NO_CURSOR) && (!defined(Q_OS_WINCE) || defined(GWES_ICONCURS))
void tst_QGraphicsProxyWidget::changingCursor_basic()
{
+#if defined(Q_OS_WINCE) && (!defined(GWES_ICONCURS) || defined(QT_NO_CURSOR))
+ QSKIP("hover events not supported on this platform");
+#endif
+#ifndef QT_NO_CURSOR
// Confirm that mouse events are working properly by checking that
// when moving the mouse over a line edit it will change the cursor into the I
QGraphicsScene scene;
@@ -2576,8 +2577,8 @@ void tst_QGraphicsProxyWidget::changingCursor_basic()
QTest::mouseMove(view.viewport(), QPoint(1, 1));
sendMouseMove(view.viewport(), QPoint(1, 1));
QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor);
-}
#endif
+}
void tst_QGraphicsProxyWidget::tooltip_basic()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index d69927b12c..496628597d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -216,9 +216,7 @@ private slots:
void addPixmap();
void addRect();
void addText();
-#if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS)
void removeItem();
-#endif
void clear();
void focusItem();
void focusItemLostFocus();
@@ -1245,9 +1243,11 @@ void tst_QGraphicsScene::addText()
QCOMPARE(text->font(), QFont());
}
-#if !defined(Q_OS_WINCE) || defined(GWES_ICONCURS)
void tst_QGraphicsScene::removeItem()
{
+#if defined(Q_OS_WINCE) && !defined(GWES_ICONCURS)
+ QSKIP("No mouse cursor support");
+#endif
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(0, 0, 10, 10));
QCOMPARE(scene.itemAt(0, 0), item); // forces indexing
@@ -1309,7 +1309,6 @@ void tst_QGraphicsScene::removeItem()
qApp->processEvents(); // <- pending update is sent to view
QVERIFY(!hoverItem->isHovered);
}
-#endif
void tst_QGraphicsScene::focusItem()
{
diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
index ded0cc7965..ad204f231d 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp
@@ -187,10 +187,8 @@ private slots:
void mapFromScenePath();
void sendEvent();
void wheelEvent();
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void cursor();
void cursor2();
-#endif
void transformationAnchor();
void resizeAnchor();
void viewportUpdateMode();
@@ -244,16 +242,12 @@ private slots:
void task239047_fitInViewSmallViewport();
void task245469_itemsAtPointWithClip();
void task253415_reconnectUpdateSceneOnSceneChanged();
-#ifndef Q_OS_WINCE
void task255529_transformationAnchorMouseAndViewportMargins();
-#endif
void task259503_scrollingArtifacts();
void QTBUG_4151_clipAndIgnore_data();
void QTBUG_4151_clipAndIgnore();
void QTBUG_5859_exposedRect();
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void QTBUG_7438_cursor();
-#endif
void hoverLeave();
void QTBUG_16063_microFocusRect();
@@ -2057,10 +2051,12 @@ void tst_QGraphicsView::wheelEvent()
QVERIFY(widget->hasFocus());
}
-// Qt/CE does not have regular cursor support.
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void tst_QGraphicsView::cursor()
{
+#ifndef QT_NO_CURSOR
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not have regular cursor support");
+#endif
if (PlatformQuirks::haveMouseCursor())
QSKIP("The Platform does not have regular cursor support");
@@ -2082,13 +2078,17 @@ void tst_QGraphicsView::cursor()
sendMouseMove(view.viewport(), QPoint(5, 5));
QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor);
-}
#endif
+}
// Qt/CE does not have regular cursor support.
#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void tst_QGraphicsView::cursor2()
{
+#ifndef QT_NO_CURSOR
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not have regular cursor support");
+#endif
if (PlatformQuirks::haveMouseCursor())
QSKIP("The Platform does not have regular cursor support");
@@ -2154,8 +2154,8 @@ void tst_QGraphicsView::cursor2()
QCOMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor);
sendMouseMove(view.viewport(), view.mapFromScene(-15, -15));
QCOMPARE(view.viewport()->cursor().shape(), Qt::SizeAllCursor);
-}
#endif
+}
void tst_QGraphicsView::transformationAnchor()
{
@@ -4252,10 +4252,11 @@ void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged()
QVERIFY(wasConnected2);
}
-// Qt/CE does not implement mouse tracking at this point.
-#ifndef Q_OS_WINCE
void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
{
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not implement mouse tracking at this point");
+#endif
QGraphicsScene scene(-100, -100, 200, 200);
scene.addRect(QRectF(-50, -50, 100, 100), QPen(Qt::black), QBrush(Qt::blue));
@@ -4289,8 +4290,8 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins()
QEXPECT_FAIL("", "QTBUG-22455", Abort);
QVERIFY(qAbs(newMouseScenePos.x() - mouseScenePos.x()) < slack);
QVERIFY(qAbs(newMouseScenePos.y() - mouseScenePos.y()) < slack);
-}
#endif
+}
void tst_QGraphicsView::task259503_scrollingArtifacts()
{
@@ -4439,10 +4440,12 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect()
QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect);
}
-// Qt/CE does not have regular cursor support.
-#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE)
void tst_QGraphicsView::QTBUG_7438_cursor()
{
+#ifndef QT_NO_CURSOR
+#if defined(Q_OS_WINCE)
+ QSKIP("Qt/CE does not have regular cursor support");
+#endif
QGraphicsScene scene;
QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20));
item->setFlag(QGraphicsItem::ItemIsMovable);
@@ -4461,8 +4464,8 @@ void tst_QGraphicsView::QTBUG_7438_cursor()
QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor);
sendMouseRelease(view.viewport(), view.mapFromScene(0, 0));
QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor);
-}
#endif
+}
class GraphicsItemWithHover : public QGraphicsRectItem
{