Commit c19fe3d7 authored by Kai Koehne's avatar Kai Koehne
Browse files

QmlDesigner: Fix autotest compilation

parent 1ed2874b
......@@ -63,14 +63,14 @@ static QString bareTemplate("import Qt 4.6\n"
static QString contentsTemplate(bareTemplate.arg("Text { id: textChild; x:10; y: 10; text: \"%1\"; %2 }"));
void printErrors(const QList<QmlError> &errors, const QString &fileName)
void printErrors(const QList<QDeclarativeError> &errors, const QString &fileName)
{
if (errors.isEmpty())
return;
qDebug() << "Error loading file \"" << fileName << "\":";
foreach (const QmlError &error, errors) {
foreach (const QDeclarativeError &error, errors) {
qDebug() << error.line() << ":" << error.column() << ": " << error.description();
}
}
......@@ -138,7 +138,7 @@ static bool compareTree(const ModelNode &node1, const ModelNode &node2)
// QByteArray bytes = data.toLatin1();
// QBuffer file(&bytes, 0);
// QVERIFY(file.open(QIODevice::ReadOnly));
// QList<QmlError> errors;
// QList<QDeclarativeError> errors;
// QString fileText(file.readAll());
// modifier = ByteArrayModifier::create(QString(fileText));
// model = Model::create(modifier, QUrl(), &errors);
......
......@@ -58,7 +58,8 @@
#include "testrewriterview.h"
#include <QPlainTextEdit>
#include <private/qmlstate_p.h>
#include <private/qdeclarativestate_p.h>
#include <private/qdeclarativemetatype_p.h>
using namespace QmlDesigner;
......@@ -101,7 +102,7 @@ void TestCore::testModelCreateCoreModel()
// TODO: this need to e updated for states
void TestCore::loadEmptyCoreModel()
{
QList<QmlError> errors;
QList<QDeclarativeError> errors;
QFile file(":/fx/empty.qml");
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
......@@ -228,7 +229,7 @@ void TestCore::testRewriterErrors()
void TestCore::saveEmptyCoreModel()
{
QList<QmlError> errors;
QList<QDeclarativeError> errors;
QFile file(":/fx/empty.qml");
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
......@@ -263,7 +264,7 @@ void TestCore::saveEmptyCoreModel()
void TestCore::loadAttributesInCoreModel()
{
QList<QmlError> errors;
QList<QDeclarativeError> errors;
QFile file(":/fx/attributes.qml");
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
......@@ -631,8 +632,8 @@ void TestCore::testBasicStates()
NodeInstance state2Instance = view->instanceForModelNode(state2.modelNode());
QVERIFY(state2Instance.isValid());
QmlState *stateObject = qobject_cast<QmlState*>(const_cast<QObject*>(state2Instance.testHandle()));
QmlListProperty<QmlStateOperation> changesList = stateObject->changes();
QDeclarativeState *stateObject = qobject_cast<QDeclarativeState*>(const_cast<QObject*>(state2Instance.testHandle()));
QDeclarativeListProperty<QDeclarativeStateOperation> changesList = stateObject->changes();
QCOMPARE(changesList.count(&changesList), 2);
QCOMPARE(changesList.at(&changesList, 0)->actions().size(), 0);
QCOMPARE(changesList.at(&changesList, 1)->actions().size(), 1);
......@@ -1068,9 +1069,9 @@ void TestCore::testQmlModelView()
QCOMPARE(node3.instanceValue("width").toInt(), 0);
QCOMPARE(node3.instanceValue("x").toInt(), 20);
QVERIFY(!QmlMetaType::toQObject(node3.instanceValue("anchors.fill")));
QVERIFY(!QDeclarativeMetaType::toQObject(node3.instanceValue("anchors.fill")));
node3.setBindingProperty("anchors.fill", "parent");
QVERIFY(QmlMetaType::toQObject(node3.instanceValue("anchors.fill")));
QVERIFY(QDeclarativeMetaType::toQObject(node3.instanceValue("anchors.fill")));
QCOMPARE(node3.instanceValue("x").toInt(), 0);
QCOMPARE(node3.instanceValue("width").toInt(), 20);
......@@ -3151,7 +3152,7 @@ void TestCore::subItemMetaInfo()
// QFile file(QCoreApplication::applicationDirPath() + "/../tests/data/fx/topitem.qml");
// QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
//
// QList<QmlError> errors;
// QList<QDeclarativeError> errors;
// QScopedPointer<ByteArrayModifier> modifier1(ByteArrayModifier::create(QString(file.readAll())));
// QScopedPointer<Model> model(Model::create(modifier1.data(), QUrl::fromLocalFile(file.fileName()), &errors));
// QVERIFY(errors.isEmpty());
......@@ -3493,17 +3494,17 @@ void TestCore::testInstancesStates()
//
NodeInstance state1Instance = instanceView->instanceForNode(state1Node);
QVERIFY(state1Instance.isValid());
QmlState *state1 = const_cast<QmlState*>(qobject_cast<const QmlState*>(state1Instance.testHandle()));
QDeclarativeState *state1 = const_cast<QDeclarativeState*>(qobject_cast<const QDeclarativeState*>(state1Instance.testHandle()));
QVERIFY(state1);
QmlListProperty<QmlStateOperation> state1Changes = state1->changes();
QDeclarativeListProperty<QDeclarativeStateOperation> state1Changes = state1->changes();
QCOMPARE(state1Changes.count(&state1Changes), 1);
QCOMPARE(state1Changes.at(&state1Changes, 0)->actions().size(), 2);
NodeInstance state2Instance = instanceView->instanceForNode(state2Node);
QVERIFY(state2Instance.isValid());
QmlState *state2 = const_cast<QmlState*>(qobject_cast<const QmlState*>(state1Instance.testHandle()));
QDeclarativeState *state2 = const_cast<QDeclarativeState*>(qobject_cast<const QDeclarativeState*>(state1Instance.testHandle()));
QVERIFY(state2);
QmlListProperty<QmlStateOperation> state2Changes = state2->changes();
QDeclarativeListProperty<QDeclarativeStateOperation> state2Changes = state2->changes();
QCOMPARE(state2Changes.count(&state2Changes), 1);
QCOMPARE(state2Changes.at(&state2Changes, 0)->actions().size(), 2);
......@@ -3673,9 +3674,9 @@ void TestCore::testStates()
textItem.setVariantProperty("text", QVariant("state 1")); //set text in state !
QmlState *qmlState1 = const_cast<QmlState*>(qobject_cast<const QmlState*>(state1Instance.testHandle()));
QDeclarativeState *qmlState1 = const_cast<QDeclarativeState*>(qobject_cast<const QDeclarativeState*>(state1Instance.testHandle()));
QVERIFY(qmlState1);
QmlListProperty<QmlStateOperation> state1Changes = qmlState1->changes();
QDeclarativeListProperty<QDeclarativeStateOperation> state1Changes = qmlState1->changes();
QCOMPARE(state1Changes.count(&state1Changes), 1);
QCOMPARE(state1Changes.at(&state1Changes, 0)->actions().size(), 1);
......@@ -4084,8 +4085,8 @@ void TestCore::attributeChangeSynchronizer()
QSKIP("no rewriter anymore", SkipAll);
// ByteArrayModifier* modifier;
// Model* model = 0;
// const QString originalQml = contentsTemplate.arg("text", "");
// load(originalQml, model, modifier);
// const QString originalQDeclarative = contentsTemplate.arg("text", "");
// load(originalQDeclarative, model, modifier);
// QVERIFY(model);
// QCOMPARE(view->rootModelNode().childNodes().size(), 1);
// ModelNode textChild = view->rootModelNode().childNodes().first();
......@@ -4749,7 +4750,7 @@ void TestCore::testDynamicProperties()
void TestCore::sideIndex()
{
QSKIP("not anymore needed", SkipAll);
// QList<QmlError> errors;
// QList<QDeclarativeError> errors;
//
// char qmlString[] = "import Qt 4.6\n"
// "Rectangle {\n"
......@@ -4788,7 +4789,7 @@ void TestCore::sideIndex()
//
// QScopedPointer<ByteArrayModifier> modifier1(ByteArrayModifier::create(QLatin1String(qmlString)));
// QScopedPointer<Model> model(Model::create(modifier1.data(), QUrl(), &errors));
// foreach(QmlError error, errors) {
// foreach(QDeclarativeError error, errors) {
// QFAIL((QString("Line %1: %2").arg(error.line()).arg(error.description())).toLatin1());
// }
//
......@@ -6024,7 +6025,7 @@ void TestCore::loadObjectPropertyBinding()
{
QSKIP("will be changed", SkipAll);
// QList<QmlError> errors;
// QList<QDeclarativeError> errors;
// QScopedPointer<ByteArrayModifier> modifier1(ByteArrayModifier::create(QString("import Qt 4.6; Item { ListView { delegate:componentId } Component { id:componentId;Rectangle {} } }")));
//
// QVERIFY(model.data());
......@@ -6041,7 +6042,7 @@ void TestCore::loadWelcomeScreen()
// QFile file(QCoreApplication::applicationDirPath() + "/../shared/welcomescreen.qml");
// QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
//
// QList<QmlError> errors;
// QList<QDeclarativeError> errors;
// QScopedPointer<ByteArrayModifier> modifier1(ByteArrayModifier::create(QString(file.readAll())));
// QScopedPointer<Model> model1(Model::create(modifier1.data(), QUrl::fromLocalFile(file.fileName()), &errors));
// if (!errors.isEmpty()) {
......@@ -6306,7 +6307,7 @@ void TestCore::changeSubModel()
// QVERIFY(modelNode.isValid());
// QCOMPARE(modelNode.id(), QString("rect2"));
//
// QList<QmlError> errors;
// QList<QDeclarativeError> errors;
// // Create a model on top of the component node:
// TextModifier *subModifier = model1->createTextModifier(modelNode);
// QScopedPointer<Model> subModel(Model::create(subModifier, model1->fileUrl(), &errors));
......
......@@ -46,7 +46,7 @@
#include <QSpinBox>
#include <QLineEdit>
#include <QStackedWidget>
#include <QmlView>
#include <QDeclarativeView>
#include <QVariant>
using namespace QmlDesigner;
......@@ -61,7 +61,7 @@ static void inspectPropertyEditor(ModelNode node, QWidget* propWidget)
QStackedWidget * stackedWidget = qobject_cast<QStackedWidget *> (propWidget);
QVERIFY(stackedWidget);
QmlView *view = qobject_cast<QmlView*>(stackedWidget->currentWidget());
QDeclarativeView *view = qobject_cast<QDeclarativeView*>(stackedWidget->currentWidget());
QVERIFY(view);
QLineEdit * idLineEdit = view->findChild<QLineEdit* >("IdLineEdit");
......@@ -146,7 +146,7 @@ static void loadFileAndTest(const QString &fileName)
QFile file(fileName);
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
QList<QmlError> errors;
QList<QDeclarativeError> errors;
//std::auto_ptr<ByteArrayModifier> modifier1(ByteArrayModifier::create(QString(file.readAll())));
//std::auto_ptr<Model> model1(Model::create(modifier1.get(), QUrl::fromLocalFile(file.fileName()), &errors));
......@@ -204,14 +204,14 @@ void TestPropertyEditor::createCoreModel()
void TestPropertyEditor::loadEmptyCoreModel()
{
/* QList<QmlError> errors;
/* QList<QDeclarativeError> errors;
QFile file(":/fx/empty.qml");
QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
std::auto_ptr<QWidget> widget(new QWidget());
std::auto_ptr<ByteArrayModifier> modifier1(ByteArrayModifier::create(QString(file.readAll())));
std::auto_ptr<Model> model1(Model::create(modifier1.get(), QUrl(), &errors));
foreach (const QmlError &error, errors)
foreach (const QDeclarativeError &error, errors)
QFAIL(error.toString().toLatin1());
QVERIFY(model1.get());
setupPropertyEditor(widget.get(), model1.get());
......@@ -220,7 +220,7 @@ void TestPropertyEditor::loadEmptyCoreModel()
std::auto_ptr<ByteArrayModifier> modifier2(ByteArrayModifier::create("import Qt 4.6\n Item{}"));
std::auto_ptr<Model> model2(Model::create(modifier2.get(), QUrl(), &errors));
foreach (const QmlError &error, errors)
foreach (const QDeclarativeError &error, errors)
QFAIL(error.toString().toLatin1());
QVERIFY(model2.get());
......
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