]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/controls/gridtest.cpp
Fix the size of the font returned from wxTextCtrl::GetStyle() in wxMSW.
[wxWidgets.git] / tests / controls / gridtest.cpp
index fca5d58340b33c77f409673bb45ff8824f7752c9..34da0de16fd5d1de00f8486c3860081d7ad4588b 100644 (file)
@@ -95,7 +95,7 @@ private:
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( GridTestCase );
 
-// also include in it's own registry so that these tests can be run alone
+// 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
@@ -238,7 +238,7 @@ void GridTestCase::CellSelect()
 
 void GridTestCase::LabelClick()
 {
-#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
+#if wxUSE_UIACTIONSIMULATOR
     wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
                                           wxTestableFrame);
 
@@ -263,9 +263,6 @@ void GridTestCase::LabelClick()
     sim.MouseDblClick();
     wxYield();
 
-    //A double click event sends a single click event first
-    //test to ensure this still happens in the future
-    CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_LEFT_CLICK));
     CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_LEFT_DCLICK));
 
     sim.MouseClick(wxMOUSE_BTN_RIGHT);
@@ -292,7 +289,7 @@ void GridTestCase::LabelClick()
 
 void GridTestCase::SortClick()
 {
-#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
+#if wxUSE_UIACTIONSIMULATOR
     m_grid->SetSortingColumn(0);
 
     wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
@@ -312,8 +309,6 @@ void GridTestCase::SortClick()
     wxYield();
 
     CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
-
-    m_grid->SetSortingColumn(wxNOT_FOUND);
 #endif
 }
 
@@ -592,16 +587,9 @@ void GridTestCase::SelectionMode()
     m_grid->SetSelectionMode(wxGrid::wxGridSelectRows);
     m_grid->SelectBlock(3, 1, 3, 1);
 
-    wxGridCellCoordsArray topleft = m_grid->GetSelectionBlockTopLeft();
-    wxGridCellCoordsArray bottomright = m_grid->GetSelectionBlockBottomRight();
-
-    CPPUNIT_ASSERT_EQUAL(1, topleft.Count());
-    CPPUNIT_ASSERT_EQUAL(1, bottomright.Count());
-
-    CPPUNIT_ASSERT_EQUAL(0, topleft.Item(0).GetCol());
-    CPPUNIT_ASSERT_EQUAL(3, topleft.Item(0).GetRow());
-    CPPUNIT_ASSERT_EQUAL(1, bottomright.Item(0).GetCol());
-    CPPUNIT_ASSERT_EQUAL(3, bottomright.Item(0).GetRow());
+    wxArrayInt selectedRows = m_grid->GetSelectedRows();
+    CPPUNIT_ASSERT_EQUAL(1, selectedRows.Count());
+    CPPUNIT_ASSERT_EQUAL(3, selectedRows[0]);
 
     CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectRows,
                          m_grid->GetSelectionMode());
@@ -612,16 +600,9 @@ void GridTestCase::SelectionMode()
     m_grid->SetSelectionMode(wxGrid::wxGridSelectColumns);
     m_grid->SelectBlock(3, 1, 3, 1);
 
-    topleft = m_grid->GetSelectionBlockTopLeft();
-    bottomright = m_grid->GetSelectionBlockBottomRight();
-
-    CPPUNIT_ASSERT_EQUAL(1, topleft.Count());
-    CPPUNIT_ASSERT_EQUAL(1, bottomright.Count());
-
-    CPPUNIT_ASSERT_EQUAL(1, topleft.Item(0).GetCol());
-    CPPUNIT_ASSERT_EQUAL(0, topleft.Item(0).GetRow());
-    CPPUNIT_ASSERT_EQUAL(1, bottomright.Item(0).GetCol());
-    CPPUNIT_ASSERT_EQUAL(9, bottomright.Item(0).GetRow());
+    wxArrayInt selectedCols = m_grid->GetSelectedCols();
+    CPPUNIT_ASSERT_EQUAL(1, selectedCols.Count());
+    CPPUNIT_ASSERT_EQUAL(1, selectedCols[0]);
 
     CPPUNIT_ASSERT_EQUAL(wxGrid::wxGridSelectColumns,
                          m_grid->GetSelectionMode());
@@ -649,11 +630,13 @@ void GridTestCase::CellFormatting()
 
     CPPUNIT_ASSERT_EQUAL(back, m_grid->GetCellTextColour(0, 0));
 
+#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);
+#endif // WXWIN_COMPATIBILITY_2_8
 
     m_grid->SetCellAlignment(0, 0, wxALIGN_LEFT, wxALIGN_BOTTOM);
     m_grid->GetCellAlignment(0, 0, &cellhoriz, &cellvert);
@@ -661,12 +644,12 @@ void GridTestCase::CellFormatting()
     CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_LEFT), cellhoriz);
     CPPUNIT_ASSERT_EQUAL(static_cast<int>(wxALIGN_BOTTOM), cellvert);
 
+#if WXWIN_COMPATIBILITY_2_8
     m_grid->SetCellTextColour(*wxRED, 0, 0);
-
     CPPUNIT_ASSERT_EQUAL(*wxRED, m_grid->GetCellTextColour(0, 0));
+#endif // WXWIN_COMPATIBILITY_2_8
 
     m_grid->SetCellTextColour(0, 0, *wxGREEN);
-
     CPPUNIT_ASSERT_EQUAL(*wxGREEN, m_grid->GetCellTextColour(0, 0));
 }