summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2014-02-08 10:46:47 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2014-02-08 11:40:59 -0500
commit7d71fd489c39f348c43477cafdc1bc150bf1ff68 (patch)
tree5ebaf6a899245532f495d7d07b9bc6f473839ed4
parentbbe6ea29856f5a5e2aeb87334a86bf8e3193dc23 (diff)
fdo#74521: Write unit test for this first.
Change-Id: I1815464e25703f1b0181211ac74341edb41793be
-rw-r--r--sc/qa/unit/data/ods/notes-on-3-sheets.odsbin0 -> 11803 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test.cxx45
2 files changed, 45 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/notes-on-3-sheets.ods b/sc/qa/unit/data/ods/notes-on-3-sheets.ods
new file mode 100644
index 000000000000..e7b6399281a8
--- /dev/null
+++ b/sc/qa/unit/data/ods/notes-on-3-sheets.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 47278e0a8796..2db6307e5b51 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -70,6 +70,7 @@ public:
void testCellValuesExportODS();
void testCellNoteExportODS();
+ void testCellNoteExportXLS();
void testFormatExportODS();
void testInlineArrayXLS();
@@ -91,6 +92,7 @@ public:
CPPUNIT_TEST(testRichTextExportODS);
CPPUNIT_TEST(testCellValuesExportODS);
CPPUNIT_TEST(testCellNoteExportODS);
+ CPPUNIT_TEST(testCellNoteExportXLS);
CPPUNIT_TEST(testFormatExportODS);
CPPUNIT_TEST(testInlineArrayXLS);
CPPUNIT_TEST(testEmbeddedChartXLS);
@@ -775,6 +777,49 @@ void ScExportTest::testCellNoteExportODS()
xNewDocSh->DoClose();
}
+void ScExportTest::testCellNoteExportXLS()
+{
+ // Start with an empty document.s
+ ScDocShellRef xOrigDocSh = loadDoc("notes-on-3-sheets.", ODS);
+ ScDocument* pDoc = xOrigDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("This document should have 3 sheets.", pDoc->GetTableCount() == 3);
+
+ // Check note's presence.
+ CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,2,0)));
+
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,0,1)));
+ CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,1,1)));
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,2,1)));
+
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,0,2)));
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,1,2)));
+ CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,2,2)));
+
+ // save and reload as XLS.
+ ScDocShellRef xNewDocSh = saveAndReload(xOrigDocSh, XLS);
+ xOrigDocSh->DoClose();
+ CPPUNIT_ASSERT(xNewDocSh.Is());
+ pDoc = xNewDocSh->GetDocument();
+ CPPUNIT_ASSERT_MESSAGE("This document should have 3 sheets.", pDoc->GetTableCount() == 3);
+
+ // Check note's presence again.
+ CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,0,0)));
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,1,0)));
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,2,0)));
+
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,0,1)));
+ CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,1,1)));
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,2,1)));
+
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,0,2)));
+ CPPUNIT_ASSERT(!pDoc->HasNote(ScAddress(0,1,2)));
+ CPPUNIT_ASSERT( pDoc->HasNote(ScAddress(0,2,2)));
+
+ xNewDocSh->DoClose();
+}
+
namespace {
void checkMatrixRange(ScDocument& rDoc, const ScRange& rRange)