[Libreoffice-commits] .: sc/inc sc/qa sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Mar 4 17:29:59 PST 2011
sc/inc/document.hxx | 1 +
sc/qa/unit/ucalc.cxx | 24 ++++++++++++++++++++++++
sc/source/core/data/document.cxx | 6 ++++++
3 files changed, 31 insertions(+)
New commits:
commit 299930bec5091841c19c1394db2803177e7b4b5d
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Mar 4 20:27:33 2011 -0500
Unit test for text and text number inputs.
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index cf1afea..d403b29 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -750,6 +750,7 @@ public:
SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString );
+ SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rString );
SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString );
SC_DLLPUBLIC double GetValue( const ScAddress& );
SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue );
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 35ee9f9..7c19673 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -228,6 +228,7 @@ public:
bool testLoad(const rtl::OUString &rFilter, const rtl::OUString &rURL);
void testCollator();
+ void testInput();
void testSUM();
void testVolatileFunc();
void testNamedRange();
@@ -251,6 +252,7 @@ public:
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(testCollator);
+ CPPUNIT_TEST(testInput);
CPPUNIT_TEST(testSUM);
CPPUNIT_TEST(testVolatileFunc);
CPPUNIT_TEST(testNamedRange);
@@ -333,6 +335,28 @@ void Test::testCollator()
CPPUNIT_ASSERT_MESSAGE("these strings are supposed to be different!", nRes != 0);
}
+void Test::testInput()
+{
+ rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("foo"));
+ CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
+ m_pDoc->InsertTab (0, aTabName));
+
+ OUString numstr(RTL_CONSTASCII_USTRINGPARAM("'10.5"));
+ OUString str(RTL_CONSTASCII_USTRINGPARAM("'apple'"));
+ OUString test;
+
+ m_pDoc->SetString(0, 0, 0, numstr);
+ m_pDoc->GetString(0, 0, 0, test);
+ bool bTest = test.equalsAscii("10.5");
+ CPPUNIT_ASSERT_MESSAGE("String number should have the first apostrophe stripped.", bTest);
+ m_pDoc->SetString(0, 0, 0, str);
+ m_pDoc->GetString(0, 0, 0, test);
+ bTest = test.equalsAscii("'apple'");
+ CPPUNIT_ASSERT_MESSAGE("Text content should have retained the first apostrophe.", bTest);
+
+ m_pDoc->DeleteTab(0);
+}
+
void Test::testSUM()
{
rtl::OUString aTabName(RTL_CONSTASCII_USTRINGPARAM("foo"));
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 3321b4c..e50f66e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2764,6 +2764,12 @@ void ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString
rString.Erase();
}
+void ScDocument::GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rString )
+{
+ String aStr;
+ GetString(nCol, nRow, nTab, aStr);
+ rString = aStr;
+}
void ScDocument::GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString )
{
More information about the Libreoffice-commits
mailing list