<table><tr><td style="">elvisangelaccio requested changes to this revision.<br />elvisangelaccio added inline comments.<br />This revision now requires changes to proceed.
</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/D9973" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>INLINE COMMENTS</strong><div><div style="margin: 6px 0 12px 0;"><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53309" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:39-52</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span style="color: #aa4000">void</span> <span class="n">KTooltipPositionTest</span><span style="color: #aa2211">::</span><span class="n">init</span><span class="p">()</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">m_container</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">new</span> <span class="n">QWidget</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">m_target</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">new</span> <span class="n">QLabel</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"dummy file"</span><span class="p">));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QHBoxLayout</span><span style="color: #aa2211">*</span> <span class="n">layout</span> <span style="color: #aa2211">=</span> <span style="color: #aa4000">new</span> <span class="n">QHBoxLayout</span><span class="p">(</span><span class="n">m_container</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">layout</span><span style="color: #aa2211">-></span><span class="n">addWidget</span><span class="p">(</span><span class="n">m_target</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">m_margin</span> <span style="color: #aa2211">=</span> <span class="n">m_container</span><span style="color: #aa2211">-></span><span class="n">style</span><span class="p">()</span><span style="color: #aa2211">-></span><span class="n">pixelMetric</span><span class="p">(</span><span class="n">QStyle</span><span style="color: #aa2211">::</span><span class="n">PM_ToolTipLabelFrameWidth</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Imho these variables could be local to <tt style="background: #ebebeb; font-size: 13px;">shouldNotObscureTarget()</tt>, so that we don't need to define <tt style="background: #ebebeb; font-size: 13px;">init()</tt> and <tt style="background: #ebebeb; font-size: 13px;">cleanup()</tt> and we don't need to make them class members.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53310" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:65</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">positions</span><span class="p">.</span><span class="n">insert</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"centered"</span><span class="p">)</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="p">,</span> <span class="n">QPoint</span><span class="p">(</span><span class="n">m_screenGeometry</span><span class="p">.</span><span class="n">width</span><span class="p">()</span> <span style="color: #aa2211">/</span> <span style="color: #601200">2</span><span class="p">,</span> <span class="n">m_screenGeometry</span><span class="p">.</span><span class="n">height</span><span class="p">()</span> <span style="color: #aa2211">/</span> <span style="color: #601200">2</span><span class="p">));</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Weird comma position :p</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53311" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:71</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #74777d">//FIXME: Compose names w/o compiler warning -Wformat-security</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">QTest</span><span style="color: #aa2211">::</span><span class="n">addRow</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"small/%1"</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">i</span><span class="p">.</span><span class="n">key</span><span class="p">()).</span><span class="n">toLatin1</span><span class="p">().</span><span class="n">constData</span><span class="p">())</span> 
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #aa2211"><<</span> <span class="n">i</span><span class="p">.</span><span class="n">value</span><span class="p">()</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Weird, I usually use <tt style="background: #ebebeb; font-size: 13px;">qPrintable()</tt> for this, but</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">QTest::addRow(qPrintable(QStringLiteral("small/%1").arg(i.key())))</pre></div>

<p style="padding: 0; margin: 8px;">still gives me the compiler warning. Not sure what is going on here.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53314" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:85</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">m_screenGeometry</span><span class="p">.</span><span class="n">width</span><span class="p">()</span> <span style="color: #aa2211">>=</span> <span style="color: #601200">1600</span> <span style="color: #aa2211">&&</span> <span class="n">m_screenGeometry</span><span class="p">.</span><span class="n">width</span><span class="p">()</span> <span style="color: #aa2211">>=</span> <span style="color: #601200">900</span><span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">QTest</span><span style="color: #aa2211">::</span><span class="n">addRow</span><span class="p">(</span><span class="n">QStringLiteral</span><span class="p">(</span><span style="color: #766510">"super large/%1"</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">i</span><span class="p">.</span><span class="n">key</span><span class="p">()).</span><span class="n">toLatin1</span><span class="p">().</span><span class="n">constData</span><span class="p">())</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Did you mean</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">if (m_screenGeometry.width() >= 1600 && m_screenGeometry.height() >= 900) {
      ...
}</pre></div>

