aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/quickcontrolstestutils/controlstestutils.cpp15
-rw-r--r--tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/quickcontrolstestutils/controlstestutils.cpp b/src/quickcontrolstestutils/controlstestutils.cpp
index de7d38db32..662633c7b6 100644
--- a/src/quickcontrolstestutils/controlstestutils.cpp
+++ b/src/quickcontrolstestutils/controlstestutils.cpp
@@ -17,11 +17,19 @@ QQuickControlsTestUtils::QQuickControlsApplicationHelper::QQuickControlsApplicat
appWindow = qobject_cast<QQuickApplicationWindow*>(cleanup.data());
}
+/*!
+ \internal
+
+ If \a style is different from the current style, this function will
+ recreate the QML engine, clear type registrations and set the new style.
+
+ Returns \c true if successful or if \c style is already set.
+*/
bool QQuickControlsTestUtils::QQuickStyleHelper::updateStyle(const QString &style)
{
// If it's not the first time a style has been set and the new style is not different, do nothing.
if (!currentStyle.isEmpty() && style == currentStyle)
- return false;
+ return true;
engine.reset();
currentStyle = style;
@@ -31,8 +39,9 @@ bool QQuickControlsTestUtils::QQuickStyleHelper::updateStyle(const QString &styl
QQmlComponent component(engine.data());
component.setData(QString::fromUtf8("import QtQuick\nimport QtQuick.Controls\n Control { }").toUtf8(), QUrl());
-
- return true;
+ if (!component.isReady())
+ qWarning() << "Failed to load component:" << component.errorString();
+ return component.isReady();
}
void QQuickControlsTestUtils::forEachControl(QQmlEngine *engine, const QString &qqc2ImportPath,
diff --git a/tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp b/tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp
index 660be4ad4a..82259269d9 100644
--- a/tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp
+++ b/tests/benchmarks/quickcontrols2/creationtime/tst_creationtime.cpp
@@ -57,7 +57,7 @@ static void doBenchmark(QQuickStyleHelper &styleHelper, const QUrl &url)
QCOMPARE(styleAndFileName.size(), 2);
QString style = styleAndFileName.first();
style[0] = style.at(0).toUpper();
- styleHelper.updateStyle(style);
+ QVERIFY(styleHelper.updateStyle(style));
QQmlComponent component(styleHelper.engine.data());
component.loadUrl(url);