Commit a797d2ae authored by Albert Astals Cid's avatar Albert Astals Cid

parttest: Move calculating the width/height to a bit later

Seems to make tests more stable
parent 8e1d9aa4
...@@ -285,16 +285,16 @@ void PartTest::testSelectText() ...@@ -285,16 +285,16 @@ void PartTest::testSelectText()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
const int mouseY = height * 0.052; const int mouseY = height * 0.052;
...@@ -317,16 +317,16 @@ void PartTest::testClickInternalLink() ...@@ -317,16 +317,16 @@ void PartTest::testClickInternalLink()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseNormal"); QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseNormal");
QCOMPARE(part.m_document->currentPage(), 0u); QCOMPARE(part.m_document->currentPage(), 0u);
...@@ -346,16 +346,16 @@ void PartTest::testMouseMoveOverLinkWhileInSelectionMode() ...@@ -346,16 +346,16 @@ void PartTest::testMouseMoveOverLinkWhileInSelectionMode()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
...@@ -377,16 +377,16 @@ void PartTest::testClickUrlLinkWhileInSelectionMode() ...@@ -377,16 +377,16 @@ void PartTest::testClickUrlLinkWhileInSelectionMode()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
...@@ -429,16 +429,16 @@ void PartTest::testeTextSelectionOverAndAcrossLinks() ...@@ -429,16 +429,16 @@ void PartTest::testeTextSelectionOverAndAcrossLinks()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
...@@ -469,16 +469,16 @@ void PartTest::testClickUrlLinkWhileLinkTextIsSelected() ...@@ -469,16 +469,16 @@ void PartTest::testClickUrlLinkWhileLinkTextIsSelected()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
...@@ -516,16 +516,16 @@ void PartTest::testRClickWhileLinkTextIsSelected() ...@@ -516,16 +516,16 @@ void PartTest::testRClickWhileLinkTextIsSelected()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
...@@ -585,16 +585,16 @@ void PartTest::testRClickOverLinkWhileLinkTextIsSelected() ...@@ -585,16 +585,16 @@ void PartTest::testRClickOverLinkWhileLinkTextIsSelected()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
...@@ -648,16 +648,16 @@ void PartTest::testRClickOnSelectionModeShoulShowFollowTheLinkMenu() ...@@ -648,16 +648,16 @@ void PartTest::testRClickOnSelectionModeShoulShowFollowTheLinkMenu()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
...@@ -705,16 +705,16 @@ void PartTest::testClickAnywhereAfterSelectionShouldUnselect() ...@@ -705,16 +705,16 @@ void PartTest::testClickAnywhereAfterSelectionShouldUnselect()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseTextSelect"));
...@@ -747,16 +747,16 @@ void PartTest::testeRectSelectionStartingOnLinks() ...@@ -747,16 +747,16 @@ void PartTest::testeRectSelectionStartingOnLinks()
part.widget()->show(); part.widget()->show();
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
// enter text-selection mode // enter text-selection mode
QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseSelect")); QVERIFY(QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseSelect"));
...@@ -1539,16 +1539,16 @@ void PartTest::testAnnotWindow() ...@@ -1539,16 +1539,16 @@ void PartTest::testAnnotWindow()
part.widget()->resize(800, 600); part.widget()->resize(800, 600);
QVERIFY(QTest::qWaitForWindowExposed(part.widget())); QVERIFY(QTest::qWaitForWindowExposed(part.widget()));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
part.m_document->setViewportPage(0); part.m_document->setViewportPage(0);
// wait for pixmap // wait for pixmap
QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView)); QTRY_VERIFY(part.m_document->page(0)->hasPixmap(part.m_pageView));
const int width = part.m_pageView->horizontalScrollBar()->maximum() +
part.m_pageView->viewport()->width();
const int height = part.m_pageView->verticalScrollBar()->maximum() +
part.m_pageView->viewport()->height();
QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseNormal"); QMetaObject::invokeMethod(part.m_pageView, "slotSetMouseNormal");
QCOMPARE(part.m_document->currentPage(), 0u); QCOMPARE(part.m_document->currentPage(), 0u);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment