aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmltest
diff options
context:
space:
mode:
Diffstat (limited to 'src/qmltest')
-rw-r--r--src/qmltest/quicktest.cpp23
-rw-r--r--src/qmltest/quicktestevent.cpp3
-rw-r--r--src/qmltest/quicktestresult.cpp11
-rw-r--r--src/qmltest/quicktestresult_p.h1
4 files changed, 21 insertions, 17 deletions
diff --git a/src/qmltest/quicktest.cpp b/src/qmltest/quicktest.cpp
index 9cddf61543..470b3c0f7a 100644
--- a/src/qmltest/quicktest.cpp
+++ b/src/qmltest/quicktest.cpp
@@ -70,6 +70,7 @@
#include <QtQml/QQmlFileSelector>
#include <private/qqmlcomponent_p.h>
+#include <private/qv4executablecompilationunit_p.h>
#ifdef QT_QMLTEST_WITH_WIDGETS
#include <QtWidgets/QApplication>
@@ -290,7 +291,8 @@ public:
m_errors += component.errors();
if (component.isReady()) {
- QQmlRefPointer<CompilationUnit> rootCompilationUnit = QQmlComponentPrivate::get(&component)->compilationUnit;
+ QQmlRefPointer<QV4::ExecutableCompilationUnit> rootCompilationUnit
+ = QQmlComponentPrivate::get(&component)->compilationUnit;
TestCaseEnumerationResult result = enumerateTestCases(rootCompilationUnit.data());
m_testCases = result.testCases + result.finalizedPartialTestCases();
m_errors += result.errors;
@@ -330,12 +332,13 @@ private:
}
};
- TestCaseEnumerationResult enumerateTestCases(CompilationUnit *compilationUnit, const Object *object = nullptr)
+ TestCaseEnumerationResult enumerateTestCases(QV4::ExecutableCompilationUnit *compilationUnit,
+ const Object *object = nullptr)
{
QQmlType testCaseType;
for (quint32 i = 0, count = compilationUnit->importCount(); i < count; ++i) {
const Import *import = compilationUnit->importAt(i);
- if (compilationUnit->stringAt(import->uriIndex) != QLatin1Literal("QtTest"))
+ if (compilationUnit->stringAt(import->uriIndex) != QLatin1String("QtTest"))
continue;
QString testCaseTypeName(QStringLiteral("TestCase"));
@@ -353,7 +356,9 @@ private:
if (!object) // Start at root of compilation unit if not enumerating a specific child
object = compilationUnit->objectAt(0);
- if (CompilationUnit *superTypeUnit = compilationUnit->resolvedTypes.value(object->inheritedTypeNameIndex)->compilationUnit.data()) {
+ if (QV4::ExecutableCompilationUnit *superTypeUnit
+ = compilationUnit->resolvedTypes.value(object->inheritedTypeNameIndex)
+ ->compilationUnit.data()) {
// We have a non-C++ super type, which could indicate we're a subtype of a TestCase
if (testCaseType.isValid() && superTypeUnit->url() == testCaseType.sourceUrl())
result.isTestCase = true;
@@ -363,7 +368,7 @@ private:
if (result.isTestCase) {
// Look for override of name in this type
for (auto binding = object->bindingsBegin(); binding != object->bindingsEnd(); ++binding) {
- if (compilationUnit->stringAt(binding->propertyNameIndex) == QLatin1Literal("name")) {
+ if (compilationUnit->stringAt(binding->propertyNameIndex) == QLatin1String("name")) {
if (binding->type == QV4::CompiledData::Binding::Type_String) {
result.testCaseName = compilationUnit->stringAt(binding->stringIndex);
} else {
@@ -382,10 +387,10 @@ private:
auto functionsEnd = compilationUnit->objectFunctionsEnd(object);
for (auto function = compilationUnit->objectFunctionsBegin(object); function != functionsEnd; ++function) {
QString functionName = compilationUnit->stringAt(function->nameIndex);
- if (!(functionName.startsWith(QLatin1Literal("test_")) || functionName.startsWith(QLatin1Literal("benchmark_"))))
+ if (!(functionName.startsWith(QLatin1String("test_")) || functionName.startsWith(QLatin1String("benchmark_"))))
continue;
- if (functionName.endsWith(QLatin1Literal("_data")))
+ if (functionName.endsWith(QLatin1String("_data")))
continue;
result.testFunctions << functionName;
@@ -554,7 +559,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch
// Register the test object
qmlRegisterSingletonType<QTestRootObject>("Qt.test.qtestroot", 1, 0, "QTestRootObject", testRootObject);
- QSet<QString> commandLineTestFunctions = QTest::testFunctions.toSet();
+ QSet<QString> commandLineTestFunctions(QTest::testFunctions.cbegin(), QTest::testFunctions.cend());
const bool filteringTestFunctions = !commandLineTestFunctions.isEmpty();
// Scan through all of the "tst_*.qml" files and run each of them
@@ -596,7 +601,7 @@ int quick_test_main_with_setup(int argc, char **argv, const char *name, const ch
continue;
}
- const QSet<QString> availableTestSet = availableTestFunctions.toSet();
+ const QSet<QString> availableTestSet(availableTestFunctions.cbegin(), availableTestFunctions.cend());
if (filteringTestFunctions && !availableTestSet.intersects(commandLineTestFunctions))
continue;
commandLineTestFunctions.subtract(availableTestSet);
diff --git a/src/qmltest/quicktestevent.cpp b/src/qmltest/quicktestevent.cpp
index 5b07220c29..1e949615c2 100644
--- a/src/qmltest/quicktestevent.cpp
+++ b/src/qmltest/quicktestevent.cpp
@@ -241,7 +241,8 @@ namespace QtQuickTest
QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask);
stateKey &= static_cast<unsigned int>(Qt::KeyboardModifierMask);
- QWheelEvent we(pos, window->mapToGlobal(pos), QPoint(0, 0), QPoint(xDelta, yDelta), 0, Qt::Vertical, buttons, stateKey);
+ QWheelEvent we(pos, window->mapToGlobal(pos), QPoint(0, 0), QPoint(xDelta, yDelta), buttons,
+ stateKey, Qt::NoScrollPhase, false);
QSpontaneKeyEvent::setSpontaneous(&we); // hmmmm
if (!qApp->notify(window, &we))
diff --git a/src/qmltest/quicktestresult.cpp b/src/qmltest/quicktestresult.cpp
index 4dbec585c4..49552e1901 100644
--- a/src/qmltest/quicktestresult.cpp
+++ b/src/qmltest/quicktestresult.cpp
@@ -62,7 +62,9 @@
#include <QtCore/qdebug.h>
#include <QtCore/QUrl>
#include <QtCore/QDir>
+#if QT_CONFIG(regularexpression)
#include <QtCore/qregularexpression.h>
+#endif
#include <QtQuick/qquickwindow.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qimagewriter.h>
@@ -640,12 +642,9 @@ void QuickTestResult::warn(const QString &message, const QUrl &location, int lin
void QuickTestResult::ignoreWarning(const QJSValue &message)
{
if (message.isRegExp()) {
- // ### we should probably handle QRegularExpression conversion engine-side
- QRegExp re = message.toVariant().toRegExp();
- QRegularExpression::PatternOptions opts = re.caseSensitivity() ==
- Qt::CaseInsensitive ? QRegularExpression::CaseInsensitiveOption : QRegularExpression::NoPatternOption;
- QRegularExpression re2(re.pattern(), opts);
- QTestLog::ignoreMessage(QtWarningMsg, re2);
+#if QT_CONFIG(regularexpression)
+ QTestLog::ignoreMessage(QtWarningMsg, message.toVariant().toRegularExpression());
+#endif
} else {
QTestLog::ignoreMessage(QtWarningMsg, message.toString().toLatin1());
}
diff --git a/src/qmltest/quicktestresult_p.h b/src/qmltest/quicktestresult_p.h
index 3643826e5d..0d229ad713 100644
--- a/src/qmltest/quicktestresult_p.h
+++ b/src/qmltest/quicktestresult_p.h
@@ -57,7 +57,6 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qscopedpointer.h>
#include <QtQuick/qquickitem.h>
-#include <QtQml/private/qv8engine_p.h>
QT_BEGIN_NAMESPACE