Set correct properties for the new file added in r63660.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63684 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-03-14 14:44:25 +00:00
parent b76b3d2854
commit a41b1a1bba

View File

@@ -1,78 +1,78 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Name: tests/graphics/ellipsization.cpp // Name: tests/graphics/ellipsization.cpp
// Purpose: wxControlBase::*Ellipsize* unit test // Purpose: wxControlBase::*Ellipsize* unit test
// Author: Francesco Montorsi // Author: Francesco Montorsi
// Created: 2010-03-10 // Created: 2010-03-10
// RCS-ID: $Id$ // RCS-ID: $Id$
// Copyright: (c) 2010 Francesco Montorsi // Copyright: (c) 2010 Francesco Montorsi
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// headers // headers
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#include "testprec.h" #include "testprec.h"
#ifdef __BORLANDC__ #ifdef __BORLANDC__
#pragma hdrstop #pragma hdrstop
#endif #endif
#include "wx/control.h" #include "wx/control.h"
#include "wx/dcmemory.h" #include "wx/dcmemory.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// test class // test class
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
class EllipsizationTestCase : public CppUnit::TestCase class EllipsizationTestCase : public CppUnit::TestCase
{ {
public: public:
EllipsizationTestCase() { } EllipsizationTestCase() { }
private: private:
CPPUNIT_TEST_SUITE( EllipsizationTestCase ); CPPUNIT_TEST_SUITE( EllipsizationTestCase );
CPPUNIT_TEST( Ellipsize ); CPPUNIT_TEST( Ellipsize );
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
void Ellipsize(); void Ellipsize();
DECLARE_NO_COPY_CLASS(EllipsizationTestCase) DECLARE_NO_COPY_CLASS(EllipsizationTestCase)
}; };
// register in the unnamed registry so that these tests are run by default // register in the unnamed registry so that these tests are run by default
CPPUNIT_TEST_SUITE_REGISTRATION( EllipsizationTestCase ); CPPUNIT_TEST_SUITE_REGISTRATION( EllipsizationTestCase );
// also include in it's own registry so that these tests can be run alone // also include in it's own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( EllipsizationTestCase, "EllipsizationTestCase" ); CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( EllipsizationTestCase, "EllipsizationTestCase" );
void EllipsizationTestCase::Ellipsize() void EllipsizationTestCase::Ellipsize()
{ {
wxMemoryDC dc; wxMemoryDC dc;
wxString stringsToTest[] = wxString stringsToTest[] =
{ {
"N", ".", "x", "foobar", wxS("\u03B1"), "Another test", "a very very very very very very very long string", "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", "\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 // alpha+beta+gamma+delta+epsilon+zeta+eta+theta+iota
"\t", "\t\t\t\t\t", "a\tstring\twith\ttabs", "\t", "\t\t\t\t\t", "a\tstring\twith\ttabs",
"\n", "\n\n\n\n\n", "a\nstring\nwith\nnewlines", "\n", "\n\n\n\n\n", "a\nstring\nwith\nnewlines",
"&", "&&&&&&&", "a&string&with&newlines", "&", "&&&&&&&", "a&string&with&newlines",
"\t\n&", "a\t\n&string\t\n&with\t\n&many\t\n&chars" "\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, int flagsToTest[] = { 0, wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS, wxELLIPSIZE_FLAGS_EXPAND_TABS,
wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS|wxELLIPSIZE_FLAGS_EXPAND_TABS }; wxELLIPSIZE_FLAGS_PROCESS_MNEMONICS|wxELLIPSIZE_FLAGS_EXPAND_TABS };
wxEllipsizeMode modesToTest[] = { wxELLIPSIZE_START, wxELLIPSIZE_MIDDLE, wxELLIPSIZE_END }; wxEllipsizeMode modesToTest[] = { wxELLIPSIZE_START, wxELLIPSIZE_MIDDLE, wxELLIPSIZE_END };
int widthsToTest[] = { 0, 1, 2, 3, 10, 20, 100 }; int widthsToTest[] = { 0, 1, 2, 3, 10, 20, 100 };
for (unsigned int s=0; s<WXSIZEOF(stringsToTest); s++) for (unsigned int s=0; s<WXSIZEOF(stringsToTest); s++)
for (unsigned int f=0; f<WXSIZEOF(flagsToTest); f++) for (unsigned int f=0; f<WXSIZEOF(flagsToTest); f++)
for (unsigned int m=0; m<WXSIZEOF(modesToTest); m++) for (unsigned int m=0; m<WXSIZEOF(modesToTest); m++)
for (unsigned int w=0; w<WXSIZEOF(widthsToTest); w++) for (unsigned int w=0; w<WXSIZEOF(widthsToTest); w++)
{ {
wxString ret = wxControlBase::Ellipsize(stringsToTest[s], dc, modesToTest[m], wxString ret = wxControlBase::Ellipsize(stringsToTest[s], dc, modesToTest[m],
widthsToTest[w], flagsToTest[f]); widthsToTest[w], flagsToTest[f]);
CPPUNIT_ASSERT_MESSAGE((std::string)("invalid ellipsization for: " + stringsToTest[s]), CPPUNIT_ASSERT_MESSAGE((std::string)("invalid ellipsization for: " + stringsToTest[s]),
dc.GetMultiLineTextExtent(ret).GetWidth() <= widthsToTest[w]); dc.GetMultiLineTextExtent(ret).GetWidth() <= widthsToTest[w]);
} }
} }