Changeset View
Changeset View
Standalone View
Standalone View
autotests/parttest.cpp
Show First 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 95 | private slots: | |||
---|---|---|---|---|---|
123 | void testRClickOverLinkWhileLinkTextIsSelected(); | 123 | void testRClickOverLinkWhileLinkTextIsSelected(); | ||
124 | void testRClickOnSelectionModeShoulShowFollowTheLinkMenu(); | 124 | void testRClickOnSelectionModeShoulShowFollowTheLinkMenu(); | ||
125 | void testClickAnywhereAfterSelectionShouldUnselect(); | 125 | void testClickAnywhereAfterSelectionShouldUnselect(); | ||
126 | void testeRectSelectionStartingOnLinks(); | 126 | void testeRectSelectionStartingOnLinks(); | ||
127 | void testCheckBoxReadOnly(); | 127 | void testCheckBoxReadOnly(); | ||
128 | void testCrashTextEditDestroy(); | 128 | void testCrashTextEditDestroy(); | ||
129 | void testAnnotWindow(); | 129 | void testAnnotWindow(); | ||
130 | void testAdditionalActionTriggers(); | 130 | void testAdditionalActionTriggers(); | ||
131 | void testTypewriterAnnotTool(); | ||||
131 | void testJumpToPage(); | 132 | void testJumpToPage(); | ||
132 | void testTabletProximityBehavior(); | 133 | void testTabletProximityBehavior(); | ||
133 | 134 | | |||
134 | private: | 135 | private: | ||
135 | void simulateMouseSelection(double startX, double startY, double endX, double endY, QWidget *target); | 136 | void simulateMouseSelection(double startX, double startY, double endX, double endY, QWidget *target); | ||
136 | }; | 137 | }; | ||
137 | 138 | | |||
138 | class PartThatHijacksQueryClose : public Okular::Part | 139 | class PartThatHijacksQueryClose : public Okular::Part | ||
▲ Show 20 Lines • Show All 1650 Lines • ▼ Show 20 Line(s) | 1689 | #endif | |||
1789 | 1790 | | |||
1790 | // Confirm that a mouse release outside does not trigger the show action. | 1791 | // Confirm that a mouse release outside does not trigger the show action. | ||
1791 | QTest::mousePress( widget, Qt::LeftButton, Qt::NoModifier, QPoint( 5, 5 ) ); | 1792 | QTest::mousePress( widget, Qt::LeftButton, Qt::NoModifier, QPoint( 5, 5 ) ); | ||
1792 | verifyTargetStates( QStringLiteral( "pb" ), fields, false, false, false, __LINE__ ); | 1793 | verifyTargetStates( QStringLiteral( "pb" ), fields, false, false, false, __LINE__ ); | ||
1793 | QTest::mouseRelease( part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, tfPos ); | 1794 | QTest::mouseRelease( part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, tfPos ); | ||
1794 | verifyTargetStates( QStringLiteral( "pb" ), fields, false, false, false, __LINE__ ); | 1795 | verifyTargetStates( QStringLiteral( "pb" ), fields, false, false, false, __LINE__ ); | ||
1795 | } | 1796 | } | ||
1796 | 1797 | | |||
1798 | void PartTest::testTypewriterAnnotTool() | ||||
1799 | { | ||||
1800 | QScopedPointer<CloseDialogHelper> closeDialogHelper; | ||||
1801 | Okular::Part part(nullptr, nullptr, QVariantList()); | ||||
1802 | | ||||
1803 | part.openUrl(QUrl::fromLocalFile(QStringLiteral(KDESRCDIR "data/file1.pdf"))); | ||||
1804 | | ||||
1805 | part.widget()->show(); | ||||
1806 | QVERIFY(QTest::qWaitForWindowExposed(part.widget())); | ||||
1807 | | ||||
1808 | const int width = part.m_pageView->horizontalScrollBar()->maximum() + | ||||
1809 | part.m_pageView->viewport()->width(); | ||||
1810 | const int height = part.m_pageView->verticalScrollBar()->maximum() + | ||||
1811 | part.m_pageView->viewport()->height(); | ||||
1812 | | ||||
1813 | part.m_document->setViewportPage(0); | ||||
1814 | | ||||
1815 | QMetaObject::invokeMethod(part.m_pageView, "slotToggleAnnotator", Q_ARG( bool, true )); | ||||
1816 | | ||||
1817 | QList<QToolButton *> toolbuttonList = part.m_pageView->findChildren<QToolButton *>(); | ||||
1818 | // Check if the tooltip of 10th button is "Typewriter" | ||||
1819 | QToolButton* typewriterButton = toolbuttonList.at(9); | ||||
1820 | QCOMPARE( typewriterButton->toolTip(), QStringLiteral("Typewriter") ); | ||||
1821 | | ||||
1822 | typewriterButton->click(); | ||||
1823 | | ||||
1824 | QTest::mouseMove(part.m_pageView->viewport(), QPoint(width * 0.5, height * 0.2)); | ||||
1825 | closeDialogHelper.reset(new CloseDialogHelper( QDialogButtonBox::Ok )); // this is the "add new note" dialog | ||||
1826 | QTest::mouseClick(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.5, height * 0.2)); | ||||
1827 | | ||||
1828 | Annotation* annot = part.m_document->page(0)->annotations().first(); | ||||
1829 | TextAnnotation* ta = static_cast<TextAnnotation*>( annot ); | ||||
1830 | QVERIFY( annot ); | ||||
1831 | QVERIFY( ta ); | ||||
1832 | QCOMPARE( annot->subType(), Okular::Annotation::AText ); | ||||
1833 | QCOMPARE( annot->style().color(), QColor(255,255,255,0) ); | ||||
1834 | QCOMPARE( ta->textType(), Okular::TextAnnotation::InPlace ); | ||||
1835 | QCOMPARE( ta->inplaceIntent(), Okular::TextAnnotation::TypeWriter ); | ||||
1836 | } | ||||
1837 | | ||||
1797 | void PartTest::testJumpToPage() { | 1838 | void PartTest::testJumpToPage() { | ||
1798 | const QString testFile = QStringLiteral( KDESRCDIR "data/simple-multipage.pdf" ); | 1839 | const QString testFile = QStringLiteral( KDESRCDIR "data/simple-multipage.pdf" ); | ||
1799 | const int targetPage = 25; | 1840 | const int targetPage = 25; | ||
1800 | Okular::Part part( nullptr, nullptr, QVariantList() ); | 1841 | Okular::Part part( nullptr, nullptr, QVariantList() ); | ||
1801 | part.openDocument( testFile ); | 1842 | part.openDocument( testFile ); | ||
1802 | part.widget()->resize(800, 600); | 1843 | part.widget()->resize(800, 600); | ||
1803 | part.widget()->show(); | 1844 | part.widget()->show(); | ||
1804 | QVERIFY( QTest::qWaitForWindowExposed( part.widget() ) ); | 1845 | QVERIFY( QTest::qWaitForWindowExposed( part.widget() ) ); | ||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |