<table><tr><td style="">simgunz added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D10792">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D10792#241504" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">D10792#241504</a>, <a href="https://phabricator.kde.org/p/aacid/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@aacid</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #8C98B8;
color: #6B748C;
font-style: italic;
margin: 4px 0 12px 0;
padding: 8px 12px;
background-color: #F8F9FC;">
<div style="font-style: normal;
padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D10792#241405" style="background-color: #e7e7e7;
border-color: #e7e7e7;
border-radius: 3px;
padding: 0 4px;
font-weight: bold;
color: black;text-decoration: none;">D10792#241405</a>, <a href="https://phabricator.kde.org/p/simgunz/" style="
border-color: #f1f7ff;
color: #19558d;
background-color: #f1f7ff;
border: 1px solid transparent;
border-radius: 3px;
font-weight: bold;
padding: 0 4px;">@simgunz</a> wrote:</div>
<div style="margin: 0;
padding: 0;
border: 0;
color: rgb(107, 116, 140);"><p>Thanks to your suggestions I made some progresses.</p>
<p>My current autotest looks as in the block below.</p>
<p>Problems:</p>
<ol class="remarkup-list">
<li class="remarkup-list-item">If I do not export <tt style="background: #ebebeb; font-size: 13px;">AnnotWindow</tt> and call <tt style="background: #ebebeb; font-size: 13px;">QVERIFY( part.m_pageView->findChildren<QFrame *>().size() == 1 )</tt> it fails, while calling <tt style="background: #ebebeb; font-size: 13px;">QVERIFY( part.m_pageView->findChildren<AnnotWindow *>().size() == 1 )</tt> would succeed.</li>
<li class="remarkup-list-item">The value returned by <tt style="background: #ebebeb; font-size: 13px;"> annot1->boundingRectangle().center(); </tt> is wrong. Moreover if I I pass to <tt style="background: #ebebeb; font-size: 13px;">mouseMove</tt> 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.</li>
</ol></div>
</blockquote>
<p>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.</p></div>
</blockquote>
<p>Thanks for the explanation. I'm slowly understanding how this coordinate system works.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p><a href="https://paste.kde.org/phoqbec1x" class="remarkup-link" target="_blank" rel="noreferrer">https://paste.kde.org/phoqbec1x</a> "WORKS" in my computer, you still need to add more stuff to the end of the test, right? at least a verify :)</p></blockquote>
<p>Yes. I have added a check on the number of rects composing the visible region, which should be four for a fully visible window ( if I am not wrong it is because the KTextEdit is on top of the parent widget of the AnnotWindow, so that this last one is never fully visible). Actually also for a partially visible window they can be four, I think, but for the particular position where I moved window 1 they are three. I hope this is enough as a test.</p>
<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><ol class="remarkup-list" start="3">
<li class="remarkup-list-item">How do I click on the annotation window?
<br /><br />
These two commands both fail <tt style="background: #ebebeb; font-size: 13px;">`</tt> QTest::mouseClick(part.m_pageView->viewport(), Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.1, height * 0.06)); <em> The window is under the mouse QTest::mouseClick(win2, Qt::LeftButton, Qt::NoModifier, QPoint(width * 0.1, height * 0.06)); </em> win2 is the annotation window widget (under the mouse again)
<br /><br />
<tt style="background: #ebebeb; font-size: 13px;">`</tt>
<br /><br />
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?</li>
</ol></blockquote>
<p>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.</p></blockquote>
<p>Ok. Understood it.</p>
<p>I have left two qWait after adding the annotations because without those the test was failing some times.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R223 Okular</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D10792">https://phabricator.kde.org/D10792</a></div></div><br /><div><strong>To: </strong>simgunz, Okular, aacid<br /><strong>Cc: </strong>ngraham, Okular, michaelweghorn, aacid<br /></div>