Fix wxDataViewCtrl::GetItemRect() for collapsed items

Calling GetItemRect() for an item which was not currently visible
because its parent was collapsed resulted in silently returning the
value for a wrong value before the recent fix to GetRowByItem() and in
a crash after it because GetTreeNodeByRow() returned null when passed
invalid row index.

Fix this by explicitly checking whether the item is shown and just
returning an empty rectangle instead.

Also document this behaviour and add a unit test for it.
This commit is contained in:
Vadim Zeitlin
2018-11-04 17:12:08 +01:00
parent 31c49caab5
commit ada5de3d0d
3 changed files with 34 additions and 3 deletions

View File

@@ -1446,8 +1446,13 @@ public:
int GetIndent() const;
/**
Returns item rectangle. Coordinates of the rectangle are specified in
wxDataViewCtrl client area coordinates.
Returns item rectangle.
If item is not currently visible because its parent is collapsed,
return an empty rectangle.
Coordinates of the rectangle are specified in wxDataViewCtrl client
area coordinates.
@param item
A valid item.