Need help in getting started with writing the integration test

Albert Astals Cid aacid at kde.org
Wed Jun 6 21:17:39 UTC 2018


El dimecres, 6 de juny de 2018, a les 15:43:01 CEST, Dileep Sankhla va 
escriure:
> I'm adding my test to autotests/parttest.cpp with a test function
> PartTest::testTypewriterAnnotTool.
> For the annotation toolbar, I have #include "../ui/pageviewannotator.h" and
> doing this in the test function:
> 
> PageViewAnnotator pageviewannotator(part.m_pageView, part.m_document);
> pageviewannotator.setEnabled( true );

Why don't you just call PageView::slotToggleAnnotator ?

> 
> But on make, I'm getting linking error as the undefined reference to
> PageViewAnnotator::PageViewAnnotator(PageView*, Okular::Document*)
> 
> How to resolve this and check for the typewriter tool button in the toolbar?

PageViewAnnotator is not an exported class so you can't call functions on it 
because those functions are not part of the library. You'll have the same 
"problem" with PageView::slotToggleAnnotator.

In this case it can be workarounded since it's a slot and you can use qobject 
magic to call it. See the QMetaObject::invokeMethod calls in parttest

Cheers,
  Albert

> 
> 
> 
> 
> On Wed, Jun 6, 2018 at 3:08 PM, Dileep Sankhla <sankhla.dileep96 at gmail.com>
> 
> wrote:
> > Hello Tobias,
> > 
> > Thank you so much for the detailed explanation. I got the overview of how
> > tests are written and how they are currently organized.
> > 
> > I have just begun to write the test for typewriter annotation tool and my
> > first test case is "checking if the annotation toolbar has the typewriter
> > tool button in it?"
> > 
> > Till now I have been succeeded in opening the document data/file1.pdf with
> > the current page as 0 by using the object of Okular::Part and now I'm not
> > getting the way of showing the annotation toolbar and how will I check for
> > the typewriter tool in it?
> > 
> > Do I need to simulate <F6> keypress for showing the annotation toolbar and
> > if yes, then how will I check for the specific tool in it?
> > 
> > Need help.
> > 
> > Thanks and Regards
> > Dileep
> > 
> > 
> > 
> > 
> > On Mon, Jun 4, 2018 at 1:19 AM, Tobias Deiminger <haxtibal at posteo.de>
> > 
> > wrote:
> >> Am 03.06.2018 21:39 schrieb Tobias Deiminger:
> >>> Am 03.06.2018 08:05 schrieb Dileep Sankhla:
> >> Ups, I misread the question
> >> 
> >>> What will I compare here?
> >> 
> >> as "what will compare here?"
> >> 
> >> GUI tests compare with autotests/parttest.cpp.
> >> 
> >>> Core tests potentially compare with autotests/*annot*.cpp
> >>> Afaikt there are no tests yet that check painting results pixel wise.
> >> 
> >> New answer: You compare actual outcome with expected outcome. What actual
> >> outcome and expected outcome means depends on your test case. You have to
> >> define it.
> >> 
> >> Tobias






More information about the Okular-devel mailing list