Replace legacy CppUnit assertions with CATCH ones in grid test
Get rid of compatibility macros and use CATCH macros directly. Also remove the now unnecessary casts.
This commit is contained in:
@@ -197,7 +197,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellClick", "[grid]")
|
||||
sim.MouseClick();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
|
||||
CHECK(lclick.GetCount() == 1);
|
||||
lclick.Clear();
|
||||
|
||||
sim.MouseDblClick();
|
||||
@@ -205,20 +205,20 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellClick", "[grid]")
|
||||
|
||||
//A double click event sends a single click event first
|
||||
//test to ensure this still happens in the future
|
||||
CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, ldclick.GetCount());
|
||||
CHECK(lclick.GetCount() == 1);
|
||||
CHECK(ldclick.GetCount() == 1);
|
||||
|
||||
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
|
||||
CHECK(rclick.GetCount() == 1);
|
||||
rclick.Clear();
|
||||
|
||||
sim.MouseDblClick(wxMOUSE_BTN_RIGHT);
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, rdclick.GetCount());
|
||||
CHECK(rclick.GetCount() == 1);
|
||||
CHECK(rdclick.GetCount() == 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ReorderedColumnsCellClick", "[grid]")
|
||||
sim.MouseClick();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, click.GetCount());
|
||||
CHECK(click.GetCount() == 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellSelect", "[grid]")
|
||||
sim.MouseClick();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, cell.GetCount());
|
||||
CHECK(cell.GetCount() == 1);
|
||||
|
||||
cell.Clear();
|
||||
|
||||
@@ -283,7 +283,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellSelect", "[grid]")
|
||||
sim.MouseDblClick();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(3, cell.GetCount());
|
||||
CHECK(cell.GetCount() == 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -313,17 +313,17 @@ TEST_CASE_METHOD(GridTestCase, "Grid::LabelClick", "[grid]")
|
||||
sim.MouseClick();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
|
||||
CHECK(lclick.GetCount() == 1);
|
||||
|
||||
sim.MouseDblClick();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, ldclick.GetCount());
|
||||
CHECK(ldclick.GetCount() == 1);
|
||||
|
||||
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
|
||||
CHECK(rclick.GetCount() == 1);
|
||||
rclick.Clear();
|
||||
|
||||
sim.MouseDblClick(wxMOUSE_BTN_RIGHT);
|
||||
@@ -333,12 +333,12 @@ TEST_CASE_METHOD(GridTestCase, "Grid::LabelClick", "[grid]")
|
||||
{
|
||||
//Right double click not supported with native headers so we get two
|
||||
//right click events
|
||||
CPPUNIT_ASSERT_EQUAL(2, rclick.GetCount());
|
||||
CHECK(rclick.GetCount() == 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
|
||||
CPPUNIT_ASSERT_EQUAL(1, rdclick.GetCount());
|
||||
CHECK(rclick.GetCount() == 1);
|
||||
CHECK(rdclick.GetCount() == 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -368,7 +368,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::SortClick", "[grid]")
|
||||
sim.MouseClick();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, sort.GetCount());
|
||||
CHECK(sort.GetCount() == 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Size", "[grid]")
|
||||
sim.MouseUp();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, colsize.GetCount());
|
||||
CHECK(colsize.GetCount() == 1);
|
||||
|
||||
pt = m_grid->ClientToScreen(wxPoint(5, m_grid->GetColLabelSize() +
|
||||
m_grid->GetRowSize(0)));
|
||||
@@ -410,7 +410,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Size", "[grid]")
|
||||
sim.MouseDragDrop(pt.x, pt.y, pt.x, pt.y + 50);
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, rowsize.GetCount());
|
||||
CHECK(rowsize.GetCount() == 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::RangeSelect", "[grid]")
|
||||
sim.MouseUp();
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, select.GetCount());
|
||||
CHECK(select.GetCount() == 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -449,8 +449,8 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Cursor", "[grid]")
|
||||
{
|
||||
m_grid->SetGridCursor(1, 1);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, m_grid->GetGridCursorCol());
|
||||
CPPUNIT_ASSERT_EQUAL(1, m_grid->GetGridCursorRow());
|
||||
CHECK(m_grid->GetGridCursorCol() == 1);
|
||||
CHECK(m_grid->GetGridCursorRow() == 1);
|
||||
|
||||
m_grid->MoveCursorDown(false);
|
||||
m_grid->MoveCursorLeft(false);
|
||||
@@ -458,8 +458,8 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Cursor", "[grid]")
|
||||
m_grid->MoveCursorUp(false);
|
||||
m_grid->MoveCursorRight(false);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, m_grid->GetGridCursorCol());
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetGridCursorRow());
|
||||
CHECK(m_grid->GetGridCursorCol() == 1);
|
||||
CHECK(m_grid->GetGridCursorRow() == 0);
|
||||
|
||||
m_grid->SetCellValue(0, 0, "some text");
|
||||
m_grid->SetCellValue(3, 0, "other text");
|
||||
@@ -471,57 +471,57 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Cursor", "[grid]")
|
||||
|
||||
m_grid->MoveCursorLeftBlock(false);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetGridCursorCol());
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetGridCursorRow());
|
||||
CHECK(m_grid->GetGridCursorCol() == 0);
|
||||
CHECK(m_grid->GetGridCursorRow() == 0);
|
||||
|
||||
m_grid->MoveCursorDownBlock(false);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetGridCursorCol());
|
||||
CPPUNIT_ASSERT_EQUAL(3, m_grid->GetGridCursorRow());
|
||||
CHECK(m_grid->GetGridCursorCol() == 0);
|
||||
CHECK(m_grid->GetGridCursorRow() == 3);
|
||||
|
||||
m_grid->MoveCursorRightBlock(false);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, m_grid->GetGridCursorCol());
|
||||
CPPUNIT_ASSERT_EQUAL(3, m_grid->GetGridCursorRow());
|
||||
CHECK(m_grid->GetGridCursorCol() == 1);
|
||||
CHECK(m_grid->GetGridCursorRow() == 3);
|
||||
|
||||
m_grid->MoveCursorUpBlock(false);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, m_grid->GetGridCursorCol());
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetGridCursorRow());
|
||||
CHECK(m_grid->GetGridCursorCol() == 1);
|
||||
CHECK(m_grid->GetGridCursorRow() == 0);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::Selection", "[grid]")
|
||||
{
|
||||
m_grid->SelectAll();
|
||||
|
||||
CPPUNIT_ASSERT(m_grid->IsSelection());
|
||||
CPPUNIT_ASSERT(m_grid->IsInSelection(0, 0));
|
||||
CPPUNIT_ASSERT(m_grid->IsInSelection(9, 1));
|
||||
CHECK(m_grid->IsSelection());
|
||||
CHECK(m_grid->IsInSelection(0, 0));
|
||||
CHECK(m_grid->IsInSelection(9, 1));
|
||||
|
||||
m_grid->SelectBlock(1, 0, 3, 1);
|
||||
|
||||
wxGridCellCoordsArray topleft = m_grid->GetSelectionBlockTopLeft();
|
||||
wxGridCellCoordsArray bottomright = m_grid->GetSelectionBlockBottomRight();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, topleft.Count());
|
||||
CPPUNIT_ASSERT_EQUAL(1, bottomright.Count());
|
||||
CHECK(topleft.Count() == 1);
|
||||
CHECK(bottomright.Count() == 1);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, topleft.Item(0).GetCol());
|
||||
CPPUNIT_ASSERT_EQUAL(1, topleft.Item(0).GetRow());
|
||||
CPPUNIT_ASSERT_EQUAL(1, bottomright.Item(0).GetCol());
|
||||
CPPUNIT_ASSERT_EQUAL(3, bottomright.Item(0).GetRow());
|
||||
CHECK(topleft.Item(0).GetCol() == 0);
|
||||
CHECK(topleft.Item(0).GetRow() == 1);
|
||||
CHECK(bottomright.Item(0).GetCol() == 1);
|
||||
CHECK(bottomright.Item(0).GetRow() == 3);
|
||||
|
||||
m_grid->SelectCol(1);
|
||||
|
||||
CPPUNIT_ASSERT(m_grid->IsInSelection(0, 1));
|
||||
CPPUNIT_ASSERT(m_grid->IsInSelection(9, 1));
|
||||
CPPUNIT_ASSERT(!m_grid->IsInSelection(3, 0));
|
||||
CHECK(m_grid->IsInSelection(0, 1));
|
||||
CHECK(m_grid->IsInSelection(9, 1));
|
||||
CHECK(!m_grid->IsInSelection(3, 0));
|
||||
|
||||
m_grid->SelectRow(4);
|
||||
|
||||
CPPUNIT_ASSERT(m_grid->IsInSelection(4, 0));
|
||||
CPPUNIT_ASSERT(m_grid->IsInSelection(4, 1));
|
||||
CPPUNIT_ASSERT(!m_grid->IsInSelection(3, 0));
|
||||
CHECK(m_grid->IsInSelection(4, 0));
|
||||
CHECK(m_grid->IsInSelection(4, 1));
|
||||
CHECK(!m_grid->IsInSelection(3, 0));
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::SelectEmptyGrid", "[grid]")
|
||||
@@ -658,26 +658,26 @@ TEST_CASE_METHOD(GridTestCase, "Grid::SelectUsingEndKey", "[grid]")
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::AddRowCol", "[grid]")
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL(10, m_grid->GetNumberRows());
|
||||
CPPUNIT_ASSERT_EQUAL(2, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberRows() == 10);
|
||||
CHECK(m_grid->GetNumberCols() == 2);
|
||||
|
||||
m_grid->AppendCols();
|
||||
m_grid->AppendRows();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(11, m_grid->GetNumberRows());
|
||||
CPPUNIT_ASSERT_EQUAL(3, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberRows() == 11);
|
||||
CHECK(m_grid->GetNumberCols() == 3);
|
||||
|
||||
m_grid->AppendCols(2);
|
||||
m_grid->AppendRows(2);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(13, m_grid->GetNumberRows());
|
||||
CPPUNIT_ASSERT_EQUAL(5, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberRows() == 13);
|
||||
CHECK(m_grid->GetNumberCols() == 5);
|
||||
|
||||
m_grid->InsertCols(1, 2);
|
||||
m_grid->InsertRows(2, 3);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(16, m_grid->GetNumberRows());
|
||||
CPPUNIT_ASSERT_EQUAL(7, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberRows() == 16);
|
||||
CHECK(m_grid->GetNumberCols() == 7);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::DeleteAndAddRowCol", "[grid]")
|
||||
@@ -685,27 +685,27 @@ TEST_CASE_METHOD(GridTestCase, "Grid::DeleteAndAddRowCol", "[grid]")
|
||||
SECTION("Default") {}
|
||||
SECTION("Native header") { m_grid->UseNativeColHeader(); }
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(10, m_grid->GetNumberRows());
|
||||
CPPUNIT_ASSERT_EQUAL(2, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberRows() == 10);
|
||||
CHECK(m_grid->GetNumberCols() == 2);
|
||||
|
||||
m_grid->DeleteRows(0, 10);
|
||||
m_grid->DeleteCols(0, 2);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetNumberRows());
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberRows() == 0);
|
||||
CHECK(m_grid->GetNumberCols() == 0);
|
||||
|
||||
m_grid->AppendRows(5);
|
||||
m_grid->AppendCols(3);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(5, m_grid->GetNumberRows());
|
||||
CPPUNIT_ASSERT_EQUAL(3, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberRows() == 5);
|
||||
CHECK(m_grid->GetNumberCols() == 3);
|
||||
|
||||
// The order of functions calls can be important
|
||||
m_grid->DeleteCols(0, 3);
|
||||
m_grid->DeleteRows(0, 5);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetNumberRows());
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberRows() == 0);
|
||||
CHECK(m_grid->GetNumberCols() == 0);
|
||||
|
||||
// Different functions calls order
|
||||
m_grid->AppendCols(3);
|
||||
@@ -720,7 +720,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ColumnOrder", "[grid]")
|
||||
|
||||
m_grid->AppendCols(2);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(4, m_grid->GetNumberCols());
|
||||
CHECK(m_grid->GetNumberCols() == 4);
|
||||
|
||||
wxArrayInt neworder;
|
||||
neworder.push_back(1);
|
||||
@@ -730,102 +730,100 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ColumnOrder", "[grid]")
|
||||
|
||||
m_grid->SetColumnsOrder(neworder);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetColPos(1));
|
||||
CPPUNIT_ASSERT_EQUAL(1, m_grid->GetColPos(3));
|
||||
CPPUNIT_ASSERT_EQUAL(2, m_grid->GetColPos(2));
|
||||
CPPUNIT_ASSERT_EQUAL(3, m_grid->GetColPos(0));
|
||||
CHECK(m_grid->GetColPos(1) == 0);
|
||||
CHECK(m_grid->GetColPos(3) == 1);
|
||||
CHECK(m_grid->GetColPos(2) == 2);
|
||||
CHECK(m_grid->GetColPos(0) == 3);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, m_grid->GetColAt(0));
|
||||
CPPUNIT_ASSERT_EQUAL(3, m_grid->GetColAt(1));
|
||||
CPPUNIT_ASSERT_EQUAL(2, m_grid->GetColAt(2));
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetColAt(3));
|
||||
CHECK(m_grid->GetColAt(0) == 1);
|
||||
CHECK(m_grid->GetColAt(1) == 3);
|
||||
CHECK(m_grid->GetColAt(2) == 2);
|
||||
CHECK(m_grid->GetColAt(3) == 0);
|
||||
|
||||
m_grid->ResetColPos();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, m_grid->GetColPos(0));
|
||||
CPPUNIT_ASSERT_EQUAL(1, m_grid->GetColPos(1));
|
||||
CPPUNIT_ASSERT_EQUAL(2, m_grid->GetColPos(2));
|
||||
CPPUNIT_ASSERT_EQUAL(3, m_grid->GetColPos(3));
|
||||
CHECK(m_grid->GetColPos(0) == 0);
|
||||
CHECK(m_grid->GetColPos(1) == 1);
|
||||
CHECK(m_grid->GetColPos(2) == 2);
|
||||
CHECK(m_grid->GetColPos(3) == 3);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::ColumnVisibility", "[grid]")
|
||||
{
|
||||
m_grid->AppendCols(3);
|
||||
CPPUNIT_ASSERT( m_grid->IsColShown(1) );
|
||||
CHECK( m_grid->IsColShown(1) );
|
||||
|
||||
m_grid->HideCol(1);
|
||||
CPPUNIT_ASSERT( !m_grid->IsColShown(1) );
|
||||
CPPUNIT_ASSERT( m_grid->IsColShown(2) );
|
||||
CHECK( !m_grid->IsColShown(1) );
|
||||
CHECK( m_grid->IsColShown(2) );
|
||||
|
||||
m_grid->ShowCol(1);
|
||||
CPPUNIT_ASSERT( m_grid->IsColShown(1) );
|
||||
CHECK( m_grid->IsColShown(1) );
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::LineFormatting", "[grid]")
|
||||
{
|
||||
CPPUNIT_ASSERT(m_grid->GridLinesEnabled());
|
||||
CHECK(m_grid->GridLinesEnabled());
|
||||
|
||||
m_grid->EnableGridLines(false);
|
||||
|
||||
CPPUNIT_ASSERT(!m_grid->GridLinesEnabled());
|
||||
CHECK(!m_grid->GridLinesEnabled());
|
||||
|
||||
m_grid->EnableGridLines();
|
||||
|
||||
m_grid->SetGridLineColour(*wxRED);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(m_grid->GetGridLineColour(), *wxRED);
|
||||
CHECK(*wxRED == m_grid->GetGridLineColour());
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::SortSupport", "[grid]")
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL(wxNOT_FOUND, m_grid->GetSortingColumn());
|
||||
CHECK(m_grid->GetSortingColumn() == wxNOT_FOUND);
|
||||
|
||||
m_grid->SetSortingColumn(1);
|
||||
|
||||
CPPUNIT_ASSERT(!m_grid->IsSortingBy(0));
|
||||
CPPUNIT_ASSERT(m_grid->IsSortingBy(1));
|
||||
CPPUNIT_ASSERT(m_grid->IsSortOrderAscending());
|
||||
CHECK(!m_grid->IsSortingBy(0));
|
||||
CHECK(m_grid->IsSortingBy(1));
|
||||
CHECK(m_grid->IsSortOrderAscending());
|
||||
|
||||
m_grid->SetSortingColumn(0, false);
|
||||
|
||||
CPPUNIT_ASSERT(m_grid->IsSortingBy(0));
|
||||
CPPUNIT_ASSERT(!m_grid->IsSortingBy(1));
|
||||
CPPUNIT_ASSERT(!m_grid->IsSortOrderAscending());
|
||||
CHECK(m_grid->IsSortingBy(0));
|
||||
CHECK(!m_grid->IsSortingBy(1));
|
||||
CHECK(!m_grid->IsSortOrderAscending());
|
||||
|
||||
m_grid->UnsetSortingColumn();
|
||||
|
||||
CPPUNIT_ASSERT(!m_grid->IsSortingBy(0));
|
||||
CPPUNIT_ASSERT(!m_grid->IsSortingBy(1));
|
||||
CHECK(!m_grid->IsSortingBy(0));
|
||||
CHECK(!m_grid->IsSortingBy(1));
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::Labels", "[grid]")
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL("A", m_grid->GetColLabelValue(0));
|
||||
CPPUNIT_ASSERT_EQUAL("1", m_grid->GetRowLabelValue(0));
|
||||
CHECK(m_grid->GetColLabelValue(0) == "A");
|
||||
CHECK(m_grid->GetRowLabelValue(0) == "1");
|
||||
|
||||
m_grid->SetColLabelValue(0, "Column 1");
|
||||
m_grid->SetRowLabelValue(0, "Row 1");
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL("Column 1", m_grid->GetColLabelValue(0));
|
||||
CPPUNIT_ASSERT_EQUAL("Row 1", m_grid->GetRowLabelValue(0));
|
||||
CHECK(m_grid->GetColLabelValue(0) == "Column 1");
|
||||
CHECK(m_grid->GetRowLabelValue(0) == "Row 1");
|
||||
|
||||
m_grid->SetLabelTextColour(*wxGREEN);
|
||||
m_grid->SetLabelBackgroundColour(*wxRED);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(*wxGREEN, m_grid->GetLabelTextColour());
|
||||
CPPUNIT_ASSERT_EQUAL(*wxRED, m_grid->GetLabelBackgroundColour());
|
||||
CHECK(m_grid->GetLabelTextColour() == *wxGREEN);
|
||||
CHECK(m_grid->GetLabelBackgroundColour() == *wxRED);
|
||||
|
||||
m_grid->SetColLabelTextOrientation(wxVERTICAL);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxVERTICAL),
|
||||
static_cast<int>(m_grid->GetColLabelTextOrientation()));
|
||||
CHECK(m_grid->GetColLabelTextOrientation() == wxVERTICAL);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::SelectionMode", "[grid]")
|
||||
{
|
||||
//We already test this mode in Select
|
||||
CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectCells,
|
||||
m_grid->GetSelectionMode());
|
||||
CHECK(m_grid->GetSelectionMode() == wxGrid::wxGridSelectCells);
|
||||
|
||||
//Test row selection be selecting a single cell and checking the whole
|
||||
//row is selected
|
||||
@@ -833,11 +831,10 @@ TEST_CASE_METHOD(GridTestCase, "Grid::SelectionMode", "[grid]")
|
||||
m_grid->SelectBlock(3, 1, 3, 1);
|
||||
|
||||
wxArrayInt selectedRows = m_grid->GetSelectedRows();
|
||||
CPPUNIT_ASSERT_EQUAL(1, selectedRows.Count());
|
||||
CPPUNIT_ASSERT_EQUAL(3, selectedRows[0]);
|
||||
CHECK(selectedRows.Count() == 1);
|
||||
CHECK(selectedRows[0] == 3);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectRows,
|
||||
m_grid->GetSelectionMode());
|
||||
CHECK(m_grid->GetSelectionMode() == wxGrid::wxGridSelectRows);
|
||||
|
||||
|
||||
//Test column selection be selecting a single cell and checking the whole
|
||||
@@ -846,11 +843,10 @@ TEST_CASE_METHOD(GridTestCase, "Grid::SelectionMode", "[grid]")
|
||||
m_grid->SelectBlock(3, 1, 3, 1);
|
||||
|
||||
wxArrayInt selectedCols = m_grid->GetSelectedCols();
|
||||
CPPUNIT_ASSERT_EQUAL(1, selectedCols.Count());
|
||||
CPPUNIT_ASSERT_EQUAL(1, selectedCols[0]);
|
||||
CHECK(selectedCols.Count() == 1);
|
||||
CHECK(selectedCols[0] == 1);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectColumns,
|
||||
m_grid->GetSelectionMode());
|
||||
CHECK(m_grid->GetSelectionMode() == wxGrid::wxGridSelectColumns);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::CellFormatting", "[grid]")
|
||||
@@ -861,41 +857,41 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellFormatting", "[grid]")
|
||||
m_grid->GetDefaultCellAlignment(&horiz, &vert);
|
||||
m_grid->GetCellAlignment(0, 0, &cellhoriz, &cellvert);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(cellhoriz, horiz);
|
||||
CPPUNIT_ASSERT_EQUAL(cellvert, vert);
|
||||
CHECK(horiz == cellhoriz);
|
||||
CHECK(vert == cellvert);
|
||||
|
||||
//Check initial text colour and background colour are default
|
||||
wxColour text, back;
|
||||
|
||||
back = m_grid->GetDefaultCellBackgroundColour();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(back, m_grid->GetCellBackgroundColour(0, 0));
|
||||
CHECK(m_grid->GetCellBackgroundColour(0, 0) == back);
|
||||
|
||||
back = m_grid->GetDefaultCellTextColour();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(back, m_grid->GetCellTextColour(0, 0));
|
||||
CHECK(m_grid->GetCellTextColour(0, 0) == back);
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
m_grid->SetCellAlignment(wxALIGN_CENTRE, 0, 0);
|
||||
m_grid->GetCellAlignment(0, 0, &cellhoriz, &cellvert);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_CENTRE), cellhoriz);
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_CENTRE), cellvert);
|
||||
CHECK(cellhoriz == wxALIGN_CENTRE);
|
||||
CHECK(cellvert == wxALIGN_CENTRE);
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
m_grid->SetCellAlignment(0, 0, wxALIGN_LEFT, wxALIGN_BOTTOM);
|
||||
m_grid->GetCellAlignment(0, 0, &cellhoriz, &cellvert);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_LEFT), cellhoriz);
|
||||
CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_BOTTOM), cellvert);
|
||||
CHECK(cellhoriz == wxALIGN_LEFT);
|
||||
CHECK(cellvert == wxALIGN_BOTTOM);
|
||||
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
m_grid->SetCellTextColour(*wxRED, 0, 0);
|
||||
CPPUNIT_ASSERT_EQUAL(*wxRED, m_grid->GetCellTextColour(0, 0));
|
||||
CHECK(m_grid->GetCellTextColour(0, 0) == *wxRED);
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
m_grid->SetCellTextColour(0, 0, *wxGREEN);
|
||||
CPPUNIT_ASSERT_EQUAL(*wxGREEN, m_grid->GetCellTextColour(0, 0));
|
||||
CHECK(m_grid->GetCellTextColour(0,0) == *wxGREEN);
|
||||
}
|
||||
|
||||
TEST_CASE_METHOD(GridTestCase, "Grid::GetNonDefaultAlignment", "[grid]")
|
||||
@@ -942,11 +938,11 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Editable", "[grid]")
|
||||
|
||||
wxUIActionSimulator sim;
|
||||
|
||||
CPPUNIT_ASSERT(m_grid->IsEditable());
|
||||
CHECK(m_grid->IsEditable());
|
||||
|
||||
m_grid->EnableEditing(false);
|
||||
|
||||
CPPUNIT_ASSERT(!m_grid->IsEditable());
|
||||
CHECK(!m_grid->IsEditable());
|
||||
|
||||
m_grid->SetFocus();
|
||||
m_grid->SetGridCursor(1, 1);
|
||||
@@ -957,7 +953,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::Editable", "[grid]")
|
||||
sim.Char(WXK_RETURN);
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, created.GetCount());
|
||||
CHECK(created.GetCount() == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -972,11 +968,11 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ReadOnly", "[grid]")
|
||||
|
||||
wxUIActionSimulator sim;
|
||||
|
||||
CPPUNIT_ASSERT(!m_grid->IsReadOnly(1, 1));
|
||||
CHECK(!m_grid->IsReadOnly(1, 1));
|
||||
|
||||
m_grid->SetReadOnly(1, 1);
|
||||
|
||||
CPPUNIT_ASSERT(m_grid->IsReadOnly(1, 1));
|
||||
CHECK(m_grid->IsReadOnly(1, 1));
|
||||
|
||||
m_grid->SetFocus();
|
||||
|
||||
@@ -991,7 +987,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ReadOnly", "[grid]")
|
||||
|
||||
m_grid->SetGridCursor(1, 1);
|
||||
|
||||
CPPUNIT_ASSERT(m_grid->IsCurrentCellReadOnly());
|
||||
CHECK(m_grid->IsCurrentCellReadOnly());
|
||||
|
||||
sim.Text("abab");
|
||||
wxYield();
|
||||
@@ -999,7 +995,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ReadOnly", "[grid]")
|
||||
sim.Char(WXK_RETURN);
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, created.GetCount());
|
||||
CHECK(created.GetCount() == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1062,7 +1058,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::WindowAsEditorControl", "[grid]")
|
||||
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, created.GetCount());
|
||||
CHECK(created.GetCount() == 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1107,7 +1103,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ResizeScrolledHeader", "[grid]")
|
||||
|
||||
wxYield();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(startwidth + draglength, m_grid->GetColSize(0));
|
||||
CHECK(m_grid->GetColSize(0) == startwidth + draglength);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1126,7 +1122,7 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ColumnMinWidth", "[grid]")
|
||||
int const newminwidth = m_grid->GetColMinimalAcceptableWidth();
|
||||
int const startwidth = m_grid->GetColSize(0);
|
||||
|
||||
CPPUNIT_ASSERT(m_grid->GetColMinimalAcceptableWidth() < startwidth);
|
||||
CHECK(m_grid->GetColMinimalAcceptableWidth() < startwidth);
|
||||
|
||||
wxRect rect = m_grid->CellToRect(0, 1);
|
||||
wxPoint point = m_grid->CalcScrolledPosition(rect.GetPosition());
|
||||
@@ -1148,10 +1144,10 @@ TEST_CASE_METHOD(GridTestCase, "Grid::ColumnMinWidth", "[grid]")
|
||||
sim.MouseUp();
|
||||
wxYield();
|
||||
|
||||
if ( ms_nativeheader )
|
||||
CPPUNIT_ASSERT_EQUAL(startwidth, m_grid->GetColSize(0));
|
||||
if ( m_grid->IsUsingNativeHeader() )
|
||||
CHECK(m_grid->GetColSize(0) == startwidth);
|
||||
else
|
||||
CPPUNIT_ASSERT_EQUAL(newminwidth, m_grid->GetColSize(0));
|
||||
CHECK(m_grid->GetColSize(0) == newminwidth);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user