diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2019-09-09 17:09:36 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2019-09-27 09:07:22 +0200 |
commit | 201ea73049229b67b5899d362bb98c2f7e3d587c (patch) | |
tree | 86768575f0cf6379976ffafaf58edec452432cd1 /tests/auto/quick/qquickboundaryrule | |
parent | 56194f7467f592e3476be1cda9e6f40b00eef12a (diff) |
Quick: Move BoundaryRule into labsanimation
We don't want to mix multiple modules in the same library anymore.
QtQuick should only contain types to be registered under QtQuick.
Otherwise we cannot automatically generate the type registrations.
Change-Id: I6a8e20fe8f7d01600232439a10168ef4298fc6b4
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickboundaryrule')
3 files changed, 16 insertions, 11 deletions
diff --git a/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml b/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml index c66fd76ff1..769a5b2c7d 100644 --- a/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml +++ b/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml @@ -14,6 +14,7 @@ Rectangle { } BoundaryRule on x { + objectName: "boundaryRule" id: xbr minimum: -50 maximum: 100 diff --git a/tests/auto/quick/qquickboundaryrule/qquickboundaryrule.pro b/tests/auto/quick/qquickboundaryrule/qquickboundaryrule.pro index ef43f4526a..c41f798d33 100644 --- a/tests/auto/quick/qquickboundaryrule/qquickboundaryrule.pro +++ b/tests/auto/quick/qquickboundaryrule/qquickboundaryrule.pro @@ -9,4 +9,4 @@ include (../shared/util.pri) TESTDATA = data/* -QT += core-private gui-private qml-private quick-private testlib +QT += quick-private qml testlib diff --git a/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp b/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp index 44f1c9a2f9..75639dba49 100644 --- a/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp +++ b/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp @@ -30,7 +30,6 @@ #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> #include <QtQuick/qquickview.h> -#include <QtQuick/private/qquickboundaryrule_p.h> #include <QtQuick/private/qquickdraghandler_p.h> #include "../../shared/util.h" #include "../shared/viewtestutil.h" @@ -57,7 +56,7 @@ void tst_qquickboundaryrule::dragHandler() QVERIFY(target); QQuickDragHandler *dragHandler = target->findChild<QQuickDragHandler*>(); QVERIFY(dragHandler); - QQuickBoundaryRule *boundaryRule = target->findChild<QQuickBoundaryRule*>(); + QObject *boundaryRule = target->findChild<QObject *>(QLatin1String("boundaryRule")); QVERIFY(boundaryRule); QSignalSpy overshootChangedSpy(boundaryRule, SIGNAL(currentOvershootChanged())); @@ -68,29 +67,34 @@ void tst_qquickboundaryrule::dragHandler() QTest::mouseMove(&window, p1); QTRY_VERIFY(dragHandler->active()); QCOMPARE(target->position().x(), 100); - QCOMPARE(boundaryRule->currentOvershoot(), 0); - QCOMPARE(boundaryRule->peakOvershoot(), 0); + bool ok = false; + QCOMPARE(boundaryRule->property("currentOvershoot").toReal(&ok), 0); + QVERIFY(ok); + QCOMPARE(boundaryRule->property("peakOvershoot").toReal(&ok), 0); + QVERIFY(ok); QCOMPARE(overshootChangedSpy.count(), 0); // restricted drag: halfway into overshoot p1 += QPoint(20, 0); QTest::mouseMove(&window, p1); QCOMPARE(target->position().x(), 117.5); - QCOMPARE(boundaryRule->currentOvershoot(), 20); - QCOMPARE(boundaryRule->peakOvershoot(), 20); + QCOMPARE(boundaryRule->property("currentOvershoot").toReal(), 20); + QCOMPARE(boundaryRule->property("peakOvershoot").toReal(), 20); QCOMPARE(overshootChangedSpy.count(), 1); // restricted drag: maximum overshoot p1 += QPoint(80, 0); QTest::mouseMove(&window, p1); QCOMPARE(target->position().x(), 140); - QCOMPARE(boundaryRule->currentOvershoot(), 100); - QCOMPARE(boundaryRule->peakOvershoot(), 100); + QCOMPARE(boundaryRule->property("currentOvershoot").toReal(), 100); + QCOMPARE(boundaryRule->property("peakOvershoot").toReal(), 100); QCOMPARE(overshootChangedSpy.count(), 2); // release and let it return to bounds QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p1); QTRY_COMPARE(dragHandler->active(), false); QTRY_COMPARE(overshootChangedSpy.count(), 3); - QCOMPARE(boundaryRule->currentOvershoot(), 0); - QCOMPARE(boundaryRule->peakOvershoot(), 0); + QCOMPARE(boundaryRule->property("currentOvershoot").toReal(&ok), 0); + QVERIFY(ok); + QCOMPARE(boundaryRule->property("peakOvershoot").toReal(&ok), 0); + QVERIFY(ok); QCOMPARE(target->position().x(), 100); } |