[Libreoffice-commits] core.git: sc/inc sc/qa
Kohei Yoshida
kohei.yoshida at gmail.com
Fri Aug 2 19:10:47 PDT 2013
sc/inc/document.hxx | 2 -
sc/qa/unit/data/ods/empty.ods |binary
sc/qa/unit/subsequent_export-test.cxx | 64 ++++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 1 deletion(-)
New commits:
commit ac0041248bffa53f8da338a84ed6defafcb5435e
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Fri Aug 2 22:08:54 2013 -0400
Add a test that currently fails. We need to fix this bug.
Conflicts:
sc/qa/unit/subsequent_export-test.cxx
Change-Id: Ie09c668d952a6297ffe3c75e348c2a0348176bbe
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 9c30744..90e0148 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -817,7 +817,7 @@ public:
SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
SC_DLLPUBLIC OUString GetString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
- OUString GetString( const ScAddress& rPos ) const;
+ SC_DLLPUBLIC OUString GetString( const ScAddress& rPos ) const;
/**
* Return a pointer to the string object stored in string cell.
diff --git a/sc/qa/unit/data/ods/empty.ods b/sc/qa/unit/data/ods/empty.ods
new file mode 100644
index 0000000..14b4232
Binary files /dev/null and b/sc/qa/unit/data/ods/empty.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index f881923..90ced45 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -28,9 +28,13 @@
#include "cellform.hxx"
#include "formulacell.hxx"
#include "tokenarray.hxx"
+#include "editutil.hxx"
#include "svx/svdoole2.hxx"
#include "tabprotection.hxx"
+#include "editeng/wghtitem.hxx"
+#include "editeng/postitem.hxx"
+#include "editeng/editdata.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -55,6 +59,7 @@ public:
void testDataBarExportXLSX();
void testMiscRowHeightExport();
void testNamedRangeBugfdo62729();
+ void testRichTextExportODS();
void testInlineArrayXLS();
void testEmbeddedChartXLS();
@@ -72,6 +77,7 @@ public:
CPPUNIT_TEST(testColorScaleExportXLSX);
CPPUNIT_TEST(testMiscRowHeightExport);
CPPUNIT_TEST(testNamedRangeBugfdo62729);
+// CPPUNIT_TEST(testRichTextExportODS); This currently fails.
CPPUNIT_TEST(testInlineArrayXLS);
CPPUNIT_TEST(testEmbeddedChartXLS);
CPPUNIT_TEST(testFormulaReferenceXLS);
@@ -334,6 +340,64 @@ void ScExportTest::testNamedRangeBugfdo62729()
xDocSh->DoClose();
}
+void ScExportTest::testRichTextExportODS()
+{
+ // Start with an empty document, put one edit text cell, and make sure it
+ // survives the save and reload.
+ ScDocShellRef xNewDocSh = loadDoc("empty.", ODS);
+ ScDocument* pDoc = xNewDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ CPPUNIT_ASSERT_MESSAGE("This document should at least have one sheet.", pDoc->GetTableCount() > 0);
+
+ // Insert an edit text cell.
+ OUString aCellText("Bold and Italic");
+ ScFieldEditEngine& rEE = pDoc->GetEditEngine();
+ rEE.SetText(aCellText);
+ ESelection aSel;
+ aSel.nStartPara = aSel.nEndPara = 0;
+
+ {
+ // Set the 'Bold' part bold.
+ SfxItemSet aItemSet = rEE.GetEmptyItemSet();
+ aSel.nStartPos = 0;
+ aSel.nEndPos = 4;
+ SvxWeightItem aWeight(WEIGHT_BOLD, ATTR_FONT_WEIGHT);
+ aItemSet.Put(aWeight);
+ rEE.QuickSetAttribs(aItemSet, aSel);
+ }
+
+ {
+ // Set the 'Italic' part italic.
+ SfxItemSet aItemSet = rEE.GetEmptyItemSet();
+ SvxPostureItem aItalic(ITALIC_NORMAL, ATTR_FONT_POSTURE);
+ aItemSet.Put(aItalic);
+ aSel.nStartPos = 9;
+ aSel.nEndPos = 15;
+ rEE.QuickSetAttribs(aItemSet, aSel);
+ }
+
+ // Set this edit text to cell B2.
+ pDoc->SetEditText(ScAddress(1,1,0), rEE.CreateTextObject());
+ const EditTextObject* pEditText = pDoc->GetEditText(ScAddress(1,1,0));
+ CPPUNIT_ASSERT_MESSAGE("B2 should be an edit text.", pEditText);
+
+ // Now, save and reload this document.
+ ScDocShellRef xDocSh = saveAndReload(xNewDocSh, ODS);
+ xNewDocSh->DoClose();
+ CPPUNIT_ASSERT(xDocSh.Is());
+ pDoc = xDocSh->GetDocument();
+ CPPUNIT_ASSERT(pDoc);
+ CPPUNIT_ASSERT_MESSAGE("Reloaded document should at least have one sheet.", pDoc->GetTableCount() > 0);
+
+ // Make sure the content of B2 is still intact.
+ CPPUNIT_ASSERT_EQUAL(aCellText, pDoc->GetString(ScAddress(1,1,0)));
+
+ pEditText = pDoc->GetEditText(ScAddress(1,1,0));
+ CPPUNIT_ASSERT_MESSAGE("B2 should be an edit text.", pEditText);
+
+ xDocSh->DoClose();
+}
+
namespace {
void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange)
More information about the Libreoffice-commits
mailing list