Need help in getting started with writing the integration test
Dileep Sankhla
sankhla.dileep96 at gmail.com
Fri Jun 8 16:57:32 UTC 2018
Hello Tobias,
I have succeeded in getting the QInputDialog to write a new note:
QMetaObject::invokeMethod(part.m_pageView, "slotToggleAnnotator", Q_ARG(
bool, true )); // displayes the annotation toolbar
QList<QToolButton *> toolbuttonList =
part.m_pageView->findChildren<QToolButton *>(); // Get the list of all 10
annotation toolbuttons
QToolButton* typewriterButton = toolbuttonList.at(9); // Get's typewriter
toolbutton at 10th posiiton
typewriterButton->click(); // clicks and selects the typewriter tool
// Clicks on the viewport and a QInputDialog popups
QTest::mouseMove(part.m_pageView->viewport(), QPoint(width * 0.5, height *
0.2));
QTest::mouseClick(part.m_pageView->viewport(), Qt::LeftButton,
Qt::NoModifier, QPoint(width * 0.5, height * 0.2));
It popups a multiline QInputDialog annotation window and prompts for the
note. I write any content, press OK and the test ends.
My question is how to check if the popup window appears in the test as it
doesn't have any parent widget? So I can't do findChildren on
part.m_pageView to check for the QInputDialog. And after checking for the
QInputDialog, how to CANCEL the dialog in the test so that my test doesn't
pause at user's input prompt? I just need an idea as I'm stuck here.
Secondly, I'm doing like this to create and add a typewriter annotation to
page:
part.m_document->setViewportPage(0);
Okular::Annotation * annot = nullptr;
Okular::TextAnnotation * ta = new Okular::TextAnnotation();
annot = ta;
ta->setFlags( ta->flags() | Okular::Annotation::FixedRotation );
ta->setTextType( Okular::TextAnnotation::InPlace );
ta->setInplaceIntent( Okular::TextAnnotation::TypeWriter );
ta->style().setWidth( 0.0 );
ta->style().setColor( QColor(255,255,255,0) );
annot->setBoundingRectangle( Okular::NormalizedRect( 0.8, 0.1, 0.85, 0.15 )
);
annot->setContents( QStringLiteral("annot contents") );
// Add annotation to page
part.m_document->addPageAnnotation( 0, annot );
I'm sleeping the UI thread with QThread::sleep(5) for 5 seconds in order to
hold the output widget and I'm not getting any visual of the added
annotation. I want to compare different properties from
Okular::Annotation::getAnnotationPropertiesDomeNode. May you help me where
I'm wrong or what I'm missing?
Thanks and Regards
Dileep
On Fri, Jun 8, 2018 at 3:20 PM Dileep Sankhla <sankhla.dileep96 at gmail.com>
wrote:
> Thank you. I have created a single test case for the typewriter
> toolbutton and have pushed it to the gsoc2018_typewriter branch.
>
> I have defined 3 test cases as follows:
> 1. Check if the toolbar buttons contain the "Typewriter" button - Done
> 2. Click the typewriter button, start PickPointEngine engine, click and
> drag on PDF page to create a block and check if a popup QInputDialog opens
> 3. Add typewriter to a Okular::Document with
> setTextType(Okular::TextAnnotation::InPlace) and
> setInplaceIntent(Okular::TextAnnotation::TypeWriter), and check
> Okular::Annotation::getAnnotationPropertiesDomNode for expected
> attributes.
>
> I'm only sticking to the simple test cases at the initial as I'm new to
> writing tests and having the limited time. I don't know how to write a test
> that checks painting results pixel-wise and there are already none so my
> test cases are simple. I will write more complicated tests after doing the
> font color in both Poppler and Okular.
>
> Thanks and Regards
> Dileep
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20180608/578ff365/attachment.html>
More information about the Okular-devel
mailing list