48 changed files with 566 additions and 268 deletions
@ -0,0 +1,41 @@ |
|||||
|
/*
|
||||
|
This file is part of cpp-ethereum. |
||||
|
|
||||
|
cpp-ethereum is free software: you can redistribute it and/or modify |
||||
|
it under the terms of the GNU General Public License as published by |
||||
|
the Free Software Foundation, either version 3 of the License, or |
||||
|
(at your option) any later version. |
||||
|
|
||||
|
cpp-ethereum is distributed in the hope that it will be useful, |
||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
GNU General Public License for more details. |
||||
|
|
||||
|
You should have received a copy of the GNU General Public License |
||||
|
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
/** @file QBasicNodeDefinition.cpp
|
||||
|
* @author Yann yann@ethdev.com |
||||
|
* @date 2014 |
||||
|
*/ |
||||
|
|
||||
|
#include "QBasicNodeDefinition.h" |
||||
|
#include <libsolidity/AST.h> |
||||
|
|
||||
|
namespace dev |
||||
|
{ |
||||
|
namespace mix |
||||
|
{ |
||||
|
|
||||
|
QBasicNodeDefinition::QBasicNodeDefinition(QObject* _parent, solidity::Declaration const* _d): |
||||
|
QObject(_parent), m_name(QString::fromStdString(_d->getName())) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
QBasicNodeDefinition::QBasicNodeDefinition(QObject* _parent, std::string const& _name): |
||||
|
QObject(_parent), m_name(QString::fromStdString(_name)) |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
/*
|
||||
|
This file is part of cpp-ethereum. |
||||
|
|
||||
|
cpp-ethereum is free software: you can redistribute it and/or modify |
||||
|
it under the terms of the GNU General Public License as published by |
||||
|
the Free Software Foundation, either version 3 of the License, or |
||||
|
(at your option) any later version. |
||||
|
|
||||
|
cpp-ethereum is distributed in the hope that it will be useful, |
||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
GNU General Public License for more details. |
||||
|
|
||||
|
You should have received a copy of the GNU General Public License |
||||
|
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
/** @file QVariableDefinition.cpp
|
||||
|
* @author Yann yann@ethdev.com |
||||
|
* @date 2014 |
||||
|
*/ |
||||
|
|
||||
|
#include "QVariableDefinition.h" |
||||
|
#include <libdevcore/CommonJS.h> |
||||
|
|
||||
|
namespace dev |
||||
|
{ |
||||
|
namespace mix |
||||
|
{ |
||||
|
QString QVariableDefinition::encodeValueAsString() |
||||
|
{ |
||||
|
return QString::fromStdString(dev::toHex(encodeValue())); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
@ -1,8 +0,0 @@ |
|||||
singleton Style 1.0 Style.qml |
|
||||
singleton StateDialogStyle 1.0 StateDialogStyle.qml |
|
||||
singleton ProjectFilesStyle 1.0 ProjectFilesStyle.qml |
|
||||
singleton DebuggerPaneStyle 1.0 DebuggerPaneStyle.qml |
|
||||
singleton StateStyle 1.0 StateStyle.qml |
|
||||
singleton StatusPaneStyle 1.0 StatusPaneStyle.qml |
|
||||
singleton WebPreviewStyle 1.0 WebPreviewStyle.qml |
|
||||
singleton LogsPaneStyle 1.0 LogsPaneStyle.qml |
|
@ -0,0 +1,50 @@ |
|||||
|
/*
|
||||
|
This file is part of cpp-ethereum. |
||||
|
|
||||
|
cpp-ethereum is free software: you can redistribute it and/or modify |
||||
|
it under the terms of the GNU General Public License as published by |
||||
|
the Free Software Foundation, either version 3 of the License, or |
||||
|
(at your option) any later version. |
||||
|
|
||||
|
cpp-ethereum is distributed in the hope that it will be useful, |
||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
GNU General Public License for more details. |
||||
|
|
||||
|
You should have received a copy of the GNU General Public License |
||||
|
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
/** @file main.cpp
|
||||
|
* @author Yann yann@ethdev.com |
||||
|
* @date 2014 |
||||
|
* Ethereum IDE client. |
||||
|
*/ |
||||
|
|
||||
|
#include <iostream> |
||||
|
#include <stdlib.h> |
||||
|
#include <quicktest.h> |
||||
|
#include <QtQml> |
||||
|
#include "MixApplication.h" |
||||
|
#include "Exceptions.h" |
||||
|
#include "TestService.h" |
||||
|
|
||||
|
using namespace dev::mix; |
||||
|
|
||||
|
int main(int _argc, char* _argv[]) |
||||
|
{ |
||||
|
try |
||||
|
{ |
||||
|
MixApplication::initialize(); |
||||
|
qmlRegisterType<TestService>("org.ethereum.qml.TestService", 1, 0, "TestService"); |
||||
|
|
||||
|
return quick_test_main(_argc, _argv, "mix", _argv[1]); |
||||
|
} |
||||
|
catch (boost::exception const& _e) |
||||
|
{ |
||||
|
std::cerr << boost::diagnostic_information(_e); |
||||
|
} |
||||
|
catch (std::exception const& _e) |
||||
|
{ |
||||
|
std::cerr << _e.what(); |
||||
|
} |
||||
|
} |
@ -1,51 +0,0 @@ |
|||||
import QtQuick 2.2 |
|
||||
import QtTest 1.1 |
|
||||
//import Qt.test.qtestroot 1.0 |
|
||||
import "../qml" |
|
||||
|
|
||||
|
|
||||
TestCase |
|
||||
{ |
|
||||
|
|
||||
Item |
|
||||
{ |
|
||||
id: helper |
|
||||
function findChild(item, childId) { |
|
||||
if (item.children) { |
|
||||
var searchString = "button" |
|
||||
|
|
||||
for (var idx in item.children) { |
|
||||
var currentItem = item.children[idx] |
|
||||
|
|
||||
if (currentItem.id.match("^"+childId) === childId) |
|
||||
return currentItem; |
|
||||
|
|
||||
return findChild(currentItem, childId); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
|
|
||||
function test_t1() |
|
||||
{ |
|
||||
waitForRendering(mainApplication.mainContent, 10000); |
|
||||
mainApplication.projectModel.createProject(); |
|
||||
var projectDlg = helper.findChild(mainApplication, "newProjectDialog"); |
|
||||
|
|
||||
if (mainApplication.appService.waitForSignal(mainApplication.codeModel, "compilationComplete()", 5000)) |
|
||||
console.log("compiled"); |
|
||||
} |
|
||||
|
|
||||
function runTest() |
|
||||
{ |
|
||||
waitForRendering(mainApplication.mainContent, 10000); |
|
||||
console.log("runtest"); |
|
||||
mousePress(mainApplication, 10, 10); |
|
||||
} |
|
||||
|
|
||||
Application { |
|
||||
id: mainApplication |
|
||||
} |
|
||||
|
|
||||
} |
|
@ -0,0 +1,113 @@ |
|||||
|
/*
|
||||
|
This file is part of cpp-ethereum. |
||||
|
|
||||
|
cpp-ethereum is free software: you can redistribute it and/or modify |
||||
|
it under the terms of the GNU General Public License as published by |
||||
|
the Free Software Foundation, either version 3 of the License, or |
||||
|
(at your option) any later version. |
||||
|
|
||||
|
cpp-ethereum is distributed in the hope that it will be useful, |
||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
GNU General Public License for more details. |
||||
|
|
||||
|
You should have received a copy of the GNU General Public License |
||||
|
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
/** @file TestService.cpp
|
||||
|
* @author Arkadiy Paronyan arkadiy@ethdev.com |
||||
|
* @date 2015 |
||||
|
* Ethereum IDE client. |
||||
|
*/ |
||||
|
|
||||
|
#include "TestService.h" |
||||
|
#include <QtTest/QSignalSpy> |
||||
|
#include <QElapsedTimer> |
||||
|
#include <QtTest/QTest> |
||||
|
#include <QtTest/qtestkeyboard.h> |
||||
|
|
||||
|
namespace dev |
||||
|
{ |
||||
|
namespace mix |
||||
|
{ |
||||
|
|
||||
|
bool TestService::waitForSignal(QObject* _item, QString _signalName, int _timeout) |
||||
|
{ |
||||
|
QSignalSpy spy(_item, ("2" + _signalName.toStdString()).c_str()); |
||||
|
QMetaObject const* mo = _item->metaObject(); |
||||
|
|
||||
|
QStringList methods; |
||||
|
|
||||
|
for(int i = mo->methodOffset(); i < mo->methodCount(); ++i) { |
||||
|
if (mo->method(i).methodType() == QMetaMethod::Signal) { |
||||
|
methods << QString::fromLatin1(mo->method(i).methodSignature()); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
QElapsedTimer timer; |
||||
|
timer.start(); |
||||
|
|
||||
|
while (!spy.size()) { |
||||
|
int remaining = _timeout - int(timer.elapsed()); |
||||
|
if (remaining <= 0) |
||||
|
break; |
||||
|
QCoreApplication::processEvents(QEventLoop::AllEvents, remaining); |
||||
|
QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); |
||||
|
QTest::qSleep(10); |
||||
|
} |
||||
|
|
||||
|
return spy.size(); |
||||
|
} |
||||
|
|
||||
|
bool TestService::keyPress(int _key, int _modifiers, int _delay) |
||||
|
{ |
||||
|
QWindow *window = eventWindow(); |
||||
|
QTest::keyPress(window, Qt::Key(_key), Qt::KeyboardModifiers(_modifiers), _delay); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
bool TestService::keyRelease(int _key, int _modifiers, int _delay) |
||||
|
{ |
||||
|
QWindow *window = eventWindow(); |
||||
|
QTest::keyRelease(window, Qt::Key(_key), Qt::KeyboardModifiers(_modifiers), _delay); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
bool TestService::keyClick(int _key, int _modifiers, int _delay) |
||||
|
{ |
||||
|
QWindow *window = eventWindow(); |
||||
|
QTest::keyClick(window, Qt::Key(_key), Qt::KeyboardModifiers(_modifiers), _delay); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
bool TestService::keyPressChar(QString const& _character, int _modifiers, int _delay) |
||||
|
{ |
||||
|
QTEST_ASSERT(_character.length() == 1); |
||||
|
QWindow *window = eventWindow(); |
||||
|
QTest::keyPress(window, _character[0].toLatin1(), Qt::KeyboardModifiers(_modifiers), _delay); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
bool TestService::keyReleaseChar(QString const& _character, int _modifiers, int _delay) |
||||
|
{ |
||||
|
QTEST_ASSERT(_character.length() == 1); |
||||
|
QWindow *window = eventWindow(); |
||||
|
QTest::keyRelease(window, _character[0].toLatin1(), Qt::KeyboardModifiers(_modifiers), _delay); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
bool TestService::keyClickChar(QString const& _character, int _modifiers, int _delay) |
||||
|
{ |
||||
|
QTEST_ASSERT(_character.length() == 1); |
||||
|
QWindow *window = eventWindow(); |
||||
|
QTest::keyClick(window, _character[0].toLatin1(), Qt::KeyboardModifiers(_modifiers), _delay); |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
QWindow* TestService::eventWindow() |
||||
|
{ |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
/*
|
||||
|
This file is part of cpp-ethereum. |
||||
|
|
||||
|
cpp-ethereum is free software: you can redistribute it and/or modify |
||||
|
it under the terms of the GNU General Public License as published by |
||||
|
the Free Software Foundation, either version 3 of the License, or |
||||
|
(at your option) any later version. |
||||
|
|
||||
|
cpp-ethereum is distributed in the hope that it will be useful, |
||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
GNU General Public License for more details. |
||||
|
|
||||
|
You should have received a copy of the GNU General Public License |
||||
|
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
/** @file TestService.h
|
||||
|
* @author Arkadiy Paronyan arkadiy@ethdev.com |
||||
|
* @date 2015 |
||||
|
* Ethereum IDE client. |
||||
|
*/ |
||||
|
|
||||
|
#pragma once |
||||
|
|
||||
|
#include <QObject> |
||||
|
|
||||
|
class QWindow; |
||||
|
|
||||
|
namespace dev |
||||
|
{ |
||||
|
namespace mix |
||||
|
{ |
||||
|
|
||||
|
class TestService: public QObject |
||||
|
{ |
||||
|
Q_OBJECT |
||||
|
|
||||
|
public slots: |
||||
|
bool waitForSignal(QObject* _item, QString _signalName, int _timeout); |
||||
|
bool keyPress(int _key, int _modifiers, int _delay); |
||||
|
bool keyRelease(int _key, int _modifiers, int _delay); |
||||
|
bool keyClick(int _key, int _modifiers, int _delay); |
||||
|
bool keyPressChar(QString const& _character, int _modifiers, int _delay); |
||||
|
bool keyReleaseChar(QString const& _character, int _modifiers, int _delay); |
||||
|
bool keyClickChar(QString const& _character, int _modifiers, int _delay); |
||||
|
|
||||
|
private: |
||||
|
QWindow* eventWindow(); |
||||
|
}; |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
import QtQuick 2.2 |
||||
|
import QtTest 1.1 |
||||
|
import org.ethereum.qml.TestService 1.0 |
||||
|
import "../../qml" |
||||
|
|
||||
|
|
||||
|
|
||||
|
TestCase |
||||
|
{ |
||||
|
id: tc |
||||
|
|
||||
|
TestService |
||||
|
{ |
||||
|
id: ts |
||||
|
function typeString(str) |
||||
|
{ |
||||
|
for (var c in str) |
||||
|
ts.keyClickChar(c, Qt.NoModifier, 20); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
function test_t1() |
||||
|
{ |
||||
|
waitForRendering(mainApplication.mainContent, 10000); |
||||
|
mainApplication.projectModel.createProject(); |
||||
|
var projectDlg = mainApplication.projectModel.newProjectDialog; |
||||
|
projectDlg.projectTitle = "TestProject"; |
||||
|
projectDlg.pathFieldText = "/tmp/MixTest"; //TODO: get platform temp path |
||||
|
projectDlg.acceptAndClose(); |
||||
|
ts.waitForSignal(mainApplication.mainContent.codeEditor, "loadComplete()", 5000) |
||||
|
|
||||
|
ts.keyClickChar("A", Qt.ControlModifier, 20); |
||||
|
ts.typeString("CCC"); |
||||
|
if (ts.waitForSignal(mainApplication.codeModel, "compilationComplete()", 5000)) |
||||
|
console.log("compiled"); |
||||
|
ts.waitForSignal(mainApplication.codeModel, "compilationComplete()", 5000); |
||||
|
} |
||||
|
|
||||
|
function runTest() |
||||
|
{ |
||||
|
waitForRendering(mainApplication.mainContent, 10000); |
||||
|
console.log("runtest"); |
||||
|
mousePress(mainApplication, 10, 10); |
||||
|
} |
||||
|
|
||||
|
Application |
||||
|
{ |
||||
|
id: mainApplication |
||||
|
} |
||||
|
} |
||||
|
|
Loading…
Reference in new issue