diff options
Diffstat (limited to 'sc/qa/unit/subsequent_filters-test.cxx')
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 56 |
1 files changed, 56 insertions, 0 deletions
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) |