~nskaggs/ubuntu-ui-toolkit/add-popover-object-support

« back to all changes in this revision

Viewing changes to tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp

  • Committer: CI bot
  • Author(s): Zsombor Egri, Tarmac, Zoltán Balogh
  • Date: 2014-06-18 17:10:31 UTC
  • mfrom: (1000.76.9 landing_04-06)
  • Revision ID: ps-jenkins@lists.canonical.com-20140618171031-1s026ulaxymh2e9f
  [Leo Arias ]
  * On the autopilot helper for the header, fix the swipe to show
    when hidden.
  * Added a fixture for autopilot tests to use a fake home directory.
    Fixes: https://bugs.launchpad.net/bugs/1317639
  * Cleaned the containers in unity test using the alternate
    launcher.

  [ Christian Dywan ]   
  * Add a launcher with a switch for the QQMLEngine.

  [ Tim Peeters ]
  * Anchor the internal PageTreeNode of PageStack to fill its parent.
    Fixes: https://bugs.launchpad.net/bugs/1322527
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include <QtQuick/QQuickItem>
23
23
#include <QtCore/QEvent>
24
24
 
 
25
#include "uctestcase.h"
25
26
#include "inversemouseareatype.h"
26
27
#include "ucunits.h"
27
28
#include <private/qquickevents_p_p.h>
28
 
#include <qpa/qwindowsysteminterface.h>
29
29
 
30
30
#define DOUBLECLICK_TIMEOUT 400
31
31
 
78
78
        return QPointF(UCUnits::instance().gu(guX), UCUnits::instance().gu(guY)).toPoint();
79
79
    }
80
80
 
81
 
    void touchClick(QWindow *window, const QPoint &point)
82
 
    {
83
 
        QTest::touchEvent(window, device).press(0, point, window);
84
 
        QTest::qWait(10);
85
 
        QTest::touchEvent(window, device).release(0, point, window);
86
 
    }
87
 
 
88
81
protected Q_SLOTS:
89
82
    void capturePressed(QQuickMouseEvent *event)
90
83
    {
95
88
 
96
89
    void initTestCase()
97
90
    {
 
91
        // make sure we have a touch device installed
 
92
        UbuntuTestCase::registerTouchDevice();
98
93
        QString modules("../../../modules");
99
94
        QVERIFY(QDir(modules).exists());
100
95
 
101
96
        quickView = new QQuickView(0);
102
97
        quickEngine = quickView->engine();
103
98
 
104
 
        device = new QTouchDevice;
105
 
        device->setType(QTouchDevice::TouchScreen);
106
 
        QWindowSystemInterface::registerTouchDevice(device);
107
 
 
108
99
        quickView->setGeometry(0,0, 240, 320);
109
100
        //add modules folder so we have access to the plugin from QML
110
101
        QStringList imports = quickEngine->importPathList();
139
130
        QVERIFY(eventCleanup.isEmpty());
140
131
    }
141
132
 
142
 
 
143
133
    void testCase_PropagateEvents()
144
134
    {
145
135
        eventCleanup.clear();
167
157
        InverseMouseAreaType *area = testArea("InverseMouseAreaInWindow.qml");
168
158
        QVERIFY(area);
169
159
        quickView->show();
 
160
        QTest::qWaitForWindowExposed(quickView);
170
161
 
171
162
        QList<QQuickWindow *> l = quickView->rootObject()->findChildren<QQuickWindow*>("isawindow");
172
163
        QVERIFY(l.count());
173
164
 
 
165
        QQuickItem *clickArea = quickView->rootObject()->findChild<QQuickItem*>("clickArea");
 
166
        QVERIFY(clickArea);
 
167
 
174
168
        QTest::mouseClick(l[0], Qt::LeftButton, 0, QPoint(20, 10));
175
169
        QTest::waitForEvents();
176
170
        QCOMPARE(quickView->rootObject()->property("log").toString(), QString("IMA"));
519
513
        QCOMPARE(imaSpy.count(), 1);
520
514
 
521
515
        imaSpy.clear();
522
 
        touchClick(quickView, guPoint(20, 5));
 
516
        UbuntuTestCase::touchClick(0, quickView, guPoint(20, 5));
523
517
        QCOMPARE(imaSpy.count(), 1);
524
518
    }
525
519