]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/controls/itemcontainertest.cpp
Ensure that detached menus don't keep focus grab in wxGTK.
[wxWidgets.git] / tests / controls / itemcontainertest.cpp
index ab8b9807fbd75e3768168c3e83f2602658ab3d9f..48944ad0a87c55ce1c9d50e9a874ff0e5f85c29b 100644 (file)
@@ -170,6 +170,9 @@ void ItemContainerTestCase::ClientData()
 
     CPPUNIT_ASSERT_EQUAL(static_cast<wxClientData*>(item2data),
                          container->GetClientObject(2));
 
     CPPUNIT_ASSERT_EQUAL(static_cast<wxClientData*>(item2data),
                          container->GetClientObject(2));
+
+    WX_ASSERT_FAILS_WITH_ASSERT( container->SetClientObject((unsigned)-1, item0data) );
+    WX_ASSERT_FAILS_WITH_ASSERT( container->SetClientObject(12345, item0data) );
 }
 
 void ItemContainerTestCase::VoidData()
 }
 
 void ItemContainerTestCase::VoidData()
@@ -195,6 +198,9 @@ void ItemContainerTestCase::VoidData()
     container->Insert("item 2", 2, item2);
 
     CPPUNIT_ASSERT_EQUAL(item2, container->GetClientData(2));
     container->Insert("item 2", 2, item2);
 
     CPPUNIT_ASSERT_EQUAL(item2, container->GetClientData(2));
+
+    WX_ASSERT_FAILS_WITH_ASSERT( container->SetClientData((unsigned)-1, NULL) );
+    WX_ASSERT_FAILS_WITH_ASSERT( container->SetClientData(12345, NULL) );
 }
 
 void ItemContainerTestCase::Set()
 }
 
 void ItemContainerTestCase::Set()
@@ -238,13 +244,16 @@ void ItemContainerTestCase::SetString()
 
     container->Append(testitems);
 
 
     container->Append(testitems);
 
+    container->SetSelection(0);
     container->SetString(0, "new item 0");
     container->SetString(0, "new item 0");
-#ifndef __WXOSX__
-    container->SetString(2, "");
-#endif
-
     CPPUNIT_ASSERT_EQUAL("new item 0", container->GetString(0));
     CPPUNIT_ASSERT_EQUAL("new item 0", container->GetString(0));
+
+    // Modifying the item shouldn't deselect it.
+    CPPUNIT_ASSERT_EQUAL(0, container->GetSelection());
+
+    // wxOSX doesn't support having empty items in some containers.
 #ifndef __WXOSX__
 #ifndef __WXOSX__
+    container->SetString(2, "");
     CPPUNIT_ASSERT_EQUAL("", container->GetString(2));
 #endif
 }
     CPPUNIT_ASSERT_EQUAL("", container->GetString(2));
 #endif
 }