void tst_QGraphicsEffect::itemHasNoContents() { QGraphicsRectItem *parent = new QGraphicsRectItem; parent->setFlag(QGraphicsItem::ItemHasNoContents); MyGraphicsItem *child = new MyGraphicsItem; child->setParentItem(parent); child->resize(200, 200); QGraphicsScene scene; scene.addItem(parent); QGraphicsView view(&scene); view.show(); QTest::qWaitForWindowShown(&view); QTRY_COMPARE(child->nbPaint, 1); CustomEffect *effect = new CustomEffect; parent->setGraphicsEffect(effect); QTRY_COMPARE(effect->numRepaints, 1); for (int i = 0; i < 3; ++i) { effect->reset(); effect->update(); QTRY_COMPARE(effect->numRepaints, 1); } }
void tst_QGraphicsEffect::itemHasNoContents() { QGraphicsRectItem *parent = new QGraphicsRectItem; parent->setFlag(QGraphicsItem::ItemHasNoContents); MyGraphicsItem *child = new MyGraphicsItem; child->setParentItem(parent); child->resize(200, 200); QGraphicsScene scene; scene.addItem(parent); QGraphicsView view(&scene); view.show(); QTest::qWaitForWindowShown(&view); #ifdef Q_OS_MAC if (QSysInfo::MacintoshVersion == QSysInfo::MV_LION) { QEXPECT_FAIL("", "QTBUG-26858", Abort); } #endif QTRY_COMPARE(child->nbPaint, 1); CustomEffect *effect = new CustomEffect; parent->setGraphicsEffect(effect); QTRY_COMPARE(effect->numRepaints, 1); for (int i = 0; i < 3; ++i) { effect->reset(); effect->update(); QTRY_COMPARE(effect->numRepaints, 1); } }