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

fdo#74325: Write unit test for cell note export to ods.

Change-Id: Ic145781a6c2d7fefb4e80b3a84735e0fb505b0e7
üst 7d2e1c20
...@@ -902,7 +902,7 @@ public: ...@@ -902,7 +902,7 @@ public:
SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab); SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
void SetNote(const ScAddress& rPos, ScPostIt* pNote); void SetNote(const ScAddress& rPos, ScPostIt* pNote);
void SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote); void SetNote(SCCOL nCol, SCROW nRow, SCTAB nTab, ScPostIt* pNote);
bool HasNote(const ScAddress& rPos); SC_DLLPUBLIC bool HasNote(const ScAddress& rPos);
bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab); bool HasNote(SCCOL nCol, SCROW nRow, SCTAB nTab);
SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab); SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab);
SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab); SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab);
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "editutil.hxx" #include "editutil.hxx"
#include "scopetools.hxx" #include "scopetools.hxx"
#include "cellvalue.hxx" #include "cellvalue.hxx"
#include <postit.hxx>
#include "svx/svdoole2.hxx" #include "svx/svdoole2.hxx"
#include "tabprotection.hxx" #include "tabprotection.hxx"
...@@ -67,6 +68,7 @@ public: ...@@ -67,6 +68,7 @@ public:
void testRichTextExportODS(); void testRichTextExportODS();
void testCellValuesExportODS(); void testCellValuesExportODS();
void testCellNoteExportODS();
void testFormatExportODS(); void testFormatExportODS();
void testInlineArrayXLS(); void testInlineArrayXLS();
...@@ -87,6 +89,7 @@ public: ...@@ -87,6 +89,7 @@ public:
CPPUNIT_TEST(testNamedRangeBugfdo62729); CPPUNIT_TEST(testNamedRangeBugfdo62729);
CPPUNIT_TEST(testRichTextExportODS); CPPUNIT_TEST(testRichTextExportODS);
CPPUNIT_TEST(testCellValuesExportODS); CPPUNIT_TEST(testCellValuesExportODS);
CPPUNIT_TEST(testCellNoteExportODS);
CPPUNIT_TEST(testFormatExportODS); CPPUNIT_TEST(testFormatExportODS);
CPPUNIT_TEST(testInlineArrayXLS); CPPUNIT_TEST(testInlineArrayXLS);
CPPUNIT_TEST(testEmbeddedChartXLS); CPPUNIT_TEST(testEmbeddedChartXLS);
...@@ -661,6 +664,34 @@ void ScExportTest::testCellValuesExportODS() ...@@ -661,6 +664,34 @@ void ScExportTest::testCellValuesExportODS()
xNewDocSh->DoClose(); xNewDocSh->DoClose();
} }
void ScExportTest::testCellNoteExportODS()
{
ScDocShellRef xOrigDocSh = loadDoc("single-note.", ODS);
ScDocument* pDoc = xOrigDocSh->GetDocument();
ScAddress aPos(0,0,0); // Start with A1.
CPPUNIT_ASSERT_MESSAGE("There should be a note at A1.", pDoc->HasNote(aPos));
aPos.IncRow(); // Move to A2.
ScPostIt* pNote = pDoc->GetOrCreateNote(aPos);
pNote->SetText(aPos, "Note One");
pNote->SetAuthor("Author One");
CPPUNIT_ASSERT_MESSAGE("There should be a note at A2.", pDoc->HasNote(aPos));
// save and reload
ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, ODS);
xOrigDocSh->DoClose();
CPPUNIT_ASSERT(xNewDocSh.Is());
pDoc = xNewDocSh->GetDocument();
aPos.SetRow(0); // Move back to A1.
CPPUNIT_ASSERT_MESSAGE("There should be a note at A1.", pDoc->HasNote(aPos));
aPos.IncRow(); // Move to A2.
CPPUNIT_ASSERT_MESSAGE("There should be a note at A2.", pDoc->HasNote(aPos));
xNewDocSh->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