diff options
author | Colin Snover | 2017-10-07 22:01:13 -0500 |
---|---|---|
committer | Colin Snover | 2017-11-10 09:57:41 -0600 |
commit | dda0f77bcf093dced1ad833982be8a9e0951a85e (patch) | |
tree | 15c83704faf94b687af600e9b265ff46ec5db32e /test | |
parent | 216376477a5b3eb35e3f3450461b284ecfed8244 (diff) | |
download | scummvm-rg350-dda0f77bcf093dced1ad833982be8a9e0951a85e.tar.gz scummvm-rg350-dda0f77bcf093dced1ad833982be8a9e0951a85e.tar.bz2 scummvm-rg350-dda0f77bcf093dced1ad833982be8a9e0951a85e.zip |
COMMON: Add basic fixed-width word wrap to Common::String
Diffstat (limited to 'test')
-rw-r--r-- | test/common/str.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h index b7ad28e56e..9f8c6fbd60 100644 --- a/test/common/str.h +++ b/test/common/str.h @@ -443,6 +443,28 @@ class StringTestSuite : public CxxTest::TestSuite TS_ASSERT_LESS_THAN(scumm_strnicmp("abCd", "ABCde", 5), 0); } + void test_wordWrap() { + Common::String testString("123456"); + testString.wordWrap(10); + TS_ASSERT(testString == "123456"); + testString.wordWrap(2); + TS_ASSERT(testString == "12\n34\n56"); + testString = "1234 5678"; + testString.wordWrap(4); + TS_ASSERT(testString == "1234\n5678"); + testString = "12 3 45"; + testString.wordWrap(4); + TS_ASSERT(testString == "12 3\n45"); + testString = "\n1\n23 45\n\n"; + testString.wordWrap(3); + TS_ASSERT(testString == "\n1\n23\n45\n\n"); + testString = "123 "; + testString.wordWrap(4); + TS_ASSERT(testString == "123 "); + testString.wordWrap(3); + TS_ASSERT(testString == "123\n"); + } + void test_replace() { // Tests created with the results of the STL std::string class |