1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/gridtest.cpp
3 // Purpose: wxGrid unit test
4 // Author: Steven Lamerton
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
23 #include "testableframe.h"
24 #include "asserthelper.h"
25 #include "wx/uiaction.h"
27 // FIXME: A lot of mouse-related tests sporadically fail in wxGTK. This happens
28 // almost all the time but sometimes the tests do pass and the failure
29 // doesn't happen when debugging so this looks like some kind of event
30 // dispatching/simulating problem rather than a real problem in wxGrid.
32 // Just disable these tests for now but it would be really great to
33 // really fix the problem.
35 #define NONGTK_TEST(test)
37 #define NONGTK_TEST(test) WXUISIM_TEST(test)
41 class GridTestCase
: public CppUnit::TestCase
47 virtual void tearDown();
50 CPPUNIT_TEST_SUITE( GridTestCase
);
51 WXUISIM_TEST( CellEdit
);
52 NONGTK_TEST( CellClick
);
53 NONGTK_TEST( CellSelect
);
54 NONGTK_TEST( LabelClick
);
55 NONGTK_TEST( SortClick
);
57 NONGTK_TEST( RangeSelect
);
58 CPPUNIT_TEST( Cursor
);
59 CPPUNIT_TEST( Selection
);
60 CPPUNIT_TEST( AddRowCol
);
61 CPPUNIT_TEST( ColumnOrder
);
62 CPPUNIT_TEST( LineFormatting
);
63 CPPUNIT_TEST( SortSupport
);
64 CPPUNIT_TEST( Labels
);
65 CPPUNIT_TEST( SelectionMode
);
66 CPPUNIT_TEST( CellFormatting
);
67 WXUISIM_TEST( Editable
);
68 WXUISIM_TEST( ReadOnly
);
69 CPPUNIT_TEST( PseudoTest_NativeHeader
);
70 NONGTK_TEST( LabelClick
);
71 NONGTK_TEST( SortClick
);
72 CPPUNIT_TEST( ColumnOrder
);
73 CPPUNIT_TEST( PseudoTest_NativeLabels
);
74 NONGTK_TEST( LabelClick
);
75 NONGTK_TEST( SortClick
);
76 CPPUNIT_TEST( ColumnOrder
);
77 CPPUNIT_TEST_SUITE_END();
90 void LineFormatting();
94 void CellFormatting();
97 void PseudoTest_NativeHeader() { ms_nativeheader
= true; }
98 void PseudoTest_NativeLabels() { ms_nativeheader
= false;
99 ms_nativelabels
= true; }
101 static bool ms_nativeheader
;
102 static bool ms_nativelabels
;
106 DECLARE_NO_COPY_CLASS(GridTestCase
)
109 // register in the unnamed registry so that these tests are run by default
110 CPPUNIT_TEST_SUITE_REGISTRATION( GridTestCase
);
112 // also include in its own registry so that these tests can be run alone
113 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( GridTestCase
, "GridTestCase" );
115 //initialise the static variable
116 bool GridTestCase::ms_nativeheader
= false;
117 bool GridTestCase::ms_nativelabels
= false;
119 void GridTestCase::setUp()
121 m_grid
= new wxGrid(wxTheApp
->GetTopWindow(), wxID_ANY
);
122 m_grid
->CreateGrid(10, 2);
123 m_grid
->SetSize(400, 200);
125 if( ms_nativeheader
)
126 m_grid
->UseNativeColHeader();
128 if( ms_nativelabels
)
129 m_grid
->SetUseNativeColLabels();
135 void GridTestCase::tearDown()
137 // This is just a hack to continue the rest of the tests to run: if we
138 // destroy the header control while it has capture, this results in an
139 // assert failure and while handling an exception from it more bad things
140 // happen (as it's thrown from a dtor), resulting in simply aborting
141 // everything. So ensure that it doesn't have capture in any case.
143 // Of course, the right thing to do would be to understand why does it
144 // still have capture when the grid is destroyed sometimes.
145 wxWindow
* const win
= wxWindow::GetCapture();
152 void GridTestCase::CellEdit()
154 #if wxUSE_UIACTIONSIMULATOR
155 EventCounter
changing(m_grid
, wxEVT_GRID_CELL_CHANGING
);
156 EventCounter
changed(m_grid
, wxEVT_GRID_CELL_CHANGED
);
157 EventCounter
created(m_grid
, wxEVT_GRID_EDITOR_CREATED
);
159 wxUIActionSimulator sim
;
162 m_grid
->SetGridCursor(1, 1);
163 m_grid
->ShowCellEditControl();
166 sim
.Char(WXK_RETURN
);
170 CPPUNIT_ASSERT_EQUAL(1, created
.GetCount());
171 CPPUNIT_ASSERT_EQUAL(1, changing
.GetCount());
172 CPPUNIT_ASSERT_EQUAL(1, changed
.GetCount());
176 void GridTestCase::CellClick()
178 #if wxUSE_UIACTIONSIMULATOR
179 EventCounter
lclick(m_grid
, wxEVT_GRID_CELL_LEFT_CLICK
);
180 EventCounter
ldclick(m_grid
, wxEVT_GRID_CELL_LEFT_DCLICK
);
181 EventCounter
rclick(m_grid
, wxEVT_GRID_CELL_RIGHT_CLICK
);
182 EventCounter
rdclick(m_grid
, wxEVT_GRID_CELL_RIGHT_DCLICK
);
185 wxUIActionSimulator sim
;
187 wxRect rect
= m_grid
->CellToRect(0, 0);
188 wxPoint point
= m_grid
->CalcScrolledPosition(rect
.GetPosition());
189 point
= m_grid
->ClientToScreen(point
+ wxPoint(m_grid
->GetRowLabelSize(),
190 m_grid
->GetColLabelSize())
193 sim
.MouseMove(point
);
199 CPPUNIT_ASSERT_EQUAL(1, lclick
.GetCount());
205 //A double click event sends a single click event first
206 //test to ensure this still happens in the future
207 CPPUNIT_ASSERT_EQUAL(1, lclick
.GetCount());
208 CPPUNIT_ASSERT_EQUAL(1, ldclick
.GetCount());
210 sim
.MouseClick(wxMOUSE_BTN_RIGHT
);
213 CPPUNIT_ASSERT_EQUAL(1, rclick
.GetCount());
216 sim
.MouseDblClick(wxMOUSE_BTN_RIGHT
);
219 CPPUNIT_ASSERT_EQUAL(1, rclick
.GetCount());
220 CPPUNIT_ASSERT_EQUAL(1, rdclick
.GetCount());
224 void GridTestCase::CellSelect()
226 #if wxUSE_UIACTIONSIMULATOR
227 EventCounter
cell(m_grid
, wxEVT_GRID_SELECT_CELL
);
229 wxUIActionSimulator sim
;
231 wxRect rect
= m_grid
->CellToRect(0, 0);
232 wxPoint point
= m_grid
->CalcScrolledPosition(rect
.GetPosition());
233 point
= m_grid
->ClientToScreen(point
+ wxPoint(m_grid
->GetRowLabelSize(),
234 m_grid
->GetColLabelSize())
237 sim
.MouseMove(point
);
243 CPPUNIT_ASSERT_EQUAL(1, cell
.GetCount());
247 m_grid
->SetGridCursor(1, 1);
248 m_grid
->GoToCell(1, 0);
250 sim
.MouseMove(point
);
256 CPPUNIT_ASSERT_EQUAL(3, cell
.GetCount());
260 void GridTestCase::LabelClick()
262 #if wxUSE_UIACTIONSIMULATOR
263 EventCounter
lclick(m_grid
, wxEVT_GRID_LABEL_LEFT_CLICK
);
264 EventCounter
ldclick(m_grid
, wxEVT_GRID_LABEL_LEFT_DCLICK
);
265 EventCounter
rclick(m_grid
, wxEVT_GRID_LABEL_RIGHT_CLICK
);
266 EventCounter
rdclick(m_grid
, wxEVT_GRID_LABEL_RIGHT_DCLICK
);
268 wxUIActionSimulator sim
;
270 wxPoint
pos(m_grid
->GetRowLabelSize() + 2, 2);
271 pos
= m_grid
->ClientToScreen(pos
);
279 CPPUNIT_ASSERT_EQUAL(1, lclick
.GetCount());
284 CPPUNIT_ASSERT_EQUAL(1, ldclick
.GetCount());
286 sim
.MouseClick(wxMOUSE_BTN_RIGHT
);
289 CPPUNIT_ASSERT_EQUAL(1, rclick
.GetCount());
292 sim
.MouseDblClick(wxMOUSE_BTN_RIGHT
);
295 if( ms_nativeheader
)
297 //Right double click not supported with native headers so we get two
299 CPPUNIT_ASSERT_EQUAL(2, rclick
.GetCount());
303 CPPUNIT_ASSERT_EQUAL(1, rclick
.GetCount());
304 CPPUNIT_ASSERT_EQUAL(1, rdclick
.GetCount());
309 void GridTestCase::SortClick()
311 #if wxUSE_UIACTIONSIMULATOR
312 m_grid
->SetSortingColumn(0);
314 EventCounter
sort(m_grid
, wxEVT_GRID_COL_SORT
);
316 wxUIActionSimulator sim
;
318 wxPoint
pos(m_grid
->GetRowLabelSize() + 4, 4);
319 pos
= m_grid
->ClientToScreen(pos
);
327 CPPUNIT_ASSERT_EQUAL(1, sort
.GetCount());
331 void GridTestCase::Size()
333 #if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
334 EventCounter
colsize(m_grid
, wxEVT_GRID_COL_SIZE
);
335 EventCounter
rowsize(m_grid
, wxEVT_GRID_ROW_SIZE
);
337 wxUIActionSimulator sim
;
339 wxPoint pt
= m_grid
->ClientToScreen(wxPoint(m_grid
->GetRowLabelSize() +
340 m_grid
->GetColSize(0), 5));
348 sim
.MouseMove(pt
.x
+ 50, pt
.y
);
354 CPPUNIT_ASSERT_EQUAL(1, colsize
.GetCount());
356 pt
= m_grid
->ClientToScreen(wxPoint(5, m_grid
->GetColLabelSize() +
357 m_grid
->GetRowSize(0)));
359 sim
.MouseDragDrop(pt
.x
, pt
.y
, pt
.x
, pt
.y
+ 50);
362 CPPUNIT_ASSERT_EQUAL(1, rowsize
.GetCount());
366 void GridTestCase::RangeSelect()
368 #if wxUSE_UIACTIONSIMULATOR
369 EventCounter
select(m_grid
, wxEVT_GRID_RANGE_SELECT
);
371 wxUIActionSimulator sim
;
373 //We add the extra 10 to ensure that we are inside the cell
374 wxPoint pt
= m_grid
->ClientToScreen(wxPoint(m_grid
->GetRowLabelSize() + 10,
375 m_grid
->GetColLabelSize() + 10)
384 sim
.MouseMove(pt
.x
+ 50, pt
.y
+ 50);
390 CPPUNIT_ASSERT_EQUAL(1, select
.GetCount());
394 void GridTestCase::Cursor()
396 m_grid
->SetGridCursor(1, 1);
398 CPPUNIT_ASSERT_EQUAL(1, m_grid
->GetGridCursorCol());
399 CPPUNIT_ASSERT_EQUAL(1, m_grid
->GetGridCursorRow());
401 m_grid
->MoveCursorDown(false);
402 m_grid
->MoveCursorLeft(false);
403 m_grid
->MoveCursorUp(false);
404 m_grid
->MoveCursorUp(false);
405 m_grid
->MoveCursorRight(false);
407 CPPUNIT_ASSERT_EQUAL(1, m_grid
->GetGridCursorCol());
408 CPPUNIT_ASSERT_EQUAL(0, m_grid
->GetGridCursorRow());
410 m_grid
->SetCellValue(0, 0, "some text");
411 m_grid
->SetCellValue(3, 0, "other text");
412 m_grid
->SetCellValue(0, 1, "more text");
413 m_grid
->SetCellValue(3, 1, "extra text");
418 m_grid
->MoveCursorLeftBlock(false);
420 CPPUNIT_ASSERT_EQUAL(0, m_grid
->GetGridCursorCol());
421 CPPUNIT_ASSERT_EQUAL(0, m_grid
->GetGridCursorRow());
423 m_grid
->MoveCursorDownBlock(false);
425 CPPUNIT_ASSERT_EQUAL(0, m_grid
->GetGridCursorCol());
426 CPPUNIT_ASSERT_EQUAL(3, m_grid
->GetGridCursorRow());
428 m_grid
->MoveCursorRightBlock(false);
430 CPPUNIT_ASSERT_EQUAL(1, m_grid
->GetGridCursorCol());
431 CPPUNIT_ASSERT_EQUAL(3, m_grid
->GetGridCursorRow());
433 m_grid
->MoveCursorUpBlock(false);
435 CPPUNIT_ASSERT_EQUAL(1, m_grid
->GetGridCursorCol());
436 CPPUNIT_ASSERT_EQUAL(0, m_grid
->GetGridCursorRow());
439 void GridTestCase::Selection()
443 CPPUNIT_ASSERT(m_grid
->IsSelection());
444 CPPUNIT_ASSERT(m_grid
->IsInSelection(0, 0));
445 CPPUNIT_ASSERT(m_grid
->IsInSelection(9, 1));
447 m_grid
->SelectBlock(1, 0, 3, 1);
449 wxGridCellCoordsArray topleft
= m_grid
->GetSelectionBlockTopLeft();
450 wxGridCellCoordsArray bottomright
= m_grid
->GetSelectionBlockBottomRight();
452 CPPUNIT_ASSERT_EQUAL(1, topleft
.Count());
453 CPPUNIT_ASSERT_EQUAL(1, bottomright
.Count());
455 CPPUNIT_ASSERT_EQUAL(0, topleft
.Item(0).GetCol());
456 CPPUNIT_ASSERT_EQUAL(1, topleft
.Item(0).GetRow());
457 CPPUNIT_ASSERT_EQUAL(1, bottomright
.Item(0).GetCol());
458 CPPUNIT_ASSERT_EQUAL(3, bottomright
.Item(0).GetRow());
460 m_grid
->SelectCol(1);
462 CPPUNIT_ASSERT(m_grid
->IsInSelection(0, 1));
463 CPPUNIT_ASSERT(m_grid
->IsInSelection(9, 1));
464 CPPUNIT_ASSERT(!m_grid
->IsInSelection(3, 0));
466 m_grid
->SelectRow(4);
468 CPPUNIT_ASSERT(m_grid
->IsInSelection(4, 0));
469 CPPUNIT_ASSERT(m_grid
->IsInSelection(4, 1));
470 CPPUNIT_ASSERT(!m_grid
->IsInSelection(3, 0));
473 void GridTestCase::AddRowCol()
475 CPPUNIT_ASSERT_EQUAL(10, m_grid
->GetNumberRows());
476 CPPUNIT_ASSERT_EQUAL(2, m_grid
->GetNumberCols());
478 m_grid
->AppendCols();
479 m_grid
->AppendRows();
481 CPPUNIT_ASSERT_EQUAL(11, m_grid
->GetNumberRows());
482 CPPUNIT_ASSERT_EQUAL(3, m_grid
->GetNumberCols());
484 m_grid
->AppendCols(2);
485 m_grid
->AppendRows(2);
487 CPPUNIT_ASSERT_EQUAL(13, m_grid
->GetNumberRows());
488 CPPUNIT_ASSERT_EQUAL(5, m_grid
->GetNumberCols());
490 m_grid
->InsertCols(1, 2);
491 m_grid
->InsertRows(2, 3);
493 CPPUNIT_ASSERT_EQUAL(16, m_grid
->GetNumberRows());
494 CPPUNIT_ASSERT_EQUAL(7, m_grid
->GetNumberCols());
497 void GridTestCase::ColumnOrder()
499 m_grid
->AppendCols(2);
501 CPPUNIT_ASSERT_EQUAL(4, m_grid
->GetNumberCols());
504 neworder
.push_back(1);
505 neworder
.push_back(3);
506 neworder
.push_back(2);
507 neworder
.push_back(0);
509 m_grid
->SetColumnsOrder(neworder
);
511 CPPUNIT_ASSERT_EQUAL(0, m_grid
->GetColPos(1));
512 CPPUNIT_ASSERT_EQUAL(1, m_grid
->GetColPos(3));
513 CPPUNIT_ASSERT_EQUAL(2, m_grid
->GetColPos(2));
514 CPPUNIT_ASSERT_EQUAL(3, m_grid
->GetColPos(0));
516 CPPUNIT_ASSERT_EQUAL(1, m_grid
->GetColAt(0));
517 CPPUNIT_ASSERT_EQUAL(3, m_grid
->GetColAt(1));
518 CPPUNIT_ASSERT_EQUAL(2, m_grid
->GetColAt(2));
519 CPPUNIT_ASSERT_EQUAL(0, m_grid
->GetColAt(3));
521 m_grid
->ResetColPos();
523 CPPUNIT_ASSERT_EQUAL(0, m_grid
->GetColPos(0));
524 CPPUNIT_ASSERT_EQUAL(1, m_grid
->GetColPos(1));
525 CPPUNIT_ASSERT_EQUAL(2, m_grid
->GetColPos(2));
526 CPPUNIT_ASSERT_EQUAL(3, m_grid
->GetColPos(3));
529 void GridTestCase::LineFormatting()
531 CPPUNIT_ASSERT(m_grid
->GridLinesEnabled());
533 m_grid
->EnableGridLines(false);
535 CPPUNIT_ASSERT(!m_grid
->GridLinesEnabled());
537 m_grid
->EnableGridLines();
539 m_grid
->SetGridLineColour(*wxRED
);
541 CPPUNIT_ASSERT_EQUAL(m_grid
->GetGridLineColour(), *wxRED
);
544 void GridTestCase::SortSupport()
546 CPPUNIT_ASSERT_EQUAL(wxNOT_FOUND
, m_grid
->GetSortingColumn());
548 m_grid
->SetSortingColumn(1);
550 CPPUNIT_ASSERT(!m_grid
->IsSortingBy(0));
551 CPPUNIT_ASSERT(m_grid
->IsSortingBy(1));
552 CPPUNIT_ASSERT(m_grid
->IsSortOrderAscending());
554 m_grid
->SetSortingColumn(0, false);
556 CPPUNIT_ASSERT(m_grid
->IsSortingBy(0));
557 CPPUNIT_ASSERT(!m_grid
->IsSortingBy(1));
558 CPPUNIT_ASSERT(!m_grid
->IsSortOrderAscending());
560 m_grid
->UnsetSortingColumn();
562 CPPUNIT_ASSERT(!m_grid
->IsSortingBy(0));
563 CPPUNIT_ASSERT(!m_grid
->IsSortingBy(1));
566 void GridTestCase::Labels()
568 CPPUNIT_ASSERT_EQUAL("A", m_grid
->GetColLabelValue(0));
569 CPPUNIT_ASSERT_EQUAL("1", m_grid
->GetRowLabelValue(0));
571 m_grid
->SetColLabelValue(0, "Column 1");
572 m_grid
->SetRowLabelValue(0, "Row 1");
574 CPPUNIT_ASSERT_EQUAL("Column 1", m_grid
->GetColLabelValue(0));
575 CPPUNIT_ASSERT_EQUAL("Row 1", m_grid
->GetRowLabelValue(0));
577 m_grid
->SetLabelTextColour(*wxGREEN
);
578 m_grid
->SetLabelBackgroundColour(*wxRED
);
580 CPPUNIT_ASSERT_EQUAL(*wxGREEN
, m_grid
->GetLabelTextColour());
581 CPPUNIT_ASSERT_EQUAL(*wxRED
, m_grid
->GetLabelBackgroundColour());
583 m_grid
->SetColLabelTextOrientation(wxVERTICAL
);
585 CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxVERTICAL
),
586 static_cast<int>(m_grid
->GetColLabelTextOrientation()));
589 void GridTestCase::SelectionMode()
591 //We already test this mode in Select
592 CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectCells
,
593 m_grid
->GetSelectionMode());
595 //Test row selection be selecting a single cell and checking the whole
597 m_grid
->SetSelectionMode(wxGrid::wxGridSelectRows
);
598 m_grid
->SelectBlock(3, 1, 3, 1);
600 wxArrayInt selectedRows
= m_grid
->GetSelectedRows();
601 CPPUNIT_ASSERT_EQUAL(1, selectedRows
.Count());
602 CPPUNIT_ASSERT_EQUAL(3, selectedRows
[0]);
604 CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectRows
,
605 m_grid
->GetSelectionMode());
608 //Test column selection be selecting a single cell and checking the whole
610 m_grid
->SetSelectionMode(wxGrid::wxGridSelectColumns
);
611 m_grid
->SelectBlock(3, 1, 3, 1);
613 wxArrayInt selectedCols
= m_grid
->GetSelectedCols();
614 CPPUNIT_ASSERT_EQUAL(1, selectedCols
.Count());
615 CPPUNIT_ASSERT_EQUAL(1, selectedCols
[0]);
617 CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectColumns
,
618 m_grid
->GetSelectionMode());
621 void GridTestCase::CellFormatting()
623 //Check that initial alignment is default
624 int horiz
, cellhoriz
, vert
, cellvert
;
626 m_grid
->GetDefaultCellAlignment(&horiz
, &vert
);
627 m_grid
->GetCellAlignment(0, 0, &cellhoriz
, &cellvert
);
629 CPPUNIT_ASSERT_EQUAL(cellhoriz
, horiz
);
630 CPPUNIT_ASSERT_EQUAL(cellvert
, vert
);
632 //Check initial text colour and background colour are default
635 back
= m_grid
->GetDefaultCellBackgroundColour();
637 CPPUNIT_ASSERT_EQUAL(back
, m_grid
->GetCellBackgroundColour(0, 0));
639 back
= m_grid
->GetDefaultCellTextColour();
641 CPPUNIT_ASSERT_EQUAL(back
, m_grid
->GetCellTextColour(0, 0));
643 #if WXWIN_COMPATIBILITY_2_8
644 m_grid
->SetCellAlignment(wxALIGN_CENTRE
, 0, 0);
645 m_grid
->GetCellAlignment(0, 0, &cellhoriz
, &cellvert
);
647 CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_CENTRE
), cellhoriz
);
648 CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_CENTRE
), cellvert
);
649 #endif // WXWIN_COMPATIBILITY_2_8
651 m_grid
->SetCellAlignment(0, 0, wxALIGN_LEFT
, wxALIGN_BOTTOM
);
652 m_grid
->GetCellAlignment(0, 0, &cellhoriz
, &cellvert
);
654 CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_LEFT
), cellhoriz
);
655 CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_BOTTOM
), cellvert
);
657 #if WXWIN_COMPATIBILITY_2_8
658 m_grid
->SetCellTextColour(*wxRED
, 0, 0);
659 CPPUNIT_ASSERT_EQUAL(*wxRED
, m_grid
->GetCellTextColour(0, 0));
660 #endif // WXWIN_COMPATIBILITY_2_8
662 m_grid
->SetCellTextColour(0, 0, *wxGREEN
);
663 CPPUNIT_ASSERT_EQUAL(*wxGREEN
, m_grid
->GetCellTextColour(0, 0));
666 void GridTestCase::Editable()
668 #if wxUSE_UIACTIONSIMULATOR
669 //As the grid is not editable we shouldn't create an editor
670 EventCounter
created(m_grid
, wxEVT_GRID_EDITOR_CREATED
);
672 wxUIActionSimulator sim
;
674 CPPUNIT_ASSERT(m_grid
->IsEditable());
676 m_grid
->EnableEditing(false);
678 CPPUNIT_ASSERT(!m_grid
->IsEditable());
681 m_grid
->SetGridCursor(1, 1);
682 m_grid
->ShowCellEditControl();
687 sim
.Char(WXK_RETURN
);
690 CPPUNIT_ASSERT_EQUAL(0, created
.GetCount());
694 void GridTestCase::ReadOnly()
696 #if wxUSE_UIACTIONSIMULATOR
697 //As the cell is readonly we shouldn't create an editor
698 EventCounter
created(m_grid
, wxEVT_GRID_EDITOR_CREATED
);
700 wxUIActionSimulator sim
;
702 CPPUNIT_ASSERT(!m_grid
->IsReadOnly(1, 1));
704 m_grid
->SetReadOnly(1, 1);
706 CPPUNIT_ASSERT(m_grid
->IsReadOnly(1, 1));
709 m_grid
->SetGridCursor(1, 1);
711 CPPUNIT_ASSERT(m_grid
->IsCurrentCellReadOnly());
713 m_grid
->ShowCellEditControl();
718 sim
.Char(WXK_RETURN
);
721 CPPUNIT_ASSERT_EQUAL(0, created
.GetCount());