<p style="padding: 0; margin: 8px;">?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53315" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:111</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #aa2211">:</span> <span class="n">m_screenGeometry</span><span class="p">.</span><span class="n">right</span><span class="p">()</span> <span style="color: #aa2211">+</span> <span class="n">position</span><span class="p">.</span><span class="n">x</span><span class="p">()</span> <span style="color: #aa2211">-</span> <span class="n">m_container</span><span style="color: #aa2211">-></span><span class="n">width</span><span class="p">()</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="p">,</span> <span class="n">position</span><span class="p">.</span><span class="n">y</span><span class="p">()</span> <span style="color: #aa2211">>=</span> <span style="color: #601200">0</span> 
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span style="color: #aa2211">?</span> <span class="n">position</span><span class="p">.</span><span class="n">y</span><span class="p">()</span> 
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Weird comma position. Maybe two local QPoint variables could also improve the readability here.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53316" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:122</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QLabel</span><span style="color: #aa2211">*</span> <span style="color: #004012">contentWidget</span><span class="p">(</span><span style="color: #aa4000">new</span> <span class="n">QLabel</span><span class="p">(</span><span class="n">content</span><span class="p">));</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">contentWidget</span><span style="color: #aa2211">-></span><span class="n">setMaximumSize</span><span class="p">(</span><span class="n">m_screenGeometry</span><span class="p">.</span><span class="n">width</span><span class="p">()</span> <span style="color: #aa2211">-</span> <span style="color: #601200">20</span><span class="p">,</span> <span class="n">m_screenGeometry</span><span class="p">.</span><span class="n">height</span><span class="p">()</span> <span style="color: #aa2211">-</span> <span style="color: #601200">20</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Unusual style, we usually do <tt style="background: #ebebeb; font-size: 13px;">QLabel* contentWidget = new QLabel(content);</tt></p>

<p style="padding: 0; margin: 8px;">Also, where is this label deleted?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53319" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:125</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QWindow</span><span style="color: #aa2211">*</span> <span style="color: #004012">transientParent</span><span class="p">(</span><span class="n">m_container</span><span style="color: #aa2211">-></span><span class="n">windowHandle</span><span class="p">());</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">KToolTipWidget</span> <span class="n">tooltip</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Same as above about the style.</p>

<p style="padding: 0; margin: 8px;">But are we sure we want to <em>create</em> a new QWindow? Why not just pass <tt style="background: #ebebeb; font-size: 13px;">m_container->windowHandle()</tt> to <tt style="background: #ebebeb; font-size: 13px;">showBelow()</tt> ?</p>

