aacid added a comment.
In D10792#241405 <https://phabricator.kde.org/D10792#241405>, @simgunz wrote: > Thanks to your suggestions I made some progresses. > > My current autotest looks as in the block below. > > Problems: > > 1. If I do not export `AnnotWindow` and call `QVERIFY( part.m_pageView->findChildren<QFrame *>().size() == 1 )` it fails, while calling `QVERIFY( part.m_pageView->findChildren<AnnotWindow *>().size() == 1 )` would succeed. > 2. The value returned by ` annot1->boundingRectangle().center(); ` is wrong. Moreover if I I pass to `mouseMove` a point within the coordinates I specify when I construct the annotation the mouse moves to the wrong position. In particular the mouse moves to a Y position way below the annotation. So either I am missing something or there is a bug. There's a "bug" in the test, you're opening a two page file, so the height variable is the height of the two pages, and then all the math fails when trying to find the proper y, changing to open file1.pdf makes it better. https://paste.kde.org/phoqbec1x "WORKS" in my computer, you still need to add more stuff to the end of the test, right? at least a verify :) > 3. How do I click on the annotation window? > > These two commands both fail ``` QTest::mouseClick(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.1, height * 0.06)); // The window is under the mouse QTest::mouseClick(win2, Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.1, height * 0.06)); // win2 is the annotation window widget (under the mouse again) > > ``` > > Isn't it possible to call mouseClick without specifying the target widget, as if I would click manually so that the top widget is the target of the click? It's a bit tricky, check what i did on the paste. Probably there's a better way to do it, but it's a bit late now so this works for me. REPOSITORY R223 Okular REVISION DETAIL https://phabricator.kde.org/D10792 To: simgunz, #okular, aacid Cc: ngraham, #okular, michaelweghorn, aacid