Kaydet (Commit) ac004124 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

Add a test that currently fails. We need to fix this bug.

Conflicts:
	sc/qa/unit/subsequent_export-test.cxx

Change-Id: Ie09c668d952a6297ffe3c75e348c2a0348176bbe
üst 7b319cb9
...@@ -817,7 +817,7 @@ public: ...@@ -817,7 +817,7 @@ public:
SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark); SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark);
SC_DLLPUBLIC OUString GetString( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; 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. * Return a pointer to the string object stored in string cell.
......
...@@ -28,9 +28,13 @@ ...@@ -28,9 +28,13 @@
#include "cellform.hxx" #include "cellform.hxx"
#include "formulacell.hxx" #include "formulacell.hxx"
#include "tokenarray.hxx" #include "tokenarray.hxx"
#include "editutil.hxx"
#include "svx/svdoole2.hxx" #include "svx/svdoole2.hxx"
#include "tabprotection.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;
using namespace ::com::sun::star::uno; using namespace ::com::sun::star::uno;
...@@ -55,6 +59,7 @@ public: ...@@ -55,6 +59,7 @@ public:
void testDataBarExportXLSX(); void testDataBarExportXLSX();
void testMiscRowHeightExport(); void testMiscRowHeightExport();
void testNamedRangeBugfdo62729(); void testNamedRangeBugfdo62729();
void testRichTextExportODS();
void testInlineArrayXLS(); void testInlineArrayXLS();
void testEmbeddedChartXLS(); void testEmbeddedChartXLS();
...@@ -72,6 +77,7 @@ public: ...@@ -72,6 +77,7 @@ public:
CPPUNIT_TEST(testColorScaleExportXLSX); CPPUNIT_TEST(testColorScaleExportXLSX);
CPPUNIT_TEST(testMiscRowHeightExport); CPPUNIT_TEST(testMiscRowHeightExport);
CPPUNIT_TEST(testNamedRangeBugfdo62729); CPPUNIT_TEST(testNamedRangeBugfdo62729);
// CPPUNIT_TEST(testRichTextExportODS); This currently fails.
CPPUNIT_TEST(testInlineArrayXLS); CPPUNIT_TEST(testInlineArrayXLS);
CPPUNIT_TEST(testEmbeddedChartXLS); CPPUNIT_TEST(testEmbeddedChartXLS);
CPPUNIT_TEST(testFormulaReferenceXLS); CPPUNIT_TEST(testFormulaReferenceXLS);
...@@ -334,6 +340,64 @@ void ScExportTest::testNamedRangeBugfdo62729() ...@@ -334,6 +340,64 @@ void ScExportTest::testNamedRangeBugfdo62729()
xDocSh->DoClose(); 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 { namespace {
void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange) void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment