]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/strings/crt.cpp
Remove unused GetTextExtent() call from wxProgressDialog.
[wxWidgets.git] / tests / strings / crt.cpp
index c0c6600a2f4128234154336ff357037d00e38b42..e0623f6ac59a562d327184ce4f0444d38785793e 100644 (file)
@@ -44,6 +44,7 @@ public:
 private:
     CPPUNIT_TEST_SUITE( CrtTestCase );
         CPPUNIT_TEST( SetGetEnv );
+        CPPUNIT_TEST( Strchr );
         CPPUNIT_TEST( Strcmp );
         CPPUNIT_TEST( Strspn );
         CPPUNIT_TEST( Strcspn );
@@ -52,6 +53,7 @@ private:
     CPPUNIT_TEST_SUITE_END();
 
     void SetGetEnv();
+    void Strchr();
     void Strcmp();
     void Strspn();
     void Strcspn();
@@ -89,6 +91,19 @@ void CrtTestCase::SetGetEnv()
 #undef TESTVAR_NAME
 }
 
+void CrtTestCase::Strchr()
+{
+    // test that searching for a wide character in a narrow string simply
+    // doesn't find it but doesn't fail with an assert (#11487)
+    const wxUniChar smiley = *wxString::FromUTF8("\xe2\x98\xba").begin();
+
+    CPPUNIT_ASSERT( !wxStrchr("hello", smiley) );
+
+    // but searching for an explicitly wide character does find it
+    CPPUNIT_ASSERT( wxStrchr(wxString::FromUTF8(":-) == \xe2\x98\xba"),
+                    static_cast<wchar_t>(smiley)) );
+}
+
 void CrtTestCase::Strcmp()
 {
     // this code tests if all possible ways of calling wxStrcmp() compile: