diff --git a/mix/CodeModel.cpp b/mix/CodeModel.cpp index 5fc4663d5..3c4972fcf 100644 --- a/mix/CodeModel.cpp +++ b/mix/CodeModel.cpp @@ -220,7 +220,7 @@ QVariantMap CodeModel::contracts() const return result; } -CompiledContract* CodeModel::contractByDocumentId(QString _documentId) const +CompiledContract* CodeModel::contractByDocumentId(QString const& _documentId) const { Guard l(x_contractMap); for (ContractMap::const_iterator c = m_contractMap.cbegin(); c != m_contractMap.cend(); ++c) @@ -229,7 +229,7 @@ CompiledContract* CodeModel::contractByDocumentId(QString _documentId) const return nullptr; } -CompiledContract const& CodeModel::contract(QString _name) const +CompiledContract const& CodeModel::contract(QString const& _name) const { Guard l(x_contractMap); CompiledContract* res = m_contractMap.value(_name); @@ -238,7 +238,7 @@ CompiledContract const& CodeModel::contract(QString _name) const return *res; } -CompiledContract const* CodeModel::tryGetContract(QString _name) const +CompiledContract const* CodeModel::tryGetContract(QString const& _name) const { Guard l(x_contractMap); CompiledContract* res = m_contractMap.value(_name); diff --git a/mix/CodeModel.h b/mix/CodeModel.h index f790e3ac3..ea3694642 100644 --- a/mix/CodeModel.h +++ b/mix/CodeModel.h @@ -142,13 +142,13 @@ public: dev::bytes const& getStdContractCode(QString const& _contractName, QString const& _url); /// Get contract by name /// Throws if not found - CompiledContract const& contract(QString _name) const; + CompiledContract const& contract(QString const& _name) const; /// Get contract by name /// @returns nullptr if not found - CompiledContract const* tryGetContract(QString _name) const; + CompiledContract const* tryGetContract(QString const& _name) const; /// Find a contract by document id /// @returns CompiledContract object or null if not found - Q_INVOKABLE CompiledContract* contractByDocumentId(QString _documentId) const; + Q_INVOKABLE CompiledContract* contractByDocumentId(QString const& _documentId) const; /// Reset code model Q_INVOKABLE void reset() { reset(QVariantMap()); } /// Convert solidity type info to mix type diff --git a/mix/test/TestService.cpp b/mix/test/TestService.cpp index 6a7061173..751c2379a 100644 --- a/mix/test/TestService.cpp +++ b/mix/test/TestService.cpp @@ -20,6 +20,7 @@ * Ethereum IDE client. */ +#include #include "TestService.h" #include #include @@ -162,6 +163,7 @@ bool TestService::keyClickChar(QObject* _item, QString const& _character, int _m bool TestService::mouseClick(QObject* _item, qreal _x, qreal _y, int _button, int _modifiers, int _delay) { QWindow* window = qobject_cast(_item); + QMetaObject const* mo = _item->metaObject(); if (!window) window = eventWindow(_item); mouseEvent(MouseClick, window, _item, Qt::MouseButton(_button), Qt::KeyboardModifiers(_modifiers), QPointF(_x, _y), _delay); @@ -176,18 +178,22 @@ void TestService::setTargetWindow(QObject* _window) window->requestActivate(); } + QWindow* TestService::eventWindow(QObject* _item) { QQuickItem* item = qobject_cast(_item); if (item && item->window()) return item->window(); - QQuickWindow* window = qobject_cast(_item); + QWindow* window = qobject_cast(_item); + if (!window && _item->parent()) + window = eventWindow(_item->parent()); if (!window) window = qobject_cast(m_targetWindow); if (window) { window->requestActivate(); + std::cout << window->title().toStdString(); return window; } item = qobject_cast(m_targetWindow); diff --git a/mix/test/qml/TestMain.qml b/mix/test/qml/TestMain.qml index 058b37e1e..0da565ac5 100644 --- a/mix/test/qml/TestMain.qml +++ b/mix/test/qml/TestMain.qml @@ -16,6 +16,8 @@ TestCase { if (el === undefined) el = mainApplication; + if (el.contentItem) //for dialgos + el = el.contentItem for (var c in str) { @@ -60,6 +62,8 @@ TestCase function clickElement(el, x, y) { + if (el.contentItem) + el = el.contentItem; ts.mouseClick(el, x, y, Qt.LeftButton, Qt.NoModifier, 10) } diff --git a/mix/test/qml/js/TestTutorial.js b/mix/test/qml/js/TestTutorial.js index a83cd6ee5..895b5c9c1 100644 --- a/mix/test/qml/js/TestTutorial.js +++ b/mix/test/qml/js/TestTutorial.js @@ -50,9 +50,9 @@ function test_tutorial() var transactionDialog = mainApplication.projectModel.stateDialog.transactionDialog; ts.waitForRendering(transactionDialog, 3000); transactionDialog.selectFunction("setRating"); - clickElement(transactionDialog, 180, 310); + clickElement(transactionDialog, 200, 310); ts.typeString("Titanic", transactionDialog); - clickElement(transactionDialog, 180, 330); + clickElement(transactionDialog, 200, 330); ts.typeString("2", transactionDialog); transactionDialog.acceptAndClose(); mainApplication.projectModel.stateDialog.acceptAndClose();