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

2015-04-21 Thread Austin Chen
 sw/qa/extras/uiwriter/uiwriter.cxx |   38 +
 1 file changed, 38 insertions(+)

New commits:
commit f29e959c827a5858e3baeea6e748aa597ac9fb94
Author: Austin Chen austinche...@gmail.com
Date:   Thu Apr 16 22:30:12 2015 -0700

Applies CharAttribute to selected text and tests undo

Change-Id: Ibd171fda4ea38de4d76d8f252d6f6d37cf3b9a66
Reviewed-on: https://gerrit.libreoffice.org/15158
Reviewed-by: Caolán McNamara caol...@redhat.com
Tested-by: Caolán McNamara caol...@redhat.com

diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx 
b/sw/qa/extras/uiwriter/uiwriter.cxx
index 803e222..ffd281b 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -89,6 +89,7 @@ public:
 void testTdf90003();
 void testSearchWithTransliterate();
 void testTdf90362();
+void testUndoCharAttribute();
 
 CPPUNIT_TEST_SUITE(SwUiWriterTest);
 CPPUNIT_TEST(testReplaceForward);
@@ -123,6 +124,7 @@ public:
 CPPUNIT_TEST(testTdf90003);
 CPPUNIT_TEST(testSearchWithTransliterate);
 CPPUNIT_TEST(testTdf90362);
+CPPUNIT_TEST(testUndoCharAttribute);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -910,6 +912,42 @@ void SwUiWriterTest::testTdf90362()
 CPPUNIT_ASSERT_EQUAL(false, pWrtShell-HasReadonlySel());
 }
 
+void SwUiWriterTest::testUndoCharAttribute()
+{
+// Create a new empty Writer document
+SwDoc* pDoc = createDoc();
+SwPaM* pCrsr = pDoc-GetEditShell()-GetCrsr();
+sw::UndoManager rUndoManager = pDoc-GetUndoManager();
+IDocumentContentOperations  rIDCO(pDoc-getIDocumentContentOperations());
+// Insert some text
+rIDCO.InsertString(*pCrsr, This will be bolded);
+// Position of word   9876543210
+// Use cursor to select part of text
+pCrsr-SetMark();
+for (int i = 0; i  9; i++) {
+pCrsr-Move(fnMoveBackward);
+}
+// Check that correct text was selected
+CPPUNIT_ASSERT_EQUAL(OUString(be bolded), pCrsr-GetTxt());
+// Apply a Bold attribute to selection
+SvxWeightItem aWeightItem(WEIGHT_BOLD, RES_CHRATR_WEIGHT);
+rIDCO.InsertPoolItem(*pCrsr, aWeightItem);
+SfxItemSet aSet( pDoc-GetAttrPool(), RES_CHRATR_WEIGHT, 
RES_CHRATR_WEIGHT);
+// Adds selected text's attributes to aSet
+pCrsr-GetNode().GetTxtNode()-GetAttr(aSet, 10, 19);
+SfxPoolItem* aPoolItem = (SfxPoolItem*) aSet.GetItem(RES_CHRATR_WEIGHT);
+SfxPoolItem ampPoolItem = aWeightItem;
+// Check that bold is active on the selection; checks if it's in aSet
+CPPUNIT_ASSERT_EQUAL((*aPoolItem == ampPoolItem), true);
+// Invoke Undo
+rUndoManager.Undo();
+// Check that bold is no longer active
+aSet.ClearItem(RES_CHRATR_WEIGHT);
+pCrsr-GetNode().GetTxtNode()-GetAttr(aSet, 10, 19);
+aPoolItem = (SfxPoolItem*) aSet.GetItem(RES_CHRATR_WEIGHT);
+CPPUNIT_ASSERT_EQUAL((*aPoolItem == ampPoolItem), false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: oox/source sc/source

2015-03-26 Thread Austin Chen
 oox/source/drawingml/chart/chartconverter.cxx |2 +-
 sc/source/filter/oox/formulabase.cxx  |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 0fb66458c08b9c0ce59bca85e77d26fad8b59e4b
Author: Austin Chen austinche...@gmail.com
Date:   Wed Mar 25 02:43:57 2015 -0700

tdf#57950: Replace chained O(U)StringBuffer::append() with operator+

Change-Id: Iae8e50864dbd90ff49a4fcc31a06b2158eab4afc
Reviewed-on: https://gerrit.libreoffice.org/14998
Reviewed-by: Noel Grandin noelgran...@gmail.com
Tested-by: Noel Grandin noelgran...@gmail.com

diff --git a/oox/source/drawingml/chart/chartconverter.cxx 
b/oox/source/drawingml/chart/chartconverter.cxx
index b39ca70..acbe9bb 100644
--- a/oox/source/drawingml/chart/chartconverter.cxx
+++ b/oox/source/drawingml/chart/chartconverter.cxx
@@ -54,7 +54,7 @@ static OUString lclGenerateApiString( const OUString rString 
)
 sal_Int32 nQuotePos = aRetString.getLength();
 while( (nQuotePos = aRetString.lastIndexOf( '', nQuotePos )) = 0 )
 aRetString = aRetString.replaceAt( nQuotePos, 1, \\ );
-return OUStringBuffer().append( '' ).append( aRetString ).append( '' 
).makeStringAndClear();
+return \ + aRetString + \;
 }
 
 static OUString lclGenerateApiArray( const Matrix Any  rMatrix )
diff --git a/sc/source/filter/oox/formulabase.cxx 
b/sc/source/filter/oox/formulabase.cxx
index e1237b7..38f0ef2 100644
--- a/sc/source/filter/oox/formulabase.cxx
+++ b/sc/source/filter/oox/formulabase.cxx
@@ -1624,7 +1624,7 @@ OUString FormulaProcessorBase::generateApiString( const 
OUString rString )
 sal_Int32 nQuotePos = aRetString.getLength();
 while( (nQuotePos = aRetString.lastIndexOf( '', nQuotePos )) = 0 )
 aRetString = aRetString.replaceAt( nQuotePos, 1, OUString( \\ ) );
-return OUStringBuffer().append( '' ).append( aRetString ).append( '' 
).makeStringAndClear();
+return \ + aRetString + \;
 }
 
 OUString FormulaProcessorBase::generateApiArray( const Matrix Any  rMatrix )
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


Austin Chen License Statement

2015-03-25 Thread Austin Chen
All of my past  future contributions to LibreOffice may be   licensed under 
the MPLv2/LGPLv3+ dual license.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice