TestTouchItem::clearMousePressCounter();
QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
window->resize(250, 250);
window->setPos(100, 100);
window->show();
delete topItem;
delete middleItem;
delete bottomItem;
- delete window;
}
void tst_qquickwindow::touchEvent_propagation()
QFETCH(bool, showItem);
QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
window->resize(250, 250);
window->setPos(100, 100);
window->show();
delete topItem;
delete middleItem;
delete bottomItem;
- delete window;
}
void tst_qquickwindow::touchEvent_propagation_data()
TestTouchItem::clearMousePressCounter();
QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
window->resize(250, 250);
window->setPos(100, 100);
window->show();
COMPARE_TOUCH_DATA(item->lastEvent, d);
delete item;
- delete window;
}
void tst_qquickwindow::touchEvent_reentrant()
TestTouchItem::clearMousePressCounter();
QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
+
window->resize(250, 250);
window->setPos(100, 100);
window->show();
QTRY_COMPARE(item->touchEventCount, 3);
delete item;
- delete window;
}
void tst_qquickwindow::touchEvent_velocity()
TestTouchItem::clearMousePressCounter();
QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
window->resize(250, 250);
window->setPos(100, 100);
window->show();
QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
QCoreApplication::processEvents();
delete item;
- delete window;
}
void tst_qquickwindow::mouseFromTouch_basic()
TestTouchItem::clearMousePressCounter();
QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
window->resize(250, 250);
window->setPos(100, 100);
window->show();
QWindowSystemInterface::handleTouchEvent(window, touchDeviceWithVelocity, points);
QCoreApplication::processEvents();
delete item;
- delete window;
}
void tst_qquickwindow::clearWindow()
TestTouchItem::clearMousePressCounter();
QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
window->resize(250, 250);
window->setPos(100, 100);
window->show();
QTRY_COMPARE(middleItem->mousePressId, 1);
QTRY_COMPARE(bottomItem->mousePressId, 2);
QTRY_COMPARE(topItem->mousePressId, 3);
-
- delete window;
}
void tst_qquickwindow::qmlCreation()
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("window.qml"));
QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
QVERIFY(created);
QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
QQuickItem* item = window->findChild<QQuickItem*>("item");
QVERIFY(item);
QCOMPARE(item->window(), window);
-
- delete window;
}
void tst_qquickwindow::clearColor()
{
//::grab examines rendering to make sure it works visually
QQuickWindow *window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
window->resize(250, 250);
window->setPos(100, 100);
window->setColor(Qt::blue);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
QCOMPARE(window->color(), QColor(Qt::blue));
- delete window;
}
void tst_qquickwindow::grab()
void tst_qquickwindow::multipleWindows()
{
QList<QQuickWindow *> windows;
+ QScopedPointer<QQuickWindow> cleanup[6];
+
for (int i=0; i<6; ++i) {
QQuickWindow *c = new QQuickWindow();
c->setColor(Qt::GlobalColor(Qt::red + i));
c->setPos(100 + i * 30, 100 + i * 20);
c->show();
windows << c;
- QVERIFY(c->isVisible());
+ cleanup[i].reset(c);
+ QVERIFY(QTest::qWaitForWindowExposed(c));
}
// move them
for (int i=0; i<windows.size(); ++i) {
QQuickWindow *c = windows.at(i);
- c->setPos(c->x() - 10, c->y() - 10);
+ c->setPos(100 + i * 30, 100 + i * 20 + 100);
}
// resize them
QQuickWindow *c = windows.at(i);
c->resize(200, 150);
}
-
- qDeleteAll(windows);
}
void tst_qquickwindow::animationsWhileHidden()
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("AnimationsWhileHidden.qml"));
QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
QVERIFY(window);
// Running animaiton should cause it to become visible again shortly.
QTRY_VERIFY(window->isVisible());
-
- delete window;
}
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("Headless.qml"));
QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
QVERIFY(window);
+ window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(window->isVisible());
QImage newContent = window->grabWindow();
QCOMPARE(originalContent, newContent);
-
- delete window;
}
void tst_qquickwindow::focusObject()
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("focus.qml"));
QObject *created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+
QVERIFY(created);
QQuickWindow *window = qobject_cast<QQuickWindow*>(created);
QVERIFY(item2);
item2->setFocus(true);
QCOMPARE(item2, window->focusObject());
-
- delete window;
}
void tst_qquickwindow::ignoreUnhandledMouseEvents()
{
QQuickWindow* window = new QQuickWindow;
+ QScopedPointer<QQuickWindow> cleanup(window);
window->resize(100, 100);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
QVERIFY(QCoreApplication::sendEvent(window, &me));
QVERIFY(!me.isAccepted());
}
-
- delete window;
}
QQmlComponent component(&engine);
component.loadUrl(testFileUrl("ownershipRootItem.qml"));
QObject* created = component.create();
+ QScopedPointer<QObject> cleanup(created);
QQuickWindow* window = qobject_cast<QQuickWindow*>(created);
QVERIFY(window);