summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2016-10-30 22:55:32 (GMT)
committerAlbert Astals Cid <aacid@kde.org>2016-10-30 22:55:32 (GMT)
commit2aa006fa87240a89ff8446744ccd9f86a48c8dd0 (patch)
treee40bcfd52fa605dfc92aca6be3a0a99470cd369c
parent5db87d4d6fd4f02ffa6514639b95ac950432804d (diff)
-rw-r--r--autotests/parttest.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/autotests/parttest.cpp b/autotests/parttest.cpp
index d55e3cf..7b9f4f5 100644
--- a/autotests/parttest.cpp
+++ b/autotests/parttest.cpp
@@ -207,13 +207,17 @@ void PartTest::testSelectText()
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
- QTest::mouseMove(part.m_pageView->viewport(), QPoint(width * 0.12, height * 0.055));
- QTest::mousePress(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.12, height * 0.055));
- QTest::mouseMove(part.m_pageView->viewport(), QPoint(width * 0.8, height * 0.055));
+ const int mouseY = height * 0.052;
+ const int mouseStartX = width * 0.12;
+ const int mouseEndX = width * 0.7;
+
+ QTest::mouseMove(part.m_pageView->viewport(), QPoint(mouseStartX, mouseY));
+ QTest::mousePress(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(mouseStartX, mouseY));
+ QTest::mouseMove(part.m_pageView->viewport(), QPoint(mouseEndX, mouseY));
// without this wait the test fails. 100ms were enough on my local system, but when running under valgrind
// or on the CI server we need to wait longer.
QTest::qWait(1000);
- QTest::mouseRelease(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.8, height * 0.055));
+ QTest::mouseRelease(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(mouseEndX, mouseY));
QApplication::clipboard()->clear();
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "copyTextSelection"));