[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 11 +-- sc/source/ui/view/tabview5.cxx |8 +++- 2 files changed, 16 insertions(+), 3 deletions(-) New commits: commit 2939a0f4805c7f708a803d624c5ac42f78bcf791 Author: Tamás Zolnai AuthorDate: Fri Sep 27 19:49:55 2019 +0200 Commit: Tamás Zolnai CommitDate: Sat Sep 28 03:33:38 2019 +0200 sc lok: Optimize invalidation triggered by ScTabView::TabChanged() method We don't need to invalidate all parts of the document. It's enough to invalidate only that sheet which we changed to. Reviewed-on: https://gerrit.libreoffice.org/79500 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 96bd7504165f89ec5485d00a487e54634af347ce) Change-Id: I2c3aeb226c83bef473b0b33444b625e93d111b01 Reviewed-on: https://gerrit.libreoffice.org/79626 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai Reviewed-on: https://gerrit.libreoffice.org/79769 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 685b36659845..07c54e6f671f 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -450,6 +450,7 @@ public: bool m_bFullInvalidateTiles; bool m_bInvalidateTiles; std::vector m_aInvalidations; +std::vector m_aInvalidationsParts; bool m_bViewLock; OString m_sCellFormula; boost::property_tree::ptree m_aCommentCallbackResult; @@ -525,6 +526,8 @@ public: aInvalidationRect.setWidth(aSeq[2].toInt32()); aInvalidationRect.setHeight(aSeq[3].toInt32()); m_aInvalidations.push_back(aInvalidationRect); +if (aSeq.getLength() == 5) +m_aInvalidationsParts.push_back(aSeq[4].toInt32()); m_bInvalidateTiles = true; } } @@ -1732,12 +1735,16 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() SfxLokHelper::setView(nView1); aView1.m_bInvalidateTiles = false; aView1.m_aInvalidations.clear(); +aView1.m_aInvalidationsParts.clear(); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(3), aView1.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidations[0]); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 10, 10), aView1.m_aInvalidations[1]); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidationsParts.size()); +CPPUNIT_ASSERT_EQUAL(pModelObj->getPart(), aView1.m_aInvalidationsParts[0]); } void ScTiledRenderingTest::testInsertDeletePageInvalidation() @@ -1766,7 +1773,7 @@ void ScTiledRenderingTest::testInsertDeletePageInvalidation() comphelper::dispatchCommand(".uno:Insert", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(8), aView1.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(size_t(6), aView1.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 10, 10), aView1.m_aInvalidations[0]); CPPUNIT_ASSERT_EQUAL(2, pModelObj->getParts()); diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 88d35b111ed3..396b1c63a72c 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -329,8 +329,14 @@ void ScTabView::TabChanged( bool bSameTabButMoved ) ss << aDocSize.Width() << ", " << aDocSize.Height(); OString sRect = ss.str().c_str(); ScTabViewShell* pViewShell = aViewData.GetViewShell(); + +// Invalidate first +tools::Rectangle aRectangle(0, 0, 10, 10); +OString sPayload = aRectangle.toString() + OString(", ") + OString::number(aViewData.GetTabNo()); + pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_INVALIDATE_TILES, sPayload.getStr()); + ScModelObj* pModel = ScModelObj::getImplementation(pViewShell->GetCurrentDocument()); -SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel); +SfxLokHelper::notifyDocumentSizeChanged(pViewShell, sRect, pModel, false); } } } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx | 15 -- sc/source/ui/view/tabview.cxx| 38 +-- 2 files changed, 25 insertions(+), 28 deletions(-) New commits: commit 9f71c43ca0ff956adc74f171bd20d3163ecf366c Author: Tamás Zolnai AuthorDate: Fri Sep 27 19:29:27 2019 +0200 Commit: Tamás Zolnai CommitDate: Sat Sep 28 03:31:45 2019 +0200 sc lok: Optimize invalidation triggered by getRowColumnHeaders() method Don't call a full invalidation, rather use invalidation only on the new area. Make sure that the invalidation is called first. Reviewed-on: https://gerrit.libreoffice.org/79494 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai (cherry picked from commit e740aaf876edd58c1f5c5e17af2495cad36cfc27) Change-Id: I89d1c6342ed8e95fe738a876a76ca6feda031962 Reviewed-on: https://gerrit.libreoffice.org/79620 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai Reviewed-on: https://gerrit.libreoffice.org/79763 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index e7937792abd9..f88070b065b0 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1799,9 +1799,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(0, 15, 19650, 5400)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 10, 10), aView1.m_aInvalidations[0]); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[1]); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(26775, 0, 49725, 13005), aView1.m_aInvalidations[0]); // Extend area top-to-bottom aView1.m_bInvalidateTiles = false; @@ -1809,9 +1808,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(0, 5400, 19650, 9800)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 10, 10), aView1.m_aInvalidations[0]); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[1]); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 49725, 19380), aView1.m_aInvalidations[0]); // Extend area left-to-right aView1.m_bInvalidateTiles = false; @@ -1819,9 +1817,8 @@ void ScTiledRenderingTest::testGetRowColumnHeadersInvalidation() pModelObj->getRowColumnHeaders(tools::Rectangle(5400, 5400, 25050, 9800)); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView1.m_aInvalidations.size()); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 10, 10), aView1.m_aInvalidations[0]); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[1]); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(49725, 0, 75225, 19380), aView1.m_aInvalidations[0]); } } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 210308caf3f3..935ed1ef290d 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -2564,14 +2564,6 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) SAL_INFO("sc.lok.header", "Row Header: a new height: " << aNewSize.Height()); if (pDocSh) { -// Provide size in the payload, so clients don't have to -// call lok::Document::getDocumentSize(). -std::stringstream ss; -ss << aNewSize.Width() << ", " << aNewSize.Height(); -OString sSize = ss.str().c_str(); -ScModelObj* pModel = ScModelObj::getImplementation(aViewData.GetViewShell()->GetCurrentDocument()); -SfxLokHelper::notifyDocumentSizeChanged(aViewData.GetViewShell(), sSize, pModel); - // New area extended to the bottom of the sheet after last row // excluding overlapping area with aNewColArea tools::Rectangle aNewRowArea(0, aOldSize.getHeight(), aOldSize.getWidth(), aNewSize.getHeight()); @@ -2582,6 +2574,14 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) UpdateSelectionOverlay(); SfxLokHelper::notifyInvalidation(aViewData.GetViewShell(), aNewRowArea.toString()); } + +// Provide size in the
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/tiledrendering/tiledrendering.cxx | 39 ++- 1 file changed, 21 insertions(+), 18 deletions(-) New commits: commit 086fb1fe8cf8cccf57c135e59b6e1393d6247bc3 Author: Tamás Zolnai AuthorDate: Fri Sep 27 19:13:44 2019 +0200 Commit: Tamás Zolnai CommitDate: Sat Sep 28 03:30:32 2019 +0200 sc lok tests: Store all invalidation rectangles. Reviewed-on: https://gerrit.libreoffice.org/79490 Reviewed-by: Tamás Zolnai Tested-by: Tamás Zolnai (cherry picked from commit 630d5915819c664aaee5f17066c61939f7ceaefe) Reviewed-on: https://gerrit.libreoffice.org/79616 Tested-by: Jenkins CollaboraOffice Change-Id: I214a98d1901af0d0c25897ebfbdb644e92714f5c Reviewed-on: https://gerrit.libreoffice.org/79759 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 3276ce901dcc..12ac20e380bd 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -441,7 +441,7 @@ public: bool m_bGraphicViewSelection; bool m_bFullInvalidateTiles; bool m_bInvalidateTiles; -tools::Rectangle m_aInvalidation; +std::vector m_aInvalidations; bool m_bViewLock; OString m_sCellFormula; boost::property_tree::ptree m_aCommentCallbackResult; @@ -509,15 +509,14 @@ public: } else { -if (m_aInvalidation.IsEmpty()) -{ -uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); -CPPUNIT_ASSERT_EQUAL(static_cast(4), aSeq.getLength()); -m_aInvalidation.setX(aSeq[0].toInt32()); -m_aInvalidation.setY(aSeq[1].toInt32()); -m_aInvalidation.setWidth(aSeq[2].toInt32()); -m_aInvalidation.setHeight(aSeq[3].toInt32()); -} +uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); +CPPUNIT_ASSERT_EQUAL(static_cast(4), aSeq.getLength()); +tools::Rectangle aInvalidationRect; +aInvalidationRect.setX(aSeq[0].toInt32()); +aInvalidationRect.setY(aSeq[1].toInt32()); +aInvalidationRect.setWidth(aSeq[2].toInt32()); +aInvalidationRect.setHeight(aSeq[3].toInt32()); +m_aInvalidations.push_back(aInvalidationRect); m_bInvalidateTiles = true; } } @@ -1039,11 +1038,12 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() // insert row aView.m_bInvalidateTiles = false; -aView.m_aInvalidation = tools::Rectangle(); +aView.m_aInvalidations.clear(); comphelper::dispatchCommand(".uno:InsertRows", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidation); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidations[0]); // move on the right for (int i = 0; i < 200; ++i) @@ -1055,11 +1055,12 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() // insert column aView.m_bInvalidateTiles = false; -aView.m_aInvalidation = tools::Rectangle(); +aView.m_aInvalidations.clear(); comphelper::dispatchCommand(".uno:InsertColumns", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidation); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidations[0]); } void ScTiledRenderingTest::testCommentCallback() @@ -1698,12 +1699,13 @@ void ScTiledRenderingTest::testPageDownInvalidation() SfxLokHelper::setView(nView1); aView1.m_bInvalidateTiles = false; -aView1.m_aInvalidation = tools::Rectangle(); +aView1.m_aInvalidations.clear(); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, awt::Key::PAGEDOWN, 0); pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, awt::Key::PAGEDOWN, 0); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidation); +CPPUNIT_ASSERT_EQUAL(size_t(3), aView1.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidations[0]); } void ScTiledRenderingTest::testSheetChangeInvalidation() @@ -1721,12 +1723,13 @@ void ScTiledRenderingTest::testSheetChangeInvalidation() SfxLokHelper::setView(nView1);
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/tiledrendering/data/two_sheets.ods |binary sc/qa/unit/tiledrendering/tiledrendering.cxx | 25 + 2 files changed, 25 insertions(+) New commits: commit 6d29c06e17e2a7ab1efd30108350f785f2a1ee0e Author: Tamás Zolnai AuthorDate: Fri Sep 13 17:44:36 2019 +0200 Commit: Tamás Zolnai CommitDate: Sat Sep 28 03:30:08 2019 +0200 sc lok: Test invalidation after sheet change Reviewed-on: https://gerrit.libreoffice.org/79489 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit ff0cd54de41e71e24bf7d833b1260c6dbb8dbfea) Change-Id: I799089fc65d92fe72d7e76afbcd44bd4161d25f4 Reviewed-on: https://gerrit.libreoffice.org/79615 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai Reviewed-on: https://gerrit.libreoffice.org/79758 diff --git a/sc/qa/unit/tiledrendering/data/two_sheets.ods b/sc/qa/unit/tiledrendering/data/two_sheets.ods new file mode 100644 index ..6aa1d03be62c Binary files /dev/null and b/sc/qa/unit/tiledrendering/data/two_sheets.ods differ diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index db524665e86c..3276ce901dcc 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -100,6 +100,7 @@ public: void testFilterDlg(); void testVbaRangeCopyPaste(); void testPageDownInvalidation(); +void testSheetChangeInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -134,6 +135,7 @@ public: CPPUNIT_TEST(testFilterDlg); CPPUNIT_TEST(testVbaRangeCopyPaste); CPPUNIT_TEST(testPageDownInvalidation); +CPPUNIT_TEST(testSheetChangeInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -1704,6 +1706,29 @@ void ScTiledRenderingTest::testPageDownInvalidation() CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidation); } +void ScTiledRenderingTest::testSheetChangeInvalidation() +{ +comphelper::LibreOfficeKit::setActive(); + +ScModelObj* pModelObj = createDoc("two_sheets.ods"); +ScViewData* pViewData = ScDocShell::GetViewData(); +CPPUNIT_ASSERT(pViewData); + +int nView1 = SfxLokHelper::getView(); +ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); +CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); + +SfxLokHelper::setView(nView1); +aView1.m_bInvalidateTiles = false; +aView1.m_aInvalidation = tools::Rectangle(); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::PAGEDOWN | KEY_MOD1); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::PAGEDOWN | KEY_MOD1); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 0, 1310720, 268435456), aView1.m_aInvalidation); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/tiledrendering/tiledrendering.cxx |4 1 file changed, 4 insertions(+) New commits: commit 305f0c9b974d480570cbd994711ddc3b8d83b5a8 Author: Tamás Zolnai AuthorDate: Fri Sep 27 19:09:12 2019 +0200 Commit: Tamás Zolnai CommitDate: Sat Sep 28 03:29:46 2019 +0200 sc lok: Test also the invalidation rectangle in case of row/column insertion Reviewed-on: https://gerrit.libreoffice.org/79488 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit d877c232c0d63fd509fa8bf9ca433481dfb2b126) Reviewed-on: https://gerrit.libreoffice.org/79614 Tested-by: Tamás Zolnai Change-Id: I5dffc0521ae7ef3ddd47574a85457ddcec2a0566 Reviewed-on: https://gerrit.libreoffice.org/79757 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index c9405934a9c9..db524665e86c 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1037,9 +1037,11 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() // insert row aView.m_bInvalidateTiles = false; +aView.m_aInvalidation = tools::Rectangle(); comphelper::dispatchCommand(".uno:InsertRows", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 50985, 32212230, 63990), aView.m_aInvalidation); // move on the right for (int i = 0; i < 200; ++i) @@ -1051,9 +1053,11 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() // insert column aView.m_bInvalidateTiles = false; +aView.m_aInvalidation = tools::Rectangle(); comphelper::dispatchCommand(".uno:InsertColumns", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(253650, -15, 32212230, 63990), aView.m_aInvalidation); } void ScTiledRenderingTest::testCommentCallback() ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/tiledrendering/tiledrendering.cxx | 36 +++ 1 file changed, 36 insertions(+) New commits: commit 4097f085137a35f95f3e3b53add17f3109e59108 Author: Tamás Zolnai AuthorDate: Fri Sep 13 15:59:54 2019 +0200 Commit: Tamás Zolnai CommitDate: Sat Sep 28 03:29:25 2019 +0200 sc lok: Test invalidation triggered by PageDown Reviewed-on: https://gerrit.libreoffice.org/79487 Tested-by: Jenkins Reviewed-by: Tamás Zolnai (cherry picked from commit 54bb961b1e8c01603782f8e5c50e9e1ee5896d7c) Change-Id: Id54a679b60e440f17371a3a532928bd161077e90 Reviewed-on: https://gerrit.libreoffice.org/79613 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tamás Zolnai Reviewed-on: https://gerrit.libreoffice.org/79756 diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index ad31824a601f..c9405934a9c9 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -98,6 +99,7 @@ public: void testIMESupport(); void testFilterDlg(); void testVbaRangeCopyPaste(); +void testPageDownInvalidation(); CPPUNIT_TEST_SUITE(ScTiledRenderingTest); CPPUNIT_TEST(testRowColumnSelections); @@ -131,6 +133,7 @@ public: CPPUNIT_TEST(testIMESupport); CPPUNIT_TEST(testFilterDlg); CPPUNIT_TEST(testVbaRangeCopyPaste); +CPPUNIT_TEST(testPageDownInvalidation); CPPUNIT_TEST_SUITE_END(); private: @@ -436,6 +439,7 @@ public: bool m_bGraphicViewSelection; bool m_bFullInvalidateTiles; bool m_bInvalidateTiles; +tools::Rectangle m_aInvalidation; bool m_bViewLock; OString m_sCellFormula; boost::property_tree::ptree m_aCommentCallbackResult; @@ -503,6 +507,15 @@ public: } else { +if (m_aInvalidation.IsEmpty()) +{ +uno::Sequence aSeq = comphelper::string::convertCommaSeparated(OUString::createFromAscii(pPayload)); +CPPUNIT_ASSERT_EQUAL(static_cast(4), aSeq.getLength()); +m_aInvalidation.setX(aSeq[0].toInt32()); +m_aInvalidation.setY(aSeq[1].toInt32()); +m_aInvalidation.setWidth(aSeq[2].toInt32()); +m_aInvalidation.setHeight(aSeq[3].toInt32()); +} m_bInvalidateTiles = true; } } @@ -1664,6 +1677,29 @@ void ScTiledRenderingTest::testVbaRangeCopyPaste() CPPUNIT_ASSERT(!pDocShell->GetClipData().is()); } +void ScTiledRenderingTest::testPageDownInvalidation() +{ +comphelper::LibreOfficeKit::setActive(); + +ScModelObj* pModelObj = createDoc("empty.ods"); +ScViewData* pViewData = ScDocShell::GetViewData(); +CPPUNIT_ASSERT(pViewData); + +int nView1 = SfxLokHelper::getView(); +ViewCallback aView1; + SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); +CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData)); + +SfxLokHelper::setView(nView1); +aView1.m_bInvalidateTiles = false; +aView1.m_aInvalidation = tools::Rectangle(); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, awt::Key::PAGEDOWN, 0); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, awt::Key::PAGEDOWN, 0); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT(aView1.m_bInvalidateTiles); +CPPUNIT_ASSERT_EQUAL(tools::Rectangle(15, 15, 1230, 225), aView1.m_aInvalidation); +} + } CPPUNIT_TEST_SUITE_REGISTRATION(ScTiledRenderingTest); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/tiledrendering/tiledrendering.cxx | 161 --- 1 file changed, 77 insertions(+), 84 deletions(-) New commits: commit 42977af4e50974e907db8a981f16a79d5fceddad Author: Miklos Vajna AuthorDate: Fri May 10 14:09:56 2019 +0200 Commit: Michael Meeks CommitDate: Fri May 10 18:14:59 2019 +0200 CppunitTest_sc_tiledrendering: close the document while LOK is still active This is the same type of problem that was fixed for CppunitTest_desktop_lib in commit da17ccaec39f50de68c3fdd431bc66a2bec04127 (CppunitTest_desktop_lib: close the document while LOK is still active, 2019-05-09). (cherry picked from commit 6eac1c9e3f4e801a3cfa75f85f7bc3944c7cd21e) On cp-6.0, this is a regression from the cp-6.0-only commit 49fe72fe93d6b292da275fd0508a01b49a86fa3b (sfx2: LOK: route the parent sidebar window instead of the deck, 2018-10-10). Conflicts: sc/qa/unit/tiledrendering/tiledrendering.cxx Change-Id: I2515e18713c9f20a4f70de478ab062bab5650608 Reviewed-on: https://gerrit.libreoffice.org/72127 Reviewed-by: Michael Meeks Tested-by: Michael Meeks diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 711d663b5892..d7cba12df804 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -157,7 +157,22 @@ void ScTiledRenderingTest::setUp() void ScTiledRenderingTest::tearDown() { if (mxComponent.is()) +{ +ScModelObj* pModelObj = static_cast(mxComponent.get()); +ScDocShell* pDocSh = dynamic_cast< ScDocShell* >( pModelObj->GetEmbeddedObject() ); +if (pDocSh) +{ +ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false); +if (pViewShell) +{ +// The current view is unregistered here, multiple views have to be unregistered +// in the test function itself. +pViewShell->registerLibreOfficeKitViewCallback(nullptr, nullptr); +} +} mxComponent->dispose(); +} +comphelper::LibreOfficeKit::setActive(false); test::BootstrapFixture::tearDown(); } @@ -309,8 +324,6 @@ void ScTiledRenderingTest::testRowColumnSelections() aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType); aExpected = "1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n"; CPPUNIT_ASSERT_EQUAL(aExpected, aResult); - -comphelper::LibreOfficeKit::setActive(false); } void ScTiledRenderingTest::testSortAscendingDescending() @@ -348,8 +361,6 @@ void ScTiledRenderingTest::testSortAscendingDescending() CPPUNIT_ASSERT_EQUAL(double(1), pDoc->GetValue(ScAddress(1, 0, 0))); CPPUNIT_ASSERT_EQUAL(double(3), pDoc->GetValue(ScAddress(1, 1, 0))); CPPUNIT_ASSERT_EQUAL(double(2), pDoc->GetValue(ScAddress(1, 2, 0))); - -comphelper::LibreOfficeKit::setActive(false); } void ScTiledRenderingTest::testPartHash() @@ -365,7 +376,6 @@ void ScTiledRenderingTest::testPartHash() // check part that it does not exists CPPUNIT_ASSERT(pModelObj->getPartHash(100).isEmpty()); -comphelper::LibreOfficeKit::setActive(false); } void ScTiledRenderingTest::testDocumentSize() @@ -396,8 +406,6 @@ void ScTiledRenderingTest::testDocumentSize() // 2 seconds aResult = m_aDocSizeCondition.wait(std::chrono::seconds(2)); CPPUNIT_ASSERT_EQUAL(aResult, osl::Condition::result_ok); - -comphelper::LibreOfficeKit::setActive(false); } void ScTiledRenderingTest::testEmptyColumnSelection() @@ -417,8 +425,6 @@ void ScTiledRenderingTest::testEmptyColumnSelection() OString aResult = pModelObj->getTextSelection("text/plain;charset=utf-8", aUsedMimeType); // should be an empty string CPPUNIT_ASSERT_EQUAL(OString(), aResult); - -comphelper::LibreOfficeKit::setActive(false); } /// A view callback tracks callbacks invoked on one specific view. @@ -528,6 +534,7 @@ void ScTiledRenderingTest::testViewCursors() ScModelObj* pModelObj = createDoc("select-row-cols.ods"); ViewCallback aView1; SfxViewShell::Current()->registerLibreOfficeKitViewCallback(&ViewCallback::callback, &aView1); +int nView1 = SfxLokHelper::getView(); SfxLokHelper::createView(); pModelObj->initializeForTiledRendering(uno::Sequence()); ViewCallback aView2; @@ -542,10 +549,8 @@ void ScTiledRenderingTest::testViewCursors() Scheduler::ProcessEventsToIdle(); SfxLokHelper::destroyView(SfxLokHelper::getView()); CPPUNIT_ASSERT(aView1.m_bViewCursorInvalidated); -mxComponent->dispose(); -mxComponent.clear(); - -comphelper::LibreOfficeKit::setActive(false); +SfxLokHelper::setView(nView1); +SfxViewShell::Current()->registerLibreOfficeKitViewCallback(nullptr, nullptr); } void lcl_dispatchCommand(const uno::Reference& xComponent, const OUSt
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/data/ods/conditionalformat_containstext.ods |binary sc/qa/unit/subsequent_export-test.cxx | 13 + 2 files changed, 13 insertions(+) New commits: commit 02a57aa51d71680ed64ce6519d77e28db06b03b3 Author: Markus Mohrhard AuthorDate: Sat Jul 14 15:29:41 2018 +0200 Commit: Andras Timar CommitDate: Fri May 10 08:25:01 2019 +0200 add test for tdf#117816 Reviewed-on: https://gerrit.libreoffice.org/57433 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit 7e8dbbb02f25278d5afc51ae4a397831f5b21239) Change-Id: I470b4137a3b4e23acf0f4e949a7a834fed8069db Reviewed-on: https://gerrit.libreoffice.org/72005 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/ods/conditionalformat_containstext.ods b/sc/qa/unit/data/ods/conditionalformat_containstext.ods new file mode 100644 index ..fa3e21e29f5a Binary files /dev/null and b/sc/qa/unit/data/ods/conditionalformat_containstext.ods differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index c095e9fb3847..831c98750454 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -110,6 +110,7 @@ public: void testDataBarExportODS(); void testDataBarExportXLSX(); void testConditionalFormatRangeListXLSX(); +void testConditionalFormatContainsTextXLSX(); void testConditionalFormatPriorityCheckXLSX(); void testMiscRowHeightExport(); void testNamedRangeBugfdo62729(); @@ -237,6 +238,7 @@ public: CPPUNIT_TEST(testDataBarExportODS); CPPUNIT_TEST(testDataBarExportXLSX); CPPUNIT_TEST(testConditionalFormatRangeListXLSX); +CPPUNIT_TEST(testConditionalFormatContainsTextXLSX); CPPUNIT_TEST(testConditionalFormatPriorityCheckXLSX); CPPUNIT_TEST(testMiscRowHeightExport); CPPUNIT_TEST(testNamedRangeBugfdo62729); @@ -3922,6 +3924,17 @@ void ScExportTest::testConditionalFormatRangeListXLSX() assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "F4 F10"); } +void ScExportTest::testConditionalFormatContainsTextXLSX() +{ +ScDocShellRef xDocSh = loadDoc("conditionalformat_containstext.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +assertXPathContent(pDoc, "//x:conditionalFormatting/x:cfRule/x:formula", "NOT(ISERROR(SEARCH(\"test\",A1)))"); +} + void ScExportTest::testConditionalFormatPriorityCheckXLSX() { ScDocShellRef xDocSh = loadDoc("conditional_fmt_checkpriority.", FORMAT_XLSX); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/xlsx/conditional_fmt_checkpriority.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 48 sc/source/filter/excel/xeextlst.cxx |2 sc/source/filter/inc/condformatbuffer.hxx | 13 ++ sc/source/filter/inc/extlstcontext.hxx |2 sc/source/filter/oox/condformatbuffer.cxx | 93 ++-- sc/source/filter/oox/extlstcontext.cxx | 15 ++ 7 files changed, 162 insertions(+), 11 deletions(-) New commits: commit 333d4dd7745dda0e1f73c13bf625a36cbbb53450 Author: Dennis Francis AuthorDate: Fri Apr 19 23:15:53 2019 +0530 Commit: Andras Timar CommitDate: Fri May 10 08:24:23 2019 +0200 tdf#122590: follow-up : import x14:cfRule priorities If there are x:cfRule's and x14:cfRule's with matching range-list, then insert the conditional-fmt entries into the document in the order of the priorities. That is don't just append the x14:cfRule entries to the document after the x:cfRule entries are inserted. There was also a off-by-one bug in the priority export of x14:cfRule entries. This caused the priority numbers to be duplicated. This is also fixed. Reviewed-on: https://gerrit.libreoffice.org/71311 Tested-by: Jenkins Reviewed-by: Andras Timar (cherry picked from commit c2f1c68ffb6dfa1ce7de09dcc428d6c53549e88d) Change-Id: I5b0d11c4456b2966b808f6ee589075a870f43768 Reviewed-on: https://gerrit.libreoffice.org/72003 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/data/xlsx/conditional_fmt_checkpriority.xlsx b/sc/qa/unit/data/xlsx/conditional_fmt_checkpriority.xlsx new file mode 100644 index ..e9af11d00615 Binary files /dev/null and b/sc/qa/unit/data/xlsx/conditional_fmt_checkpriority.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index ab51e7575033..c095e9fb3847 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -110,6 +110,7 @@ public: void testDataBarExportODS(); void testDataBarExportXLSX(); void testConditionalFormatRangeListXLSX(); +void testConditionalFormatPriorityCheckXLSX(); void testMiscRowHeightExport(); void testNamedRangeBugfdo62729(); void testBuiltinRangesXLSX(); @@ -236,6 +237,7 @@ public: CPPUNIT_TEST(testDataBarExportODS); CPPUNIT_TEST(testDataBarExportXLSX); CPPUNIT_TEST(testConditionalFormatRangeListXLSX); +CPPUNIT_TEST(testConditionalFormatPriorityCheckXLSX); CPPUNIT_TEST(testMiscRowHeightExport); CPPUNIT_TEST(testNamedRangeBugfdo62729); CPPUNIT_TEST(testBuiltinRangesXLSX); @@ -364,6 +366,8 @@ void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx) { BAD_CAST("r"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships";) }, { BAD_CAST("number"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0") }, { BAD_CAST("loext"), BAD_CAST("urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0") }, +{ BAD_CAST("x14"), BAD_CAST("http://schemas.microsoft.com/office/spreadsheetml/2009/9/main";) }, +{ BAD_CAST("xm"), BAD_CAST("http://schemas.microsoft.com/office/excel/2006/main";) }, }; for(size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i) { @@ -3918,6 +3922,50 @@ void ScExportTest::testConditionalFormatRangeListXLSX() assertXPath(pDoc, "//x:conditionalFormatting", "sqref", "F4 F10"); } +void ScExportTest::testConditionalFormatPriorityCheckXLSX() +{ +ScDocShellRef xDocSh = loadDoc("conditional_fmt_checkpriority.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/worksheets/sheet1.xml", FORMAT_XLSX); +CPPUNIT_ASSERT(pDoc); + +constexpr bool bHighPriorityExtensionA1 = true; // Should A1's extension cfRule has higher priority than normal cfRule ? +constexpr bool bHighPriorityExtensionA3 = false; // Should A3's extension cfRule has higher priority than normal cfRule ? + +size_t nA1NormalPriority = 0; +size_t nA1ExtPriority = 0; +size_t nA3NormalPriority = 0; +size_t nA3ExtPriority = 0; + +for (size_t nIdx = 1; nIdx <= 2; ++nIdx) +{ +OString aIdx = OString::number(nIdx); +OUString aCellAddr = getXPath(pDoc, "//x:conditionalFormatting[" + aIdx + "]", "sqref"); +OUString aPriority = getXPath(pDoc, "//x:conditionalFormatting[" + aIdx + "]/x:cfRule", "priority");; + +CPPUNIT_ASSERT_MESSAGE("conditionalFormatting sqref must be either A1 or A3", aCellAddr == "A1" || aCellAddr == "A3"); + +if (aCellAddr == "A1") +nA1NormalPriority = aPriority.toUInt32(); +else +nA3NormalPriority = aPriority.toUInt32(); + +aCellAddr = getXPathContent(pDoc, "//x:extLst/x
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/ods/pivottable_fieldInRowsAndData.ods |binary sc/qa/unit/pivottable_filters_test.cxx| 19 ++ sc/source/filter/excel/xepivotxml.cxx | 16 +++ 3 files changed, 35 insertions(+) New commits: commit 5afa630cf781143c8ff3228a28657bb412d2c0a9 Author: Mike Kaganski AuthorDate: Thu May 2 19:44:47 2019 +0300 Commit: Mike Kaganski CommitDate: Thu May 2 20:17:41 2019 +0200 tdf#125086: Write dataField attribute for fields that also appear in Data Change-Id: Id9f8f07bfdb1060f0c3d7ed6f8526a6bfdd84eb4 Reviewed-on: https://gerrit.libreoffice.org/71687 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/71696 Tested-by: Mike Kaganski diff --git a/sc/qa/unit/data/ods/pivottable_fieldInRowsAndData.ods b/sc/qa/unit/data/ods/pivottable_fieldInRowsAndData.ods new file mode 100644 index ..cbb773857605 Binary files /dev/null and b/sc/qa/unit/data/ods/pivottable_fieldInRowsAndData.ods differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 065ad71b4e55..30969db5f039 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -96,6 +96,7 @@ public: void testTdf124883(); void testTdf125046(); void testTdf125055(); +void testTdf125086(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -146,6 +147,7 @@ public: CPPUNIT_TEST(testTdf124883); CPPUNIT_TEST(testTdf125046); CPPUNIT_TEST(testTdf125055); +CPPUNIT_TEST(testTdf125086); CPPUNIT_TEST_SUITE_END(); @@ -2696,6 +2698,23 @@ void ScPivotTableFiltersTest::testTdf125055() pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "m")); } +void ScPivotTableFiltersTest::testTdf125086() +{ +ScDocShellRef xDocSh = loadDoc("pivottable_fieldInRowsAndData.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX); +xDocSh->DoClose(); + +xmlDocPtr pDoc += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pDoc); +assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", "axis", "axisRow"); +// "dataField" attribute was not written for this "axisRow" field +assertXPath(pDoc, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[2]", "dataField", "1"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index e0a6bc84870c..752d971cfd25 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -1012,8 +1012,24 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP aMemberSequence.emplace_back(nItem, true); } +// tdf#125086: check if this field *also* appears in Data region +bool bAppearsInData = false; +{ +OUString aSrcName = ScDPUtil::getSourceDimensionName(pDim->GetName()); +const auto it = std::find_if( +aDataFields.begin(), aDataFields.end(), [&aSrcName](const DataField& rDataField) { +OUString aThisName += ScDPUtil::getSourceDimensionName(rDataField.mpDim->GetName()); +return aThisName == aSrcName; +}); +if (it != aDataFields.end()) +bAppearsInData = true; +} + auto pAttList = sax_fastparser::FastSerializerHelper::createAttrList(); pAttList->add(XML_axis, toOOXMLAxisType(eOrient)); +if (bAppearsInData) +pAttList->add(XML_dataField, ToPsz10(true)); pAttList->add(XML_showAll, ToPsz10(false)); long nSubTotalCount = pDim->GetSubTotalsCount(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivottable_1s_difference.xlsx |binary sc/qa/unit/pivottable_filters_test.cxx | 42 + sc/source/filter/excel/xepivotxml.cxx |6 ++- 3 files changed, 46 insertions(+), 2 deletions(-) New commits: commit 4fa1bdfad1ccf3bb61ff0d505278402f3f1a2afe Author: Mike Kaganski AuthorDate: Wed May 1 07:22:44 2019 +0300 Commit: Mike Kaganski CommitDate: Wed May 1 10:23:17 2019 +0200 tdf#125055: properly round fractions of seconds ... so that 2017-07-10T09:11:02.99... becomes 2017-07-10T09:11:03, not 2017-07-10T09:11:02. The latter created duplicated items in pivot table cache previously. TODO: check what to do if the times are actually different by 100 ns? What Excel does then? Should we increase cache item precision? Change-Id: I622d1c784ee9fddf6b387bec2d8af87bae5668ba Reviewed-on: https://gerrit.libreoffice.org/71610 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/71618 Tested-by: Mike Kaganski diff --git a/sc/qa/unit/data/xlsx/pivottable_1s_difference.xlsx b/sc/qa/unit/data/xlsx/pivottable_1s_difference.xlsx new file mode 100644 index ..de8906cf94ca Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_1s_difference.xlsx differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 100a8143facb..065ad71b4e55 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -95,6 +95,7 @@ public: void testTdf124810(); void testTdf124883(); void testTdf125046(); +void testTdf125055(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -144,6 +145,7 @@ public: CPPUNIT_TEST(testTdf124810); CPPUNIT_TEST(testTdf124883); CPPUNIT_TEST(testTdf125046); +CPPUNIT_TEST(testTdf125055); CPPUNIT_TEST_SUITE_END(); @@ -2654,6 +2656,46 @@ void ScPivotTableFiltersTest::testTdf125046() "longText", "1"); } +void ScPivotTableFiltersTest::testTdf125055() +{ +ScDocShellRef xDocSh = loadDoc("pivottable_1s_difference.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX); +xDocSh->DoClose(); + +xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, + "xl/pivotCache/pivotCacheDefinition1.xml"); +CPPUNIT_ASSERT(pDoc); + +// 1-second precision should not result in duplicated entries for values different by ~1 s. +// Previously truncating nanoseconds in GetExcelFormattedDate converted +// "2017-07-10T09:11:02.9..." into "2017-07-10T09:11:02", creating two identical strings +// Only compare times here: see comment to ScPivotTableFiltersTest::testPivotCacheExportXLSX +// "TODO Date generator in tests are one day higher, than during standard xlsx export" +OUString sISODateTime = getXPath( +pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "minDate"); +CPPUNIT_ASSERT_EQUAL(OUString("T09:11:02"), sISODateTime.copy(10)); +sISODateTime = getXPath( +pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "maxDate"); +CPPUNIT_ASSERT_EQUAL(OUString("T09:11:03"), sISODateTime.copy(10)); +assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", +"count", "3"); +assertXPathChildren(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", +3); // 2 different values + empty +sISODateTime = getXPath( +pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[1]", "v"); +CPPUNIT_ASSERT_EQUAL(OUString("T09:11:02"), sISODateTime.copy(10)); +sISODateTime = getXPath( +pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems/x:d[2]", "v"); +CPPUNIT_ASSERT_EQUAL(OUString("T09:11:03"), sISODateTime.copy(10)); +// Trailing empty +CPPUNIT_ASSERT_EQUAL( +2, getXPathPosition( + pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", "m")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index fb174ef849f9..e0a6bc84870c 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -194,8 +194,10 @@ namespace { */ OUString GetExcelFormattedDate( double fSerialDateTime, SvNumberFormatter& rFormatter ) { -//::sax::Converter::convertDateTime(sBuf, (DateTime(rFormatter.GetNullDate()) + fSerialDateTime).GetUNODateTime(), 0, true); -css::util::DateTime aUDateTime = (DateTime(rFormatter.GetNullDate()) + fSerialDateTime).GetUNODateTi
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/xlsx/pivottable_long_text.xlsx |binary sc/qa/unit/pivottable_filters_test.cxx | 18 ++ sc/source/filter/excel/xepivotxml.cxx | 11 +++ 3 files changed, 29 insertions(+) New commits: commit f669f332733bf80b0a32022e1351957089958ce2 Author: Mike Kaganski AuthorDate: Tue Apr 30 16:45:54 2019 +0300 Commit: Mike Kaganski CommitDate: Tue Apr 30 17:25:42 2019 +0200 tdf#125046: export longText attribute for sharedItems element Change-Id: Id727f10763bc5017eeb3e267b425d6013786d6a2 Reviewed-on: https://gerrit.libreoffice.org/71585 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/71590 Tested-by: Mike Kaganski diff --git a/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx b/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx new file mode 100644 index ..f56db722e915 Binary files /dev/null and b/sc/qa/unit/data/xlsx/pivottable_long_text.xlsx differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 3684497ca39a..100a8143facb 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -94,6 +94,7 @@ public: void tesTtdf124772NumFmt(); void testTdf124810(); void testTdf124883(); +void testTdf125046(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -142,6 +143,7 @@ public: CPPUNIT_TEST(tesTtdf124772NumFmt); CPPUNIT_TEST(testTdf124810); CPPUNIT_TEST(testTdf124883); +CPPUNIT_TEST(testTdf125046); CPPUNIT_TEST_SUITE_END(); @@ -2636,6 +2638,22 @@ void ScPivotTableFiltersTest::testTdf124883() "Count of Value2"); } +void ScPivotTableFiltersTest::testTdf125046() +{ +ScDocShellRef xDocSh = loadDoc("pivottable_long_text.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX); +xDocSh->DoClose(); + +xmlDocPtr pDoc = XPathHelper::parseExport(pXPathFile, m_xSFactory, + "xl/pivotCache/pivotCacheDefinition1.xml"); +CPPUNIT_ASSERT(pDoc); +assertXPath(pDoc, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]/x:sharedItems", +"longText", "1"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 332c2ff2d8e3..fb174ef849f9 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -363,6 +363,7 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr double fMin = std::numeric_limits::infinity(), fMax = -std::numeric_limits::infinity(); bool isValueInteger = true; bool isContainsDate = rCache.IsDateDimension(i); +bool isLongText = false; double intpart; for (; it != itEnd; ++it) { @@ -383,6 +384,10 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr isValueInteger = false; } } +else if (eType == ScDPItemData::String && !isLongText) +{ +isLongText = it->GetString().getLength() > 255; +} } auto aDPTypeEnd = aDPTypes.cend(); @@ -460,6 +465,12 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr { pAttList->add(XML_count, OString::number(static_cast(rFieldItems.size(; } + +if (isLongText) +{ +pAttList->add(XML_longText, ToPsz10(true)); +} + sax_fastparser::XFastAttributeListRef xAttributeList(pAttList); pDefStrm->startElement(XML_sharedItems, xAttributeList); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx | 104 -- sc/source/filter/excel/xetable.cxx| 43 -- sc/source/filter/inc/xetable.hxx |9 +- 3 files changed, 69 insertions(+), 87 deletions(-) New commits: commit 225e10cda96b16479f45658817a22e2cbe72b82c Author: Mike Kaganski AuthorDate: Tue Apr 23 15:59:24 2019 +0300 Commit: Mike Kaganski CommitDate: Wed Apr 24 10:23:14 2019 +0200 tdf#124741: export default column width to XLSX For some reason, we have never exported the default column width to XLSX, although we have such export for XLS. This led to bugs like tdf#100946. Workarounds applied to those bugs have made LO to export columns which shouldn't have been exported, abusing "customWidth" attribute in XclExpColinfo::XclExpColinfo depending on if the column has size different from an app-global default; after that, sheet-local default was determined, and then columns which have mbCustomWidth set (i.e., different from app default), as well as those different from sheet-local default, were stored. Effectively, the hack had disabled the removal of defaults from maColInfos in XclExpColinfoBuffer::Finalize. We even had unit tests explicitly testing that we export those columns that Excel skips. The effect of that is not only unnecessary data in the file; the data was actually wrong (customWidth actually means that the width was edited manually by user, even if equal to the default, thus changing Excel handling of the column); and also Calc initializes all columns to the right of last used column for such a file. Only in case when app-global default happened to match sheet-local one, columns would have properties allowing them to be removed from maColInfos in the end of XclExpColinfoBuffer::Finalize, which still resulted in problems similar to the workarounded one. This patch implements proper export of the default column width to XLSX, thus partially reverting changes made for tdf#100946 in commit 40d892a2db4d750aaf0562c63004e693c028273c. Actually, our export to XLSX does not depend on the 5-pixel correction (see ECMA-376-1:2016 18.3.1.81), since the exported default depends only on most-used column width. XclExpDefcolwidth implementation was edited to only take the correction into account when exporting to XLS (to keep status quo; it's clear that XLS widths export and import implementation is incorrect: some empirical formula is used in XclTools::GetXclDefColWidthCorrection, that was introduced in commit 555d702903fb0857122024e1ab78a72d122d3f16 for i#3006, that doesn't match any documentation, and changes widths of columns in exported XLS - something to be fixed independently). Change-Id: I227aca17e56247cbb839444717066a898987c4f1 Reviewed-on: https://gerrit.libreoffice.org/71132 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/71222 diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 787f3e43f13d..fd3b6c3eaa04 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -723,80 +723,60 @@ void ScExportTest::testCustomColumnWidthExportXLSX() xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); CPPUNIT_ASSERT(pSheet); -// First column, has everything default (width in Calc: 1280) +// tdf#124741: check that we export default width, otherwise the skipped columns would have +// wrong width. Previously defaultColWidth attribute was missing +double nDefWidth += getXPath(pSheet, "/x:worksheet/x:sheetFormatPr", "defaultColWidth").toDouble(); +CPPUNIT_ASSERT_DOUBLES_EQUAL(11.53515625, nDefWidth, 0.01); + +// First column, has everything default (width in Calc: 1280), skipped + +// Second column, has custom width (width in Calc: 1225) assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "hidden", "false"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "outlineLevel", "0"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", "false"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "customWidth", "true"); assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "collapsed", "false"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "1"); -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "1"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "min", "2"); +assertXPath(pSheet, "/x:worksheet/x:cols/x:col[1]", "max", "2"); -// Second column, has custom width (width in Calc: 1225) -assertXPath(pSheet, "/x:worksheet/x:cols/x:col[2]", "hidden", "false"); +// Third column, has everything default (width in Calc: 1280), skipped + +// Fourth column has custom width. Column
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/pivottable_filters_test.cxx| 22 ++ sc/source/filter/oox/pivottablebuffer.cxx |3 +++ sc/source/ui/unoobj/dapiuno.cxx |8 3 files changed, 33 insertions(+) New commits: commit cdf7363d2fc371f16153365ed607e611bf1556db Author: Mike Kaganski AuthorDate: Mon Apr 22 14:56:07 2019 +0300 Commit: Mike Kaganski CommitDate: Mon Apr 22 18:02:03 2019 +0200 tdf#124883: don't drop data field names on import The name attribute of dataField element was already read in PivotTable::importDataField; and then it was ignored in PivotTableField::convertDataField. ScDataPilotFieldObj had no handler for name in its ScDataPilotFieldObj::[gs]etPropertyValue, although it has [gs]etName for that - so this change puts pieces together to allow to use the imported name correctly. Reviewed-on: https://gerrit.libreoffice.org/71068 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 7f6a6664a1f3a37a97d02d5f0894300aff0d8db5) Change-Id: I5357601b26e6635ab132ff6a1294645995aff97e Reviewed-on: https://gerrit.libreoffice.org/71070 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 42d3d87a6e57..3684497ca39a 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -93,6 +93,7 @@ public: void testTdf124736(); void tesTtdf124772NumFmt(); void testTdf124810(); +void testTdf124883(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -140,6 +141,7 @@ public: CPPUNIT_TEST(testTdf124736); CPPUNIT_TEST(tesTtdf124772NumFmt); CPPUNIT_TEST(testTdf124810); +CPPUNIT_TEST(testTdf124883); CPPUNIT_TEST_SUITE_END(); @@ -2614,6 +2616,26 @@ void ScPivotTableFiltersTest::testTdf124810() } } +void ScPivotTableFiltersTest::testTdf124883() +{ +ScDocShellRef xDocSh = loadDoc("pivot-table/two-data-fields.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX); +xDocSh->DoClose(); + +xmlDocPtr pTable += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pTable); + +// The field names must be kept just as they appear in original XLSX +assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[1]", "name", +"Sum of Value"); +assertXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField[2]", "name", +"Count of Value2"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/oox/pivottablebuffer.cxx b/sc/source/filter/oox/pivottablebuffer.cxx index fa54a0e59330..a3b47b4b3a11 100644 --- a/sc/source/filter/oox/pivottablebuffer.cxx +++ b/sc/source/filter/oox/pivottablebuffer.cxx @@ -572,6 +572,9 @@ void PivotTableField::convertDataField( const PTDataFieldModel& rDataField ) // field orientation aPropSet.setProperty( PROP_Orientation, DataPilotFieldOrientation_DATA ); +if (!rDataField.maName.isEmpty()) +aPropSet.setProperty(PROP_Name, rDataField.maName); + /* Field aggregation function. Documentation is a little bit confused about which names to use for the count functions. The name 'count' means 'count all', and 'countNum' means 'count numbers'. On the diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 5522e9555970..857cc8c36f04 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1922,6 +1922,12 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa { setRepeatItemLabels(cppu::any2bool(aValue)); } +else if (aPropertyName == SC_UNONAME_NAME) +{ +OUString sName; +if (aValue >>= sName) +setName(sName); +} } Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyName ) @@ -2011,6 +2017,8 @@ Any SAL_CALL ScDataPilotFieldObj::getPropertyValue( const OUString& aPropertyNam aRet <<= getShowEmpty(); else if ( aPropertyName == SC_UNONAME_REPEATITEMLABELS ) aRet <<= getRepeatItemLabels(); +else if (aPropertyName == SC_UNONAME_NAME) +aRet <<= getName(); return aRet; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/ods/pivot-table-num-fmt.ods |binary sc/qa/unit/pivottable_filters_test.cxx | 27 + sc/source/filter/excel/xepivotxml.cxx | 44 +--- 3 files changed, 61 insertions(+), 10 deletions(-) New commits: commit 83ae62c41a1d00058a3b8d0039903afb081871e8 Author: Mike Kaganski AuthorDate: Wed Apr 17 11:11:58 2019 +0300 Commit: Mike Kaganski CommitDate: Thu Apr 18 09:14:15 2019 +0200 tdf#124772: export data field number format to XLSX ... otherwise Excel would reset data formatting e.g. from currency to plain numbers upon refresh. Excel relies on per-field format setting in pivot tables, while Calc takes fields formatting from source. Change-Id: Ia8cdf3f8fcd23720e3daaf989152c170057b339c Reviewed-on: https://gerrit.libreoffice.org/70860 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/70919 diff --git a/sc/qa/unit/data/ods/pivot-table-num-fmt.ods b/sc/qa/unit/data/ods/pivot-table-num-fmt.ods new file mode 100644 index ..e6cfd138c12d Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-num-fmt.ods differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index eea645d7d3c7..423e5ff63ead 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -91,6 +91,7 @@ public: void testTdf123939(); void testTdf124651(); void testTdf124736(); +void tesTtdf124772NumFmt(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -136,6 +137,7 @@ public: CPPUNIT_TEST(testTdf123939); CPPUNIT_TEST(testTdf124651); CPPUNIT_TEST(testTdf124736); +CPPUNIT_TEST(tesTtdf124772NumFmt); CPPUNIT_TEST_SUITE_END(); @@ -2533,6 +2535,31 @@ void ScPivotTableFiltersTest::testTdf124736() "t", "default"); } +void ScPivotTableFiltersTest::tesTtdf124772NumFmt() +{ +ScDocShellRef xDocSh = loadDoc("pivot-table-num-fmt.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX); +xDocSh->DoClose(); + +xmlDocPtr pTable += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pTable); + +// This asserts that numFmtId attribute is present +const OUString sXclNumFmt += getXPath(pTable, "/x:pivotTableDefinition/x:dataFields/x:dataField", "numFmtId"); + +pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/styles.xml"); +CPPUNIT_ASSERT(pTable); + +// Check that we refer to correct format +assertXPath(pTable, "/x:styleSheet/x:numFmts/x:numFmt[@numFmtId='" + sXclNumFmt.toUtf8() + "']", +"formatCode", "\\$#,##0"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 694eee0469d3..d333bedd379a 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -15,16 +15,21 @@ #include #include #include +#include +#include +#include #include #include #include +#include #include #include #include #include #include +#include #include @@ -1082,6 +1087,10 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP if (!aDataFields.empty()) { +css::uno::Reference xDimsByName; +if (auto xDimSupplier = const_cast(rDPObj).GetSource()) +xDimsByName = xDimSupplier->getDimensions(); + pPivotStrm->startElement(XML_dataFields, XML_count, OString::number(static_cast(aDataFields.size())), FSEND); @@ -1097,17 +1106,32 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP // Excel (at least 2016) seems to insist on the presence of "name" attribute in // dataField element, even if empty const OString sName = pName ? XclXmlUtils::ToOString(*pName) : ""; -pPivotStrm->write("<")->writeId(XML_dataField); -rStrm.WriteAttributes(XML_name, sName, FSEND); - -rStrm.WriteAttributes(XML_fld, OString::number(nDimIdx).getStr(), FSEND); - -ScGeneralFunction eFunc = rDim.GetFunction(); -const char* pSubtotal = toOOXMLSubtotalType(eFunc); +auto pItemAttList = sax_fastparser::FastSerializerHelper::createAttrList(); +pItemAttList->add(XML_name, sName); +pItemAttList->add(XML_fld, OString::number(nDimIdx)); +const char* pSubtotal = toOOXMLSubtotalType(rDim.GetFunction()); if (pSubtotal) -rStrm.WriteAttributes(XML_subtotal, pSubtotal, FSEND); - -pPivotStrm->write("/>"); +pItemAttList->add(XML_subto
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/pivottable_filters_test.cxx | 56 ++ sc/source/filter/excel/xepivotxml.cxx | 99 +++-- 2 files changed, 115 insertions(+), 40 deletions(-) New commits: commit a4c2ae0e039534367c51c5e4f4041dd0b0bf1365 Author: Mike Kaganski AuthorDate: Mon Apr 15 23:33:38 2019 +0300 Commit: Mike Kaganski CommitDate: Tue Apr 16 12:24:59 2019 +0200 tdf#124736: Sort group field items Excel expects the group field items to be in ascending order starting from "<01/02/2010", then "Jan", "Feb", ..., then end with ">01/02/2020". Change-Id: I29e9b55f43091ed007f59e10dec64f46a37c7d5f Reviewed-on: https://gerrit.libreoffice.org/70800 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/70815 Tested-by: Mike Kaganski diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 4f1134c7c686..eea645d7d3c7 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -90,6 +90,7 @@ public: void testTdf123923(); void testTdf123939(); void testTdf124651(); +void testTdf124736(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -134,6 +135,7 @@ public: CPPUNIT_TEST(testTdf123923); CPPUNIT_TEST(testTdf123939); CPPUNIT_TEST(testTdf124651); +CPPUNIT_TEST(testTdf124736); CPPUNIT_TEST_SUITE_END(); @@ -2477,6 +2479,60 @@ void ScPivotTableFiltersTest::testTdf124651() assertXPath(pDoc, "/x:pivotTableDefinition/x:dataFields/x:dataField", "name", ""); } +void ScPivotTableFiltersTest::testTdf124736() +{ +ScDocShellRef xDocSh = loadDoc("pivot-table/shared-dategroup.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(xDocSh.get(), FORMAT_XLSX); +xDocSh->DoClose(); + +xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, + "xl/pivotCache/pivotCacheDefinition1.xml"); +CPPUNIT_ASSERT(pTable); + +assertXPath(pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems", +"count", "45"); +// Group items must start with "<05/16/1958", then years sorted ascending, then ">06/11/2009" +// They used to have years in the beginning, then "<05/16/1958", then ">06/11/2009". +// The "<" and ">" date strings are locale-dependent, so test depends on en_US locale +assertXPath( +pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[1]", +"v", "<05/16/1958"); +for (int i = 2; i <= 44; ++i) +assertXPath( +pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[" ++ OString::number(i) + "]", +"v", OUString::number(1963 + i)); +assertXPath( +pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:fieldGroup/x:groupItems/x:s[45]", +"v", ">06/11/2009"); + +// Now check that table references these in correct order (document-dependent, so this is how +// it should be in this specific testdoc which shows "<" and ">" values in the end) +pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pTable); +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items", "count", +"46"); +const int vals[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 0, 44 }; +for (size_t i = 0; i < SAL_N_ELEMENTS(vals); ++i) +{ +assertXPath(pTable, + "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[" ++ OString::number(i + 1) + "]", +"x", OUString::number(vals[i])); +} +assertXPath(pTable, "/x:pivotTableDefinition/x:pivotFields/x:pivotField[1]/x:items/x:item[46]", +"t", "default"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 8648f27e7539..694eee0469d3 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -197,7 +197,42 @@ OUString GetExcelFormattedDate( double fSerialDateTime, SvNumberFormatter& rForm ::sax::Converter::convertDateTime(sBuf, aUDateTime, nullptr, true); return sBuf.makeStringAndClear(); } + +// Excel seems to expect different order of group item values; we need to rearrange elements +// to output "date2" last. +// Since ScDPItemData::Dat
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/ods/tdf124651_simplePivotTable.ods |binary sc/qa/unit/pivottable_filters_test.cxx | 33 + sc/source/filter/excel/xepivotxml.cxx |7 +++- 3 files changed, 32 insertions(+), 8 deletions(-) New commits: commit 1a28b0a602bb3c10f75c3c6408cf9bc555020d34 Author: Mike Kaganski AuthorDate: Wed Apr 10 15:18:07 2019 +0300 Commit: Mike Kaganski CommitDate: Fri Apr 12 23:09:26 2019 +0200 tdf#124651: always write "name" attribute to dataField element Despite being optional as per ECMA-376-1:2016, Excel 2016 seems to require the presence of "name" attribute in dataField element of pivot table definition, so make sure to write at least empty string there. Change-Id: Iaab5674f86b7dd0b267776678e11af47086635d7 Reviewed-on: https://gerrit.libreoffice.org/70522 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/70684 diff --git a/sc/qa/unit/data/ods/tdf124651_simplePivotTable.ods b/sc/qa/unit/data/ods/tdf124651_simplePivotTable.ods new file mode 100644 index ..05fd5fec838f Binary files /dev/null and b/sc/qa/unit/data/ods/tdf124651_simplePivotTable.ods differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 9caf4d6a61b1..34b26d9a3e25 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -89,6 +89,7 @@ public: void testTdf112106(); void testTdf123923(); void testTdf123939(); +void testTdf124651(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -132,6 +133,7 @@ public: CPPUNIT_TEST(testTdf112106); CPPUNIT_TEST(testTdf123923); CPPUNIT_TEST(testTdf123939); +CPPUNIT_TEST(testTdf124651); CPPUNIT_TEST_SUITE_END(); @@ -2355,17 +2357,21 @@ void ScPivotTableFiltersTest::testPivotTableDuplicateFields() std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); -xmlDocPtr pCacheDef -= XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotCache/pivotCacheDefinition1.xml"); +xmlDocPtr pCacheDef = XPathHelper::parseExport(pXPathFile, m_xSFactory, + "xl/pivotCache/pivotCacheDefinition1.xml"); CPPUNIT_ASSERT(pCacheDef); assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields", "count", "6"); assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]", "name", "ID"); assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[2]", "name", "Name"); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]", "name", "Score"); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]", "name", "Method"); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]", "name", "method2"); -assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]", "name", "Method3"); +assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[3]", "name", +"Score"); +assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[4]", "name", +"Method"); +assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[5]", "name", +"method2"); +assertXPath(pCacheDef, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[6]", "name", +"Method3"); xShell->DoClose(); } @@ -2443,6 +2449,21 @@ void ScPivotTableFiltersTest::testTdf123939() "containsMixedTypes", "1"); } +void ScPivotTableFiltersTest::testTdf124651() +{ +ScDocShellRef xDocSh = loadDoc("tdf124651_simplePivotTable.", FORMAT_ODS); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocPtr pDoc += XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/pivotTables/pivotTable1.xml"); +CPPUNIT_ASSERT(pDoc); +// We have to export name attribute, even though it's optional according to ECMA-376 standard, +// because Excel (at least 2016) seems to require it. +assertXPath(pDoc, "/x:pivotTableDefinition/x:dataFields/x:dataField", "name", ""); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 0594601b6eb3..d879f9c80a20 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -970,9 +970,12 @@ void XclExpXmlPivotTables::SavePivotTableXml( XclExpXmlStream& rStrm, const ScDP assert(aCachedDims[nDimIdx]); // the loop above should have screened for NULL's. const ScDPSaveDimension& rDim = *it->mpDim; const OUString* pName = rDim
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/ods/pivot-table-str-and-err-in-data.ods |binary sc/qa/unit/pivottable_filters_test.cxx | 29 sc/source/filter/excel/xepivotxml.cxx |7 ++- 3 files changed, 34 insertions(+), 2 deletions(-) New commits: commit ebc7f46f65cb853845eae9c2f7b96f341e4b0cb4 Author: Mike Kaganski AuthorDate: Fri Mar 8 14:01:03 2019 +0300 Commit: Mike Kaganski CommitDate: Mon Mar 11 20:18:35 2019 +0100 tdf#123939: string and error are same type for pivot cache in XLSX Change-Id: Id39d322661f7537e8999acafee655c0cc16a78c1 Reviewed-on: https://gerrit.libreoffice.org/68911 Tested-by: Jenkins Reviewed-by: Mike Kaganski Reviewed-on: https://gerrit.libreoffice.org/69063 Tested-by: Mike Kaganski diff --git a/sc/qa/unit/data/ods/pivot-table-str-and-err-in-data.ods b/sc/qa/unit/data/ods/pivot-table-str-and-err-in-data.ods new file mode 100644 index ..9c58dc8958ae Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-str-and-err-in-data.ods differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 1a046296357f..4674ebb2533f 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -85,6 +85,7 @@ public: void testPivotTableTabularModeXLSX(); void testTdf112106(); void testTdf123923(); +void testTdf123939(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -124,6 +125,7 @@ public: CPPUNIT_TEST(testPivotTableTabularModeXLSX); CPPUNIT_TEST(testTdf112106); CPPUNIT_TEST(testTdf123923); +CPPUNIT_TEST(testTdf123939); CPPUNIT_TEST_SUITE_END(); @@ -2334,6 +2336,33 @@ void ScPivotTableFiltersTest::testTdf123923() "v", "#REF!"); } +void ScPivotTableFiltersTest::testTdf123939() +{ +// tdf#123939: Excel warns on containsMixedTypes="1" if sharedItems has only strings and errors + +ScDocShellRef xShell = loadDoc("pivot-table-str-and-err-in-data.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, + "xl/pivotCache/pivotCacheDefinition1.xml"); +CPPUNIT_ASSERT(pTable); + +assertXPathNoAttribute(pTable, + "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", + "containsMixedTypes"); + +// But we must emit containsMixedTypes="1" for a mix of errors and non-string types! + +pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, + "xl/pivotCache/pivotCacheDefinition2.xml"); +CPPUNIT_ASSERT(pTable); + +assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems", +"containsMixedTypes", "1"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xepivotxml.cxx b/sc/source/filter/excel/xepivotxml.cxx index 5d47d628cee7..2ed98873202f 100644 --- a/sc/source/filter/excel/xepivotxml.cxx +++ b/sc/source/filter/excel/xepivotxml.cxx @@ -267,6 +267,9 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr for (; it != itEnd; ++it) { ScDPItemData::Type eType = it->GetType(); +// tdf#123939 : error and string are same for cache; if both are present, keep only one +if (eType == ScDPItemData::Error) +eType = ScDPItemData::String; aDPTypes.insert(eType); if (eType == ScDPItemData::Value) { @@ -292,8 +295,8 @@ void XclExpXmlPivotCaches::SavePivotCacheXml( XclExpXmlStream& rStrm, const Entr std::set aDPTypesWithoutBlank = aDPTypes; aDPTypesWithoutBlank.erase(ScDPItemData::Empty); -bool isContainsString = aDPTypesWithoutBlank.find(ScDPItemData::String) != aDPTypesWithoutBlank.end() || -aDPTypesWithoutBlank.find(ScDPItemData::Error) != aDPTypesWithoutBlank.end(); +const bool isContainsString += aDPTypesWithoutBlank.find(ScDPItemData::String) != aDPTypesWithoutBlank.end(); bool isContainsBlank = aDPTypes.find(ScDPItemData::Empty) != aDPTypeEnd; bool isContainsNumber = !isContainsDate && aDPTypesWithoutBlank.find(ScDPItemData::Value) != aDPTypesWithoutBlank.end(); bool isContainsNonDate = !(isContainsDate && aDPTypesWithoutBlank.size() <= 1); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/ods/pivot-table-err-in-cache.ods |binary sc/qa/unit/pivottable_filters_test.cxx | 19 +++ sc/source/core/tool/interpr1.cxx |1 + 3 files changed, 20 insertions(+) New commits: commit 0640e800c532cac0905412fe961efb03474ecc3f Author: Mike Kaganski AuthorDate: Thu Mar 7 16:38:20 2019 +0300 Commit: Mike Kaganski CommitDate: Mon Mar 11 18:33:02 2019 +0100 tdf#123923: make COUNTIF propagate errors in its first parameter In a specific case, Err:504 was emitted by COUNTIF when its 1st parameter was #REF!. This value was written into pivot cache definition when exporting to XLSX. Clearly Excel only expected propagated #REF! there, emitted error to user, and dropped the pivot table. This problem made XLSX pivot table cache generated by Calc unusable by Excel, despite ECMA-376 Part 1, 18.10.1.27 tells that the error value is application-dependent. The change makes COUNTIF to propagate errors received in its 1st parameter, instead of owerwriting them with own Err:504. This will likely need to be extended to other functions, if similar problems would arise. Change-Id: I459fa163a0e3e5f2c658631d66e096f4d46b1ace Reviewed-on: https://gerrit.libreoffice.org/68868 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit 1f970c20a25deed282dbaf08a4be5af25e4951db) Reviewed-on: https://gerrit.libreoffice.org/69039 Tested-by: Mike Kaganski diff --git a/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods new file mode 100644 index ..b566a61f8898 Binary files /dev/null and b/sc/qa/unit/data/ods/pivot-table-err-in-cache.ods differ diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index bb989d2b1b83..1a046296357f 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -84,6 +84,7 @@ public: void testPivotTableDuplicatedMemberFilterXLSX(); void testPivotTableTabularModeXLSX(); void testTdf112106(); +void testTdf123923(); CPPUNIT_TEST_SUITE(ScPivotTableFiltersTest); @@ -122,6 +123,7 @@ public: CPPUNIT_TEST(testPivotTableDuplicatedMemberFilterXLSX); CPPUNIT_TEST(testPivotTableTabularModeXLSX); CPPUNIT_TEST(testTdf112106); +CPPUNIT_TEST(testTdf123923); CPPUNIT_TEST_SUITE_END(); @@ -2315,6 +2317,23 @@ void ScPivotTableFiltersTest::testTdf112106() xDocSh->DoClose(); } +void ScPivotTableFiltersTest::testTdf123923() +{ +// tdf#123923: Excel fails when it finds "Err:504" instead of "#REF!" in pivot table cache + +ScDocShellRef xShell = loadDoc("pivot-table-err-in-cache.", FORMAT_ODS); +CPPUNIT_ASSERT(xShell.is()); + +std::shared_ptr pXPathFile += ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); +xmlDocPtr pTable = XPathHelper::parseExport(pXPathFile, m_xSFactory, + "xl/pivotCache/pivotCacheDefinition1.xml"); +CPPUNIT_ASSERT(pTable); + +assertXPath(pTable, "/x:pivotCacheDefinition/x:cacheFields/x:cacheField[1]/x:sharedItems/x:e", +"v", "#REF!"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScPivotTableFiltersTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index cb0ac61a3cc6..bd5963bc1c97 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -5606,6 +5606,7 @@ void ScInterpreter::ScCountIf() } break; default: +PopError(); // Propagate it further PushIllegalParameter(); return ; } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/subsequent_export-test.cxx |2 +- sc/source/filter/excel/xestyle.cxx| 11 --- 2 files changed, 9 insertions(+), 4 deletions(-) New commits: commit c503ba502a9b7ddc6ac41044fb04dc2e1f276891 Author: Markus Mohrhard AuthorDate: Sat Jul 21 23:16:19 2018 +0200 Commit: Aron Budea CommitDate: Fri Dec 21 20:05:23 2018 +0100 tdf#98074, using the same builtinId maps the styles to the same one Additionally, using customBuiltin for all styles is a bad idea as well. Change-Id: I788a3c5b9164f79aa65ded2fc3e6a556e44ee0a8 Reviewed-on: https://gerrit.libreoffice.org/57807 Tested-by: Jenkins Reviewed-by: Markus Mohrhard (cherry picked from commit fa881095bc62c3646406c82a98d8503377288a54) Reviewed-on: https://gerrit.libreoffice.org/57813 Reviewed-by: Eike Rathke (cherry picked from commit f67c6912e8612c5850a5728c971b4ec130b9) diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 4e50010fb8b9..7ecaba7a6d68 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -3938,7 +3938,7 @@ void ScExportTest::testNatNumInNumberFormatXLSX() xmlDocPtr pDoc = XPathHelper::parseExport(*xDocSh, m_xSFactory, "xl/styles.xml", FORMAT_XLSX); CPPUNIT_ASSERT(pDoc); -assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[2]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); +assertXPath(pDoc, "/x:styleSheet/x:numFmts/x:numFmt[3]", "formatCode", "[DBNum2][$-804]General;[RED][DBNum2][$-804]General"); xDocSh->DoClose(); } diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 25cda7d56db7..8d882ed5a061 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -2333,13 +2333,19 @@ static const char* lcl_StyleNameFromId( sal_Int32 nStyleId ) void XclExpStyle::SaveXml( XclExpXmlStream& rStrm ) { +constexpr sal_Int32 CELL_STYLE_MAX_BUILTIN_ID = 54; OString sName; +OString sBuiltinId; +const char* pBuiltinId = nullptr; if( IsBuiltIn() ) { sName = OString( lcl_StyleNameFromId( mnStyleId ) ); +sBuiltinId = OString::number( std::min( static_cast( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast ( mnStyleId ) ) ); +pBuiltinId = sBuiltinId.getStr(); } else sName = XclXmlUtils::ToOString( maName ); + // get the index in sortedlist associated with the mnXId sal_Int32 nXFId = rStrm.GetRoot().GetXFBuffer().GetXFIndex( maXFId.mnXFId ); // get the style index associated with index into sortedlist @@ -2348,11 +2354,10 @@ void XclExpStyle::SaveXml( XclExpXmlStream& rStrm ) XML_name, sName.getStr(), XML_xfId, OString::number( nXFId ).getStr(), // builtinId of 54 or above is invalid according to OpenXML SDK validator. -#define CELL_STYLE_MAX_BUILTIN_ID 54 - XML_builtinId, OString::number( std::min( static_cast( CELL_STYLE_MAX_BUILTIN_ID - 1 ), static_cast ( mnStyleId ) ) ).getStr(), +XML_builtinId, pBuiltinId, // OOXTODO: XML_iLevel, // OOXTODO: XML_hidden, -XML_customBuiltin, ToPsz( ! IsBuiltIn() ), +// XML_customBuiltin, ToPsz( ! IsBuiltIn() ), FSEND ); // OOXTODO: XML_extLst } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf41425.xlsx|binary sc/qa/unit/subsequent_export-test.cxx | 16 sc/source/filter/excel/xetable.cxx|3 +++ 3 files changed, 19 insertions(+) New commits: commit 772c80f7581eb6902c972ce87028a5f5e7f8c4f9 Author: László Németh AuthorDate: Fri Aug 3 16:11:16 2018 +0200 Commit: Andras Timar CommitDate: Mon Sep 17 16:35:47 2018 +0200 tdf#41425 XLS/XLSX export: workaround for style and validation loss of cells of blank rows. This workaround is probably a fix for problems of most users, but for a full solution it needs to extend the workaround for all rows with not default settings, also avoiding of the possible performance problems. Note: the number 1000 of the extra rows came from a similar workaround used in XLSX export of Google Spreadsheets, but instead of listing extra empty 1000 rows in OOXML, this fix writes only the cells with not default settings from the extra 1000 blank rows. Reviewed-on: https://gerrit.libreoffice.org/58575 Tested-by: Jenkins Reviewed-by: László Németh (cherry picked from commit 99b9ea63bfc9a5fe63a0cd7b30b66ce2c1bde08e) Reviewed-on: https://gerrit.libreoffice.org/58812 Reviewed-by: Christian Lohmaier (cherry picked from commit d7cbaac61b8f3575184c675a760907c3b4bb225e) Change-Id: Icac9441b7eb1520dcd20fc04337e070d070591c7 diff --git a/sc/qa/unit/data/xlsx/tdf41425.xlsx b/sc/qa/unit/data/xlsx/tdf41425.xlsx new file mode 100644 index ..f7d3ec9ed6ec Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf41425.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index a071b12b7493..4e50010fb8b9 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -209,6 +209,8 @@ public: void testHyperlinkTargetFrameODS(); void testOpenDocumentAsReadOnly(); void testTdf118990(); +void testKeepSettingsOfBlankRows(); + CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); @@ -318,6 +320,7 @@ public: CPPUNIT_TEST(testHyperlinkTargetFrameODS); CPPUNIT_TEST(testOpenDocumentAsReadOnly); CPPUNIT_TEST(testTdf118990); +CPPUNIT_TEST(testKeepSettingsOfBlankRows); CPPUNIT_TEST_SUITE_END(); @@ -4086,6 +4089,19 @@ void ScExportTest::testTdf118990() xDocSh->DoClose(); } +void ScExportTest::testKeepSettingsOfBlankRows() +{ +ScDocShellRef xDocSh = loadDoc("tdf41425.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); + +std::shared_ptr pXPathFile = ScBootstrapFixture::exportTo(&(*xDocSh), FORMAT_XLSX); +xmlDocPtr pSheet = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); +CPPUNIT_ASSERT(pSheet); + +// saved blank row with not default setting in A2 +assertXPath(pSheet, "/x:worksheet/x:sheetData/x:row", 2); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 75980091a640..1fc75abd4380 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2456,6 +2456,9 @@ XclExpCellTable::XclExpCellTable( const XclExpRoot& rRoot ) : if(nLastUsedScCol > nMaxScCol) nLastUsedScCol = nMaxScCol; +// check extra blank rows to avoid of losing their not default settings (workaround for tdf#41425) +nLastUsedScRow += 1000; + if(nLastUsedScRow > nMaxScRow) nLastUsedScRow = nMaxScRow; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/screenshots/screenshots.cxx |7 +++ 1 file changed, 7 insertions(+) New commits: commit ce6a51307863a69bf832647458cff3a58ddfaec4 Author: Stephan Bergmann AuthorDate: Mon Jun 4 11:53:35 2018 +0200 Commit: Andras Timar CommitDate: Mon Aug 27 22:21:03 2018 +0200 loplugin:unreffun ...since 25d6789e0e7949fa2e7441eeeb0f6e9cf701dbed "sc: disable test that fails on Windows" Change-Id: I730495fe9b6d648c75a374b2cd15024e56c85126 (cherry picked from commit 78bd14939abb8040182b9db7b2c28c03d60eccb9) diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 75f91a3f96b4..f732b2c22b1a 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -75,10 +75,15 @@ public: ScScreenshotTest(); void testOpeningModalDialogs(); +#if 0 void testMultiViewCopyPaste(); +#endif CPPUNIT_TEST_SUITE(ScScreenshotTest); CPPUNIT_TEST(testOpeningModalDialogs); +#if 0 +CPPUNIT_TEST(testMultiViewCopyPaste); +#endif CPPUNIT_TEST_SUITE_END(); }; @@ -289,6 +294,7 @@ void ScScreenshotTest::testOpeningModalDialogs() mxComponent.clear(); } +#if 0 void ScScreenshotTest::testMultiViewCopyPaste() { initialize(); @@ -335,6 +341,7 @@ void ScScreenshotTest::testMultiViewCopyPaste() mxComponent->dispose(); mxComponent.clear(); } +#endif CPPUNIT_TEST_SUITE_REGISTRATION(ScScreenshotTest); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |6 ++ sc/source/ui/docshell/docsh.cxx | 19 +++ sc/source/ui/inc/tabvwsh.hxx |7 +-- sc/source/ui/undo/undoblk.cxx|2 +- sc/source/ui/vba/excelvbahelper.cxx |4 ++-- sc/source/ui/view/cellsh.cxx | 25 +++-- sc/source/ui/view/cellsh1.cxx| 16 +--- sc/source/ui/view/cliputil.cxx |2 +- sc/source/ui/view/drawvie4.cxx |1 - sc/source/ui/view/gridwin.cxx|2 +- sc/source/ui/view/tabvwshc.cxx | 16 sc/source/ui/view/viewfun3.cxx | 11 +-- sc/source/ui/view/viewfun7.cxx |2 +- 13 files changed, 53 insertions(+), 60 deletions(-) New commits: commit 426482bf235519d3368a197efe74a02a288d022d Author: Henry Castro AuthorDate: Tue Jun 26 23:32:41 2018 -0400 Commit: Andras Timar CommitDate: Mon Aug 27 22:18:29 2018 +0200 tdf#118308: Incorrect Paste Special dialog when ... pasting content from another cell In tiled rendering case (headless) each window has its own clipboard, otherwise exists a unique clipboard (UNO service). Change-Id: I7d5d0b085faeaffa3fc0a80914fbe9349f4aa402 Reviewed-on: https://gerrit.libreoffice.org/56508 Tested-by: Jenkins Reviewed-by: Eike Rathke Reviewed-on: https://gerrit.libreoffice.org/59630 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index f80fdcde710f..711d663b5892 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -1542,12 +1543,17 @@ void ScTiledRenderingTest::testMultiViewCopyPaste() // view #1 ScTabViewShell* pView1 = dynamic_cast(SfxViewShell::Current()); CPPUNIT_ASSERT(pView1); +// emulate clipboard + pView1->GetViewData().GetActiveWin()->SetClipboard(css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext())); // view #2 SfxLokHelper::createView(); ScTabViewShell* pView2 = dynamic_cast(SfxViewShell::Current()); +// emulate clipboard + pView2->GetViewData().GetActiveWin()->SetClipboard(css::datatransfer::clipboard::SystemClipboard::create(comphelper::getProcessComponentContext())); CPPUNIT_ASSERT(pView2); CPPUNIT_ASSERT(pView1 != pView2); +CPPUNIT_ASSERT(pView1->GetViewData().GetActiveWin()->GetClipboard() != pView2->GetViewData().GetActiveWin()->GetClipboard()); // copy text view 1 pView1->SetCursor(0, 0); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index e1e33c17e562..a2c6a5a69eb3 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2748,24 +2748,11 @@ ScDocFunc *ScDocShell::CreateDocFunc() ScDocument* ScDocShell::GetClipDoc() { -css::uno::Reference xTransferable; - +vcl::Window* pWin = nullptr; if (ScTabViewShell* pViewShell = GetBestViewShell()) -xTransferable.set(pViewShell->GetClipData()); -else -{ -SfxViewFrame* pViewFrame = nullptr; -css::uno::Reference xClipboard; - -if ((pViewFrame = SfxViewFrame::GetFirst(this, false))) -xClipboard = pViewFrame->GetWindow().GetClipboard(); -else if ((pViewFrame = SfxViewFrame::GetFirst())) - xClipboard = pViewFrame->GetWindow().GetClipboard(); - -xTransferable.set(xClipboard.is() ? xClipboard->getContents() : nullptr, css::uno::UNO_QUERY); -} +pWin = pViewShell->GetViewData().GetActiveWin(); -const ScTransferObj* pObj = ScTransferObj::GetOwnClipboard(xTransferable); +const ScTransferObj* pObj = ScTransferObj::GetOwnClipboard(ScTabViewShell::GetClipData(pWin)); if (pObj) { ScDocument* pDoc = pObj->GetDocument(); diff --git a/sc/source/ui/inc/tabvwsh.hxx b/sc/source/ui/inc/tabvwsh.hxx index 9c82cbce79b9..9762151818e9 100644 --- a/sc/source/ui/inc/tabvwsh.hxx +++ b/sc/source/ui/inc/tabvwsh.hxx @@ -167,9 +167,6 @@ private: OUString maName; OUString maScope; -// ClipData -css::uno::Reference m_xClipData; - private: voidConstruct( TriState nForceDesignMode ); @@ -396,9 +393,7 @@ public: static void notifyAllViewsHeaderInvalidation(bool Columns, SCTAB nCurrentTabIndex = -1); static bool isAnyEditViewInRange(bool bColumns, SCCOLROW nStart, SCCOLROW nEnd); css::uno::Reference getSelectedXShapes(); - -css::uno::Reference GetClipData() { return m_xClipData; }; -void SetClipData(const css::uno::Reference& xTransferable) { m_xClipData = xTransferable; } +static css::uno::Reference GetClipData(vcl:
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/screenshots/screenshots.cxx |1 - 1 file changed, 1 deletion(-) New commits: commit c78318f07c217b9743fbd0869680af6678dcacc9 Author: Henry Castro AuthorDate: Thu May 31 21:54:42 2018 -0400 Commit: Andras Timar CommitDate: Mon Aug 27 21:34:07 2018 +0200 sc: disable test that fails on Windows reference "Daily Screenshot Build on Windows - Build # 410 - Failure!" https://ci.libreoffice.org/job/lo_tb_master_win_screenshot/410/ Change-Id: I4fe6b46e7c2a7a1904ffb86dd68d689f7ada9def Reviewed-on: https://gerrit.libreoffice.org/59626 Reviewed-by: Andras Timar Tested-by: Andras Timar diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index b27c9753d6a1..75f91a3f96b4 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -79,7 +79,6 @@ public: CPPUNIT_TEST_SUITE(ScScreenshotTest); CPPUNIT_TEST(testOpeningModalDialogs); -CPPUNIT_TEST(testMultiViewCopyPaste); CPPUNIT_TEST_SUITE_END(); }; ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa sc/source
sc/qa/unit/data/xlsx/tdf118990.xlsx |binary sc/qa/unit/subsequent_export-test.cxx | 33 + sc/source/filter/excel/xecontent.cxx |3 ++- 3 files changed, 35 insertions(+), 1 deletion(-) New commits: commit 7a0cad5a5667406b37b9ad6ec1e86d79784ce0ee Author: Mike Kaganski AuthorDate: Wed Aug 15 12:35:30 2018 +0300 Commit: Aron Budea CommitDate: Mon Aug 20 06:26:18 2018 +0200 tdf#118990: use full URI for absolute references Previously (since commit 7eb5e135422f1a5830a44d129300bc3fafb4627d) only path relative to reference host was stored, and host itself was dropped. That resulted in URIs like "/share/file.xlsx", even without scheme. For Windows shares, this broke UNC paths like "\\HOSTNAME\share\file.xlsx" (which are stored in XLSX by Excel as "file:///\\HOSTNAME\share\file.xlsx"), and on subsequent import, this resulted in paths on the same drive as the document (like "C:\share\file.xlsx"). With this change, we will store "file://HOSTNAME/share/file.xlsx", which is correctly processed by both LibreOffice and MS Excel. Reviewed-on: https://gerrit.libreoffice.org/59064 Reviewed-by: Mike Kaganski Tested-by: Mike Kaganski (cherry picked from commit f24b0ec13c5c8edda5ffb1336b0eb6da173dfc97) Change-Id: I3f13aa0b3ae8dc41ec28eaa1416d536469c4562a Reviewed-on: https://gerrit.libreoffice.org/59166 Tested-by: Mike Kaganski Reviewed-by: Aron Budea diff --git a/sc/qa/unit/data/xlsx/tdf118990.xlsx b/sc/qa/unit/data/xlsx/tdf118990.xlsx new file mode 100644 index ..b680edceef0e Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf118990.xlsx differ diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 916eea9229c1..2370836399a8 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -206,6 +206,8 @@ public: void testHiddenRepeatedRowsODS(); void testHyperlinkTargetFrameODS(); +void testTdf118990(); + CPPUNIT_TEST_SUITE(ScExportTest); CPPUNIT_TEST(test); CPPUNIT_TEST(testTdf111876); @@ -311,6 +313,8 @@ public: CPPUNIT_TEST(testHiddenRepeatedRowsODS); CPPUNIT_TEST(testHyperlinkTargetFrameODS); +CPPUNIT_TEST(testTdf118990); + CPPUNIT_TEST_SUITE_END(); private: @@ -3996,6 +4000,35 @@ void ScExportTest::testHyperlinkTargetFrameODS() CPPUNIT_ASSERT_EQUAL(OUString("_blank"), aTargetFrameExport); } +void ScExportTest::testTdf118990() +{ +ScDocShellRef xDocSh = loadDoc("tdf118990.", FORMAT_XLSX); +CPPUNIT_ASSERT(xDocSh.is()); +xDocSh = saveAndReload(xDocSh.get(), FORMAT_XLSX); +ScDocument& rDoc = xDocSh->GetDocument(); + +// TODO: also test A1, which contains a UNC reference to \\localhost\share\lookupsource.xlsx, +// but currently looses "localhost" part when normalized in INetURLObject, becoming +// file:///share/lookupsource.xlsx - which is incorrect, since it points to local filesystem +// and not to Windows network share. + +#if defined LINUX // following INetURLObject::setAbsURIRef +#define TDF118990_SCHEME "smb:" +#else // for Windows and macOS +#define TDF118990_SCHEME "file:" +#endif + +ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 1, 0), + "VLOOKUP(B1,'" TDF118990_SCHEME "//192.168.1.1/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)", + "Wrong Windows share (using host IP) URL in A2"); + +ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0, 2, 0), + "VLOOKUP(B1,'" TDF118990_SCHEME "//NETWORKHOST/share/lookupsource.xlsx'#$Sheet1.A1:B5,2)", + "Wrong Windows share (using hostname) URL in A3"); + +xDocSh->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 29523aa81c9d..b79815d67781 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -459,7 +459,8 @@ OUString XclExpHyperlink::BuildFileName( sal_uInt16& rnLevel, bool& rbRel, const OUString& rUrl, const XclExpRoot& rRoot, bool bEncoded ) { INetURLObject aURLObject( rUrl ); -OUString aDosName( bEncoded ? aURLObject.GetURLPath() : aURLObject.getFSysPath( FSysStyle::Dos ) ); +OUString aDosName(bEncoded ? aURLObject.GetMainURL(INetURLObject::DecodeMechanism::ToIUri) + : aURLObject.getFSysPath(FSysStyle::Dos)); rnLevel = 0; rbRel = rRoot.IsRelUrl(); ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - sc/qa
sc/qa/unit/data/contentCSV/dataValidity3.csv |4 ++ sc/qa/unit/data/ods/dataValidity.ods |binary sc/qa/unit/data/xlsx/dataValidity.xlsx |binary sc/qa/unit/subsequent_filters-test.cxx | 39 +++ 4 files changed, 43 insertions(+) New commits: commit f1423b1165cd7ace44153e146b6922fd2df66c57 Author: Marco Cecchetti Date: Mon Feb 26 17:50:25 2018 +0100 calc: unit tests for data validation Change-Id: I28ec2bd374d98ea1094649ac30ff7dd4c62370ae Reviewed-on: https://gerrit.libreoffice.org/55740 Reviewed-by: Marco Cecchetti Tested-by: Marco Cecchetti diff --git a/sc/qa/unit/data/contentCSV/dataValidity3.csv b/sc/qa/unit/data/contentCSV/dataValidity3.csv new file mode 100644 index ..a8c82cecabdf --- /dev/null +++ b/sc/qa/unit/data/contentCSV/dataValidity3.csv @@ -0,0 +1,4 @@ +"",, +"",,Enter text not a numeric value. +"",, +"",,AAA12 diff --git a/sc/qa/unit/data/ods/dataValidity.ods b/sc/qa/unit/data/ods/dataValidity.ods index 008cea5561fc..9daf01ce7798 100644 Binary files a/sc/qa/unit/data/ods/dataValidity.ods and b/sc/qa/unit/data/ods/dataValidity.ods differ diff --git a/sc/qa/unit/data/xlsx/dataValidity.xlsx b/sc/qa/unit/data/xlsx/dataValidity.xlsx new file mode 100644 index ..da4d3ab41133 Binary files /dev/null and b/sc/qa/unit/data/xlsx/dataValidity.xlsx differ diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index b17acc3f1922..798c24c09a25 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -136,6 +136,7 @@ public: void testMergedCellsODS(); void testRepeatedColumnsODS(); void testDataValidityODS(); +void testDataValidityXLSX(); void testDataTableMortgageXLS(); void testDataTableOneVarXLSX(); void testDataTableMultiTableXLSX(); @@ -267,6 +268,7 @@ public: CPPUNIT_TEST(testMergedCellsODS); CPPUNIT_TEST(testRepeatedColumnsODS); CPPUNIT_TEST(testDataValidityODS); +CPPUNIT_TEST(testDataValidityXLSX); CPPUNIT_TEST(testDataTableMortgageXLS); CPPUNIT_TEST(testDataTableOneVarXLSX); CPPUNIT_TEST(testDataTableMultiTableXLSX); @@ -1312,6 +1314,7 @@ void ScFiltersTest::testDataValidityODS() ScAddress aValBaseAddr1( 2,6,0 ); //sheet1 ScAddress aValBaseAddr2( 2,3,1 ); //sheet2 +ScAddress aValBaseAddr3( 2,2,2 ); //sheet3 //sheet1's expected Data Validation Entry values ValDataTestParams aVDTParams1( @@ -1327,17 +1330,27 @@ void ScFiltersTest::testDataValidityODS() "Must be a whole number between 1 and 10.", SC_VALERR_STOP, 2 ); +//sheet3's expected Data Validation Entry values +ValDataTestParams aVDTParams3( +SC_VALID_CUSTOM, ScConditionMode::Direct, "ISTEXT(C3)", EMPTY_OUSTRING, rDoc, +aValBaseAddr3, "Error sheet 3", +"Must not be a numerical value.", +SC_VALERR_STOP, 3 +); //check each sheet's Data Validation Entries checkValiditationEntries( aVDTParams1 ); checkValiditationEntries( aVDTParams2 ); +checkValiditationEntries( aVDTParams3 ); //expected ranges to be associated with data validity ScRange aRange1( 2,2,0, 2,6,0 ); //sheet1 ScRange aRange2( 2,3,1, 6,7,1 ); //sheet2 +ScRange aRange3( 2,2,2, 2,6,2 ); //sheet3 //check each sheet's cells for data validity checkCellValidity( aValBaseAddr1, aRange1, rDoc ); checkCellValidity( aValBaseAddr2, aRange2, rDoc ); +checkCellValidity( aValBaseAddr3, aRange3, rDoc ); //check each sheet's content OUString aCSVFileName1; @@ -1348,6 +1361,32 @@ void ScFiltersTest::testDataValidityODS() createCSVPath("dataValidity2.", aCSVFileName2); testFile(aCSVFileName2, rDoc, 1); +OUString aCSVFileName3; +createCSVPath("dataValidity3.", aCSVFileName3); +testFile(aCSVFileName3, rDoc, 2); + +xDocSh->DoClose(); +} + +void ScFiltersTest::testDataValidityXLSX() +{ +ScDocShellRef xDocSh = loadDoc("dataValidity.", FORMAT_XLSX); +ScDocument& rDoc = xDocSh->GetDocument(); + +ScAddress aValBaseAddr1( 2,6,0 ); //sheet1 +ScAddress aValBaseAddr2( 2,3,1 ); //sheet2 +ScAddress aValBaseAddr3( 2,2,2 ); //sheet3 + +//expected ranges to be associated with data validity +ScRange aRange1( 2,2,0, 2,6,0 ); //sheet1 +ScRange aRange2( 2,3,1, 6,7,1 ); //sheet2 +ScRange aRange3( 2,2,2, 2,6,2 ); //sheet3 + +//check each sheet's cells for data validity +checkCellValidity( aValBaseAddr1, aRange1, rDoc ); +checkCellValidity( aValBaseAddr2, aRange2, rDoc ); +checkCellValidity( aValBaseAddr3, aRange3, rDoc ); + xDocSh->DoClose(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits