diff options
Diffstat (limited to 'desktop/qa')
-rw-r--r-- | desktop/qa/data/hidden-row.ods | bin | 0 -> 7684 bytes | |||
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 35 |
2 files changed, 35 insertions, 0 deletions
diff --git a/desktop/qa/data/hidden-row.ods b/desktop/qa/data/hidden-row.ods Binary files differnew file mode 100644 index 000000000000..25fe89865d9e --- /dev/null +++ b/desktop/qa/data/hidden-row.ods diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index a562ab2f8b21..51b927223081 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -80,6 +80,7 @@ public: void testPasteWriter(); void testPasteWriterJPEG(); void testRowColumnHeaders(); + void testHiddenRowHeaders(); void testCellCursor(); void testCommandResult(); void testWriterComments(); @@ -101,6 +102,7 @@ public: CPPUNIT_TEST(testPasteWriter); CPPUNIT_TEST(testPasteWriterJPEG); CPPUNIT_TEST(testRowColumnHeaders); + CPPUNIT_TEST(testHiddenRowHeaders); CPPUNIT_TEST(testCellCursor); CPPUNIT_TEST(testCommandResult); CPPUNIT_TEST(testWriterComments); @@ -548,6 +550,39 @@ void DesktopLOKTest::testRowColumnHeaders() } } +void DesktopLOKTest::testHiddenRowHeaders() +{ + LibLODocument_Impl* pDocument = loadDoc("hidden-row.ods"); + + pDocument->pClass->initializeForRendering(pDocument, nullptr); + + boost::property_tree::ptree aTree; + char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); + std::stringstream aStream(pJSON); + free(pJSON); + CPPUNIT_ASSERT(!aStream.str().empty()); + + boost::property_tree::read_json(aStream, aTree); + sal_Int32 nPrevious = 0; + bool bFirst = true; + for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("rows")) + { + sal_Int32 nSize = OString(rValue.second.get<std::string>("size").c_str()).toInt32(); + CPPUNIT_ASSERT(nSize > 0); + + if (bFirst) + bFirst = false; + else + { + // nSize was 509, nPrevious was 254, i.e. hidden row wasn't reported as 0 height. + CPPUNIT_ASSERT_EQUAL(nPrevious, nSize); + break; + } + + nPrevious = nSize; + } +} + void DesktopLOKTest::testCellCursor() { LibLODocument_Impl* pDocument = loadDoc("search.ods"); |