diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-11-30 14:13:15 +0100 |
---|---|---|
committer | Marco Cecchetti <mrcekets@gmail.com> | 2017-02-13 20:07:42 +0000 |
commit | eb399d69aa5ad0c04affb830a522c5c1f130813f (patch) | |
tree | 3a23083d294c85cb03a1364b74caf2af6f3c65d7 /desktop/qa | |
parent | 1a1dbff33db8a6f2f55a5d92483a03670a610f6a (diff) |
LOK - Calc: Increase the row limit to 10.000 rows.
Change-Id: Ie91e4caf33d3b31df4c3de8dc6e78e223dc1e4b3
Reviewed-on: https://gerrit.libreoffice.org/34216
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Marco Cecchetti <mrcekets@gmail.com>
Diffstat (limited to 'desktop/qa')
-rw-r--r-- | desktop/qa/desktop_lib/test_desktop_lib.cxx | 76 |
1 files changed, 57 insertions, 19 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 5ea56329cae4..0574fec91e03 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -592,46 +592,79 @@ void DesktopLOKTest::testRowColumnHeaders() pDocument->pClass->initializeForRendering(pDocument, nullptr); + long nWidth = 0; + long nHeight = 0; + pDocument->m_pDocumentClass->getDocumentSize(pDocument, &nWidth, &nHeight); + long nX = rtl::math::round(nWidth / 4.0); + long nY = rtl::math::round(nHeight / 4.0); + nWidth = rtl::math::round(nWidth / 2.0); + nHeight = rtl::math::round(nHeight / 2.0); + + std::stringstream aPayload; + aPayload << ".uno:ViewRowColumnHeaders?x=" << nX << "&y=" << nY << "&width=" << nWidth << "&height=" << nHeight; + boost::property_tree::ptree aTree; - char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); + char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aPayload.str().c_str()); std::stringstream aStream(pJSON); free(pJSON); + CPPUNIT_ASSERT(!aStream.str().empty()); boost::property_tree::read_json(aStream, aTree); sal_Int32 nPrevious = 0; + bool bFirstHeader = true; + bool bNotEnoughHeaders = 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); OString aText(rValue.second.get<std::string>("text").c_str()); - if (!nPrevious) - // This failed, as the first item did not contain the text of the first row. - CPPUNIT_ASSERT_EQUAL(OString("1"), aText); + + if (bFirstHeader) + { + CPPUNIT_ASSERT(nSize <= nY); + CPPUNIT_ASSERT_EQUAL(OString("11"), aText); + bFirstHeader = false; + } else { - // Make sure that size is absolute: the first two items have the same relative size. + CPPUNIT_ASSERT(nSize > 0); CPPUNIT_ASSERT(nPrevious < nSize); - break; + if (nSize > nY + nHeight) + { + bNotEnoughHeaders = false; + break; + } } nPrevious = nSize; } + CPPUNIT_ASSERT(!bNotEnoughHeaders); nPrevious = 0; + bFirstHeader = true; + bNotEnoughHeaders = true; for (boost::property_tree::ptree::value_type& rValue : aTree.get_child("columns")) { sal_Int32 nSize = OString(rValue.second.get<std::string>("size").c_str()).toInt32(); - CPPUNIT_ASSERT(nSize > 0); OString aText(rValue.second.get<std::string>("text").c_str()); - if (!nPrevious) - CPPUNIT_ASSERT_EQUAL(OString("A"), aText); + if (bFirstHeader) + { + CPPUNIT_ASSERT(nSize <= nX); + CPPUNIT_ASSERT_EQUAL(OString("4"), aText); + bFirstHeader = false; + } else { + CPPUNIT_ASSERT(nSize > 0); CPPUNIT_ASSERT(nPrevious < nSize); - break; + if (nSize > nX + nWidth) + { + bNotEnoughHeaders = false; + break; + } } nPrevious = nSize; } + CPPUNIT_ASSERT(!bNotEnoughHeaders); } void DesktopLOKTest::testHiddenRowHeaders() @@ -640,29 +673,34 @@ void DesktopLOKTest::testHiddenRowHeaders() pDocument->pClass->initializeForRendering(pDocument, nullptr); + long nX = 0; + long nY = 0; + long nWidth = 0; + long nHeight = 0; + pDocument->m_pDocumentClass->getDocumentSize(pDocument, &nWidth, &nHeight); + + std::stringstream aPayload; + aPayload << ".uno:ViewRowColumnHeaders?x=" << nX << "&y=" << nY << "&width=" << nWidth << "&height=" << nHeight; + boost::property_tree::ptree aTree; - char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, ".uno:ViewRowColumnHeaders"); + char* pJSON = pDocument->m_pDocumentClass->getCommandValues(pDocument, aPayload.str().c_str()); 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; + sal_Int32 nIndex = 0; 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 + if (nIndex++ == 2) { - // nSize was 509, nPrevious was 254, i.e. hidden row wasn't reported as 0 height. + // nSize was 510, nPrevious was 255, i.e. hidden row wasn't reported as 0 height. CPPUNIT_ASSERT_EQUAL(nPrevious, nSize); break; } - nPrevious = nSize; } } |