Kaydet (Commit) 1c353c91 authored tarafından Caolán McNamara's avatar Caolán McNamara

make CheckCharacterBounds tests happy without forcing empty glyphs 1 unit wide

related, i#87757 and 8bafe38c
which itself is related to ce14342c,

These character bounds are backed by what's the glyph bounding box for the ink
used for the glyph. Whitespace has no ink so its an empty Rectangle. Which
brings the awesome RECT_EMPTY into play.

It might be a bit dubious in the first place to back getCharacterBounds with
the glyph bounding box in the first place, rather than maybe the advance width
or some such. But lets assume that decision was intentional.

So, the qa test should accept that a glyph might be of 0 width anyway.
Then, tweak rectangle merging so that we can preserve the correct top-left
position of an empty glyph
So, we can determine the correct character index given the top-left position
of an empty glyph

Change-Id: I5e18460ff7cd90cd27d5eede2aa0a5494c36a5d3
üst 8c803ef2
......@@ -385,9 +385,9 @@ public class _XAccessibleText extends MultiMethodTest {
localres = chBounds.X >= 0;
localres &= (chBounds.Y >= 0);
localres &= ((chBounds.X + chBounds.Width) <= bounds.Width);
localres &= ((chBounds.X + chBounds.Width) > 0);
localres &= ((chBounds.X + chBounds.Width) >= 0);
localres &= ((chBounds.Y + chBounds.Height) <= bounds.Height);
localres &= ((chBounds.Y + chBounds.Height) > 0);
localres &= ((chBounds.Y + chBounds.Height) >= 0);
if (!localres) {
log.println("Text at this place: "+oObj.getCharacter(i));
......
......@@ -43,11 +43,6 @@
namespace { struct SimpleLayoutEngine : public rtl::Static< ServerFontLayoutEngine, SimpleLayoutEngine > {}; }
void GlyphMetric::SetSize(const Size& s)
{
maSize = Size(std::max<long>(1, s.Width()), std::max<long>(1, s.Height()));
}
// =======================================================================
// layout implementation for ServerFont
// =======================================================================
......
......@@ -132,7 +132,7 @@ protected:
friend class GlyphData;
void SetOffset( int nX, int nY ) { maOffset = Point( nX, nY); }
void SetDelta( int nX, int nY ) { maDelta = Point( nX, nY); }
void SetSize(const Size& s);
void SetSize( const Size& s ) { maSize = s; }
void SetCharWidth( long nW ) { mnAdvanceWidth = nW; }
private:
......
......@@ -172,7 +172,10 @@ long ControlLayoutData::GetIndexForPoint( const Point& rPoint ) const
long nIndex = -1;
for( long i = m_aUnicodeBoundRects.size()-1; i >= 0; i-- )
{
if( m_aUnicodeBoundRects[ i ].IsInside( rPoint ) )
Point aTopLeft = m_aUnicodeBoundRects[i].TopLeft();
Point aBottomRight = m_aUnicodeBoundRects[i].BottomRight();
if (rPoint.X() >= aTopLeft.X() && rPoint.Y() >= aTopLeft.Y() &&
rPoint.X() <= aBottomRight.X() && rPoint.Y() <= aBottomRight.Y())
{
nIndex = i;
break;
......
......@@ -761,7 +761,10 @@ bool SalLayout::GetBoundRect( SalGraphics& rSalGraphics, Rectangle& rRect ) cons
{
// merge rectangle
aRectangle += aPos;
rRect.Union( aRectangle );
if (rRect.IsEmpty())
rRect = aRectangle;
else
rRect.Union(aRectangle);
bRet = true;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment