]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/controls/checklistboxtest.cpp
applying editor part of patch, see #15003
[wxWidgets.git] / tests / controls / checklistboxtest.cpp
index 86f03482241a5810584a8cb6bd2d7f00fc96238b..eb3c9bf52fc58a60453110ebb6b50e720bf839c5 100644 (file)
@@ -50,7 +50,7 @@ private:
 // register in the unnamed registry so that these tests are run by default
 CPPUNIT_TEST_SUITE_REGISTRATION( CheckListBoxTestCase );
 
-// 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( CheckListBoxTestCase, "CheckListBoxTestCase" );
 
 void CheckListBoxTestCase::setUp()
@@ -65,11 +65,9 @@ void CheckListBoxTestCase::tearDown()
 
 void CheckListBoxTestCase::Check()
 {
-   wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
-                                          wxTestableFrame);
-
-    EventCounter count(m_check, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED);
+    EventCounter toggled(m_check, wxEVT_CHECKLISTBOX);
 
+    wxArrayInt checkedItems;
     wxArrayString testitems;
     testitems.Add("item 0");
     testitems.Add("item 1");
@@ -83,10 +81,13 @@ void CheckListBoxTestCase::Check()
     m_check->Check(1, false);
 
     //We should not get any events when changing this from code
-    CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+    CPPUNIT_ASSERT_EQUAL(0, toggled.GetCount());
     CPPUNIT_ASSERT_EQUAL(true, m_check->IsChecked(0));
     CPPUNIT_ASSERT_EQUAL(false, m_check->IsChecked(1));
 
+    CPPUNIT_ASSERT_EQUAL(1, m_check->GetCheckedItems(checkedItems));
+    CPPUNIT_ASSERT_EQUAL(0, checkedItems[0]);
+
     //Make sure a double check of an items doesn't deselect it
     m_check->Check(0);