summaryrefslogtreecommitdiffstats
path: root/tests/auto/qgraphicsitem
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2010-12-07 13:57:38 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2010-12-07 13:57:38 (GMT)
commitd8fb8ca3a378743eebb8464f7910a5e6d1870c01 (patch)
tree9c31a017163a532946f10107b8d9f4405ed1c9db /tests/auto/qgraphicsitem
parentb5915ef3a6d0417440ad82e9369d6679505b953e (diff)
parent076bba6c901e292b61fffb7a91020075dcd84919 (diff)
downloadQt-d8fb8ca3a378743eebb8464f7910a5e6d1870c01.zip
Qt-d8fb8ca3a378743eebb8464f7910a5e6d1870c01.tar.gz
Qt-d8fb8ca3a378743eebb8464f7910a5e6d1870c01.tar.bz2
Merge branch 'qdoc-simplified' into mimir-simplified
Conflicts: doc/src/platforms/compiler-notes.qdoc tools/qdoc3/ditaxmlgenerator.cpp tools/qdoc3/ditaxmlgenerator.h tools/qdoc3/htmlgenerator.cpp tools/qdoc3/htmlgenerator.h tools/qdoc3/node.cpp tools/qdoc3/pagegenerator.h
Diffstat (limited to 'tests/auto/qgraphicsitem')
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp97
1 files changed, 78 insertions, 19 deletions
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 2ddccd2..0b29410 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -94,6 +94,8 @@ Q_DECLARE_METATYPE(QRectF)
#define COMPARE_REGIONS QTRY_COMPARE
#endif
+#include "../platformquirks.h"
+
static QGraphicsRectItem staticItem; //QTBUG-7629, we should not crash at exit.
static void sendMousePress(QGraphicsScene *scene, const QPointF &point, Qt::MouseButton button = Qt::LeftButton)
@@ -272,7 +274,7 @@ class MyGraphicsView : public QGraphicsView
public:
int repaints;
QRegion paintedRegion;
- MyGraphicsView(QGraphicsScene *scene) : QGraphicsView(scene), repaints(0) {}
+ MyGraphicsView(QGraphicsScene *scene, QWidget *parent=0) : QGraphicsView(scene,parent), repaints(0) {}
void paintEvent(QPaintEvent *e)
{
paintedRegion += e->region();
@@ -466,6 +468,7 @@ private slots:
void doNotMarkFullUpdateIfNotInScene();
void itemDiesDuringDraggingOperation();
void QTBUG_12112_focusItem();
+ void QTBUG_13473_sceneposchange();
private:
QList<QGraphicsItem *> paintedItems;
@@ -4069,9 +4072,10 @@ void tst_QGraphicsItem::cursor()
item1->setCursor(Qt::IBeamCursor);
item2->setCursor(Qt::PointingHandCursor);
- QGraphicsView view(&scene);
+ QWidget topLevel;
+ QGraphicsView view(&scene,&topLevel);
view.setFixedSize(200, 100);
- view.show();
+ topLevel.show();
QTest::mouseMove(&view, view.rect().center());
QTest::qWait(25);
@@ -4093,6 +4097,8 @@ void tst_QGraphicsItem::cursor()
QApplication::sendEvent(view.viewport(), &event);
}
+ if (!PlatformQuirks::haveMouseCursor())
+ return;
#if !defined(Q_OS_WINCE)
QTest::qWait(250);
#else
@@ -4958,7 +4964,10 @@ void tst_QGraphicsItem::paint()
QGraphicsView view(&scene);
- view.show();
+ if(PlatformQuirks::isAutoMaximizing())
+ view.showFullScreen();
+ else
+ view.show();
QTest::qWaitForWindowShown(&view);
QApplication::processEvents();
#ifdef Q_OS_WIN32
@@ -5974,9 +5983,10 @@ void tst_QGraphicsItem::untransformable()
QGraphicsScene scene(-500, -500, 1000, 1000);
scene.addItem(item1);
- QGraphicsView view(&scene);
+ QWidget topLevel;
+ QGraphicsView view(&scene,&topLevel);
view.resize(300, 300);
- view.show();
+ topLevel.show();
view.scale(8, 8);
view.centerOn(0, 0);
@@ -6615,7 +6625,10 @@ void tst_QGraphicsItem::opacity2()
scene.addItem(parent);
MyGraphicsView view(&scene);
- view.show();
+ if(PlatformQuirks::isAutoMaximizing())
+ view.showFullScreen();
+ else
+ view.show();
QTest::qWaitForWindowShown(&view);
QTRY_VERIFY(view.repaints >= 1);
@@ -7049,6 +7062,7 @@ void tst_QGraphicsItem::tabChangesFocus()
widget.setLayout(layout);
widget.show();
QTest::qWaitForWindowShown(&widget);
+ QTest::qWait(2000);
QTRY_VERIFY(scene.isActive());
@@ -7494,9 +7508,11 @@ void tst_QGraphicsItem::update()
{
QGraphicsScene scene;
scene.setSceneRect(-100, -100, 200, 200);
- MyGraphicsView view(&scene);
+ QWidget topLevel;
+ MyGraphicsView view(&scene,&topLevel);
- view.show();
+ topLevel.resize(300, 300);
+ topLevel.show();
#ifdef Q_WS_X11
qt_x11_wait_for_window_manager(&view);
#endif
@@ -7775,10 +7791,11 @@ void tst_QGraphicsItem::itemUsesExtendedStyleOption()
MyStyleOptionTester *rect = new MyStyleOptionTester(QRect(0, 0, 100, 100));
scene.addItem(rect);
rect->setPos(200, 200);
- QGraphicsView view(&scene);
- view.setWindowFlags(Qt::X11BypassWindowManagerHint);
+ QWidget topLevel;
+ QGraphicsView view(&scene, &topLevel);
+ topLevel.setWindowFlags(Qt::X11BypassWindowManagerHint);
rect->startTrack = false;
- view.show();
+ topLevel.show();
QTest::qWaitForWindowShown(&view);
QTest::qWait(60);
rect->startTrack = true;
@@ -7979,6 +7996,9 @@ void tst_QGraphicsItem::sorting_data()
void tst_QGraphicsItem::sorting()
{
+ if (PlatformQuirks::isAutoMaximizing())
+ QSKIP("Skipped because Platform is auto maximizing", SkipAll);
+
_paintedItems.clear();
QGraphicsScene scene;
@@ -8014,7 +8034,7 @@ void tst_QGraphicsItem::sorting()
_paintedItems.clear();
view.viewport()->repaint();
-#ifdef Q_WS_MAC
+#if defined(Q_WS_MAC)
// There's no difference between repaint and update on the Mac,
// so we have to process events here to make sure we get the event.
QTest::qWait(100);
@@ -8113,10 +8133,13 @@ void tst_QGraphicsItem::hitTestGraphicsEffectItem()
QGraphicsScene scene;
scene.setSceneRect(-100, -100, 200, 200);
- QGraphicsView view(&scene);
- view.show();
+ QWidget toplevel;
+
+ QGraphicsView view(&scene, &toplevel);
+ toplevel.resize(300, 300);
+ toplevel.show();
#ifdef Q_WS_X11
- qt_x11_wait_for_window_manager(&view);
+ qt_x11_wait_for_window_manager(&toplevel);
#endif
QTest::qWait(100);
@@ -9067,6 +9090,7 @@ void tst_QGraphicsItem::focusScope()
QVERIFY(!scope2->hasFocus());
QVERIFY(scope1->hasFocus());
scope2->setFocus();
+ QVERIFY(scope2->hasFocus());
scope3->setFocus();
QVERIFY(scope3->hasFocus());
@@ -10719,7 +10743,10 @@ void tst_QGraphicsItem::QTBUG_6738_missingUpdateWithSetParent()
scene.addItem(parent);
MyGraphicsView view(&scene);
- view.show();
+ if(PlatformQuirks::isAutoMaximizing())
+ view.showFullScreen();
+ else
+ view.show();
QTest::qWaitForWindowShown(&view);
QTRY_VERIFY(view.repaints > 0);
@@ -10767,7 +10794,10 @@ void tst_QGraphicsItem::QT_2653_fullUpdateDiscardingOpacityUpdate()
// ItemIgnoresTransformations, ItemClipsChildrenToShape, ItemIsSelectable
parentGreen->setFlag(QGraphicsItem::ItemIgnoresTransformations);
- view.show();
+ if (PlatformQuirks::isAutoMaximizing())
+ view.showFullScreen();
+ else
+ view.show();
QTest::qWaitForWindowShown(&view);
view.reset();
@@ -10952,7 +10982,10 @@ void tst_QGraphicsItem::doNotMarkFullUpdateIfNotInScene()
item3->setParentItem(item2);
item2->setParentItem(item);
scene.addItem(item);
- view.show();
+ if(PlatformQuirks::isAutoMaximizing())
+ view.showFullScreen();
+ else
+ view.show();
QTest::qWaitForWindowShown(&view);
QTRY_COMPARE(view.repaints, 1);
QTRY_COMPARE(item->painted, 1);
@@ -11018,5 +11051,31 @@ void tst_QGraphicsItem::QTBUG_12112_focusItem()
QVERIFY(item2->focusItem());
}
+void tst_QGraphicsItem::QTBUG_13473_sceneposchange()
+{
+ ScenePosChangeTester* parent = new ScenePosChangeTester;
+ ScenePosChangeTester* child = new ScenePosChangeTester(parent);
+
+ // parent's disabled ItemSendsGeometryChanges flag must not affect
+ // child's scene pos change notifications
+ parent->setFlag(QGraphicsItem::ItemSendsGeometryChanges, false);
+ child->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
+
+ QGraphicsScene scene;
+ scene.addItem(parent);
+
+ // ignore uninteresting changes
+ parent->clear();
+ child->clear();
+
+ // move
+ parent->moveBy(1.0, 1.0);
+ QCOMPARE(child->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 1);
+
+ // transform
+ parent->setTransform(QTransform::fromScale(0.5, 0.5));
+ QCOMPARE(child->changes.count(QGraphicsItem::ItemScenePositionHasChanged), 2);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"