diff options
Diffstat (limited to 'tests/auto')
6 files changed, 136 insertions, 36 deletions
diff --git a/tests/auto/qml/ecmascripttests/TestExpectations b/tests/auto/qml/ecmascripttests/TestExpectations index f9a405db6d..bcb6729ab6 100644 --- a/tests/auto/qml/ecmascripttests/TestExpectations +++ b/tests/auto/qml/ecmascripttests/TestExpectations @@ -431,14 +431,7 @@ built-ins/Proxy/proxy-no-prototype.js fails built-ins/Proxy/revocable/revocation-function-name.js fails built-ins/Proxy/revocable/revocation-function-nonconstructor.js fails built-ins/Proxy/set/trap-is-not-callable-realm.js fails -built-ins/Proxy/set/trap-is-undefined-receiver.js fails built-ins/Proxy/setPrototypeOf/trap-is-not-callable-realm.js fails -built-ins/Reflect/set/creates-a-data-descriptor.js fails -built-ins/Reflect/set/different-property-descriptors.js fails -built-ins/Reflect/set/receiver-is-not-object.js fails -built-ins/Reflect/set/return-false-if-target-is-not-writable.js fails -built-ins/Reflect/set/set-value-on-data-descriptor.js fails -built-ins/Reflect/set/symbol-property.js fails built-ins/RegExp/S15.10.2.12_A2_T1.js fails built-ins/RegExp/proto-from-ctor-realm.js fails built-ins/RegExp/prototype/Symbol.match/builtin-success-u-return-val-groups.js fails @@ -941,21 +934,9 @@ language/expressions/prefix-increment/S11.4.4_A5_T3.js sloppyFails language/expressions/prefix-increment/S11.4.4_A5_T4.js sloppyFails language/expressions/prefix-increment/S11.4.4_A5_T5.js fails language/expressions/prefix-increment/S11.4.4_A6_T3.js fails -language/expressions/super/prop-dot-cls-ref-strict.js fails -language/expressions/super/prop-dot-cls-ref-this.js fails -language/expressions/super/prop-dot-cls-this-uninit.js fails language/expressions/super/prop-dot-cls-val-from-arrow.js fails -language/expressions/super/prop-dot-obj-ref-non-strict.js sloppyFails -language/expressions/super/prop-dot-obj-ref-strict.js strictFails -language/expressions/super/prop-dot-obj-ref-this.js fails language/expressions/super/prop-dot-obj-val-from-arrow.js fails -language/expressions/super/prop-expr-cls-ref-strict.js fails -language/expressions/super/prop-expr-cls-ref-this.js fails -language/expressions/super/prop-expr-cls-this-uninit.js fails language/expressions/super/prop-expr-cls-val-from-arrow.js fails -language/expressions/super/prop-expr-obj-ref-non-strict.js sloppyFails -language/expressions/super/prop-expr-obj-ref-strict.js strictFails -language/expressions/super/prop-expr-obj-ref-this.js fails language/expressions/super/prop-expr-obj-val-from-arrow.js fails language/expressions/super/realm.js fails language/expressions/tagged-template/cache-different-functions-same-site.js fails @@ -1109,7 +1090,6 @@ language/statements/class/subclass/builtin-objects/WeakSet/super-must-be-called. language/statements/class/subclass/builtins.js fails language/statements/class/subclass/class-definition-null-proto-this.js fails language/statements/class/subclass/default-constructor-spread-override.js fails -language/statements/class/super/in-methods.js fails language/statements/do-while/tco-body.js strictFails language/statements/for-in/head-lhs-let.js sloppyFails language/statements/for-in/head-var-bound-names-let.js sloppyFails @@ -1214,4 +1194,4 @@ language/statements/while/tco-body.js strictFails language/statements/with/unscopables-inc-dec.js sloppyFails language/types/reference/get-value-prop-base-primitive-realm.js fails language/types/reference/put-value-prop-base-primitive-realm.js fails -language/types/reference/put-value-prop-base-primitive.js fails +language/types/reference/put-value-prop-base-primitive.js strictFails diff --git a/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp b/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp index b2908ac5bb..095943cdc7 100644 --- a/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp +++ b/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp @@ -41,6 +41,7 @@ private slots: void sweepFirstEntryInSameBucketWithDifferingHash(); void dontSweepAcrossBucketBoundaries(); void sweepAcrossBucketBoundariesIfFirstBucketFull(); + void sweepBucketGap(); }; void tst_qv4identifiertable::sweepFirstEntryInBucket() @@ -300,6 +301,63 @@ void tst_qv4identifiertable::sweepAcrossBucketBoundariesIfFirstBucketFull() QCOMPARE(table.entriesByHash[3], nullptr); } +void tst_qv4identifiertable::sweepBucketGap() +{ + QV4::ExecutionEngine engine; + QV4::IdentifierTable table(&engine, /*numBits*/3); + + auto entry1 = engine.newString(QStringLiteral("one")); + auto entry2 = engine.newString(QStringLiteral("two")); + auto entry3 = engine.newString(QStringLiteral("three")); + auto entry4 = engine.newString(QStringLiteral("four")); + + entry1->createHashValue(); + entry2->createHashValue(); + entry3->createHashValue(); + entry4->createHashValue(); + + // We have two buckets where the second entry in the first bucket + // flows into the second bucket. So insertion into the second bucket + // will shift by one and create + // [entry1][entry2 (would map to first but overflows into second), entry3, entry4] + // Garbage collecting the first entry should not only move the second entry + // into its own first bucket (where there is space now), it is also critical to + // not leave a gap but move the third and fourth entries to the beginning of + // their bucket: + // [entry2][entry3, entry4] + entry1->stringHash = 0; // % 11 -> 0 + entry2->stringHash = 11; // % 11 -> 0, but ends up at idx 1 because 0 taken + entry3->stringHash = 12; // % 11 -> 1, but ends up at idx 2 because 1 taken + entry4->stringHash = 12; // % 11 -> 1, but ends up at idx 3 because 1+2 taken + + // trigger insertion + table.asPropertyKey(entry1); + table.asPropertyKey(entry2); + table.asPropertyKey(entry3); + table.asPropertyKey(entry4); + + QCOMPARE(table.size, 4); + QCOMPARE(table.alloc, 11); + + QCOMPARE(table.entriesByHash[0], entry1); + QCOMPARE(table.entriesByHash[1], entry2); + QCOMPARE(table.entriesByHash[2], entry3); + QCOMPARE(table.entriesByHash[3], entry4); + QCOMPARE(table.entriesByHash[4], nullptr); + + // first entry not marked + entry2->setMarkBit(); + entry3->setMarkBit(); + entry4->setMarkBit(); + + table.sweep(); + + QCOMPARE(table.entriesByHash[0], entry2); + QCOMPARE(table.entriesByHash[1], entry3); + QCOMPARE(table.entriesByHash[2], entry4); + QCOMPARE(table.entriesByHash[3], nullptr); +} + QTEST_MAIN(tst_qv4identifiertable) #include "tst_qv4identifiertable.moc" diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp index 2a9ec272fa..e8b076052a 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp @@ -51,14 +51,14 @@ public: }; Q_ENUM(Destination) - Event(Destination d, QEvent::Type t, Qt::TouchPointState s, int grabState, QPointF item, QPointF scene) - : destination(d), type(t), state(s), grabState(grabState), posWrtItem(item), posWrtScene(scene) + Event(Destination d, QEvent::Type t, Qt::TouchPointState s, int grabTransition, QPointF item, QPointF scene) + : destination(d), type(t), state(s), grabTransition(grabTransition), posWrtItem(item), posWrtScene(scene) {} Destination destination; QEvent::Type type; // if this represents a QEvent that was received Qt::TouchPointState state; // if this represents an event (pointer, touch or mouse) - int grabState; // if this represents an onGrabChanged() notification (QQuickEventPoint::GrabState) + int grabTransition; // if this represents an onGrabChanged() notification (QQuickEventPoint::GrabTransition) QPointF posWrtItem; QPointF posWrtScene; }; @@ -73,9 +73,9 @@ QDebug operator<<(QDebug dbg, const class Event &event) { QtDebugUtils::formatQEnum(dbg, event.type); dbg << ' '; QtDebugUtils::formatQEnum(dbg, event.state); - if (event.grabState) { + if (event.grabTransition) { dbg << ' '; - QtDebugUtils::formatQEnum(dbg, QQuickEventPoint::GrabState(event.grabState)); + QtDebugUtils::formatQEnum(dbg, QQuickEventPoint::GrabTransition(event.grabTransition)); } dbg << " @ "; QtDebugUtils::formatQPoint(dbg, event.posWrtItem); @@ -98,7 +98,7 @@ public: : QQuickItem(parent), acceptPointer(false), grabPointer(false), acceptMouse(false), acceptTouch(false), filterTouch(false) {} - inline int grabState(bool accept, Qt::TouchPointState state) { + inline int grabTransition(bool accept, Qt::TouchPointState state) { return (accept && (state != Qt::TouchPointReleased)) ? (int)QQuickEventPoint::GrabExclusive : (int)NoGrab; } @@ -106,31 +106,31 @@ public: { qCDebug(lcPointerTests) << event << "will accept?" << acceptTouch; for (const QTouchEvent::TouchPoint &tp : event->touchPoints()) - eventList.append(Event(Event::TouchDestination, event->type(), tp.state(), grabState(acceptTouch, tp.state()), tp.pos(), tp.scenePos())); + eventList.append(Event(Event::TouchDestination, event->type(), tp.state(), grabTransition(acceptTouch, tp.state()), tp.pos(), tp.scenePos())); event->setAccepted(acceptTouch); } void mousePressEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabState(acceptMouse, Qt::TouchPointPressed), event->pos(), event->windowPos())); + eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->pos(), event->windowPos())); event->setAccepted(acceptMouse); } void mouseMoveEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointMoved, grabState(acceptMouse, Qt::TouchPointMoved), event->pos(), event->windowPos())); + eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointMoved, grabTransition(acceptMouse, Qt::TouchPointMoved), event->pos(), event->windowPos())); event->setAccepted(acceptMouse); } void mouseReleaseEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointReleased, grabState(acceptMouse, Qt::TouchPointReleased), event->pos(), event->windowPos())); + eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointReleased, grabTransition(acceptMouse, Qt::TouchPointReleased), event->pos(), event->windowPos())); event->setAccepted(acceptMouse); } void mouseDoubleClickEvent(QMouseEvent *event) { qCDebug(lcPointerTests) << event; - eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabState(acceptMouse, Qt::TouchPointPressed), event->pos(), event->windowPos())); + eventList.append(Event(Event::MouseDestination, event->type(), Qt::TouchPointPressed, grabTransition(acceptMouse, Qt::TouchPointPressed), event->pos(), event->windowPos())); event->setAccepted(acceptMouse); } @@ -177,7 +177,7 @@ public: QCOMPARE(event.destination, d);\ QCOMPARE(event.type, t);\ QCOMPARE(event.state, s);\ - QCOMPARE(event.grabState, g);\ + QCOMPARE(event.grabTransition, g);\ }\ class EventHandler : public QQuickPointerHandler @@ -204,7 +204,7 @@ class EventHandler : public QQuickPointerHandler } } - void onGrabChanged(QQuickPointerHandler *, QQuickEventPoint::GrabState stateChange, QQuickEventPoint *point) override + void onGrabChanged(QQuickPointerHandler *, QQuickEventPoint::GrabTransition stateChange, QQuickEventPoint *point) override { EventItem *item = static_cast<EventItem *>(target()); item->eventList.append(Event(Event::HandlerDestination, QEvent::None, diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp index f9970df9f0..467c964001 100644 --- a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp @@ -600,8 +600,8 @@ void tst_TapHandler::componentUserBehavioralOverride() QQuickTapHandler *userTapHandler = button->findChild<QQuickTapHandler*>("override"); QVERIFY(userTapHandler); QSignalSpy tappedSpy(button, SIGNAL(tapped())); - QSignalSpy innerGrabChangedSpy(innerTapHandler, SIGNAL(grabChanged(QQuickEventPoint::GrabState, QQuickEventPoint *))); - QSignalSpy userGrabChangedSpy(userTapHandler, SIGNAL(grabChanged(QQuickEventPoint::GrabState, QQuickEventPoint *))); + QSignalSpy innerGrabChangedSpy(innerTapHandler, SIGNAL(grabChanged(QQuickEventPoint::GrabTransition, QQuickEventPoint *))); + QSignalSpy userGrabChangedSpy(userTapHandler, SIGNAL(grabChanged(QQuickEventPoint::GrabTransition, QQuickEventPoint *))); QSignalSpy innerPressedChangedSpy(innerTapHandler, SIGNAL(pressedChanged())); QSignalSpy userPressedChangedSpy(userTapHandler, SIGNAL(pressedChanged())); diff --git a/tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml b/tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml index 0abcc76f7c..b0410dac4a 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml +++ b/tests/auto/quick/qquickmultipointtoucharea/data/mouse.qml @@ -6,6 +6,9 @@ MultiPointTouchArea { property int touchCount: 0 property int cancelCount: 0 + property int gestureStartedX: 0 + property int gestureStartedY: 0 + property bool grabGesture: false minimumTouchPoints: 1 maximumTouchPoints: 4 @@ -17,6 +20,12 @@ MultiPointTouchArea { onPressed: { touchCount = touchPoints.length } onTouchUpdated: { touchCount = touchPoints.length } onCanceled: { cancelCount = touchPoints.length } + onGestureStarted: { + gestureStartedX = gesture.touchPoints[0].startX + gestureStartedY = gesture.touchPoints[0].startY + if (grabGesture) + gesture.grab() + } Rectangle { color: "red" diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 73f3cab318..d4ad282701 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -69,6 +69,8 @@ private slots: void transformedTouchArea(); void mouseInteraction(); void mouseInteraction_data(); + void mouseGestureStarted_data(); + void mouseGestureStarted(); void cancel(); private: @@ -1196,6 +1198,57 @@ void tst_QQuickMultiPointTouchArea::mouseInteraction() QCOMPARE(area->property("touchCount").toInt(), 0); } +void tst_QQuickMultiPointTouchArea::mouseGestureStarted_data() +{ + QTest::addColumn<bool>("grabGesture"); + QTest::addColumn<int>("distanceFromOrigin"); + + QTest::newRow("near origin, don't grab") << false << 4; + QTest::newRow("near origin, grab") << true << 4; + QTest::newRow("away from origin, don't grab") << false << 100; + QTest::newRow("away from origin, grab") << true << 100; +} + +void tst_QQuickMultiPointTouchArea::mouseGestureStarted() // QTBUG-70258 +{ + const int dragThreshold = QGuiApplication::styleHints()->startDragDistance(); + QFETCH(bool, grabGesture); + QFETCH(int, distanceFromOrigin); + + QScopedPointer<QQuickView> view(createAndShowView("mouse.qml")); + QVERIFY(view->rootObject() != nullptr); + + QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(view->rootObject()); + QVERIFY(area); + area->setProperty("grabGesture", grabGesture); + QQuickTouchPoint *point1 = view->rootObject()->findChild<QQuickTouchPoint*>("point1"); + QCOMPARE(point1->pressed(), false); + QSignalSpy gestureStartedSpy(area, SIGNAL(gestureStarted(QQuickGrabGestureEvent *))); + + QPoint p1 = QPoint(distanceFromOrigin, distanceFromOrigin); + QTest::mousePress(view.data(), Qt::LeftButton, Qt::NoModifier, p1); + QCOMPARE(gestureStartedSpy.count(), 0); + + p1 += QPoint(dragThreshold, dragThreshold); + QTest::mouseMove(view.data(), p1); + QCOMPARE(gestureStartedSpy.count(), 0); + + p1 += QPoint(1, 1); + QTest::mouseMove(view.data(), p1); + QTRY_COMPARE(gestureStartedSpy.count(), 1); + QTRY_COMPARE(area->property("gestureStartedX").toInt(), distanceFromOrigin); + QCOMPARE(area->property("gestureStartedY").toInt(), distanceFromOrigin); + + p1 += QPoint(10, 10); + QTest::mouseMove(view.data(), p1); + // if nobody called gesteure->grab(), gestureStarted will keep happening + QTRY_COMPARE(gestureStartedSpy.count(), grabGesture ? 1 : 2); + QCOMPARE(area->property("gestureStartedX").toInt(), distanceFromOrigin); + QCOMPARE(area->property("gestureStartedY").toInt(), distanceFromOrigin); + + QTest::mouseRelease(view.data(), Qt::LeftButton); +} + void tst_QQuickMultiPointTouchArea::cancel() { QScopedPointer<QQuickView> window(createAndShowView("cancel.qml")); |