summaryrefslogtreecommitdiff
path: root/sc/qa/unit
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-01-04 15:28:49 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-01-04 15:34:39 -0500
commit13b8cbbb1e527051940749e29c1d106773c39a94 (patch)
treed6d58db7e7ea4e4e029ebbbbb4445168815d0c4a /sc/qa/unit
parent7b1ab8f2cf8b07e713c8511984c55e30d70c12d0 (diff)
New ods test document to check the import of row height values.
Test disabled as it currently fails. Change-Id: I33ea3c95357fd7fdb9deaba30372567cfb69ebd6
Diffstat (limited to 'sc/qa/unit')
-rw-r--r--sc/qa/unit/data/ods/row-height-import.odsbin0 -> 9656 bytes
-rw-r--r--sc/qa/unit/subsequent_filters-test.cxx56
2 files changed, 56 insertions, 0 deletions
diff --git a/sc/qa/unit/data/ods/row-height-import.ods b/sc/qa/unit/data/ods/row-height-import.ods
new file mode 100644
index 000000000000..2deb1043bb5a
--- /dev/null
+++ b/sc/qa/unit/data/ods/row-height-import.ods
Binary files differ
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index d31bd8de6ceb..c283508d7693 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -169,6 +169,8 @@ public:
void testPivotTableBasicODS();
+ void testRowHeight();
+
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testRangeNameXLS);
CPPUNIT_TEST(testRangeNameXLSX);
@@ -210,6 +212,7 @@ public:
CPPUNIT_TEST(testCellAnchoredShapesODS);
CPPUNIT_TEST(testPivotTableBasicODS);
+// CPPUNIT_TEST(testRowHeight);
//disable testPassword on MacOSX due to problems with libsqlite3
//also crashes on DragonFly due to problems with nss/nspr headers
@@ -1569,6 +1572,59 @@ void ScFiltersTest::testPivotTableBasicODS()
xDocSh->DoClose();
}
+void ScFiltersTest::testRowHeight()
+{
+ OUString aFileNameBase("row-height-import.");
+ OUString aFileExt = OUString::createFromAscii(aFileFormats[ODS].pName);
+ OUString aFilterName = OUString::createFromAscii(aFileFormats[ODS].pFilterName);
+ OUString aFilterType = OUString::createFromAscii(aFileFormats[ODS].pTypeName);
+
+ rtl::OUString aFileName;
+ createFileURL(aFileNameBase, aFileExt, aFileName);
+
+ unsigned int nFormatType = aFileFormats[ODS].nFormatType;
+ unsigned int nClipboardId = nFormatType ? SFX_FILTER_IMPORT | SFX_FILTER_USESOPTIONS : 0;
+ ScDocShellRef xDocSh = load(aFilterName, aFileName, rtl::OUString(), aFilterType,
+ nFormatType, nClipboardId, SOFFICE_FILEFORMAT_CURRENT);
+
+ SCTAB nTab = 0;
+ SCROW nRow = 0;
+ ScDocument* pDoc = xDocSh->GetDocument();
+
+ // The first 3 rows have manual heights.
+ int nHeight = pDoc->GetRowHeight(nRow, nTab, false);
+ bool bManual = pDoc->IsManualRowHeight(nRow, nTab);
+ CPPUNIT_ASSERT_EQUAL(600, nHeight);
+ CPPUNIT_ASSERT_MESSAGE("this row should have a manual row height.", bManual);
+ nHeight = pDoc->GetRowHeight(++nRow, nTab, false);
+ bManual = pDoc->IsManualRowHeight(nRow, nTab);
+ CPPUNIT_ASSERT_EQUAL(1200, nHeight);
+ CPPUNIT_ASSERT_MESSAGE("this row should have a manual row height.", bManual);
+ nHeight = pDoc->GetRowHeight(++nRow, nTab, false);
+ bManual = pDoc->IsManualRowHeight(nRow, nTab);
+ CPPUNIT_ASSERT_EQUAL(1800, nHeight);
+ CPPUNIT_ASSERT_MESSAGE("this row should have a manual row height.", bManual);
+
+ // This one should have an automatic row height.
+ bManual = pDoc->IsManualRowHeight(++nRow, nTab);
+ CPPUNIT_ASSERT_MESSAGE("Row should have an automatic height.", !bManual);
+
+ // Followed by a row with manual height.
+ nHeight = pDoc->GetRowHeight(++nRow, nTab, false);
+ bManual = pDoc->IsManualRowHeight(nRow, nTab);
+ CPPUNIT_ASSERT_EQUAL(2400, nHeight);
+ CPPUNIT_ASSERT_MESSAGE("this row should have a manual row height.", bManual);
+
+ // And all the rest should have automatic heights.
+ bManual = pDoc->IsManualRowHeight(++nRow, nTab);
+ CPPUNIT_ASSERT_MESSAGE("Row should have an automatic height.", !bManual);
+
+ bManual = pDoc->IsManualRowHeight(MAXROW, nTab);
+ CPPUNIT_ASSERT_MESSAGE("Row should have an automatic height.", !bManual);
+
+ xDocSh->DoClose();
+}
+
namespace {
void testColorScaleFormat_Impl(const rtl::OUString& rFilePath, const ScConditionalFormat* pFormat)