diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-02 10:48:57 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-02-02 13:28:27 -0500 |
commit | 31973b54efb1c607d7a53b0728264f8dd13bef0f (patch) | |
tree | 199c0a9db4ef0f80b0d5473d72f11591156d805f /sc | |
parent | 7d2e1c208ddf22decb0b3ca4d97ca50a9b95ad61 (diff) |
fdo#74325: Write unit test for cell note export to ods.
Change-Id: Ic145781a6c2d7fefb4e80b3a84735e0fb505b0e7
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/data/ods/single-note.ods | bin | 0 -> 11474 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test.cxx | 31 |
3 files changed, 32 insertions, 1 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 2d84ecd2d242..551557d280d8 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -902,7 +902,7 @@ public: SC_DLLPUBLIC ScPostIt* GetNote(SCCOL nCol, SCROW nRow, SCTAB nTab); void SetNote(const ScAddress& rPos, 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); SC_DLLPUBLIC bool HasColNotes(SCCOL nCol, SCTAB nTab); SC_DLLPUBLIC bool HasTabNotes(SCTAB nTab); diff --git a/sc/qa/unit/data/ods/single-note.ods b/sc/qa/unit/data/ods/single-note.ods Binary files differnew file mode 100644 index 000000000000..3a0c8e368607 --- /dev/null +++ b/sc/qa/unit/data/ods/single-note.ods diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ad2e2ee03e56..5e67df9db16a 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -31,6 +31,7 @@ #include "editutil.hxx" #include "scopetools.hxx" #include "cellvalue.hxx" +#include <postit.hxx> #include "svx/svdoole2.hxx" #include "tabprotection.hxx" @@ -67,6 +68,7 @@ public: void testRichTextExportODS(); void testCellValuesExportODS(); + void testCellNoteExportODS(); void testFormatExportODS(); void testInlineArrayXLS(); @@ -87,6 +89,7 @@ public: CPPUNIT_TEST(testNamedRangeBugfdo62729); CPPUNIT_TEST(testRichTextExportODS); CPPUNIT_TEST(testCellValuesExportODS); + CPPUNIT_TEST(testCellNoteExportODS); CPPUNIT_TEST(testFormatExportODS); CPPUNIT_TEST(testInlineArrayXLS); CPPUNIT_TEST(testEmbeddedChartXLS); @@ -661,6 +664,34 @@ void ScExportTest::testCellValuesExportODS() 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 { void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange) |