From 88026574906abec43f78027ed4abd720c7243c3b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 11 Mar 2020 01:58:37 +0100 Subject: [PATCH 1/3] Add wxGrid::IsUsingNativeHeader() It is convenient to have this function if only in order to be able to call GetGridColHeader() safely, i.e. without triggering an assert if native header is not being used. --- include/wx/generic/grid.h | 3 +++ interface/wx/grid.h | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/include/wx/generic/grid.h b/include/wx/generic/grid.h index 345bf6adcb..7ea0c4d938 100644 --- a/include/wx/generic/grid.h +++ b/include/wx/generic/grid.h @@ -1837,6 +1837,9 @@ public: wxWindow* GetGridColLabelWindow() const { return m_colLabelWin; } wxWindow* GetGridCornerLabelWindow() const { return (wxWindow*)m_cornerLabelWin; } + // Return true if native header is used by the grid. + bool IsUsingNativeHeader() const { return m_useNativeHeader; } + // This one can only be called if we are using the native header window wxHeaderCtrl *GetGridColHeader() const { diff --git a/interface/wx/grid.h b/interface/wx/grid.h index 3030c3da86..78df3091df 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -5373,9 +5373,18 @@ public: This function can only be called if UseNativeColHeader() had been called. + + @see IsUsingNativeHeader() */ wxHeaderCtrl *GetGridColHeader() const; + /** + Return true if native header control is currently being used. + + @since 3.1.4 + */ + bool IsUsingNativeHeader() const; + //@} From 29d890867c9e128907402d509625ea2fe3018686 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 11 Mar 2020 01:59:39 +0100 Subject: [PATCH 2/3] Rewrite grid unit tests to use individual test cases Instead of using a single test case, with multiple sections, generated by CppUnit compatibility macros, use multiple independent test cases. This makes it more convenient to run individual tests, simplifies the code and allows to get rid of ugly "pseudo tests". --- tests/controls/gridtest.cpp | 240 +++++++++++++++--------------------- 1 file changed, 100 insertions(+), 140 deletions(-) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index f7eb5257df..14c01a8be6 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -53,100 +53,18 @@ public: } // anonymous namespace -class GridTestCase : public CppUnit::TestCase +class GridTestCase { public: - GridTestCase() { } - - virtual void setUp() wxOVERRIDE; - virtual void tearDown() wxOVERRIDE; - -private: - CPPUNIT_TEST_SUITE( GridTestCase ); - WXUISIM_TEST( CellEdit ); - WXUISIM_TEST( CellClick ); - WXUISIM_TEST( ReorderedColumnsCellClick ); - WXUISIM_TEST( CellSelect ); - WXUISIM_TEST( LabelClick ); - WXUISIM_TEST( SortClick ); - WXUISIM_TEST( Size ); - WXUISIM_TEST( RangeSelect ); - CPPUNIT_TEST( Cursor ); - CPPUNIT_TEST( Selection ); - CPPUNIT_TEST( SelectEmptyGrid ); - CPPUNIT_TEST( ScrollWhenSelect ); - WXUISIM_TEST( MoveGridCursorUsingEndKey ); - WXUISIM_TEST( SelectUsingEndKey ); - CPPUNIT_TEST( AddRowCol ); - CPPUNIT_TEST( DeleteAndAddRowCol ); - CPPUNIT_TEST( ColumnOrder ); - CPPUNIT_TEST( ColumnVisibility ); - CPPUNIT_TEST( LineFormatting ); - CPPUNIT_TEST( SortSupport ); - CPPUNIT_TEST( Labels ); - CPPUNIT_TEST( SelectionMode ); - CPPUNIT_TEST( CellFormatting ); - CPPUNIT_TEST( GetNonDefaultAlignment ); - WXUISIM_TEST( Editable ); - WXUISIM_TEST( ReadOnly ); - WXUISIM_TEST( ResizeScrolledHeader ); - WXUISIM_TEST( ColumnMinWidth ); - WXUISIM_TEST( AutoSizeColumn ); - CPPUNIT_TEST( PseudoTest_NativeHeader ); - WXUISIM_TEST( LabelClick ); - WXUISIM_TEST( SortClick ); - CPPUNIT_TEST( ColumnOrder ); - WXUISIM_TEST( ResizeScrolledHeader ); - WXUISIM_TEST( ColumnMinWidth ); - WXUISIM_TEST( AutoSizeColumn ); - CPPUNIT_TEST( DeleteAndAddRowCol ); - CPPUNIT_TEST( PseudoTest_NativeLabels ); - WXUISIM_TEST( LabelClick ); - WXUISIM_TEST( SortClick ); - CPPUNIT_TEST( ColumnOrder ); - WXUISIM_TEST( WindowAsEditorControl ); - WXUISIM_TEST( AutoSizeColumn ); - CPPUNIT_TEST_SUITE_END(); - - void CellEdit(); - void CellClick(); - void ReorderedColumnsCellClick(); - void CellSelect(); - void LabelClick(); - void SortClick(); - void Size(); - void RangeSelect(); - void Cursor(); - void Selection(); - void SelectEmptyGrid(); - void ScrollWhenSelect(); - void MoveGridCursorUsingEndKey(); - void SelectUsingEndKey(); - void AddRowCol(); - void DeleteAndAddRowCol(); - void ColumnOrder(); - void ColumnVisibility(); - void LineFormatting(); - void SortSupport(); - void Labels(); - void SelectionMode(); - void CellFormatting(); - void GetNonDefaultAlignment(); - void Editable(); - void ReadOnly(); - void WindowAsEditorControl(); - void ResizeScrolledHeader(); - void ColumnMinWidth(); - void AutoSizeColumn(); - void PseudoTest_NativeHeader() { ms_nativeheader = true; } - void PseudoTest_NativeLabels() { ms_nativeheader = false; - ms_nativelabels = true; } + GridTestCase(); + ~GridTestCase(); +protected: // The helper function to determine the width of the column label depending - // on whether the native column is used. + // on whether the native column header is used. int GetColumnLabelWidth(wxClientDC& dc, int col, int margin) const { - if (ms_nativeheader) + if ( m_grid->IsUsingNativeHeader() ) return m_grid->GetGridColHeader()->GetColumnTitleWidth(col); int w, h; @@ -156,36 +74,17 @@ private: void CheckFirstColAutoSize(int expected); - static bool ms_nativeheader; - static bool ms_nativelabels; - TestableGrid *m_grid; wxDECLARE_NO_COPY_CLASS(GridTestCase); }; -// register in the unnamed registry so that these tests are run by default -CPPUNIT_TEST_SUITE_REGISTRATION( GridTestCase ); - -// also include in its own registry so that these tests can be run alone -CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( GridTestCase, "GridTestCase" ); - -//initialise the static variable -bool GridTestCase::ms_nativeheader = false; -bool GridTestCase::ms_nativelabels = false; - -void GridTestCase::setUp() +GridTestCase::GridTestCase() { m_grid = new TestableGrid(wxTheApp->GetTopWindow()); m_grid->CreateGrid(10, 2); m_grid->SetSize(400, 200); - if( ms_nativeheader ) - m_grid->UseNativeColHeader(); - - if( ms_nativelabels ) - m_grid->SetUseNativeColLabels(); - WaitForPaint waitForPaint(m_grid->GetGridWindow()); m_grid->Refresh(); @@ -197,7 +96,7 @@ void GridTestCase::setUp() } } -void GridTestCase::tearDown() +GridTestCase::~GridTestCase() { // This is just a hack to continue the rest of the tests to run: if we // destroy the header control while it has capture, this results in an @@ -214,11 +113,14 @@ void GridTestCase::tearDown() wxDELETE(m_grid); } -void GridTestCase::CellEdit() +TEST_CASE_METHOD(GridTestCase, "Grid::CellEdit", "[grid]") { // TODO on OSX when running the grid test suite solo this works // but not when running it together with other tests #if wxUSE_UIACTIONSIMULATOR && !defined(__WXOSX__) + if ( !EnableUITests() ) + return; + EventCounter changing(m_grid, wxEVT_GRID_CELL_CHANGING); EventCounter changed(m_grid, wxEVT_GRID_CELL_CHANGED); EventCounter created(m_grid, wxEVT_GRID_EDITOR_CREATED); @@ -272,7 +174,7 @@ void GridTestCase::CellEdit() #endif } -void GridTestCase::CellClick() +TEST_CASE_METHOD(GridTestCase, "Grid::CellClick", "[grid]") { #if wxUSE_UIACTIONSIMULATOR EventCounter lclick(m_grid, wxEVT_GRID_CELL_LEFT_CLICK); @@ -320,7 +222,7 @@ void GridTestCase::CellClick() #endif } -void GridTestCase::ReorderedColumnsCellClick() +TEST_CASE_METHOD(GridTestCase, "Grid::ReorderedColumnsCellClick", "[grid]") { #if wxUSE_UIACTIONSIMULATOR EventCounter click(m_grid, wxEVT_GRID_CELL_LEFT_CLICK); @@ -349,7 +251,7 @@ void GridTestCase::ReorderedColumnsCellClick() #endif } -void GridTestCase::CellSelect() +TEST_CASE_METHOD(GridTestCase, "Grid::CellSelect", "[grid]") { #if wxUSE_UIACTIONSIMULATOR EventCounter cell(m_grid, wxEVT_GRID_SELECT_CELL); @@ -385,9 +287,16 @@ void GridTestCase::CellSelect() #endif } -void GridTestCase::LabelClick() +TEST_CASE_METHOD(GridTestCase, "Grid::LabelClick", "[grid]") { #if wxUSE_UIACTIONSIMULATOR + if ( !EnableUITests() ) + return; + + SECTION("Default") {} + SECTION("Native header") { m_grid->UseNativeColHeader(); } + SECTION("Native labels") { m_grid->SetUseNativeColLabels(); } + EventCounter lclick(m_grid, wxEVT_GRID_LABEL_LEFT_CLICK); EventCounter ldclick(m_grid, wxEVT_GRID_LABEL_LEFT_DCLICK); EventCounter rclick(m_grid, wxEVT_GRID_LABEL_RIGHT_CLICK); @@ -420,7 +329,7 @@ void GridTestCase::LabelClick() sim.MouseDblClick(wxMOUSE_BTN_RIGHT); wxYield(); - if( ms_nativeheader ) + if ( m_grid->IsUsingNativeHeader() ) { //Right double click not supported with native headers so we get two //right click events @@ -434,9 +343,16 @@ void GridTestCase::LabelClick() #endif } -void GridTestCase::SortClick() +TEST_CASE_METHOD(GridTestCase, "Grid::SortClick", "[grid]") { #if wxUSE_UIACTIONSIMULATOR + if ( !EnableUITests() ) + return; + + SECTION("Default") {} + SECTION("Native header") { m_grid->UseNativeColHeader(); } + SECTION("Native labels") { m_grid->SetUseNativeColLabels(); } + m_grid->SetSortingColumn(0); EventCounter sort(m_grid, wxEVT_GRID_COL_SORT); @@ -456,13 +372,16 @@ void GridTestCase::SortClick() #endif } -void GridTestCase::Size() +TEST_CASE_METHOD(GridTestCase, "Grid::Size", "[grid]") { // TODO on OSX resizing interactively works, but not automated // Grid could not pass the test under GTK, OSX, and Universal. // So there may has bug in Grid implementation #if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__) && !defined(__WXOSX__) \ && !defined(__WXUNIVERSAL__) + if ( !EnableUITests() ) + return; + EventCounter colsize(m_grid, wxEVT_GRID_COL_SIZE); EventCounter rowsize(m_grid, wxEVT_GRID_ROW_SIZE); @@ -495,9 +414,12 @@ void GridTestCase::Size() #endif } -void GridTestCase::RangeSelect() +TEST_CASE_METHOD(GridTestCase, "Grid::RangeSelect", "[grid]") { #if wxUSE_UIACTIONSIMULATOR + if ( !EnableUITests() ) + return; + EventCounter select(m_grid, wxEVT_GRID_RANGE_SELECT); wxUIActionSimulator sim; @@ -523,7 +445,7 @@ void GridTestCase::RangeSelect() #endif } -void GridTestCase::Cursor() +TEST_CASE_METHOD(GridTestCase, "Grid::Cursor", "[grid]") { m_grid->SetGridCursor(1, 1); @@ -568,7 +490,7 @@ void GridTestCase::Cursor() CPPUNIT_ASSERT_EQUAL(0, m_grid->GetGridCursorRow()); } -void GridTestCase::Selection() +TEST_CASE_METHOD(GridTestCase, "Grid::Selection", "[grid]") { m_grid->SelectAll(); @@ -602,7 +524,7 @@ void GridTestCase::Selection() CPPUNIT_ASSERT(!m_grid->IsInSelection(3, 0)); } -void GridTestCase::SelectEmptyGrid() +TEST_CASE_METHOD(GridTestCase, "Grid::SelectEmptyGrid", "[grid]") { SECTION("Delete rows/columns") { @@ -642,7 +564,7 @@ void GridTestCase::SelectEmptyGrid() CHECK( m_grid->GetSelectionBlockBottomRight().Count() == 0 ); } -void GridTestCase::ScrollWhenSelect() +TEST_CASE_METHOD(GridTestCase, "Grid::ScrollWhenSelect", "[grid]") { m_grid->AppendCols(10); @@ -666,9 +588,12 @@ void GridTestCase::ScrollWhenSelect() CHECK( m_grid->IsVisible(6, 1) ); } -void GridTestCase::MoveGridCursorUsingEndKey() +TEST_CASE_METHOD(GridTestCase, "Grid::MoveGridCursorUsingEndKey", "[grid]") { #if wxUSE_UIACTIONSIMULATOR + if ( !EnableUITests() ) + return; + wxUIActionSimulator sim; m_grid->AppendCols(10); @@ -696,9 +621,12 @@ void GridTestCase::MoveGridCursorUsingEndKey() #endif } -void GridTestCase::SelectUsingEndKey() +TEST_CASE_METHOD(GridTestCase, "Grid::SelectUsingEndKey", "[grid]") { #if wxUSE_UIACTIONSIMULATOR + if ( !EnableUITests() ) + return; + wxUIActionSimulator sim; m_grid->AppendCols(10); @@ -728,7 +656,7 @@ void GridTestCase::SelectUsingEndKey() #endif } -void GridTestCase::AddRowCol() +TEST_CASE_METHOD(GridTestCase, "Grid::AddRowCol", "[grid]") { CPPUNIT_ASSERT_EQUAL(10, m_grid->GetNumberRows()); CPPUNIT_ASSERT_EQUAL(2, m_grid->GetNumberCols()); @@ -752,8 +680,11 @@ void GridTestCase::AddRowCol() CPPUNIT_ASSERT_EQUAL(7, m_grid->GetNumberCols()); } -void GridTestCase::DeleteAndAddRowCol() +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()); @@ -781,8 +712,12 @@ void GridTestCase::DeleteAndAddRowCol() m_grid->AppendRows(5); } -void GridTestCase::ColumnOrder() +TEST_CASE_METHOD(GridTestCase, "Grid::ColumnOrder", "[grid]") { + SECTION("Default") {} + SECTION("Native header") { m_grid->UseNativeColHeader(); } + SECTION("Native labels") { m_grid->SetUseNativeColLabels(); } + m_grid->AppendCols(2); CPPUNIT_ASSERT_EQUAL(4, m_grid->GetNumberCols()); @@ -813,7 +748,7 @@ void GridTestCase::ColumnOrder() CPPUNIT_ASSERT_EQUAL(3, m_grid->GetColPos(3)); } -void GridTestCase::ColumnVisibility() +TEST_CASE_METHOD(GridTestCase, "Grid::ColumnVisibility", "[grid]") { m_grid->AppendCols(3); CPPUNIT_ASSERT( m_grid->IsColShown(1) ); @@ -826,7 +761,7 @@ void GridTestCase::ColumnVisibility() CPPUNIT_ASSERT( m_grid->IsColShown(1) ); } -void GridTestCase::LineFormatting() +TEST_CASE_METHOD(GridTestCase, "Grid::LineFormatting", "[grid]") { CPPUNIT_ASSERT(m_grid->GridLinesEnabled()); @@ -841,7 +776,7 @@ void GridTestCase::LineFormatting() CPPUNIT_ASSERT_EQUAL(m_grid->GetGridLineColour(), *wxRED); } -void GridTestCase::SortSupport() +TEST_CASE_METHOD(GridTestCase, "Grid::SortSupport", "[grid]") { CPPUNIT_ASSERT_EQUAL(wxNOT_FOUND, m_grid->GetSortingColumn()); @@ -863,7 +798,7 @@ void GridTestCase::SortSupport() CPPUNIT_ASSERT(!m_grid->IsSortingBy(1)); } -void GridTestCase::Labels() +TEST_CASE_METHOD(GridTestCase, "Grid::Labels", "[grid]") { CPPUNIT_ASSERT_EQUAL("A", m_grid->GetColLabelValue(0)); CPPUNIT_ASSERT_EQUAL("1", m_grid->GetRowLabelValue(0)); @@ -886,7 +821,7 @@ void GridTestCase::Labels() static_cast(m_grid->GetColLabelTextOrientation())); } -void GridTestCase::SelectionMode() +TEST_CASE_METHOD(GridTestCase, "Grid::SelectionMode", "[grid]") { //We already test this mode in Select CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectCells, @@ -918,7 +853,7 @@ void GridTestCase::SelectionMode() m_grid->GetSelectionMode()); } -void GridTestCase::CellFormatting() +TEST_CASE_METHOD(GridTestCase, "Grid::CellFormatting", "[grid]") { //Check that initial alignment is default int horiz, cellhoriz, vert, cellvert; @@ -963,7 +898,7 @@ void GridTestCase::CellFormatting() CPPUNIT_ASSERT_EQUAL(*wxGREEN, m_grid->GetCellTextColour(0, 0)); } -void GridTestCase::GetNonDefaultAlignment() +TEST_CASE_METHOD(GridTestCase, "Grid::GetNonDefaultAlignment", "[grid]") { // GetNonDefaultAlignment() is used by several renderers having their own // preferred alignment, so check that if we don't reset the alignment @@ -996,9 +931,12 @@ void GridTestCase::GetNonDefaultAlignment() CHECK( vAlign == wxALIGN_CENTRE_VERTICAL ); } -void GridTestCase::Editable() +TEST_CASE_METHOD(GridTestCase, "Grid::Editable", "[grid]") { #if wxUSE_UIACTIONSIMULATOR + if ( !EnableUITests() ) + return; + //As the grid is not editable we shouldn't create an editor EventCounter created(m_grid, wxEVT_GRID_EDITOR_CREATED); @@ -1023,9 +961,12 @@ void GridTestCase::Editable() #endif } -void GridTestCase::ReadOnly() +TEST_CASE_METHOD(GridTestCase, "Grid::ReadOnly", "[grid]") { #if wxUSE_UIACTIONSIMULATOR + if ( !EnableUITests() ) + return; + //As the cell is readonly we shouldn't create an editor EventCounter created(m_grid, wxEVT_GRID_EDITOR_CREATED); @@ -1062,9 +1003,12 @@ void GridTestCase::ReadOnly() #endif } -void GridTestCase::WindowAsEditorControl() +TEST_CASE_METHOD(GridTestCase, "Grid::WindowAsEditorControl", "[grid]") { #if wxUSE_UIACTIONSIMULATOR + if ( !EnableUITests() ) + return; + // A very simple editor using a window not derived from wxControl as the // editor. class TestEditor : public wxGridCellEditor @@ -1122,10 +1066,16 @@ void GridTestCase::WindowAsEditorControl() #endif } -void GridTestCase::ResizeScrolledHeader() +TEST_CASE_METHOD(GridTestCase, "Grid::ResizeScrolledHeader", "[grid]") { // TODO this test currently works only under Windows unfortunately #if wxUSE_UIACTIONSIMULATOR && defined(__WXMSW__) + if ( !EnableUITests() ) + return; + + SECTION("Default") {} + SECTION("Native header") { m_grid->UseNativeColHeader(); } + int const startwidth = m_grid->GetColSize(0); int const draglength = 100; @@ -1161,10 +1111,16 @@ void GridTestCase::ResizeScrolledHeader() #endif } -void GridTestCase::ColumnMinWidth() +TEST_CASE_METHOD(GridTestCase, "Grid::ColumnMinWidth", "[grid]") { // TODO this test currently works only under Windows unfortunately #if wxUSE_UIACTIONSIMULATOR && defined(__WXMSW__) + if ( !EnableUITests() ) + return; + + SECTION("Default") {} + SECTION("Native header") { m_grid->UseNativeColHeader(); } + int const startminwidth = m_grid->GetColMinimalAcceptableWidth(); m_grid->SetColMinimalAcceptableWidth(startminwidth*2); int const newminwidth = m_grid->GetColMinimalAcceptableWidth(); @@ -1207,8 +1163,12 @@ void GridTestCase::CheckFirstColAutoSize(int expected) CHECK(m_grid->GetColSize(0) == expected); } -void GridTestCase::AutoSizeColumn() +TEST_CASE_METHOD(GridTestCase, "Grid::AutoSizeColumn", "[grid]") { + SECTION("Default") {} + SECTION("Native header") { m_grid->UseNativeColHeader(); } + SECTION("Native labels") { m_grid->SetUseNativeColLabels(); } + // Hardcoded extra margin for the columns used in grid.cpp. const int margin = m_grid->FromDIP(10); From 702ba585904336db034054afc14385fa7d5d0af8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 11 Mar 2020 02:05:30 +0100 Subject: [PATCH 3/3] 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. --- tests/controls/gridtest.cpp | 260 ++++++++++++++++++------------------ 1 file changed, 128 insertions(+), 132 deletions(-) diff --git a/tests/controls/gridtest.cpp b/tests/controls/gridtest.cpp index 14c01a8be6..a8d2bf1a89 100644 --- a/tests/controls/gridtest.cpp +++ b/tests/controls/gridtest.cpp @@ -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(wxVERTICAL), - static_cast(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(wxALIGN_CENTRE), cellhoriz); - CPPUNIT_ASSERT_EQUAL(static_cast(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(wxALIGN_LEFT), cellhoriz); - CPPUNIT_ASSERT_EQUAL(static_cast(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 }