Test moving the grid cursor using End key for wxGrid

This commit is contained in:
Ilya Sinitsyn 2020-01-29 01:31:40 +07:00 committed by Vadim Zeitlin
parent 68ccc77e20
commit 677b9d21ea

View File

@ -74,6 +74,7 @@ private:
CPPUNIT_TEST( Cursor ); CPPUNIT_TEST( Cursor );
CPPUNIT_TEST( Selection ); CPPUNIT_TEST( Selection );
CPPUNIT_TEST( ScrollWhenSelect ); CPPUNIT_TEST( ScrollWhenSelect );
WXUISIM_TEST( MoveGridCursorUsingEndKey );
CPPUNIT_TEST( AddRowCol ); CPPUNIT_TEST( AddRowCol );
CPPUNIT_TEST( DeleteAndAddRowCol ); CPPUNIT_TEST( DeleteAndAddRowCol );
CPPUNIT_TEST( ColumnOrder ); CPPUNIT_TEST( ColumnOrder );
@ -116,6 +117,7 @@ private:
void Cursor(); void Cursor();
void Selection(); void Selection();
void ScrollWhenSelect(); void ScrollWhenSelect();
void MoveGridCursorUsingEndKey();
void AddRowCol(); void AddRowCol();
void DeleteAndAddRowCol(); void DeleteAndAddRowCol();
void ColumnOrder(); void ColumnOrder();
@ -620,6 +622,36 @@ void GridTestCase::ScrollWhenSelect()
CHECK( m_grid->IsVisible(6, 1) ); CHECK( m_grid->IsVisible(6, 1) );
} }
void GridTestCase::MoveGridCursorUsingEndKey()
{
#if wxUSE_UIACTIONSIMULATOR
wxUIActionSimulator sim;
m_grid->AppendCols(10);
REQUIRE( m_grid->GetGridCursorCol() == 0 );
REQUIRE( m_grid->GetGridCursorRow() == 0 );
REQUIRE( m_grid->IsVisible(0, 0) );
// Hide the last row.
m_grid->HideRow(9);
// Hide the last column.
m_grid->HideCol(11);
// Move the penult column.
m_grid->SetColPos(10, 5);
m_grid->SetFocus();
sim.KeyDown(WXK_END, wxMOD_CONTROL);
sim.KeyUp(WXK_END, wxMOD_CONTROL);
wxYield();
CHECK( m_grid->GetGridCursorRow() == 8 );
CHECK( m_grid->GetGridCursorCol() == 9 );
CHECK( m_grid->IsVisible(8, 9) );
#endif
}
void GridTestCase::AddRowCol() void GridTestCase::AddRowCol()
{ {
CPPUNIT_ASSERT_EQUAL(10, m_grid->GetNumberRows()); CPPUNIT_ASSERT_EQUAL(10, m_grid->GetNumberRows());