X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a41b1a1bbac9e67cfa53bdab0752ced26d4761c5..c2f8c2b245959f612f0ebac31ab8d80bef6ea9e2:/tests/graphics/ellipsization.cpp diff --git a/tests/graphics/ellipsization.cpp b/tests/graphics/ellipsization.cpp index 0522711533..bce6235ea4 100644 --- a/tests/graphics/ellipsization.cpp +++ b/tests/graphics/ellipsization.cpp @@ -3,7 +3,6 @@ // Purpose: wxControlBase::*Ellipsize* unit test // Author: Francesco Montorsi // Created: 2010-03-10 -// RCS-ID: $Id$ // Copyright: (c) 2010 Francesco Montorsi /////////////////////////////////////////////////////////////////////////////// @@ -31,10 +30,16 @@ public: private: CPPUNIT_TEST_SUITE( EllipsizationTestCase ); - CPPUNIT_TEST( Ellipsize ); + CPPUNIT_TEST( NormalCase ); + CPPUNIT_TEST( EnoughSpace ); + CPPUNIT_TEST( VeryLittleSpace ); + CPPUNIT_TEST( HasThreeDots ); CPPUNIT_TEST_SUITE_END(); - void Ellipsize(); + void NormalCase(); + void EnoughSpace(); + void VeryLittleSpace(); + void HasThreeDots(); DECLARE_NO_COPY_CLASS(EllipsizationTestCase) }; @@ -42,37 +47,125 @@ private: // register in the unnamed registry so that these tests are run by default CPPUNIT_TEST_SUITE_REGISTRATION( EllipsizationTestCase ); -// 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( EllipsizationTestCase, "EllipsizationTestCase" ); -void EllipsizationTestCase::Ellipsize() +void EllipsizationTestCase::NormalCase() { 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 }; - int widthsToTest[] = { 0, 1, 2, 3, 10, 20, 100 }; - - for (unsigned int s=0; s