[Libreoffice-commits] core.git: sc/qa

2014-03-17 Thread Manas Joshi
 sc/qa/unit/ucalc.cxx |  193 +--
 1 file changed, 80 insertions(+), 113 deletions(-)

New commits:
commit de226dcfaeedf7f77de4f0242a713bc7e4462a0a
Author: Manas Joshi futurejosh...@gmail.com
Date:   Mon Mar 17 10:00:47 2014 +

fdo#76181 - cleanup OUString constructors

Change-Id: I0a5fbfc0b33b16e0eba7410957ab83ffbff4e008

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 3626502..3fdf42f 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -463,10 +463,8 @@ void Test::testPerf()
 
 void Test::testCollator()
 {
-OUString s1(A);
-OUString s2(B);
 CollatorWrapper* p = ScGlobal::GetCollator();
-sal_Int32 nRes = p-compareString(s1, s2);
+sal_Int32 nRes = p-compareString(A, B);
 CPPUNIT_ASSERT_MESSAGE(these strings are supposed to be different!, nRes 
!= 0);
 }
 
@@ -697,19 +695,16 @@ void Test::testMarkData()
 
 void Test::testInput()
 {
-OUString aTabName(foo);
-CPPUNIT_ASSERT_MESSAGE (failed to insert sheet,
-m_pDoc-InsertTab (0, aTabName));
 
-OUString numstr('10.5);
-OUString str('apple');
+CPPUNIT_ASSERT_MESSAGE (failed to insert sheet,
+m_pDoc-InsertTab (0, foo));
 OUString test;
 
-m_pDoc-SetString(0, 0, 0, numstr);
+m_pDoc-SetString(0, 0, 0, '10.5);
 test = m_pDoc-GetString(0, 0, 0);
 bool bTest = test == 10.5;
 CPPUNIT_ASSERT_MESSAGE(String number should have the first apostrophe 
stripped., bTest);
-m_pDoc-SetString(0, 0, 0, str);
+m_pDoc-SetString(0, 0, 0, 'apple');
 test = m_pDoc-GetString(0, 0, 0);
 bTest = test == 'apple';
 CPPUNIT_ASSERT_MESSAGE(Text content should have retained the first 
apostrophe., bTest);
@@ -937,9 +932,8 @@ void Test::testCopyToDocument()
 
 //note on A1
 ScAddress aAdrA1 (0, 0, 0); // numerical cell content
-OUString aHelloA1(Hello world in A1);
 ScPostIt* pNote = m_pDoc-GetOrCreateNote(aAdrA1);
-pNote-SetText(aAdrA1, aHelloA1);
+pNote-SetText(aAdrA1, Hello world in A1);
 
 // Copy statically to another document.
 
@@ -1639,12 +1633,12 @@ void Test::testCellBroadcaster()
 
 void Test::testFuncParam()
 {
-OUString aTabName(foo);
+
 CPPUNIT_ASSERT_MESSAGE (failed to insert sheet,
-m_pDoc-InsertTab (0, aTabName));
+m_pDoc-InsertTab (0, foo));
 
 // First, the normal case, with no missing parameters.
-m_pDoc-SetString(0, 0, 0, OUString(=AVERAGE(1;2;3)));
+m_pDoc-SetString(0, 0, 0, =AVERAGE(1;2;3));
 m_pDoc-CalcFormulaTree(false, false);
 double val;
 m_pDoc-GetValue(0, 0, 0, val);
@@ -1652,17 +1646,17 @@ void Test::testFuncParam()
 
 // Now function with missing parameters.  Missing values should be treated
 // as zeros.
-m_pDoc-SetString(0, 0, 0, OUString(=AVERAGE(1;;;)));
+m_pDoc-SetString(0, 0, 0, =AVERAGE(1;;;));
 m_pDoc-CalcFormulaTree(false, false);
 m_pDoc-GetValue(0, 0, 0, val);
 CPPUNIT_ASSERT_MESSAGE(incorrect result, val == 0.25);
 
 // Conversion of string to numeric argument.
-m_pDoc-SetString(0, 0, 0, OUString(=\\+3));// empty string
-m_pDoc-SetString(0, 1, 0, OUString(=\ \+3));   // only blank
-m_pDoc-SetString(0, 2, 0, OUString(=\ 4 \+3)); // number in blanks
-m_pDoc-SetString(0, 3, 0, OUString(=\ x \+3)); // non-numeric
-m_pDoc-SetString(0, 4, 0, OUString(=\4.4\+3)); // locale dependent
+m_pDoc-SetString(0, 0, 0, =\\+3);// empty string
+m_pDoc-SetString(0, 1, 0, =\ \+3);   // only blank
+m_pDoc-SetString(0, 2, 0, =\ 4 \+3); // number in blanks
+m_pDoc-SetString(0, 3, 0, =\ x \+3); // non-numeric
+m_pDoc-SetString(0, 4, 0, =\4.4\+3); // locale dependent
 
 OUString aVal;
 ScCalcConfig aConfig;
@@ -1795,7 +1789,7 @@ void Test::testNamedRange()
 }
 
 // Test usage in formula expression.
-m_pDoc-SetString (1, 0, 0, OUString(=A1/Divisor));
+m_pDoc-SetString (1, 0, 0, =A1/Divisor);
 m_pDoc-CalcAll();
 
 double result;
@@ -2015,8 +2009,7 @@ void Test::testMatrix()
 
 pMat-PutBoolean(true, 1, 1);
 pMat-PutDouble(-12.5, 4, 5);
-OUString aStr(Test);
-pMat-PutString(rPool.intern(aStr), 8, 2);
+pMat-PutString(rPool.intern(Test), 8, 2);
 pMat-PutEmptyPath(8, 11);
 checkMatrixElementsPartiallyFilledEmptyMatrix(*pMat);
 
@@ -2124,7 +2117,7 @@ void Test::testCellCopy()
 ScAddress aSrc(0,0,0);
 ScAddress aDest(0,1,0);
 OUString aStr(please copy me);
-m_pDoc-SetString(aSrc, aStr);
+m_pDoc-SetString(aSrc, please copy me);
 CPPUNIT_ASSERT_EQUAL(m_pDoc-GetString(aSrc), aStr);
 // copy to self - why not ?
 m_pDoc-CopyCellToDocument(aSrc,aDest,*m_pDoc);
@@ -2154,9 +2147,8 @@ void Test::testSheetCopy()
 
 // insert a note
 ScAddress aAdrA1 (0,2,0); // empty cell content.
-OUString aHelloA1(Hello world in A3);
 ScPostIt *pNoteA1 = m_pDoc-GetOrCreateNote

[PATCH] fdo#76181: cleanup constructors in ucalc.cxx

2014-03-16 Thread Manas Joshi

From 0240fe32a881059fafe20b4afa9f252057cd55dd Mon Sep 17 00:00:00 2001
From: Manas Joshi futurejosh...@gmail.com
Date: Sat, 15 Mar 2014 13:50:33 -0700
Subject: [PATCH] Bug 76181 has been fixed

---
 sc/qa/unit/ucalc.cxx |  206 +-
 1 file changed, 85 insertions(+), 121 deletions(-)

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index cfc94e0..3a6450b 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -463,10 +463,8 @@ void Test::testPerf()
 
 void Test::testCollator()
 {
-OUString s1(A);
-OUString s2(B);
 CollatorWrapper* p = ScGlobal::GetCollator();
-sal_Int32 nRes = p-compareString(s1, s2);
+sal_Int32 nRes = p-compareString(A, B);
 CPPUNIT_ASSERT_MESSAGE(these strings are supposed to be different!, nRes != 0);
 }
 
@@ -697,19 +695,16 @@ void Test::testMarkData()
 
 void Test::testInput()
 {
-OUString aTabName(foo);
+
 CPPUNIT_ASSERT_MESSAGE (failed to insert sheet,
-m_pDoc-InsertTab (0, aTabName));
-
-OUString numstr('10.5);
-OUString str('apple');
+m_pDoc-InsertTab (0, foo));
 OUString test;
 
-m_pDoc-SetString(0, 0, 0, numstr);
+m_pDoc-SetString(0, 0, 0, '10.5);
 test = m_pDoc-GetString(0, 0, 0);
 bool bTest = test == 10.5;
 CPPUNIT_ASSERT_MESSAGE(String number should have the first apostrophe stripped., bTest);
-m_pDoc-SetString(0, 0, 0, str);
+m_pDoc-SetString(0, 0, 0, 'apple');
 test = m_pDoc-GetString(0, 0, 0);
 bTest = test == 'apple';
 CPPUNIT_ASSERT_MESSAGE(Text content should have retained the first apostrophe., bTest);
@@ -760,7 +755,7 @@ void Test::testDataEntries()
 // Entries are supposed to be sorted in ascending order, and are all unique.
 CPPUNIT_ASSERT_EQUAL(static_castsize_t(3), aEntries.size());
 std::vectorScTypedStrData::const_iterator it = aEntries.begin();
-CPPUNIT_ASSERT_EQUAL(OUString(Andy), it-GetString());
+CPPUNIT_ASSERT_EQUAL(OUString(Andy), it-GetString()); 
 ++it;
 CPPUNIT_ASSERT_EQUAL(OUString(Bruce), it-GetString());
 ++it;
@@ -937,9 +932,8 @@ void Test::testCopyToDocument()
 
 //note on A1
 ScAddress aAdrA1 (0, 0, 0); // numerical cell content
-OUString aHelloA1(Hello world in A1);
 ScPostIt* pNote = m_pDoc-GetOrCreateNote(aAdrA1);
-pNote-SetText(aAdrA1, aHelloA1);
+pNote-SetText(aAdrA1, Hello world in A1);
 
 // Copy statically to another document.
 
@@ -1348,7 +1342,7 @@ void Test::testFormulaMatrixResultUpdate()
 pFC-SetChanged(false); // Clear this flag to simulate displaying of formula cell value on screen.
 
 m_pDoc-SetString(ScAddress(0,0,0), ABC);
-CPPUNIT_ASSERT_EQUAL(OUString(ABC), m_pDoc-GetString(ScAddress(1,0,0)));
+CPPUNIT_ASSERT_EQUAL(OUString(ABC), m_pDoc-GetString(ScAddress(1,0,0)));
 pFC-SetChanged(false);
 
 // Put a new value into A1. The formula should update.
@@ -1639,12 +1633,12 @@ void Test::testCellBroadcaster()
 
 void Test::testFuncParam()
 {
-OUString aTabName(foo);
+
 CPPUNIT_ASSERT_MESSAGE (failed to insert sheet,
-m_pDoc-InsertTab (0, aTabName));
+m_pDoc-InsertTab (0, foo));
 
 // First, the normal case, with no missing parameters.
-m_pDoc-SetString(0, 0, 0, OUString(=AVERAGE(1;2;3)));
+m_pDoc-SetString(0, 0, 0, =AVERAGE(1;2;3));  
 m_pDoc-CalcFormulaTree(false, false);
 double val;
 m_pDoc-GetValue(0, 0, 0, val);
@@ -1652,17 +1646,17 @@ void Test::testFuncParam()
 
 // Now function with missing parameters.  Missing values should be treated
 // as zeros.
-m_pDoc-SetString(0, 0, 0, OUString(=AVERAGE(1;;;)));
+m_pDoc-SetString(0, 0, 0, =AVERAGE(1;;;));   
 m_pDoc-CalcFormulaTree(false, false);
 m_pDoc-GetValue(0, 0, 0, val);
 CPPUNIT_ASSERT_MESSAGE(incorrect result, val == 0.25);
 
 // Conversion of string to numeric argument.
-m_pDoc-SetString(0, 0, 0, OUString(=\\+3));// empty string
-m_pDoc-SetString(0, 1, 0, OUString(=\ \+3));   // only blank
-m_pDoc-SetString(0, 2, 0, OUString(=\ 4 \+3)); // number in blanks
-m_pDoc-SetString(0, 3, 0, OUString(=\ x \+3)); // non-numeric
-m_pDoc-SetString(0, 4, 0, OUString(=\4.4\+3)); // locale dependent
+m_pDoc-SetString(0, 0, 0, =\\+3);// empty string   
+m_pDoc-SetString(0, 1, 0, =\ \+3);   // only blank
+m_pDoc-SetString(0, 2, 0, =\ 4 \+3); // number in blanks
+m_pDoc-SetString(0, 3, 0, =\ x \+3); // non-numeric
+m_pDoc-SetString(0, 4, 0, =\4.4\+3); // locale dependent
 
 OUString aVal;
 ScCalcConfig aConfig;
@@ -1795,7 +1789,7 @@ void Test::testNamedRange()
 }
 
 // Test usage in formula expression.
-m_pDoc-SetString (1, 0, 0, OUString(=A1/Divisor));
+m_pDoc-SetString (1, 0, 0, =A1/Divisor);  
 m_pDoc-CalcAll();
 
 double result;
@@ -2015,8 +2009,7 @@ void Test::testMatrix

Manas license statement

2014-03-16 Thread Manas Joshi
All of my past  future contributions to LibreOffice may be
   licensed under the MPLv2/LGPLv3+ dual license.

Regards,
Manas
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[no subject]

2014-03-14 Thread Manas Joshi

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice