diff --git a/src/UI/ProjectTabs+Strip.cpp b/src/UI/ProjectTabs+Strip.cpp index bc1c05f..bd5c985 100644 --- a/src/UI/ProjectTabs+Strip.cpp +++ b/src/UI/ProjectTabs+Strip.cpp @@ -24,11 +24,6 @@ QSize ProjectTabStrip::sizeHint() const return {int(std::ceil(projectTabOverflow(order, widths(), m_workspace.selectedID(), 0, &OverflowTabsPill::pillWidth).contentWidth())), 34}; } -QSize ProjectTabStrip::minimumSizeHint() const -{ - return {0, 34}; -} - QList ProjectTabStrip::buttons() const { return QList(m_buttons.begin(), m_buttons.end()); diff --git a/src/UI/ProjectTabs.h b/src/UI/ProjectTabs.h index 5e12842..2588904 100644 --- a/src/UI/ProjectTabs.h +++ b/src/UI/ProjectTabs.h @@ -92,7 +92,6 @@ public: OverflowTabsPill *pill() const { return m_pill; } QSize sizeHint() const override; - QSize minimumSizeHint() const override; protected: void resizeEvent(QResizeEvent *event) override; diff --git a/tests/ProjectTabDragTests.cpp b/tests/ProjectTabDragTests.cpp index 32ba357..bbcc187 100644 --- a/tests/ProjectTabDragTests.cpp +++ b/tests/ProjectTabDragTests.cpp @@ -90,6 +90,8 @@ void ProjectTabDragTests::aDraggedTabFollowsThePointerAndLandsInTheGap() // Two points stay a press; three drag, and select. fixture.move(start + QPoint(2, 0)); QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[2]->id); + fixture.move(start + QPoint(3, 0)); + QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[0]->id); fixture.move(start + QPoint(40, 0)); QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[0]->id); QCOMPARE(first.x(), 40); @@ -104,10 +106,11 @@ void ProjectTabDragTests::aDraggedTabFollowsThePointerAndLandsInTheGap() QVERIFY(slide && slide->duration() == 150 && slide->easingCurve() == QEasingCurve::OutQuad); QCOMPARE(slide->endValue().toPoint(), QPoint(0, 3)); QVERIFY(!first.findChild() && !third.findChild()); + QTRY_VERIFY(settled(fixture.strip)); // The dragged tab lies over the one it crosses. + QVERIFY(first.x() < second.x() + second.width()); QWidget *hit = fixture.strip.childAt(first.x() + 2, 14); QVERIFY(hit == &first || first.isAncestorOf(hit)); - QTRY_VERIFY(settled(fixture.strip)); QCOMPARE(second.x(), 0); QCOMPARE(third.x(), w1 + 6 + w2 + 6); // Far right: held at the row's end, the others compacted. @@ -155,6 +158,12 @@ void ProjectTabDragTests::aSmallOrUpwardMoveIsAClick() fixture.move(start + QPoint(2, -3)); QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[2]->id); QCOMPARE(button(fixture.strip, "Untitled").x(), 0); + // A move with the button let go unseen drags nothing. + QMouseEvent unheld(QEvent::MouseMove, QPointF(fixture.pressed->mapFrom(&fixture.strip, start + QPoint(200, 0))), + QPointF(fixture.pressed->mapToGlobal(fixture.pressed->mapFrom(&fixture.strip, start + QPoint(200, 0)))), Qt::NoButton, + Qt::NoButton, Qt::NoModifier); + QApplication::sendEvent(fixture.pressed, &unheld); + QCOMPARE(button(fixture.strip, "Untitled").x(), 0); fixture.release("Untitled", start + QPoint(2, -3)); // The click selects; the order stays. QCOMPARE(fixture.workspace.selectedID(), fixture.workspace.tabs()[0]->id);