diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-03 03:04:15 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-11-03 03:04:16 +0100 |
commit | 1425995a8b0e7e35b90bf93c3f9d4fe4e7e2b887 (patch) | |
tree | 93f502f98f10c1a9bbb2339465ace9e045eb3156 /tests/auto/shared | |
parent | b86d6b0b06db0eb978e2559745c48edb2ca876a7 (diff) | |
parent | 33966b5b9b026f24ac94c0905280deb4d004df81 (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I4ebc848bf78a74fb26a630d8a4839f104612ff74
Diffstat (limited to 'tests/auto/shared')
-rw-r--r-- | tests/auto/shared/qtest_quickcontrols.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/shared/qtest_quickcontrols.h b/tests/auto/shared/qtest_quickcontrols.h index 1c803ae2..4a06c021 100644 --- a/tests/auto/shared/qtest_quickcontrols.h +++ b/tests/auto/shared/qtest_quickcontrols.h @@ -55,11 +55,15 @@ static int runTests(QObject *testObject, int argc, char *argv[]) int res = 0; QTest::qInit(testObject, argc, argv); const QByteArray testObjectName = QTestResult::currentTestObjectName(); + // setCurrentTestObject() takes a C string, which means we must ensure + // that the string we pass in lives long enough (i.e until the next call + // to setCurrentTestObject()), so store the name outside of the loop. + QByteArray testName; const QStringList styles = testStyles(); for (const QString &style : styles) { qmlClearTypeRegistrations(); QQuickStyle::setStyle(style); - const QByteArray testName = testObjectName + "::" + style.toLocal8Bit(); + testName = testObjectName + "::" + style.toLocal8Bit(); QTestResult::setCurrentTestObject(testName); res += QTest::qRun(); } |