From 06449248ab638d3ebb23f03e56450f10b4acbb5c Mon Sep 17 00:00:00 2001 From: Tim Jenssen Date: Wed, 8 May 2013 13:26:41 +0200 Subject: introduce installerscriptengine - it uses one scriptengine for everything and adds the components or/and the install-controller in javascript closure contexts - added the gui object to the component script context - removed tabController from controlscript context Change-Id: I3bd6c5dcf470666c30add1b7d04a8fdd094f5f11 Reviewed-by: Iikka Eklund Reviewed-by: Karsten Heimrich --- .../installer/componentmodel/componentmodel.pro | 2 +- tests/auto/installer/installer.pro | 2 +- .../installerscriptengine/data/auto-install.qs | 16 -- .../installerscriptengine/data/component1.qs | 48 ----- .../installerscriptengine/data/component2.qs | 6 - .../installerscriptengine.pro | 11 -- .../installerscriptengine.qrc | 7 - .../tst_installerscriptengine.cpp | 202 -------------------- .../messageboxhandler/tst_messageboxhandler.cpp | 16 +- .../installer/scriptengine/data/auto-install.qs | 16 ++ .../auto/installer/scriptengine/data/component1.qs | 48 +++++ .../auto/installer/scriptengine/data/component2.qs | 6 + tests/auto/installer/scriptengine/scriptengine.pro | 11 ++ tests/auto/installer/scriptengine/scriptengine.qrc | 7 + .../installer/scriptengine/tst_scriptengine.cpp | 205 +++++++++++++++++++++ 15 files changed, 304 insertions(+), 299 deletions(-) delete mode 100644 tests/auto/installer/installerscriptengine/data/auto-install.qs delete mode 100644 tests/auto/installer/installerscriptengine/data/component1.qs delete mode 100644 tests/auto/installer/installerscriptengine/data/component2.qs delete mode 100644 tests/auto/installer/installerscriptengine/installerscriptengine.pro delete mode 100644 tests/auto/installer/installerscriptengine/installerscriptengine.qrc delete mode 100644 tests/auto/installer/installerscriptengine/tst_installerscriptengine.cpp create mode 100644 tests/auto/installer/scriptengine/data/auto-install.qs create mode 100644 tests/auto/installer/scriptengine/data/component1.qs create mode 100644 tests/auto/installer/scriptengine/data/component2.qs create mode 100644 tests/auto/installer/scriptengine/scriptengine.pro create mode 100644 tests/auto/installer/scriptengine/scriptengine.qrc create mode 100644 tests/auto/installer/scriptengine/tst_scriptengine.cpp (limited to 'tests') diff --git a/tests/auto/installer/componentmodel/componentmodel.pro b/tests/auto/installer/componentmodel/componentmodel.pro index 442986a96..7e18ff1ba 100644 --- a/tests/auto/installer/componentmodel/componentmodel.pro +++ b/tests/auto/installer/componentmodel/componentmodel.pro @@ -1,7 +1,7 @@ include(../../qttest.pri) QT -= gui -QT += network xml +QT += network xml script SOURCES += tst_componentmodel.cpp diff --git a/tests/auto/installer/installer.pro b/tests/auto/installer/installer.pro index 351ecae06..df2630166 100644 --- a/tests/auto/installer/installer.pro +++ b/tests/auto/installer/installer.pro @@ -8,4 +8,4 @@ SUBDIRS += \ messageboxhandler \ extractarchiveoperationtest \ lib7zfacade \ - installerscriptengine + scriptengine diff --git a/tests/auto/installer/installerscriptengine/data/auto-install.qs b/tests/auto/installer/installerscriptengine/data/auto-install.qs deleted file mode 100644 index 26937fc05..000000000 --- a/tests/auto/installer/installerscriptengine/data/auto-install.qs +++ /dev/null @@ -1,16 +0,0 @@ -function Controller() -{ - installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes); - installer.setValue("GuiTestValue", "hello"); -} - -Controller.prototype.ComponentSelectionPageCallback = function() -{ - var notExistingButtonId = 9999999; - gui.clickButton(notExistingButtonId); -} - -Controller.prototype.FinishedPageCallback = function() -{ - print("FinishedPageCallback - OK") -} diff --git a/tests/auto/installer/installerscriptengine/data/component1.qs b/tests/auto/installer/installerscriptengine/data/component1.qs deleted file mode 100644 index af81f5747..000000000 --- a/tests/auto/installer/installerscriptengine/data/component1.qs +++ /dev/null @@ -1,48 +0,0 @@ -function Component() -{ - print("Component constructor - OK"); -} - -Component.prototype.retranslateUi = function() -{ - // arguments.callee to get the current function name doesn't work in that case - print("retranslateUi - OK"); - // no default implementation for this method - // component.languageChanged(); -} - -Component.prototype.createOperationsForPath = function(path) -{ - print("createOperationsForPath - OK"); - component.createOperationsForPath(path); -} - -Component.prototype.createOperationsForArchive = function(archive) -{ - print("createOperationsForArchive - OK"); - component.createOperationsForArchive(archive); -} - -Component.prototype.beginInstallation = function() -{ - print("beginInstallation - OK"); - component.beginInstallation(); -} - -Component.prototype.createOperations = function() -{ - print("createOperations - OK"); - component.createOperations(); -} - -Component.prototype.isAutoDependOn = function() -{ - print("isAutoDependOn - OK"); - return false; -} - -Component.prototype.isDefault = function() -{ - print("isDefault - OK"); - return false; -} diff --git a/tests/auto/installer/installerscriptengine/data/component2.qs b/tests/auto/installer/installerscriptengine/data/component2.qs deleted file mode 100644 index b27e45c83..000000000 --- a/tests/auto/installer/installerscriptengine/data/component2.qs +++ /dev/null @@ -1,6 +0,0 @@ -function Component() -{ - print("script function: " + arguments.callee.name); - // adding some broken javascript code here - broken + 789634 -} diff --git a/tests/auto/installer/installerscriptengine/installerscriptengine.pro b/tests/auto/installer/installerscriptengine/installerscriptengine.pro deleted file mode 100644 index 055efc12a..000000000 --- a/tests/auto/installer/installerscriptengine/installerscriptengine.pro +++ /dev/null @@ -1,11 +0,0 @@ -include(../../qttest.pri) - -QT += script -greaterThan(QT_MAJOR_VERSION, 4) { - QT += widgets -} - -SOURCES += tst_installerscriptengine.cpp - -RESOURCES += \ - installerscriptengine.qrc diff --git a/tests/auto/installer/installerscriptengine/installerscriptengine.qrc b/tests/auto/installer/installerscriptengine/installerscriptengine.qrc deleted file mode 100644 index d38168175..000000000 --- a/tests/auto/installer/installerscriptengine/installerscriptengine.qrc +++ /dev/null @@ -1,7 +0,0 @@ - - - data/auto-install.qs - data/component1.qs - data/component2.qs - - diff --git a/tests/auto/installer/installerscriptengine/tst_installerscriptengine.cpp b/tests/auto/installer/installerscriptengine/tst_installerscriptengine.cpp deleted file mode 100644 index 4d629e08f..000000000 --- a/tests/auto/installer/installerscriptengine/tst_installerscriptengine.cpp +++ /dev/null @@ -1,202 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -using namespace QInstaller; - -// -- InstallerGui - -class TestGui : public QInstaller::PackageManagerGui -{ - Q_OBJECT - -public: - explicit TestGui(QInstaller::PackageManagerCore *core) - : PackageManagerGui(core, 0) - { - setPage(PackageManagerCore::Introduction, new IntroductionPage(core)); - setPage(PackageManagerCore::ComponentSelection, new ComponentSelectionPage(core)); - setPage(PackageManagerCore::InstallationFinished, new FinishedPage(core)); - } - - virtual void init() {} - - void callProtectedDelayedControlScriptExecution(int id) - { - delayedControlScriptExecution(id); - } -}; - - -class tst_InstallerScriptEngine : public QObject -{ - Q_OBJECT - -private slots: - void initTestCase() - { - m_component = new Component(&m_core); - // append the component to the package manager which deletes it at destructor - // (it calls clearAllComponentLists which calls qDeleteAll(m_rootComponents);) - m_core.appendRootComponent(m_component); - - m_component->setValue("AutoDependOn", "Script"); - m_component->setValue("Default", "Script"); - m_component->setValue(scName, "component.test.name"); - - m_scriptEngine = m_component->scriptEngine(); - } - - void testScriptPrint() - { - setExpectedScriptOutput("test"); - m_scriptEngine->evaluate("print(\"test\");"); - if (m_scriptEngine->hasUncaughtException()) { - QFAIL(qPrintable(QString::fromLatin1("installerScriptEngine hasUncaughtException:\n %1").arg( - uncaughtExceptionString(m_scriptEngine)))); - } - } - - void testExistingInstallerObject() - { - setExpectedScriptOutput("object"); - m_scriptEngine->evaluate("print(typeof installer)"); - if (m_scriptEngine->hasUncaughtException()) { - QFAIL(qPrintable(QString::fromLatin1("installerScriptEngine hasUncaughtException:\n %1").arg( - uncaughtExceptionString(m_scriptEngine)))); - } - } - - void testComponentByName() - { - const QString printComponentNameScript = QString::fromLatin1("var correctComponent = " - "installer.componentByName('%1');\nprint(correctComponent.name);").arg(m_component->name()); - - setExpectedScriptOutput("component.test.name"); - m_scriptEngine->evaluate(printComponentNameScript); - if (m_scriptEngine->hasUncaughtException()) { - QFAIL(qPrintable(QString::fromLatin1("installerScriptEngine hasUncaughtException:\n %1").arg( - uncaughtExceptionString(m_scriptEngine)))); - } - } - - void testComponentByWrongName() - { - const QString printComponentNameScript = QString::fromLatin1( "var brokenComponent = " - "installer.componentByName('%1');\nprint(brokenComponent.name);").arg("MyNotExistingComponentName"); - - m_scriptEngine->evaluate(printComponentNameScript); - QVERIFY(m_scriptEngine->hasUncaughtException()); - } - - void loadSimpleComponentScript() - { - try { - // ignore retranslateUi which is called by loadComponentScript - setExpectedScriptOutput("Component constructor - OK"); - setExpectedScriptOutput("retranslateUi - OK"); - m_component->loadComponentScript(":///data/component1.qs"); - - setExpectedScriptOutput("retranslateUi - OK"); - m_component->languageChanged(); - - setExpectedScriptOutput("createOperationsForPath - OK"); - m_component->createOperationsForPath(":///data/"); - - setExpectedScriptOutput("createOperationsForArchive - OK"); - // ignore createOperationsForPath which is called by createOperationsForArchive - setExpectedScriptOutput("createOperationsForPath - OK"); - m_component->createOperationsForArchive("test.7z"); - - setExpectedScriptOutput("beginInstallation - OK"); - m_component->beginInstallation(); - - setExpectedScriptOutput("createOperations - OK"); - m_component->createOperations(); - - setExpectedScriptOutput("isAutoDependOn - OK"); - bool returnIsAutoDependOn = m_component->isAutoDependOn(QSet()); - QCOMPARE(returnIsAutoDependOn, false); - - setExpectedScriptOutput("isDefault - OK"); - bool returnIsDefault = m_component->isDefault(); - QCOMPARE(returnIsDefault, false); - - } catch (const Error &error) { - QFAIL(qPrintable(error.message())); - } - } - - void loadBrokenComponentScript() - { - PackageManagerCore core; - Component testComponent(&core); - - const QString debugMesssage( - "create Error-Exception: \"Exception while loading the component script: :///data/component2.qs\n\n" - "ReferenceError: Can't find variable: broken\n\n" - "Backtrace:\n" -#if QT_VERSION < 0x050000 - "\t()@:///data/component2.qs:5\" "); -#else - "\tComponent() at :///data/component2.qs:5\n" - "\t() at -1\" "); -#endif - try { - // ignore Output from script - setExpectedScriptOutput("script function: Component"); - setExpectedScriptOutput(qPrintable(debugMesssage)); - testComponent.loadComponentScript(":///data/component2.qs"); - } catch (const Error &error) { - QVERIFY2(debugMesssage.contains(error.message()), "There was some unexpected error."); - } - } - - void loadSimpleAutoRunScript() - { - TestGui testGui(&m_core); - setExpectedScriptOutput("Loaded control script \":///data/auto-install.qs\" "); - testGui.loadControlScript(":///data/auto-install.qs"); - QCOMPARE(m_core.value("GuiTestValue"), QString("hello")); - - testGui.show(); - // show event calls automatically the first callback which does not exist - setExpectedScriptOutput("Control script callback \"IntroductionPageCallback\" does not exist. "); - // give some time to the event triggering mechanism - qApp->processEvents(); - - setExpectedScriptOutput("Calling control script callback \"ComponentSelectionPageCallback\" "); - // inside the auto-install script we are clicking the next button, with a not existing button - QTest::ignoreMessage(QtWarningMsg, "Button with type: \"unknown button\" not found! "); - testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::ComponentSelection); - - setExpectedScriptOutput("Calling control script callback \"FinishedPageCallback\" "); - setExpectedScriptOutput("FinishedPageCallback - OK"); - testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::InstallationFinished); - } - -private: - void setExpectedScriptOutput(const char *message) - { - // Using setExpectedScriptOutput(...); inside the test method - // as a simple test that the scripts are called. - QTest::ignoreMessage(QtDebugMsg, message); - } - - PackageManagerCore m_core; - Component *m_component; - QScriptEngine *m_scriptEngine; - -}; - - -QTEST_MAIN(tst_InstallerScriptEngine) - -#include "tst_installerscriptengine.moc" diff --git a/tests/auto/installer/messageboxhandler/tst_messageboxhandler.cpp b/tests/auto/installer/messageboxhandler/tst_messageboxhandler.cpp index f705154b5..604b8e0a0 100644 --- a/tests/auto/installer/messageboxhandler/tst_messageboxhandler.cpp +++ b/tests/auto/installer/messageboxhandler/tst_messageboxhandler.cpp @@ -1,5 +1,7 @@ -#include "messageboxhandler.h" -#include "qinstallerglobal.h" +#include +#include +#include +#include #include #include @@ -43,23 +45,24 @@ private slots: if (enumValue == QMessageBox::LastButton) break; } - QInstaller::registerMessageBox(&m_scriptEngine); } void testScriptButtonValues() { + PackageManagerCore core; + ScriptEngine scriptEngine(&core); QMapIterator i(m_standardButtonValueMap); while (i.hasNext()) { i.next(); QString scriptString = QString::fromLatin1("QMessageBox.%1").arg(i.value()); - QScriptValue scriptValue(m_scriptEngine.evaluate(scriptString)); + QScriptValue scriptValue(scriptEngine.evaluate(scriptString)); QVERIFY2(!scriptValue.isUndefined(), qPrintable( QString::fromLatin1("It seems that %1 is undefined.").arg(scriptString))); qint32 evaluatedValue = scriptValue.toInt32(); - QVERIFY2(!m_scriptEngine.hasUncaughtException(), qPrintable( - QInstaller::uncaughtExceptionString(&m_scriptEngine))); + QVERIFY2(!scriptEngine.hasUncaughtException(), qPrintable( + QInstaller::uncaughtExceptionString(&scriptEngine))); QCOMPARE(static_cast(evaluatedValue), i.key()); } @@ -109,7 +112,6 @@ private slots: private: QMap m_standardButtonValueMap; int m_maxStandardButtons; - QScriptEngine m_scriptEngine; }; QTEST_MAIN(tst_MessageBoxHandler) diff --git a/tests/auto/installer/scriptengine/data/auto-install.qs b/tests/auto/installer/scriptengine/data/auto-install.qs new file mode 100644 index 000000000..26937fc05 --- /dev/null +++ b/tests/auto/installer/scriptengine/data/auto-install.qs @@ -0,0 +1,16 @@ +function Controller() +{ + installer.setMessageBoxAutomaticAnswer("OverwriteTargetDirectory", QMessageBox.Yes); + installer.setValue("GuiTestValue", "hello"); +} + +Controller.prototype.ComponentSelectionPageCallback = function() +{ + var notExistingButtonId = 9999999; + gui.clickButton(notExistingButtonId); +} + +Controller.prototype.FinishedPageCallback = function() +{ + print("FinishedPageCallback - OK") +} diff --git a/tests/auto/installer/scriptengine/data/component1.qs b/tests/auto/installer/scriptengine/data/component1.qs new file mode 100644 index 000000000..af81f5747 --- /dev/null +++ b/tests/auto/installer/scriptengine/data/component1.qs @@ -0,0 +1,48 @@ +function Component() +{ + print("Component constructor - OK"); +} + +Component.prototype.retranslateUi = function() +{ + // arguments.callee to get the current function name doesn't work in that case + print("retranslateUi - OK"); + // no default implementation for this method + // component.languageChanged(); +} + +Component.prototype.createOperationsForPath = function(path) +{ + print("createOperationsForPath - OK"); + component.createOperationsForPath(path); +} + +Component.prototype.createOperationsForArchive = function(archive) +{ + print("createOperationsForArchive - OK"); + component.createOperationsForArchive(archive); +} + +Component.prototype.beginInstallation = function() +{ + print("beginInstallation - OK"); + component.beginInstallation(); +} + +Component.prototype.createOperations = function() +{ + print("createOperations - OK"); + component.createOperations(); +} + +Component.prototype.isAutoDependOn = function() +{ + print("isAutoDependOn - OK"); + return false; +} + +Component.prototype.isDefault = function() +{ + print("isDefault - OK"); + return false; +} diff --git a/tests/auto/installer/scriptengine/data/component2.qs b/tests/auto/installer/scriptengine/data/component2.qs new file mode 100644 index 000000000..b27e45c83 --- /dev/null +++ b/tests/auto/installer/scriptengine/data/component2.qs @@ -0,0 +1,6 @@ +function Component() +{ + print("script function: " + arguments.callee.name); + // adding some broken javascript code here + broken + 789634 +} diff --git a/tests/auto/installer/scriptengine/scriptengine.pro b/tests/auto/installer/scriptengine/scriptengine.pro new file mode 100644 index 000000000..a7b2bd157 --- /dev/null +++ b/tests/auto/installer/scriptengine/scriptengine.pro @@ -0,0 +1,11 @@ +include(../../qttest.pri) + +QT += script +greaterThan(QT_MAJOR_VERSION, 4) { + QT += widgets +} + +SOURCES += tst_scriptengine.cpp + +RESOURCES += \ + scriptengine.qrc diff --git a/tests/auto/installer/scriptengine/scriptengine.qrc b/tests/auto/installer/scriptengine/scriptengine.qrc new file mode 100644 index 000000000..d38168175 --- /dev/null +++ b/tests/auto/installer/scriptengine/scriptengine.qrc @@ -0,0 +1,7 @@ + + + data/auto-install.qs + data/component1.qs + data/component2.qs + + diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp new file mode 100644 index 000000000..af1dbf377 --- /dev/null +++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp @@ -0,0 +1,205 @@ +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace QInstaller; + +// -- InstallerGui + +class TestGui : public QInstaller::PackageManagerGui +{ + Q_OBJECT + +public: + explicit TestGui(QInstaller::PackageManagerCore *core) + : PackageManagerGui(core, 0) + { + setPage(PackageManagerCore::Introduction, new IntroductionPage(core)); + setPage(PackageManagerCore::ComponentSelection, new ComponentSelectionPage(core)); + setPage(PackageManagerCore::InstallationFinished, new FinishedPage(core)); + } + + virtual void init() {} + + void callProtectedDelayedControlScriptExecution(int id) + { + delayedControlScriptExecution(id); + } +}; + + +class tst_ScriptEngine : public QObject +{ + Q_OBJECT + +private slots: + void initTestCase() + { + m_component = new Component(&m_core); + // append the component to the package manager which deletes it at destructor + // (it calls clearAllComponentLists which calls qDeleteAll(m_rootComponents);) + m_core.appendRootComponent(m_component); + + m_component->setValue("AutoDependOn", "Script"); + m_component->setValue("Default", "Script"); + m_component->setValue(scName, "component.test.name"); + + m_scriptEngine = m_core.scriptEngine(); + } + + void testScriptPrint() + { + setExpectedScriptOutput("test"); + m_scriptEngine->evaluate("print(\"test\");"); + if (m_scriptEngine->hasUncaughtException()) { + QFAIL(qPrintable(QString::fromLatin1("ScriptEngine hasUncaughtException:\n %1").arg( + uncaughtExceptionString(m_scriptEngine)))); + } + } + + void testExistingInstallerObject() + { + setExpectedScriptOutput("object"); + m_scriptEngine->evaluate("print(typeof installer)"); + if (m_scriptEngine->hasUncaughtException()) { + QFAIL(qPrintable(QString::fromLatin1("ScriptEngine hasUncaughtException:\n %1").arg( + uncaughtExceptionString(m_scriptEngine)))); + } + } + + void testComponentByName() + { + const QString printComponentNameScript = QString::fromLatin1("var correctComponent = " + "installer.componentByName('%1');\nprint(correctComponent.name);").arg(m_component->name()); + + setExpectedScriptOutput("component.test.name"); + m_scriptEngine->evaluate(printComponentNameScript); + if (m_scriptEngine->hasUncaughtException()) { + QFAIL(qPrintable(QString::fromLatin1("ScriptEngine hasUncaughtException:\n %1").arg( + uncaughtExceptionString(m_scriptEngine)))); + } + } + + void testComponentByWrongName() + { + const QString printComponentNameScript = QString::fromLatin1( "var brokenComponent = " + "installer.componentByName('%1');\nprint(brokenComponent.name);").arg("MyNotExistingComponentName"); + + m_scriptEngine->evaluate(printComponentNameScript); + QVERIFY(m_scriptEngine->hasUncaughtException()); + } + + void loadSimpleComponentScript() + { + try { + // ignore retranslateUi which is called by loadComponentScript + setExpectedScriptOutput("Component constructor - OK"); + setExpectedScriptOutput("retranslateUi - OK"); + m_component->loadComponentScript(":///data/component1.qs"); + + setExpectedScriptOutput("retranslateUi - OK"); + m_component->languageChanged(); + + setExpectedScriptOutput("createOperationsForPath - OK"); + m_component->createOperationsForPath(":///data/"); + + setExpectedScriptOutput("createOperationsForArchive - OK"); + // ignore createOperationsForPath which is called by createOperationsForArchive + setExpectedScriptOutput("createOperationsForPath - OK"); + m_component->createOperationsForArchive("test.7z"); + + setExpectedScriptOutput("beginInstallation - OK"); + m_component->beginInstallation(); + + setExpectedScriptOutput("createOperations - OK"); + m_component->createOperations(); + + setExpectedScriptOutput("isAutoDependOn - OK"); + bool returnIsAutoDependOn = m_component->isAutoDependOn(QSet()); + QCOMPARE(returnIsAutoDependOn, false); + + setExpectedScriptOutput("isDefault - OK"); + bool returnIsDefault = m_component->isDefault(); + QCOMPARE(returnIsDefault, false); + + } catch (const Error &error) { + QFAIL(qPrintable(error.message())); + } + } + + void loadBrokenComponentScript() + { + PackageManagerCore core; + Component testComponent(&core); + + const QString debugMesssage( + "create Error-Exception: \"Exception while loading the component script: ':///data/component2.qs\n\n" + "ReferenceError: Can't find variable: broken\n\n" + "Backtrace:\n" +#if QT_VERSION < 0x050000 + "\t()@:///data/component2.qs:5'\" "); +#else + "\tComponent() at :///data/component2.qs:5\n" + "\t() at :///data/component2.qs:7\n" + "\t() at :///data/component2.qs:7'\" "); +#endif + try { + // ignore Output from script + setExpectedScriptOutput("script function: Component"); + setExpectedScriptOutput(qPrintable(debugMesssage)); + testComponent.loadComponentScript(":///data/component2.qs"); + } catch (const Error &error) { + QVERIFY2(debugMesssage.contains(error.message()), "There was some unexpected error."); + } + } + + void loadSimpleAutoRunScript() + { + try { + TestGui testGui(&m_core); + setExpectedScriptOutput("Loaded control script \":///data/auto-install.qs\" "); + testGui.loadControlScript(":///data/auto-install.qs"); + QCOMPARE(m_core.value("GuiTestValue"), QString("hello")); + + testGui.show(); + // show event calls automatically the first callback which does not exist + setExpectedScriptOutput("Control script callback \"IntroductionPageCallback\" does not exist. "); + // give some time to the event triggering mechanism + qApp->processEvents(); + + // inside the auto-install script we are clicking the next button, with a not existing button + QTest::ignoreMessage(QtWarningMsg, "Button with type: \"unknown button\" not found! "); + testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::ComponentSelection); + + setExpectedScriptOutput("FinishedPageCallback - OK"); + testGui.callProtectedDelayedControlScriptExecution(PackageManagerCore::InstallationFinished); + } catch (const Error &error) { + QFAIL(qPrintable(error.message())); + } + } + +private: + void setExpectedScriptOutput(const char *message) + { + // Using setExpectedScriptOutput(...); inside the test method + // as a simple test that the scripts are called. + QTest::ignoreMessage(QtDebugMsg, message); + } + + PackageManagerCore m_core; + Component *m_component; + QScriptEngine *m_scriptEngine; + +}; + + +QTEST_MAIN(tst_ScriptEngine) + +#include "tst_scriptengine.moc" -- cgit v1.2.3