]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/graphics/ellipsization.cpp
Remove USE_GDIPLUS setting from bakefiles.
[wxWidgets.git] / tests / graphics / ellipsization.cpp
index 05227115337999186f88f200d8a3320713f97e41..84fdbd3206d41768981cf4593cbdbb2a694b5256 100644 (file)
@@ -49,30 +49,66 @@ void EllipsizationTestCase::Ellipsize()
 {
     wxMemoryDC dc;
 
-    wxString stringsToTest[] = 
-    { 
-        "N", ".", "x", "foobar", wxS("\u03B1"), "Another test", "a very very very very very very very long string",
-        "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5\xCE\xB6\xCE\xB7\xCE\xB8\xCE\xB9", 
-            // alpha+beta+gamma+delta+epsilon+zeta+eta+theta+iota
+    static const char *stringsToTest[] =
+    {
+        "N",
+        ".",
+        "x",
+        "foobar",
+        "\xCE\xB1", // U03B1 (GREEK SMALL LETTER ALPHA)
+        "Another test",
+        "a very very very very very very very long string",
+        // alpha+beta+gamma+delta+epsilon+zeta+eta+theta+iota
+        "\xCE\xB1\xCE\xB2\xCE\xB3\xCE\xB4\xCE\xB5\xCE\xB6\xCE\xB7\xCE\xB8\xCE\xB9",
         "\t", "\t\t\t\t\t", "a\tstring\twith\ttabs",
         "\n", "\n\n\n\n\n", "a\nstring\nwith\nnewlines",
         "&", "&&&&&&&", "a&string&with&newlines",
         "\t\n&", "a\t\n&string\t\n&with\t\n&many\t\n&chars"
     };
-    int flagsToTest[] = { 0, wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS, wxELLIPSIZE_FLAGS_EXPAND_TABS, 
-                          wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS|wxELLIPSIZE_FLAGS_EXPAND_TABS };
-    wxEllipsizeMode modesToTest[] = { wxELLIPSIZE_START, wxELLIPSIZE_MIDDLE, wxELLIPSIZE_END };
+
+    static const int flagsToTest[] =
+    {
+        0,
+        wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS,
+        wxELLIPSIZE_FLAGS_EXPAND_TABS,
+        wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS | wxELLIPSIZE_FLAGS_EXPAND_TABS
+    };
+
+    static const wxEllipsizeMode modesToTest[] =
+    {
+        wxELLIPSIZE_START,
+        wxELLIPSIZE_MIDDLE,
+        wxELLIPSIZE_END
+    };
+
     int widthsToTest[] = { 0, 1, 2, 3, 10, 20, 100 };
 
-    for (unsigned int s=0; s<WXSIZEOF(stringsToTest); s++)
-        for (unsigned int f=0; f<WXSIZEOF(flagsToTest); f++)
-            for (unsigned int m=0; m<WXSIZEOF(modesToTest); m++)
-                for (unsigned int w=0; w<WXSIZEOF(widthsToTest); w++)
+    for ( unsigned int s = 0; s < WXSIZEOF(stringsToTest); s++ )
+    {
+        const wxString str = wxString::FromUTF8(stringsToTest[s]);
+
+        for ( unsigned int  f = 0; f < WXSIZEOF(flagsToTest); f++ )
+        {
+            for ( unsigned int m = 0; m < WXSIZEOF(modesToTest); m++ )
+            {
+                for ( unsigned int w = 0; w < WXSIZEOF(widthsToTest); w++ )
                 {
-                    wxString ret = wxControlBase::Ellipsize(stringsToTest[s], dc, modesToTest[m], 
-                                                            widthsToTest[w], flagsToTest[f]);
+                    wxString ret = wxControlBase::Ellipsize
+                                   (
+                                    str,
+                                    dc,
+                                    modesToTest[m],
+                                    widthsToTest[w],
+                                    flagsToTest[f]
+                                   );
 
-                    CPPUNIT_ASSERT_MESSAGE((std::string)("invalid ellipsization for: " + stringsToTest[s]),
-                                           dc.GetMultiLineTextExtent(ret).GetWidth() <= widthsToTest[w]);
+                    WX_ASSERT_MESSAGE
+                    (
+                     ("invalid ellipsization for \"%s\"", str),
+                     dc.GetMultiLineTextExtent(ret).GetWidth() <= widthsToTest[w]
+                    );
                 }
+            }
+        }
+    }
 }