summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-09 21:58:55 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-02-09 22:11:40 -0500
commite041a1bfef98b54656cfaafcb0f586867a21edf1 (patch)
tree0ff58071008b383ebead2a5a1366816125cdc6f6
parentad5443b929962dea64985b3b197ea323aafab834 (diff)
fdo#74323: Add unit test for changing cases of text cells.
Change-Id: I858e18a03d97434275676e771d91bdf3209f63fb
-rw-r--r--sc/qa/unit/ucalc.cxx25
-rw-r--r--sc/qa/unit/ucalc.hxx2
2 files changed, 27 insertions, 0 deletions
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 83498b3f0195..5ae240f7d295 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -80,6 +80,8 @@
#include <sstream>
#include <vector>
+#include <com/sun/star/i18n/TransliterationModules.hpp>
+
struct TestImpl
{
ScDocShellRef m_xDocShell;
@@ -5464,6 +5466,29 @@ void Test::testImportStream()
m_pDoc->DeleteTab(0);
}
+void Test::testTransliterateText()
+{
+ m_pDoc->InsertTab(0, "Test");
+
+ // Set texts to A1:A3.
+ m_pDoc->SetString(ScAddress(0,0,0), "Mike");
+ m_pDoc->SetString(ScAddress(0,1,0), "Noah");
+ m_pDoc->SetString(ScAddress(0,2,0), "Oscar");
+
+ // Change them to uppercase.
+ ScMarkData aMark;
+ aMark.SetMarkArea(ScRange(0,0,0,0,2,0));
+ ScDocFunc& rFunc = getDocShell().GetDocFunc();
+ rFunc.TransliterateText(
+ aMark, i18n::TransliterationModules_LOWERCASE_UPPERCASE, true, true);
+
+ CPPUNIT_ASSERT_EQUAL(OUString("MIKE"), m_pDoc->GetString(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("NOAH"), m_pDoc->GetString(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT_EQUAL(OUString("OSCAR"), m_pDoc->GetString(ScAddress(0,2,0)));
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testMixData()
{
m_pDoc->InsertTab(0, "Test");
diff --git a/sc/qa/unit/ucalc.hxx b/sc/qa/unit/ucalc.hxx
index a32b04825568..64fde25dbbc8 100644
--- a/sc/qa/unit/ucalc.hxx
+++ b/sc/qa/unit/ucalc.hxx
@@ -316,6 +316,7 @@ public:
void testCondCopyPaste();
void testImportStream();
+ void testTransliterateText();
void testColumnFindEditCells();
@@ -447,6 +448,7 @@ public:
CPPUNIT_TEST(testCondFormatInsertCol);
CPPUNIT_TEST(testCondCopyPaste);
CPPUNIT_TEST(testImportStream);
+ CPPUNIT_TEST(testTransliterateText);
CPPUNIT_TEST(testColumnFindEditCells);
CPPUNIT_TEST_SUITE_END();