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>
This commit is contained in:
Ulf Hermann 2019-09-09 17:09:36 +02:00
parent 56194f7467
commit 201ea73049
8 changed files with 22 additions and 15 deletions

View File

@ -4,8 +4,12 @@ TARGETPATH = Qt/labs/animation
IMPORT_VERSION = 1.0
SOURCES += \
qquickboundaryrule.cpp \
plugin.cpp
HEADERS += \
qquickboundaryrule_p.h
QT = qml-private quick-private
load(qml_plugin)

View File

@ -40,7 +40,7 @@
#include <QtQml/qqmlextensionplugin.h>
#include <QtQml/qqml.h>
#include <private/qquickboundaryrule_p.h>
#include "qquickboundaryrule_p.h"
QT_BEGIN_NAMESPACE

View File

@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE
class QQuickAbstractAnimation;
class QQuickBoundaryRulePrivate;
class Q_QUICK_PRIVATE_EXPORT QQuickBoundaryRule : public QObject, public QQmlPropertyValueInterceptor
class QQuickBoundaryRule : public QObject, public QQmlPropertyValueInterceptor
{
Q_OBJECT
Q_DECLARE_PRIVATE(QQuickBoundaryRule)

View File

@ -15,7 +15,6 @@ SOURCES += \
$$PWD/qquicktimeline.cpp \
$$PWD/qquickpixmapcache.cpp \
$$PWD/qquickbehavior.cpp \
$$PWD/qquickboundaryrule.cpp \
$$PWD/qquickfontloader.cpp \
$$PWD/qquickstyledtext.cpp \
$$PWD/qquickimageprovider.cpp \
@ -51,7 +50,6 @@ HEADERS += \
$$PWD/qquicktimeline_p_p.h \
$$PWD/qquickpixmapcache_p.h \
$$PWD/qquickbehavior_p.h \
$$PWD/qquickboundaryrule_p.h \
$$PWD/qquickfontloader_p.h \
$$PWD/qquickstyledtext_p.h \
$$PWD/qquickimageprovider.h \

View File

@ -14,6 +14,7 @@ Rectangle {
}
BoundaryRule on x {
objectName: "boundaryRule"
id: xbr
minimum: -50
maximum: 100

View File

@ -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

View File

@ -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);
}