Skip to content

Commit

Permalink
Fix guides in the process of being created not being rendered
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchcurtis committed Jun 29, 2018
1 parent a94d048 commit 5b55c5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/imagecanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2327,6 +2327,8 @@ void ImageCanvas::mouseMoveEvent(QMouseEvent *event)
mSplitter.setPosition(mCursorX / width());
} else if (mPressedRuler) {
update();
// Ensure that the guide being created is drawn.
mGuidesItem->update();
} else if (mPressedGuideIndex != -1) {
mGuidesItem->update();
} else {
Expand Down
8 changes: 8 additions & 0 deletions tests/tst_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3096,8 +3096,16 @@ void tst_App::rulersAndGuides()
QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, cursorWindowPos);
QVERIFY(canvas->pressedRuler());

// Do the actual moving onto the canvas.
setCursorPosInPixels(QPoint(50, rulerThickness + 10));
QTest::mouseMove(window, cursorWindowPos);

// Now it should be visible on the canvas.
QVERIFY(imageGrabber.requestImage(canvas));
QTRY_VERIFY(imageGrabber.isReady());
const QImage grabWithGuide = imageGrabber.takeImage();
QCOMPARE(grabWithGuide.pixelColor(50, rulerThickness + 10), QColor(Qt::cyan));

QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, cursorWindowPos);
QVERIFY(!canvas->pressedRuler());
QCOMPARE(project->guides().size(), 1);
Expand Down

0 comments on commit 5b55c5d

Please sign in to comment.