<p style="padding: 0; margin: 8px;">Also, what if the transient parent is null? We should probably add a <tt style="background: #ebebeb; font-size: 13px;">QVERIFY(m_container->windowHandle())</tt></p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53320" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:131</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #74777d">//TODO: Remove before landing</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">qDebug</span><span class="p">()</span> <span style="color: #aa2211"><<</span> <span style="color: #766510">"target: "</span> <span style="color: #aa2211"><<</span> <span class="n">targetRect</span><span class="p">;</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">We can actually keep (and maybe improve) this debug output. qDebug() will only print something if the test fails.</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53294" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:136</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QVERIFY2</span><span class="p">(</span><span style="color: #aa2211">!</span><span class="n">tooltipRect</span><span class="p">.</span><span class="n">intersects</span><span class="p">(</span><span class="n">targetRect</span><span class="p">),</span> <span style="color: #766510">"Target obscured"</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">QVERIFY2</span><span class="p">(</span><span class="n">tooltipRect</span><span class="p">.</span><span class="n">intersected</span><span class="p">(</span><span class="n">m_screenGeometry</span><span class="p">)</span> <span style="color: #aa2211">==</span> <span class="n">tooltipRect</span><span class="p">,</span> <span style="color: #766510">"Displayed offscreen"</span><span class="p">);</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This should be a QCOMPARE</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53295" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:139</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #74777d">// Check margins</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">if</span> <span class="p">(</span><span class="n">tooltipRect</span><span class="p">.</span><span class="n">bottom</span><span class="p">()</span> <span style="color: #aa2211"><</span>  <span class="n">targetRect</span><span class="p">.</span><span class="n">top</span><span class="p">()</span> <span class="p">)</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">QCOMPARE</span><span class="p">(</span><span class="n">m_margin</span><span class="p">,</span> <span class="n">targetRect</span><span class="p">.</span><span class="n">top</span><span class="p">()</span> <span style="color: #aa2211">-</span> <span class="n">tooltipRect</span><span class="p">.</span><span class="n">bottom</span><span class="p">());</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">remove space before )</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53296" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:148</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="p">}</span> <span style="color: #aa4000">else</span> <span class="p">{</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">        <span class="n">QFAIL</span><span class="p">(</span><span style="color: #766510">"Test is wrong"</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="p">}</span> 
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">What do you mean with "test is wrong"? Can this branch ever happen?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53321" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.cpp:151</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span class="n">tooltip</span><span class="p">.</span><span class="n">hide</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">QVERIFY(tooltip.isHidden());</tt> ?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53305" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltippositiontest.h:38-39</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">void</span> <span style="color: #004012">shouldNotObscureTarget_data</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">void</span> <span style="color: #004012">shouldNotObscureTarget</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">Is there a reason why we are creating a new test binary only for this test function? Why not use <tt style="background: #ebebeb; font-size: 13px;">ktooltipwidgettest.cpp</tt>?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53297" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltipwidget.cpp:122</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; ">    <span style="color: #74777d">// - the content is not drawn inside rect</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">const</span> <span class="n">QSize</span> <span class="n">size</span> <span style="color: #aa2211">=</span> <span class="bright"></span><span class="n"><span class="bright">content</span></span><span style="color: #aa2211">-></span><span class="n">sizeHint</span><span class="p">();</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">    <span style="color: #aa4000">const</span> <span style="color: #aa4000">int</span> <span class="n">margin</span> <span style="color: #aa2211">=</span> <span class="n">q</span><span style="color: #aa2211">-></span><span class="n">style</span><span class="p">()</span><span style="color: #aa2211">-></span><span class="n">pixelMetric</span><span class="p">(</span><span class="n">QStyle</span><span style="color: #aa2211">::</span><span class="n">PM_ToolTipLabelFrameWidth</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);"><span class="bright">    </span><span class="n"><span class="bright">q</span></span><span class="bright"></span><span style="color: #aa2211"><span class="bright">-></span></span><span class="bright"></span><span class="n"><span class="bright">adjustSize</span></span><span class="bright"></span><span class="p"><span class="bright">();</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">    <span style="color: #aa4000">const</span> <span class="n">QSize</span> <span class="n">size</span> <span style="color: #aa2211">=</span> <span class="bright"></span><span class="n"><span class="bright">q</span></span><span style="color: #aa2211">-></span><span class="n">sizeHint</span><span class="p">();</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;"><tt style="background: #ebebeb; font-size: 13px;">centerBelow()</tt> is <tt style="background: #ebebeb; font-size: 13px;">const</tt>, but this actually changes the tooltip, right?<br />
Maybe we can move this call to <tt style="background: #ebebeb; font-size: 13px;">addWidget()</tt> ?</p></div></div><br /><div style="border: 1px solid #C7CCD9; border-radius: 3px;"><div style="padding: 0; background: #F7F7F7; border-color: #e3e4e8; border-style: solid; border-width: 0 0 1px 0; margin: 0;"><div style="color: #74777d; background: #eff2f4; padding: 6px 8px; overflow: hidden;"><a style="float: right; text-decoration: none;" href="https://phabricator.kde.org/D9973#inline-53299" rel="noreferrer">View Inline</a><span style="color: #4b4d51; font-weight: bold;">ktooltipwidget.cpp:142</span></div>
<div style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; white-space: pre-wrap; clear: both; padding: 4px 0; margin: 0;"><div style="padding: 0 8px; margin: 0 4px; background: rgba(251, 175, 175, .7);">            <span class="bright"></span><span class="n"><span class="bright">x</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">=</span></span><span class="bright"> </span><span class="n"><span class="bright">screenGeometry</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">right</span></span><span class="bright"></span><span class="p"><span class="bright">()</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">-</span></span><span class="bright"> </span><span class="n"><span class="bright">size</span></span><span class="bright"></span><span class="p"><span class="bright">.</span></span><span class="bright"></span><span class="n"><span class="bright">width</span></span><span class="bright"></span><span class="p"><span class="bright">()</span></span><span class="bright"> </span><span style="color: #aa2211"><span class="bright">+</span></span><span class="bright"> </span><span style="color: #601200"><span class="bright">1</span></span><span class="bright"></span><span class="p"><span class="bright">;</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="bright"></span><span style="color: #74777d"><span class="bright">// Disallow negative x. Happens when rect is wider than screen.</span></span>
</div><div style="padding: 0 8px; margin: 0 4px; background: rgba(151, 234, 151, .6);">            <span class="n">x</span> <span style="color: #aa2211">=</span> <span class="n">qMax</span><span class="p">(</span><span class="n">screenGeometry</span><span class="p">.</span><span class="n">left</span><span class="p">(),</span> <span class="n">screenGeometry</span><span class="p">.</span><span class="n">right</span><span class="p">()</span> <span style="color: #aa2211">-</span> <span class="n">size</span><span class="p">.</span><span class="n">width</span><span class="p">()</span> <span style="color: #aa2211">+</span> <span style="color: #601200">1</span><span class="p">);</span>
</div><div style="padding: 0 8px; margin: 0 4px; ">        <span class="p">}</span>
</div></div></div>
<div style="margin: 8px 0; padding: 0 12px;"><p style="padding: 0; margin: 8px;">This looks unrelated to this patch. I don't see a testcase for it and if I revert this change, the new tests still pass.</p>

<p style="padding: 0; margin: 8px;">Ideally we need a failing test case that is fixed by this line of code. Btw, don't we have a similar "negative y" problem?</p></div></div></div></div></div><br /><div><strong>REPOSITORY</strong><div><div>R236 KWidgetsAddons</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D9973" rel="noreferrer">https://phabricator.kde.org/D9973</a></div></div><br /><div><strong>To: </strong>michaelh, elvisangelaccio, Frameworks, Dolphin, ngraham<br /><strong>Cc: </strong>cfeck, michaelh<br /></div>