aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/particles/shared/particlestestsshared.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/particles/shared/particlestestsshared.h')
-rw-r--r--tests/auto/particles/shared/particlestestsshared.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/auto/particles/shared/particlestestsshared.h b/tests/auto/particles/shared/particlestestsshared.h
index 5ef1d2cabb..e1fc6f4ccd 100644
--- a/tests/auto/particles/shared/particlestestsshared.h
+++ b/tests/auto/particles/shared/particlestestsshared.h
@@ -31,6 +31,8 @@
#include <QtQuick/QQuickView>
#include <QtTest>
#include <QAbstractAnimation>
+#include <QScopedPointer>
+
const qreal EPSILON = 0.0001;
bool extremelyFuzzyCompare(qreal a, qreal b, qreal e)//For cases which can have larger variances
@@ -55,17 +57,18 @@ bool myFuzzyGEQ(qreal a, qreal b)
QQuickView* createView(const QUrl &filename, int additionalWait=0)
{
- QQuickView *view = new QQuickView(0);
+ QScopedPointer<QQuickView> view(new QQuickView(nullptr));
view->setSource(filename);
if (view->status() != QQuickView::Ready)
- return 0;
+ return nullptr;
view->show();
- QTest::qWaitForWindowExposed(view);
+ if (!QTest::qWaitForWindowExposed(view.data()))
+ return nullptr;
if (additionalWait)
QTest::qWait(additionalWait);
- return view;
+ return view.take();
}
void ensureAnimTime(int requiredTime, QAbstractAnimation* anim)//With consistentTiming, who knows how long an animation really takes...