Commit f7e9c407 authored by Erik Verbruggen's avatar Erik Verbruggen
Browse files

Changes to get the unittests to work.

parent 8dbc9fbe
......@@ -53,8 +53,8 @@ public:
virtual int indentDepth() const;
static QmlJS::Snapshot getSnapshot();
static QStringList importPaths();
virtual QmlJS::Snapshot getSnapshot() const;
virtual QStringList importPaths() const;
};
} // namespace QmlDesigner
......
......@@ -58,6 +58,9 @@ public:
virtual void deactivateChangeSignals();
virtual void reactivateChangeSignals();
virtual QmlJS::Snapshot getSnapshot() const;
virtual QStringList importPaths() const;
public slots:
void contentsChange(int position, int charsRemoved, int charsAdded);
......
......@@ -75,6 +75,9 @@ public:
virtual void deactivateChangeSignals();
virtual void reactivateChangeSignals();
virtual QmlJS::Snapshot getSnapshot() const = 0;
virtual QStringList importPaths() const = 0;
protected:
QPlainTextEdit *plainTextEdit() const
{ return m_textEdit; }
......@@ -105,6 +108,12 @@ public:
virtual int indentDepth() const
{ return 0; }
virtual QmlJS::Snapshot getSnapshot() const
{ return QmlJS::Snapshot(); }
virtual QStringList importPaths() const
{ return QStringList(); }
};
}
......
......@@ -30,13 +30,14 @@
#ifndef TEXTMODIFIER_H
#define TEXTMODIFIER_H
#include <QtCore/QByteArray>
#include <QtCore/QObject>
#include "corelib_global.h"
#include <QTextCursor>
#include <QTextDocument>
#include <qmljs/qmljsdocument.h>
#include "corelib_global.h"
#include <QtCore/QByteArray>
#include <QtCore/QObject>
#include <QtGui/QTextCursor>
#include <QtGui/QTextDocument>
namespace QmlDesigner {
......@@ -83,6 +84,9 @@ public:
virtual void deactivateChangeSignals() = 0;
virtual void reactivateChangeSignals() = 0;
virtual QmlJS::Snapshot getSnapshot() const = 0;
virtual QStringList importPaths() const = 0;
signals:
void textChanged();
......
......@@ -76,7 +76,7 @@ static inline QmlJSEditor::ModelManagerInterface *getModelManager()
}
}
QmlJS::Snapshot BaseTextEditModifier::getSnapshot()
QmlJS::Snapshot BaseTextEditModifier::getSnapshot() const
{
QmlJSEditor::ModelManagerInterface *modelManager = getModelManager();
if (modelManager)
......@@ -85,7 +85,7 @@ QmlJS::Snapshot BaseTextEditModifier::getSnapshot()
return QmlJS::Snapshot();
}
QStringList BaseTextEditModifier::importPaths()
QStringList BaseTextEditModifier::importPaths() const
{
QmlJSEditor::ModelManagerInterface *modelManager = getModelManager();
if (modelManager)
......
......@@ -29,8 +29,7 @@
#include "componenttextmodifier.h"
namespace QmlDesigner {
using namespace QmlDesigner;
ComponentTextModifier::ComponentTextModifier(TextModifier *originalModifier, int componentStartOffset, int componentEndOffset, int rootStartOffset) :
m_originalModifier(originalModifier),
m_componentStartOffset(componentStartOffset),
......@@ -134,4 +133,8 @@ void ComponentTextModifier::contentsChange(int position, int charsRemoved, int c
}
}
} // namespace QmlDesigner
QmlJS::Snapshot ComponentTextModifier::getSnapshot() const
{ return m_originalModifier->getSnapshot(); }
QStringList ComponentTextModifier::importPaths() const
{ return m_originalModifier->importPaths(); }
......@@ -34,11 +34,10 @@
#include "nodemetainfo.h"
#include "nodeproperty.h"
#include "propertymetainfo.h"
#include "basetexteditmodifier.h"
#include "textmodifier.h"
#include "texttomodelmerger.h"
#include "rewriterview.h"
#include "variantproperty.h"
#include <qmljseditor/qmljseditor.h>
#include <qmljs/qmljsinterpreter.h>
#include <qmljs/parser/qmljsast_p.h>
......@@ -259,8 +258,8 @@ bool TextToModelMerger::load(const QByteArray &data, DifferenceHandler &differen
const bool success = domDoc.load(&engine, data, url);
if (success) {
Snapshot snapshot = BaseTextEditModifier::getSnapshot();
const QStringList importPaths = BaseTextEditModifier::importPaths();
Snapshot snapshot = m_rewriterView->textModifier()->getSnapshot();
const QStringList importPaths = m_rewriterView->textModifier()->importPaths();
const QString fileName = url.toLocalFile();
Document::Ptr doc = Document::create(fileName);
doc->setSource(QString::fromUtf8(data.constData()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment