diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-01-04 15:28:49 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-01-04 15:30:25 -0500 |
commit | 4a11267d8140143dce0bdb51791f5e703187a7e9 (patch) | |
tree | 545ffe18276234b7403e885fae1def0c480c3c7e /sc | |
parent | 149277ba2f630261ab9880523bf742318a7a7f12 (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')
-rw-r--r-- | sc/inc/document.hxx | 2 | ||||
-rw-r--r-- | sc/qa/unit/data/ods/row-height-import.ods | bin | 0 -> 9656 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 56 |
3 files changed, 57 insertions, 1 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 41afbf2d11b6..5b5a472d95a7 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1357,7 +1357,7 @@ public: SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); - bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const; + SC_DLLPUBLIC bool IsManualRowHeight(SCROW nRow, SCTAB nTab) const; /** * Write all column row flags to table's flag data, because not all column diff --git a/sc/qa/unit/data/ods/row-height-import.ods b/sc/qa/unit/data/ods/row-height-import.ods Binary files differnew file mode 100644 index 000000000000..2deb1043bb5a --- /dev/null +++ b/sc/qa/unit/data/ods/row-height-import.ods 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) |