~faenil/ubuntu-ui-toolkit/scrollbar_moreHoverFixesAndTests

« back to all changes in this revision

Viewing changes to tests/unit/bottomedge/tst_bottomedge.cpp

  • Committer: Andrea Bernabei
  • Date: 2016-07-07 15:21:03 UTC
  • mfrom: (1903.1.124 staging)
  • Revision ID: andrea.bernabei@canonical.com-20160707152103-eaz1u4zpnyhlacwf
merge staging

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include <QtTest/QtTest>
19
19
#include "ucbottomedge.h"
20
20
#include "ucbottomedgeregion.h"
21
 
#include "ucbottomedgeregion_p.h"
22
 
#include "ucbottomedge_p.h"
 
21
#include "private/ucbottomedgeregion_p.h"
 
22
#include "private/ucbottomedge_p.h"
23
23
#include "ucbottomedgehint.h"
24
24
#include "private/ucswipearea_p.h"
25
25
#include "ucunits.h"
32
32
#include "ucbottomedgestyle.h"
33
33
#undef private
34
34
 
 
35
UT_USE_NAMESPACE
 
36
 
35
37
Q_DECLARE_METATYPE(Qt::Key)
36
38
 
37
39
#define QVERIFY_RETURN(statement, returnValue) \
240
242
        QScopedPointer<BottomEdgeTestCase> test(new BottomEdgeTestCase("BottomEdgeInItem.qml"));
241
243
        UCBottomEdge *bottomEdge = test->testItem();
242
244
        UCBottomEdgeStyle *style = UCBottomEdgePrivate::get(bottomEdge)->bottomPanel;
243
 
        QSignalSpy spy(bottomEdge, SIGNAL(statusChanged(UCBottomEdge::Status)));
 
245
        QSignalSpy spy(bottomEdge, SIGNAL(statusChanged(UbuntuToolkit::UCBottomEdge::Status)));
244
246
 
245
247
        // swipe till we reveal it
246
248
        QPoint from(bottomEdge->width() / 2.0f, bottomEdge->height() - 1);
263
265
            // there must be two state changes here, one Hidden->Revealed, and one Revealed->Hidden
264
266
            QCOMPARE(spy.count(), 2);
265
267
            QList<QVariant> state1 = spy.at(0);
266
 
            QCOMPARE(state1[0].value<int>(), (int)UCBottomEdge::Revealed);
 
268
            QCOMPARE(state1[0].value<UCBottomEdge::Status>(), UCBottomEdge::Revealed);
267
269
            QList<QVariant> state2 = spy.at(1);
268
 
            QCOMPARE(state2[0].value<int>(), (int)UCBottomEdge::Hidden);
 
270
            QCOMPARE(state2[0].value<UCBottomEdge::Status>(), UCBottomEdge::Hidden);
269
271
        }
270
272
    }
271
273
 
566
568
 
567
569
        QPoint from(bottomEdge->width() / 2.0f, bottomEdge->height() - 5);
568
570
        QPoint to = from + QPoint(0, -(bottomEdge->parentItem()->height() - 1));
569
 
        QSignalSpy spy(bottomEdge, SIGNAL(activeRegionChanged(UCBottomEdgeRegion*)));
 
571
        QSignalSpy spy(bottomEdge, SIGNAL(activeRegionChanged(UbuntuToolkit::UCBottomEdgeRegion*)));
570
572
 
571
573
        UCTestExtras::touchPress(0, bottomEdge, from);
572
574
        QPoint movePos(from);
829
831
        UCBottomEdgeRegionPrivate::get(region)->to = 0.2;
830
832
        QPoint from(bottomEdge->width() / 2.0f, bottomEdge->height() - 5);
831
833
        QPoint delta(0, -(bottomEdge->height() / 2.0f));
832
 
        QSignalSpy activeRegion(bottomEdge, SIGNAL(activeRegionChanged(UCBottomEdgeRegion*)));
 
834
        QSignalSpy activeRegion(bottomEdge, SIGNAL(activeRegionChanged(UbuntuToolkit::UCBottomEdgeRegion*)));
833
835
        if (withMouse) {
834
836
            bottomEdge->hint()->setStatus(UCBottomEdgeHint::Locked);
835
837
            UCTestExtras::mouseDrag(bottomEdge, from, delta, Qt::LeftButton, 0, 10);
908
910
 
909
911
        QPoint from(bottomEdge->width() / 2.0f, bottomEdge->height() - 5);
910
912
        QPoint to = from + QPoint(0, -(bottomEdge->parentItem()->height() - 1));
911
 
        QSignalSpy spy(bottomEdge, SIGNAL(activeRegionChanged(UCBottomEdgeRegion*)));
 
913
        QSignalSpy spy(bottomEdge, SIGNAL(activeRegionChanged(UbuntuToolkit::UCBottomEdgeRegion*)));
912
914
 
913
915
        connect(bottomEdge, &UCBottomEdge::contentItemChanged, [=]() {
914
916
            regionObjects.append(bottomEdge->contentItem()