Restore overflowing for cells with non-default vertical alignment
Since the changes in a40acbb28e
(Add CanOverflow function to
wxGridCellAttr, 2020-02-06), cells with non-default vertical alignment
didn't overflow any more, even if their horizontal alignment was
unchanged and still defaulted to left-aligned.
This was due to assuming that if the alignment of wxGridCellAttr itself
was different from wxALIGN_LEFT, it meant that it wasn't left-aligned,
which seems logical but is in fact false, as the alignment can also be
wxALIGN_INVALID, in which case the real alignment is taken from the
default grid attribute.
Fix this by using GetNonDefaultAlignment() to get the alignment value
effectively used and add a unit test, as well as an example in the
sample, showing that this now works correctly.
This commit is contained in:
@@ -925,6 +925,14 @@ TEST_CASE_METHOD(GridTestCase, "Grid::GetNonDefaultAlignment", "[grid]")
|
||||
attr->GetNonDefaultAlignment(&hAlign, &vAlign);
|
||||
CHECK( hAlign == wxALIGN_RIGHT );
|
||||
CHECK( vAlign == wxALIGN_CENTRE_VERTICAL );
|
||||
|
||||
// This is only indirectly related, but test here for CanOverflow() working
|
||||
// correctly for the cells with non-default alignment, as this used to be
|
||||
// broken.
|
||||
m_grid->SetCellAlignment(0, 0, wxALIGN_INVALID, wxALIGN_CENTRE);
|
||||
attr = m_grid->CallGetCellAttr(0, 0);
|
||||
REQUIRE( attr );
|
||||
CHECK( attr->CanOverflow() );
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::Editable", "[grid]")
|
||||
|
Reference in New Issue
Block a user