summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@theqtcompany.com>2015-01-06 10:56:49 +0100
committerKai Koehne <kai.koehne@theqtcompany.com>2015-01-08 08:59:06 +0100
commitf87efd7c14e0a332341e58ed1e52d46328e31d03 (patch)
tree8c5bbf677eb2bdecad92abe60f54acb95fb4e5bf /tests
parent8d86c06aef110ad6cf6f1dcb6af56b19ddbe7f24 (diff)
Fix objects returned by gui methods
We need to make sure objects like pageWidgetByObjectName are augmented too (so that one can access child objects). This is achieved by a proxy object that augments all raw QObject * and QWidget * return values. This fixes e.g. the dynamicpage example. Task-number: QTIFW-605 Change-Id: If26dc59220946a7445ef0f9ec7caa15e5b04eaa8 Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/installer/scriptengine/data/dynamicpage.qs10
-rw-r--r--tests/auto/installer/scriptengine/tst_scriptengine.cpp2
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/installer/scriptengine/data/dynamicpage.qs b/tests/auto/installer/scriptengine/data/dynamicpage.qs
index 4ac1990c1..576d5816e 100644
--- a/tests/auto/installer/scriptengine/data/dynamicpage.qs
+++ b/tests/auto/installer/scriptengine/data/dynamicpage.qs
@@ -32,8 +32,18 @@
**
**************************************************************************/
+function assert(condition)
+{
+ if (!condition)
+ throw new Error("Assertion failed!");
+}
+
function Controller()
{
+ var widget = gui.pageWidgetByObjectName("DynamicWidget");
+ assert(typeof widget === 'object');
+ var button = widget.Button;
+ assert(typeof button === 'object');
}
Controller.prototype.ReadAndSetValues = function()
diff --git a/tests/auto/installer/scriptengine/tst_scriptengine.cpp b/tests/auto/installer/scriptengine/tst_scriptengine.cpp
index 370d7eef4..10fa9b79e 100644
--- a/tests/auto/installer/scriptengine/tst_scriptengine.cpp
+++ b/tests/auto/installer/scriptengine/tst_scriptengine.cpp
@@ -83,6 +83,8 @@ public:
void init() {
m_widget = new QWidget;
m_widget->setObjectName("Widget");
+ QWidget *button = new QWidget(m_widget);
+ button->setObjectName("Button");
packageManagerCore()->wizardPageInsertionRequested(m_widget,
PackageManagerCore::Introduction);