From 0cd098032c2406c714afea008e557502f1a9e75e Mon Sep 17 00:00:00 2001
From: Erik Verbruggen <erik.verbruggen@nokia.com>
Date: Wed, 24 Mar 2010 11:08:23 +0100
Subject: [PATCH] Fixed QmlJS interpreter metatype system initialization.

---
 .../auto/qml/qmldesigner/coretests/testcore.cpp | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tests/auto/qml/qmldesigner/coretests/testcore.cpp b/tests/auto/qml/qmldesigner/coretests/testcore.cpp
index 5872281cbb5..11c9172621b 100644
--- a/tests/auto/qml/qmldesigner/coretests/testcore.cpp
+++ b/tests/auto/qml/qmldesigner/coretests/testcore.cpp
@@ -57,6 +57,8 @@
 #include <bytearraymodifier.h>
 #include "testrewriterview.h"
 
+#include <qmljs/qmljsinterpreter.h>
+
 #include <QPlainTextEdit>
 #include <private/qdeclarativestate_p.h>
 #include <private/qdeclarativemetatype_p.h>
@@ -66,6 +68,19 @@ using namespace QmlDesigner;
 #include <cstdio>
 #include "../common/statichelpers.cpp"
 
+static void initializeMetaTypeSystem(const QString &resourcePath)
+{
+    const QDir typeFileDir(resourcePath + QLatin1String("/qml-type-descriptions"));
+    const QStringList xmlExtensions = QStringList() << QLatin1String("*.xml");
+    const QFileInfoList xmlFiles = typeFileDir.entryInfoList(xmlExtensions,
+                                                             QDir::Files,
+                                                             QDir::Name);
+
+    const QStringList errors = QmlJS::Interpreter::MetaTypeSystem::load(xmlFiles);
+    foreach (const QString &error, errors)
+        qWarning() << qPrintable(error);
+}
+
 TestCore::TestCore()
     : QObject()
 {
@@ -77,6 +92,8 @@ void TestCore::initTestCase()
     qInstallMsgHandler(testMessageOutput);
 #endif
     Exception::setShouldAssert(false);
+
+    initializeMetaTypeSystem(QLatin1String("../../../../../share/qtcreator"));
 }
 
 void TestCore::cleanupTestCase()
-- 
GitLab