[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/tiledrendering/tiledrendering.cxx | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) New commits: commit 9f4548198485779bd13ace7ec32d018dcbb3bec9 Author: Caolán McNamara AuthorDate: Thu Nov 30 09:13:53 2023 + Commit: Miklos Vajna CommitDate: Thu Nov 30 14:53:14 2023 +0100 cppunit test for notification of note position changes on row/col changes Change-Id: I32ed5cd249400f71903e7aa848ba63d03abbd9b2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160137 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 30eaaebf207a..1f18401a970c 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1247,6 +1247,10 @@ void ScTiledRenderingTest::testCommentCallback() SfxLokHelper::setView(nView1); +ScTabViewShell* pTabViewShell = dynamic_cast(SfxViewShell::Current()); +if (pTabViewShell) +pTabViewShell->SetCursor(4, 4); + // Add a new comment uno::Sequence aArgs(comphelper::InitPropertySequence( { @@ -1267,15 +1271,32 @@ void ScTiledRenderingTest::testCommentCallback() CPPUNIT_ASSERT_EQUAL(std::string("LOK User1"), aView2.m_aCommentCallbackResult.get("author")); CPPUNIT_ASSERT_EQUAL(std::string("Comment"), aView1.m_aCommentCallbackResult.get("text")); CPPUNIT_ASSERT_EQUAL(std::string("Comment"), aView2.m_aCommentCallbackResult.get("text")); -CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView1.m_aCommentCallbackResult.get("cellRange")); -CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView2.m_aCommentCallbackResult.get("cellRange")); +CPPUNIT_ASSERT_EQUAL(std::string("4 4 4 4"), aView1.m_aCommentCallbackResult.get("cellRange")); +CPPUNIT_ASSERT_EQUAL(std::string("4 4 4 4"), aView2.m_aCommentCallbackResult.get("cellRange")); + +// Ensure deleting rows updates comments +if (pTabViewShell) +pTabViewShell->SetCursor(2, 2); + +dispatchCommand(mxComponent, ".uno:DeleteRows", {}); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT_EQUAL(std::string("4 3 4 3"), aView1.m_aCommentCallbackResult.get("cellRange")); +CPPUNIT_ASSERT_EQUAL(std::string("4 3 4 3"), aView2.m_aCommentCallbackResult.get("cellRange")); + +// Ensure deleting columns updates comments +if (pTabViewShell) +pTabViewShell->SetCursor(2, 2); + +dispatchCommand(mxComponent, ".uno:DeleteColumns", {}); +Scheduler::ProcessEventsToIdle(); +CPPUNIT_ASSERT_EQUAL(std::string("3 3 3 3"), aView1.m_aCommentCallbackResult.get("cellRange")); +CPPUNIT_ASSERT_EQUAL(std::string("3 3 3 3"), aView2.m_aCommentCallbackResult.get("cellRange")); std::string aCommentId = aView1.m_aCommentCallbackResult.get("id"); // Edit a comment // Select some random cell, we should be able to edit the cell note without // selecting the cell -ScTabViewShell* pTabViewShell = dynamic_cast(SfxViewShell::Current()); if (pTabViewShell) pTabViewShell->SetCursor(3, 100); aArgs = comphelper::InitPropertySequence( @@ -1296,8 +1317,8 @@ void ScTiledRenderingTest::testCommentCallback() CPPUNIT_ASSERT_EQUAL(std::string("LOK User2"), aView2.m_aCommentCallbackResult.get("author")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView1.m_aCommentCallbackResult.get("text")); CPPUNIT_ASSERT_EQUAL(std::string("Edited comment"), aView2.m_aCommentCallbackResult.get("text")); -CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView1.m_aCommentCallbackResult.get("cellRange")); -CPPUNIT_ASSERT_EQUAL(std::string("0 1 0 1"), aView2.m_aCommentCallbackResult.get("cellRange")); +CPPUNIT_ASSERT_EQUAL(std::string("3 3 3 3"), aView1.m_aCommentCallbackResult.get("cellRange")); +CPPUNIT_ASSERT_EQUAL(std::string("3 3 3 3"), aView2.m_aCommentCallbackResult.get("cellRange")); // Delete the comment if (pTabViewShell)
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/subsequent_export_test.cxx | 31 +++ 1 file changed, 31 insertions(+) New commits: commit 17bc207d3054b4cbecb56b4d1195c73db203f21f Author: Paris Oplopoios AuthorDate: Thu Oct 26 14:28:06 2023 +0300 Commit: Paris Oplopoios CommitDate: Sun Oct 29 01:04:53 2023 +0200 sc: Test numeric conditional format text rule exports correctly Change-Id: Ib57ea44912b4cb0be7cbdb127dd7ea6f08ec8392 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158540 Tested-by: Jenkins CollaboraOffice Reviewed-by: Paris Oplopoios diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index cbbc99de69d8..d3927c136677 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -2402,6 +2402,37 @@ void ScExportTest::testSheetProtectionXLSB() CPPUNIT_ASSERT(!pTabProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS)); } +CPPUNIT_TEST_FIXTURE(ScExportTest, testConditionalFormatNumberInTextRule) +{ +createScDoc(); + +ScDocument* pDocument = getScDoc(); +ScAddress aAddress(0, 0, 0); + +auto pFormat = std::make_unique(0, pDocument); +ScRange aCondFormatRange(aAddress); +ScRangeList aRangeList(aCondFormatRange); +pFormat->SetRange(aRangeList); +ScCondFormatEntry* pEntry += new ScCondFormatEntry(ScConditionMode::BeginsWith, "15", "", *pDocument, aAddress, ""); +pFormat->AddEntry(pEntry); +pDocument->AddCondFormat(std::move(pFormat), 0); + +saveAndReload("Calc Office Open XML"); +pDocument = getScDoc(); + +ScConditionalFormat* pCondFormat = pDocument->GetCondFormat(0, 0, 0); +CPPUNIT_ASSERT(pCondFormat); +CPPUNIT_ASSERT_EQUAL(size_t(1), pCondFormat->size()); +const ScFormatEntry* pCondFormatEntry = pCondFormat->GetEntry(0); +CPPUNIT_ASSERT(pCondFormatEntry); +CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::Condition, pCondFormatEntry->GetType()); +const ScConditionEntry* pConditionEntry += static_cast(pCondFormatEntry); +CPPUNIT_ASSERT_EQUAL(ScConditionMode::BeginsWith, pConditionEntry->GetOperation()); +CPPUNIT_ASSERT_EQUAL(OUString("\"15\""), pConditionEntry->GetExpression(aAddress, 0)); +} + namespace { const char* toBorderName(SvxBorderLineStyle eStyle)
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sfx2/source
sc/qa/uitest/calc_tests7/save_readonly_with_password.py |5 +++-- sc/qa/uitest/calc_tests8/tdf147086.py |3 ++- sc/qa/uitest/calc_tests9/tdf115933.py |3 ++- sc/qa/uitest/calc_tests9/tdf118938.py |3 ++- sc/qa/uitest/calc_tests9/tdf144996.py |6 +++--- sfx2/source/doc/objmisc.cxx |8 +++- 6 files changed, 19 insertions(+), 9 deletions(-) New commits: commit 861028593d7351d5ae8a0b8840ef8018b467f5de Author: Henry Castro AuthorDate: Mon Sep 18 17:05:56 2023 -0400 Commit: Henry Castro CommitDate: Thu Sep 21 16:03:19 2023 +0200 uitest: add "Silent" property parameter add option to not popup the read-only dialog when load and excel file. Signed-off-by: Henry Castro Change-Id: I5e0ac06e3e872f156f6150f4b8bead61e7986c25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157036 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/uitest/calc_tests7/save_readonly_with_password.py b/sc/qa/uitest/calc_tests7/save_readonly_with_password.py index 02f125e3008f..0e4e75785bea 100644 --- a/sc/qa/uitest/calc_tests7/save_readonly_with_password.py +++ b/sc/qa/uitest/calc_tests7/save_readonly_with_password.py @@ -8,6 +8,7 @@ # from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue from org.libreoffice.unotest import systemPathToFileUrl from uitest.uihelper.common import select_by_text from tempfile import TemporaryDirectory @@ -48,7 +49,7 @@ class save_readonly_with_password(UITestCase): self.ui_test.wait_until_file_is_available(xFilePath) -with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: +with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: self.assertTrue(document.isReadonly()) @@ -84,7 +85,7 @@ class save_readonly_with_password(UITestCase): self.ui_test.wait_until_file_is_available(xFilePath) -with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: +with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: self.assertTrue(document.isReadonly()) diff --git a/sc/qa/uitest/calc_tests8/tdf147086.py b/sc/qa/uitest/calc_tests8/tdf147086.py index f594edb696f6..4decfa3dd3b3 100755 --- a/sc/qa/uitest/calc_tests8/tdf147086.py +++ b/sc/qa/uitest/calc_tests8/tdf147086.py @@ -8,6 +8,7 @@ # from uitest.framework import UITestCase from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue from org.libreoffice.unotest import systemPathToFileUrl from uitest.uihelper.common import select_by_text from tempfile import TemporaryDirectory @@ -46,7 +47,7 @@ class tdf147086(UITestCase): self.ui_test.wait_until_file_is_available(xFilePath) -with self.ui_test.load_file(systemPathToFileUrl(xFilePath)) as document: +with self.ui_test.load_file(systemPathToFileUrl(xFilePath), [PropertyValue(Name="Silent", Value=True)]) as document: self.assertTrue(document.isReadonly()) diff --git a/sc/qa/uitest/calc_tests9/tdf115933.py b/sc/qa/uitest/calc_tests9/tdf115933.py index 0fe7fec06758..128b80652e47 100644 --- a/sc/qa/uitest/calc_tests9/tdf115933.py +++ b/sc/qa/uitest/calc_tests9/tdf115933.py @@ -8,6 +8,7 @@ # from uitest.framework import UITestCase from uitest.uihelper.common import get_url_for_data_file +from com.sun.star.beans import PropertyValue from libreoffice.uno.propertyvalue import mkPropertyValues #Bug 115933 - XLSX password protected with algorithmName, hashValue, saltValue and spinCount @@ -15,7 +16,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class tdf115933(UITestCase): def test_tdf115933(self): -with self.ui_test.load_file(get_url_for_data_file("tdf115933.xlsx")): +with self.ui_test.load_file(get_url_for_data_file("tdf115933.xlsx"), [PropertyValue(Name="Silent", Value=True)]): #The document was created in Excel. calcDoc = self.xUITest.getTopFocusWindow() gridwin = calcDoc.getChild("grid_window") diff --git a/sc/qa/uitest/calc_tests9/tdf118938.py b/sc/qa/uitest/calc_tests9/tdf118938.py index eede90451e67..33f8cde75d82 100644 --- a/sc/qa/uitest/calc_tests9/tdf118938.py +++ b/sc/qa/uitest/calc_tests9/tdf118938.py @@ -9,6 +9,7 @@ from uitest.framework import UITestCase from uitest.uihelper.common import get_url_for_data_file from libreoffice.uno.propertyvalue import mkPropertyValues +from com.sun.star.beans import PropertyValue #Bug 118938 - FILESAVE to Microsoft Excel 2007-2013 XML (.xlsx) files as read-only # with additional password protection for editing no
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/subsequent_setup.mk
sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx | 32 ++ sc/subsequent_setup.mk|1 3 files changed, 33 insertions(+) New commits: commit 2586213c1790bd419442f3376af661168bbe8508 Author: Tomaž Vajngerl AuthorDate: Wed Sep 13 22:18:43 2023 +0200 Commit: Miklos Vajna CommitDate: Fri Sep 15 12:49:39 2023 +0200 sc: add test for the row import default index issue Change-Id: I09f94977602122ac751cc64dc7c3cec1a954aea8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156901 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit bbd1cae866630e1545b603b2b31417713d63d226) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156914 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx b/sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx new file mode 100644 index ..980cdd35a0d6 Binary files /dev/null and b/sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index f2fd4196dfa1..75a7ae4059bd 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -29,6 +29,8 @@ #include #include #include +#include +#include #include #include #include @@ -193,6 +195,7 @@ public: void testTdf82984_zip64XLSXImport(); void testSingleLine(); void testNamedTableRef(); +void testRowImportCellStyleIssue(); CPPUNIT_TEST_SUITE(ScFiltersTest2); @@ -316,6 +319,7 @@ public: CPPUNIT_TEST(testTdf82984_zip64XLSXImport); CPPUNIT_TEST(testSingleLine); CPPUNIT_TEST(testNamedTableRef); +CPPUNIT_TEST(testRowImportCellStyleIssue); CPPUNIT_TEST_SUITE_END(); }; @@ -3095,6 +3099,34 @@ void ScFiltersTest2::testNamedTableRef() } } +void ScFiltersTest2::testRowImportCellStyleIssue() +{ +// Test checks that the correct cell style is imported for the first 6 rows and then the rest of the rows. +// Row 1 to 6 have no background color, after that light2 (background2) theme color. + +createScDoc("xlsx/RowImportCellStyleIssue.xlsx"); +ScDocument* pDoc = getScDoc(); + +// Check cell A6 - should have no background color set +{ +const ScPatternAttr* pAttr = pDoc->GetPattern(0, 5, 0); // A6 +const SfxPoolItem& rItem = pAttr->GetItem(ATTR_BACKGROUND); +const SvxBrushItem& rBackground = static_cast(rItem); +CPPUNIT_ASSERT_EQUAL(false, rBackground.isUsed()); +} + +// Check cell A7 - should have light2 (background2) theme color set +{ +const ScPatternAttr* pAttr = pDoc->GetPattern(0, 6, 0); // A7 +const SfxPoolItem& rItem = pAttr->GetItem(ATTR_BACKGROUND); +const SvxBrushItem& rBackground = static_cast(rItem); +CPPUNIT_ASSERT_EQUAL(true, rBackground.isUsed()); +CPPUNIT_ASSERT_EQUAL(Color(0xe7e6e6), rBackground.GetColor()); +auto const& rComplexColor = rBackground.getComplexColor(); +CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Light2, rComplexColor.getThemeColorType()); +} +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/subsequent_setup.mk b/sc/subsequent_setup.mk index 6847aca1a775..4cf9b34f984e 100644 --- a/sc/subsequent_setup.mk +++ b/sc/subsequent_setup.mk @@ -30,6 +30,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sc_subsequent_$(1), \ cppu \ cppuhelper \ drawinglayer \ +docmodel \ editeng \ for \ forui \
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/ThemeImportExportTest.cxx | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) New commits: commit 48720d869df42bdcf2d9444e508068e91a3bd9c3 Author: Mike Kaganski AuthorDate: Tue Jul 4 11:50:01 2023 +0200 Commit: Mike Kaganski CommitDate: Fri Sep 8 15:19:04 2023 +0200 Fix build on Win64, where int != sal_Int32 Change-Id: Id835da668042a656ace0f09a7fa9bc852b968b3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153926 Tested-by: Jenkins Reviewed-by: Mike Kaganski (cherry picked from commit b68e4a2d0179558180085bfe28a32a1510aeb3e1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154251 Reviewed-by: Michael Stahl Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156703 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index 7d0eb47ee2c9..e8e1a31dbbff 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -194,9 +194,9 @@ void checkCellBackgroundThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(20, roundToPercent(rTransformations[0].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(20), roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(80, roundToPercent(rTransformations[1].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(80), roundToPercent(rTransformations[1].mnValue)); } // A3 @@ -213,7 +213,7 @@ void checkCellBackgroundThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(1), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(50, roundToPercent(rTransformations[0].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(50), roundToPercent(rTransformations[0].mnValue)); } } @@ -265,9 +265,9 @@ void checkCellTextThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(60, roundToPercent(rTransformations[0].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(60), roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(40, roundToPercent(rTransformations[1].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(40), roundToPercent(rTransformations[1].mnValue)); } // B3 @@ -284,7 +284,7 @@ void checkCellTextThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(1), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(50, roundToPercent(rTransformations[0].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(50), roundToPercent(rTransformations[0].mnValue)); } } @@ -350,9 +350,9 @@ void checkCellBorderThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(20, roundToPercent(rTransformations[0].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(20), roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(80, roundToPercent(rTransformations[1].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(80), roundToPercent(rTransformations[1].mnValue)); } { auto* pTop = pBoxItem->GetRight(); @@ -363,9 +363,9 @@ void checkCellBorderThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(20, roundToPercent(rTransformations[0].mnValue)); +CPPUNIT_ASSERT_EQUAL(sal_Int32(20), roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSER
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/subsequent_export_test.cxx|3 +-- sc/source/filter/oox/sheetdatabuffer.cxx |2 +- 2 files changed, 2 insertions(+), 3 deletions(-) New commits: commit f6740f0c3b9af9d6e3227e7ce0776147eb6219a9 Author: Paris Oplopoios AuthorDate: Mon Aug 28 20:40:33 2023 +0300 Commit: Paris Oplopoios CommitDate: Tue Aug 29 09:50:15 2023 +0200 Shared string shouldn't account preserve space property XLSX documents opened in Excel don't seem to account for the xml:space="preserve" value for whether the string is single line or not The test that was changed seems to have more accurate behavior now, where the second cell does not have multiple lines (like in Excel) Change-Id: Iad8f351c19102249e2cb1e1d063c8690dfb3d753 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156210 Tested-by: Jenkins CollaboraOffice Reviewed-by: Paris Oplopoios diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 1d4285346f61..cbbc99de69d8 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -3877,8 +3877,7 @@ void ScExportTest::testPreserveTextWhitespace2XLSX() xmlDocUniquePtr pDoc = parseExport("xl/sharedStrings.xml"); CPPUNIT_ASSERT(pDoc); assertXPath(pDoc, "/x:sst/x:si[1]/x:t", "space", "preserve"); -assertXPath(pDoc, "/x:sst/x:si[2]/x:r[1]/x:t", "space", "preserve"); -assertXPath(pDoc, "/x:sst/x:si[2]/x:r[2]/x:t", "space", "preserve"); +assertXPath(pDoc, "/x:sst/x:si[2]/x:t", "space", "preserve"); } void ScExportTest::testHiddenShapeXLS() diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx b/sc/source/filter/oox/sheetdatabuffer.cxx index 624772ef263e..1b4f9cf719d8 100644 --- a/sc/source/filter/oox/sheetdatabuffer.cxx +++ b/sc/source/filter/oox/sheetdatabuffer.cxx @@ -122,7 +122,7 @@ void SheetDataBuffer::setStringCell( const CellModel& rModel, const RichStringRe OSL_ENSURE( rxString, "SheetDataBuffer::setStringCell - missing rich string object" ); const oox::xls::Font* pFirstPortionFont = getStyles().getFontFromCellXf( rModel.mnXfId ).get(); const Xf* pXf = getStyles().getCellXf( rModel.mnXfId ).get(); -bool bSingleLine = pXf ? !rxString->isPreserveSpace() && !pXf->getAlignment().getModel().mbWrapText : false; +bool bSingleLine = pXf ? !pXf->getAlignment().getModel().mbWrapText : false; OUString aText; if( rxString->extractPlainString( aText, pFirstPortionFont ) ) {
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/data/xlsx/wrap-text.xlsx |binary sc/qa/unit/subsequent_export_test.cxx | 22 ++ sc/source/filter/excel/xestyle.cxx|2 +- sc/source/filter/excel/xetable.cxx|2 +- 4 files changed, 24 insertions(+), 2 deletions(-) New commits: commit ae730bdc0a2ee3d78ff3e0a9b47c8383840af4ee Author: Paris Oplopoios AuthorDate: Wed Aug 23 12:31:15 2023 +0300 Commit: Paris Oplopoios CommitDate: Mon Aug 28 15:20:40 2023 +0200 sc: Fix wrapText not being applied correctly on export Change-Id: I03aaa36af8fe820fa07d2eea13c5b0f69ad74dad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155970 Tested-by: Jenkins Reviewed-by: Paris Oplopoios (cherry picked from commit 5e8b2f0a084153ebab3355641b0aca06369baeff) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156140 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/data/xlsx/wrap-text.xlsx b/sc/qa/unit/data/xlsx/wrap-text.xlsx new file mode 100644 index ..961cfcbdc02e Binary files /dev/null and b/sc/qa/unit/data/xlsx/wrap-text.xlsx differ diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index 02e7c8e28c5c..1d4285346f61 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -98,6 +98,7 @@ public: void testBuiltinRangesXLSX(); void testRichTextExportODS(); void testRichTextCellFormatXLSX(); +void testWrapText(); void testFormulaRefSheetNameODS(); void testCellValuesExportODS(); @@ -219,6 +220,7 @@ public: CPPUNIT_TEST(testBuiltinRangesXLSX); CPPUNIT_TEST(testRichTextExportODS); CPPUNIT_TEST(testRichTextCellFormatXLSX); +CPPUNIT_TEST(testWrapText); CPPUNIT_TEST(testFormulaRefSheetNameODS); CPPUNIT_TEST(testCellValuesExportODS); CPPUNIT_TEST(testCellNoteExportODS); @@ -2052,6 +2054,26 @@ void ScExportTest::testRichTextCellFormatXLSX() assertXPath(pStyles, aXPath3, "val", "true"); } +void ScExportTest::testWrapText() +{ +createScDoc("xlsx/wrap-text.xlsx"); + +save("Calc Office Open XML"); + +xmlDocUniquePtr pStyles = parseExport("xl/styles.xml"); +CPPUNIT_ASSERT(pStyles); + +assertXPath(pStyles, "/x:styleSheet/x:cellXfs", "count", "7"); + +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", "wrapText", "false"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", "wrapText", "false"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[3]/x:alignment", "wrapText", "false"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[4]/x:alignment", "wrapText", "false"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[5]/x:alignment", "wrapText", "true"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[6]/x:alignment", "wrapText", "true"); +assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[7]/x:alignment", "wrapText", "true"); +} + void ScExportTest::testFormulaRefSheetNameODS() { createScDoc("ods/formula-quote-in-sheet-name.ods"); diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index fb580dd2e713..2a3d12d89938 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1508,7 +1508,7 @@ bool XclExpCellAlign::FillFromItemSet(const XclRoot& rRoot, const SfxItemSet& rI case EXC_BIFF3: // attributes new in BIFF3 { // text wrap -mbLineBreak = bForceLineBreak || rItemSet.Get( ATTR_LINEBREAK ).GetValue(); +mbLineBreak = bForceLineBreak; bUsed |= bForceLineBreak || ScfTools::CheckItem( rItemSet, ATTR_LINEBREAK, bStyle ); [[fallthrough]]; diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index e7abb111c63e..cb8a3d65d12f 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -745,7 +745,7 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot, if( GetXFId() == EXC_XFID_NOTFOUND ) { OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init - leading font not found" ); - bool bForceLineBreak = mxText->IsWrapped(); + bool bForceLineBreak = pPattern->GetItemSet().Get(ATTR_LINEBREAK ).GetValue(); SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, ApiScriptType::WEAK, nXclFont, bForceLineBreak ) ); }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/tiledrendering/tiledrendering.cxx |3 +++ 1 file changed, 3 insertions(+) New commits: commit 0cc5861d6adf60f44b0fa5d307ced948b817e20a Author: Tomaž Vajngerl AuthorDate: Tue Aug 8 23:15:59 2023 +0200 Commit: Mike Kaganski CommitDate: Mon Aug 28 12:42:20 2023 +0200 sc: fix tiledrendering test execution order issue with comment IDs ScPostIt::mnLastPostItId is a static variable, which is used for generated the comment ID. In the test we depend that the ID are consistent and start with 1, but as we have more tests that insert comments this can be a problem. testCommentCallback and testCommentCellCopyPaste, both add comments and the expected execution order is testCommentCallback and then testCommentCellCopyPaste, so the latter test resets the mnLastPostItId variable to 1, so the IDs are consistent. In a LO 7.6 build for Fedora, it happened that the testCommentCellCopyPaste was executed first and testCommentCallback afterwards, but in testCommentCallback we do not reset the mnLastPostItId and the build failed. This change resets the mnLastPostItId also in testCommentCallback. Change-Id: I123b2f47b0d6177b2f5bdefcf6d8e9c301a7413b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155498 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl (cherry picked from commit 3dcf2acadb847ec76d7e1dff3b4b730a64b52c41) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156129 Tested-by: Jenkins CollaboraOffice Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 81143b845b44..30eaaebf207a 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1232,6 +1232,9 @@ void ScTiledRenderingTest::testCommentCallback() // Comments callback are emitted only if tiled annotations are off comphelper::LibreOfficeKit::setTiledAnnotations(false); +// FIXME: Hack because previous tests do not destroy ScDocument(with annotations) on exit (?). +ScPostIt::mnLastPostItId = 1; + { ScModelObj* pModelObj = createDoc("small.ods"); ViewCallback aView1;
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source xmloff/Library_xo.mk xmloff/source
sc/qa/unit/ThemeImportExportTest.cxx | 10 + sc/source/filter/xml/xmlstyle.cxx |5 -- xmloff/Library_xo.mk |1 xmloff/source/style/StylePropertiesContext.cxx | 45 + xmloff/source/style/StylePropertiesContext.hxx | 31 + xmloff/source/style/prhdlfac.cxx |5 ++ xmloff/source/style/prstylei.cxx | 11 ++ 7 files changed, 96 insertions(+), 12 deletions(-) New commits: commit 5a3cb219f135e17fa4745811521c718b97f287c4 Author: Tomaž Vajngerl AuthorDate: Fri Jul 28 09:03:50 2023 +0200 Commit: Mike Kaganski CommitDate: Mon Aug 28 12:39:51 2023 +0200 xmloff: fix import of CharComplexColor - add StylePropertiesContext Import of CharComplexColor in Calc didn't work because the class XMLComplexColorContext wasn't used. This introduces a new class StylePropertiesContext, because the plain SvXMLPropertySetContext is not enough as we can't define to use XMLComplexColorContext when XML_CHAR_COMPLEX_COLOR is used on that class. Also adds a import/export test for CharComplexColor. Change-Id: I765ac71a801a5e9bcb105aaea73637df5e601b85 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155008 Tested-by: Tomaž Vajngerl Reviewed-by: Tomaž Vajngerl (cherry picked from commit b543463f639ecee793484e8b419147d565a53d52) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156100 Tested-by: Jenkins CollaboraOffice Reviewed-by: Mike Kaganski diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index 155370c32827..0e5b093b42ff 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -213,6 +213,16 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testCellTextThemeColor) checkCellTextThemeColor(getScDoc()); } +CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testCellTextThemeColorODF) +{ +// Open the OOXML source +loadFromURL(u"xlsx/Test_ThemeColor_Text_Background_Border.xlsx"); +// Save as ODF and load again - checks import / export cycle +saveAndReload("calc8"); +// Check the values and show that the document is unchanged and all the data preserved +checkCellTextThemeColor(getScDoc()); +} + void checkCellBorderThemeColor(ScDocument* pDoc) { // C1 diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index b1d95614242b..b2dd7ebc3c3c 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -908,11 +908,6 @@ const XMLPropertyHandler* XMLScPropHdlFactory::GetPropertyHandler( sal_Int32 nTy pHdl = new XmlScPropHdl_Vertical; } break; -case XML_TYPE_COMPLEX_COLOR: -{ -pHdl = new XMLComplexColorHandler; -} -break; } if(pHdl) diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index 588fefdbb17b..9746688d8c9b 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk @@ -232,6 +232,7 @@ $(eval $(call gb_Library_add_exception_objects,xo,\ xmloff/source/style/PagePropertySetContext \ xmloff/source/style/SinglePropertySetInfoCache \ xmloff/source/style/StyleMap \ +xmloff/source/style/StylePropertiesContext \ xmloff/source/style/TransGradientStyle \ xmloff/source/style/WordWrapPropertyHdl \ xmloff/source/style/XMLBackgroundImageContext \ diff --git a/xmloff/source/style/StylePropertiesContext.cxx b/xmloff/source/style/StylePropertiesContext.cxx new file mode 100644 index ..fff47913480e --- /dev/null +++ b/xmloff/source/style/StylePropertiesContext.cxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "StylePropertiesContext.hxx" + +#include +#include +#include +#include +#include + +#include + +using namespace xmloff::token; + +StylePropertiesContext::StylePropertiesContext( +SvXMLImport& rImport, sal_Int32 nElement, +const css::uno::Reference& xAttrList, sal_uInt32 nFamily, +std::vector& rProps, const rtl::Reference& rMap) +: SvXMLPropertySetContext(rImport, nElement, xAttrList, nFamily, rProps, rMap) +{ +} + +StylePropertiesContext::~StylePropertiesContext() {} + +css::uno::Reference +StylePropertiesContext::createFastChildContext( +sal_Int32 nElement, const css::uno::Reference& xAttrList, +std::vector& rProperties, const XMLPropertyState& rProperty) +{ +if (nElement == XML_ELEMENT(LO_EXT, XML_CHAR_COMPLEX_COLOR)) +{ +return new XMLComplexColorContext(GetImport(), nElement, xAttrList,
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/ThemeImportExportTest.cxx | 61 +-- 1 file changed, 38 insertions(+), 23 deletions(-) New commits: commit ed290f06fb80802209567cb2cc85fa6090d72d0a Author: Tomaž Vajngerl AuthorDate: Fri Jun 30 15:46:22 2023 +0900 Commit: Miklos Vajna CommitDate: Fri Aug 25 13:35:56 2023 +0200 sc: test export of model::Theme into theme1.xml with xpath Change-Id: I9b2b61a5ae93a0738fb90aa20b20f9a9ecc7272b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153786 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 8164915520b27b655372e7521b2a58978516f88d) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156079 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index 0cf03ea6c010..c04a90dc6f54 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -34,30 +34,45 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExport) save("Calc Office Open XML"); -xmlDocUniquePtr pXmlDoc = parseExport("xl/styles.xml"); - -assertXPath(pXmlDoc, "/x:styleSheet", 1); - -// Fonts -assertXPath(pXmlDoc, "/x:styleSheet/x:fonts/x:font", 6); - -assertXPath(pXmlDoc, "/x:styleSheet/x:fonts/x:font[5]/x:color", "theme", "7"); - -assertXPath(pXmlDoc, "/x:styleSheet/x:fonts/x:font[6]/x:color", "rgb", "FF9C5700"); - -// Fills -assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill", 4); - -assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[1]/x:patternFill", "patternType", "none"); - -assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[2]/x:patternFill", "patternType", "gray125"); - -assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[3]/x:patternFill", "patternType", "solid"); -assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[3]/x:patternFill/x:fgColor", "rgb", -"EB9C"); +{ +xmlDocUniquePtr pXmlDoc = parseExport("xl/theme/theme1.xml"); +OString aClrScheme = "/a:theme/a:themeElements/a:clrScheme"; +assertXPath(pXmlDoc, aClrScheme, "name", "Office"); +assertXPath(pXmlDoc, aClrScheme + "/a:dk1/a:srgbClr", "val", "00"); +assertXPath(pXmlDoc, aClrScheme + "/a:lt1/a:srgbClr", "val", "ff"); +assertXPath(pXmlDoc, aClrScheme + "/a:dk2/a:srgbClr", "val", "44546a"); +assertXPath(pXmlDoc, aClrScheme + "/a:lt2/a:srgbClr", "val", "e7e6e6"); +assertXPath(pXmlDoc, aClrScheme + "/a:accent1/a:srgbClr", "val", "4472c4"); +assertXPath(pXmlDoc, aClrScheme + "/a:accent2/a:srgbClr", "val", "ed7d31"); +assertXPath(pXmlDoc, aClrScheme + "/a:accent3/a:srgbClr", "val", "a5a5a5"); +assertXPath(pXmlDoc, aClrScheme + "/a:accent4/a:srgbClr", "val", "ffc000"); +assertXPath(pXmlDoc, aClrScheme + "/a:accent5/a:srgbClr", "val", "5b9bd5"); +assertXPath(pXmlDoc, aClrScheme + "/a:accent6/a:srgbClr", "val", "70ad47"); +assertXPath(pXmlDoc, aClrScheme + "/a:hlink/a:srgbClr", "val", "0563c1"); +assertXPath(pXmlDoc, aClrScheme + "/a:folHlink/a:srgbClr", "val", "954f72"); +} -assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[4]/x:patternFill", "patternType", "solid"); -assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[4]/x:patternFill/x:fgColor", "theme", "4"); +{ +xmlDocUniquePtr pXmlDoc = parseExport("xl/styles.xml"); + +assertXPath(pXmlDoc, "/x:styleSheet", 1); + +// Fonts +OString aFont = "/x:styleSheet/x:fonts/x:font"; +assertXPath(pXmlDoc, aFont, 6); +assertXPath(pXmlDoc, aFont + "[5]/x:color", "theme", "7"); +assertXPath(pXmlDoc, aFont + "[6]/x:color", "rgb", "FF9C5700"); + +// Fills +OString aFill = "/x:styleSheet/x:fills/x:fill"; +assertXPath(pXmlDoc, aFill, 4); +assertXPath(pXmlDoc, aFill + "[1]/x:patternFill", "patternType", "none"); +assertXPath(pXmlDoc, aFill + "[2]/x:patternFill", "patternType", "gray125"); +assertXPath(pXmlDoc, aFill + "[3]/x:patternFill", "patternType", "solid"); +assertXPath(pXmlDoc, aFill + "[3]/x:patternFill/x:fgColor", "rgb", "EB9C"); +assertXPath(pXmlDoc, aFill + "[4]/x:patternFill", "patternType", "solid"); +assertXPath(pXmlDoc, aFill + "[4]/x:patternFill/x:fgColor", "theme", "4"); +} } // Round 100th percent to percent value - so that small differences don't fail the test
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/ThemeImportExportTest.cxx | 34 +-- sc/qa/unit/subsequent_export_test2.cxx |2 sc/source/filter/excel/xestyle.cxx | 72 ++--- sc/source/filter/inc/xestyle.hxx | 20 + 4 files changed, 85 insertions(+), 43 deletions(-) New commits: commit 164c7164467aa66d231ebfacb678e905f3d3e226 Author: Tomaž Vajngerl AuthorDate: Sat Jul 1 14:26:08 2023 +0900 Commit: Miklos Vajna CommitDate: Fri Aug 25 13:35:17 2023 +0200 sc: add border export and enable round-trip test Change-Id: I76071185d819b9645d97a3e599ea7f48b341a145 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153820 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 42bbc9fbdf940e55213ee2a259c1d31de2e4cbec) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156078 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index 95e6d0e2351e..0cf03ea6c010 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -60,6 +60,12 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExport) assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[4]/x:patternFill/x:fgColor", "theme", "4"); } +// Round 100th percent to percent value - so that small differences don't fail the test +sal_Int32 roundToPercent(sal_Int16 n100Percent) +{ +return sal_Int32(std::round(double(n100Percent) / 100.0)); +} + void checkCellBackgroundThemeColor(ScDocument* pDoc) { // A1 @@ -90,9 +96,9 @@ void checkCellBackgroundThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(20, sal_Int32(std::round(rTransformations[0].mnValue / 100.0))); +CPPUNIT_ASSERT_EQUAL(20, roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(80, sal_Int32(std::round(rTransformations[1].mnValue / 100.0))); +CPPUNIT_ASSERT_EQUAL(80, roundToPercent(rTransformations[1].mnValue)); } // A3 @@ -109,7 +115,7 @@ void checkCellBackgroundThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(1), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(sal_Int16(5000), rTransformations[0].mnValue); +CPPUNIT_ASSERT_EQUAL(50, roundToPercent(rTransformations[0].mnValue)); } } @@ -151,9 +157,9 @@ void checkCellTextThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(60, sal_Int32(std::round(rTransformations[0].mnValue / 100.0))); +CPPUNIT_ASSERT_EQUAL(60, roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(40, sal_Int32(std::round(rTransformations[1].mnValue / 100.0))); +CPPUNIT_ASSERT_EQUAL(40, roundToPercent(rTransformations[1].mnValue)); } // B3 @@ -170,7 +176,7 @@ void checkCellTextThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(1), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(sal_Int16(5000), rTransformations[0].mnValue); +CPPUNIT_ASSERT_EQUAL(50, roundToPercent(rTransformations[0].mnValue)); } } @@ -226,9 +232,9 @@ void checkCellBorderThemeColor(ScDocument* pDoc) auto& rTransformations = aComplexColor.getTransformations(); CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); -CPPUNIT_ASSERT_EQUAL(sal_Int16(2000), rTransformations[0].mnValue); +CPPUNIT_ASSERT_EQUAL(20, roundToPercent(rTransformations[0].mnValue)); CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); -CPPUNIT_ASSERT_EQUAL(sal_Int16(7999), rTransformations[1].mnValue); +CPPUNIT_ASSERT_EQUAL(80, roundToPercent(rTransformations[1].mnValue)); } { auto* pTop = pBoxItem->GetRight(); @@ -239,9 +245,9 @@ void checkCellBorderThemeColor(ScDocument* pDoc)
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/ThemeImportExportTest.cxx | 213 +- sc/qa/unit/data/xlsx/Test_ThemeColor_Text_Background_Border.xlsx |binary 2 files changed, 208 insertions(+), 5 deletions(-) New commits: commit 3ace09c423255685a02018b020913de76b50efc1 Author: Tomaž Vajngerl AuthorDate: Thu Jun 29 16:51:26 2023 +0900 Commit: Miklos Vajna CommitDate: Fri Aug 25 09:27:58 2023 +0200 sc: improve import tests for text, background, border theme colors Change-Id: Icdc658e47c0e4fe20b2b38897d31278f058a6a75 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153783 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit f0c8ccaef39dc7cb876e00679f70c36ca60883d9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156067 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/qa/unit/ThemeImportExportTest.cxx b/sc/qa/unit/ThemeImportExportTest.cxx index 45d29bf7a088..106471f9a816 100644 --- a/sc/qa/unit/ThemeImportExportTest.cxx +++ b/sc/qa/unit/ThemeImportExportTest.cxx @@ -12,9 +12,13 @@ #include #include #include +#include +#include using namespace css; +namespace +{ class ThemeImportExportTest : public ScModelTestBase { public: @@ -58,12 +62,9 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testThemeExport) assertXPath(pXmlDoc, "/x:styleSheet/x:fills/x:fill[4]/x:patternFill/x:fgColor", "theme", "4"); } -CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testCellBackgroundThemeColor) +void checkCellBackgroundThemeColor(ScDocument* pDoc) { -loadFromURL(u"xlsx/Test_ThemeColor_Text_Background_Border.xlsx"); - -ScDocument* pDoc = getScDoc(); - +// A1 { const ScPatternAttr* pPattern = pDoc->GetPattern(0, 0, 0); const SfxPoolItem* pItem = nullptr; @@ -77,6 +78,7 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testCellBackgroundThemeColor) CPPUNIT_ASSERT_EQUAL(size_t(0), aComplexColor.getTransformations().size()); } +// A2 { const ScPatternAttr* pPattern = pDoc->GetPattern(0, 1, 0); const SfxPoolItem* pItem = nullptr; @@ -94,8 +96,209 @@ CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testCellBackgroundThemeColor) CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransformations[1].meType); CPPUNIT_ASSERT_EQUAL(sal_Int16(7999), rTransformations[1].mnValue); } + +// A3 +{ +const ScPatternAttr* pPattern = pDoc->GetPattern(0, 2, 0); +const SfxPoolItem* pItem = nullptr; +pPattern->GetItemSet().HasItem(ATTR_BACKGROUND, &pItem); +CPPUNIT_ASSERT(pItem); + +auto* pBrushItem = static_cast(pItem); +CPPUNIT_ASSERT_EQUAL(Color(0x14676b), pBrushItem->GetColor()); +auto aComplexColor = pBrushItem->getComplexColor(); +CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent3, aComplexColor.getSchemeType()); +auto& rTransformations = aComplexColor.getTransformations(); +CPPUNIT_ASSERT_EQUAL(size_t(1), rTransformations.size()); +CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); +CPPUNIT_ASSERT_EQUAL(sal_Int16(5000), rTransformations[0].mnValue); +} +} + +CPPUNIT_TEST_FIXTURE(ThemeImportExportTest, testCellBackgroundThemeColor) +{ +loadFromURL(u"xlsx/Test_ThemeColor_Text_Background_Border.xlsx"); +checkCellBackgroundThemeColor(getScDoc()); +} + +void checkCellTextThemeColor(ScDocument* pDoc) +{ +// B1 +{ +const ScPatternAttr* pPattern = pDoc->GetPattern(1, 0, 0); +const SfxPoolItem* pItem = nullptr; +pPattern->GetItemSet().HasItem(ATTR_FONT_COLOR, &pItem); +CPPUNIT_ASSERT(pItem); + +auto* pColorItem = static_cast(pItem); +CPPUNIT_ASSERT_EQUAL(Color(0x62a39f), pColorItem->getColor()); +auto aComplexColor = pColorItem->getComplexColor(); +CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent6, aComplexColor.getSchemeType()); +CPPUNIT_ASSERT_EQUAL(size_t(0), aComplexColor.getTransformations().size()); +} + +// B2 +{ +const ScPatternAttr* pPattern = pDoc->GetPattern(1, 1, 0); +const SfxPoolItem* pItem = nullptr; +pPattern->GetItemSet().HasItem(ATTR_FONT_COLOR, &pItem); +CPPUNIT_ASSERT(pItem); + +auto* pColorItem = static_cast(pItem); +CPPUNIT_ASSERT_EQUAL(Color(0xa1c8c5), pColorItem->getColor()); +auto aComplexColor = pColorItem->getComplexColor(); +CPPUNIT_ASSERT_EQUAL(model::ThemeColorType::Accent6, aComplexColor.getSchemeType()); +auto& rTransformations = aComplexColor.getTransformations(); +CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size()); +CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, rTransformations[0].meType); +CPPUNIT_ASSERT_EQUAL(sal_Int16(6000), rTransformations[0].mnValue); +CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumOff, rTransf
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sd/qa sw/qa uitest/impress_tests uitest/uitest
sc/qa/uitest/calc_tests/columns.py| 286 +++--- sc/qa/uitest/calc_tests/formatCells.py| 171 +-- sc/qa/uitest/calc_tests/rows.py | 216 ++-- sc/qa/uitest/calc_tests7/tdf137397.py | 26 sc/qa/uitest/calc_tests9/tdf126673.py | 30 sc/qa/uitest/calc_tests9/tdf137446.py | 36 sc/qa/uitest/chart/chartArea.py | 268 ++--- sc/qa/uitest/chart/chartDataLabels.py | 40 sc/qa/uitest/chart/chartGrid.py | 274 +++--- sc/qa/uitest/chart/chartLegend.py | 38 sc/qa/uitest/chart/chartTitles.py | 38 sc/qa/uitest/chart/chartWall.py | 246 ++--- sc/qa/uitest/chart/chartXAxis.py | 438 - sc/qa/uitest/chart/chartYAxis.py | 442 - sc/qa/uitest/chart/formatDataSeries.py| 148 +-- sc/qa/uitest/chart/tdf93506_trendline.py | 820 +- sc/qa/uitest/chart2/tdf133630.py | 58 - sc/qa/uitest/textToColumns/tdf89907.py| 80 - sd/qa/uitest/impress_tests/tdf119246.py | 52 - sd/qa/uitest/impress_tests/tdf134734.py |3 sd/qa/uitest/impress_tests/tdf137729.py |4 sd/qa/uitest/impress_tests/tdf152295.py | 65 - sd/qa/uitest/impress_tests/textColumnsDialog.py | 53 - sd/qa/uitest/impress_tests2/tdf139511.py | 34 sd/qa/uitest/impress_tests2/tdf82616.py | 66 - sw/qa/uitest/chapterNumbering/chapterNumbering.py | 110 +- sw/qa/uitest/sidebar/tdf133189.py | 28 sw/qa/uitest/sidebar/tdf135590.py | 73 - sw/qa/uitest/sidebar/tdf99711.py | 25 sw/qa/uitest/table/tableProperties.py | 342 +++ sw/qa/uitest/table/tdf134881_colProportionalAdjust.py | 46 - sw/qa/uitest/writer_tests2/formatBulletsNumbering.py | 138 +-- sw/qa/uitest/writer_tests2/formatParagraph.py | 250 ++--- sw/qa/uitest/writer_tests3/lineNumbering.py | 102 +- sw/qa/uitest/writer_tests3/pageDialog.py | 27 sw/qa/uitest/writer_tests4/tdf138546.py | 28 sw/qa/uitest/writer_tests5/columns.py | 46 - sw/qa/uitest/writer_tests6/tdf128431.py | 36 sw/qa/uitest/writer_tests7/forms.py | 58 - sw/qa/uitest/writer_tests7/tdf132169.py | 33 uitest/impress_tests/drawinglayer.py | 137 +-- uitest/uitest/uihelper/common.py | 10 42 files changed, 2711 insertions(+), 2710 deletions(-) New commits: commit 7330266381e39048cf4936708dc3892083890640 Author: Xisco Fauli AuthorDate: Mon Feb 6 13:52:58 2023 +0100 Commit: Miklos Vajna CommitDate: Wed Aug 23 08:08:11 2023 +0200 uitest: reset value when changing the measurement unit Otherwise, changing it in one test might affect other tests Use @contextmanager decorator to change it back to default 'Inch' at the end of the test even if the test hits an assert Change-Id: I1e7b35019cd19b490aa619c0a866bb9f93820950 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146583 Tested-by: Jenkins Reviewed-by: Xisco Fauli (cherry picked from commit 7355c2ee8a9f0811d1cd3d37fc9dac2ad5f95774) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155954 Tested-by: Jenkins CollaboraOffice Reviewed-by: Miklos Vajna diff --git a/sc/qa/uitest/calc_tests/columns.py b/sc/qa/uitest/calc_tests/columns.py index 6813471d71fe..ed594510f175 100644 --- a/sc/qa/uitest/calc_tests/columns.py +++ b/sc/qa/uitest/calc_tests/columns.py @@ -14,97 +14,97 @@ from libreoffice.uno.propertyvalue import mkPropertyValues class CalcColumns(UITestCase): def test_column_width(self): with self.ui_test.create_doc_in_start_center("calc"): -xCalcDoc = self.xUITest.getTopFocusWindow() -gridwin = xCalcDoc.getChild("grid_window") -change_measurement_unit(self, "Centimeter") - -#select A1 -gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"})) -#column width -with self.ui_test.execute_dialog_through_command(".uno:ColumnWidth") as xDialog: -xvalue = xDialog.getChild("value") -xdefault = xDialog.getChild("default") -self.assertEqual(get_state_as_dict(xdefault)["Selected"], "true") #default selected - -# tdf#144247: Without the fix in place, this test would have failed with -# AssertionError: '2.26 cm' != '2.2578 cm' -self.assertEqual("2.26 cm", get_state_as_dict(xvalue)["Text"]) -xvalue.executeAction("UP", tuple()) -self.assertEqual("2.30
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/uicalc/uicalc.cxx | 33 + 1 file changed, 33 insertions(+) New commits: commit b5b41306834e93171e44e63880ec695169838e5f Author: Henry Castro AuthorDate: Tue Jul 18 15:22:08 2023 -0400 Commit: Tomaž Vajngerl CommitDate: Tue Aug 8 14:38:32 2023 +0200 tdf#155799: sc: qa: add unit test "testMouseMergeRef" Signed-off-by: Henry Castro Change-Id: I2e46a014a3a66fe41b06a07a68c75e52ae5530f6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155005 Tested-by: Jenkins CollaboraOffice Reviewed-by: Tomaž Vajngerl diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 6febacf497c4..1b35263bccae 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -3103,6 +3103,39 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testKeyboardMergeRef) } } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testMouseMergeRef) +{ +createScDoc(); +ScDocShell* pDocSh = getScDocShell(); +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +ScTabViewShell* pViewShell = pDocSh->GetBestViewShell(false); +CPPUNIT_ASSERT(pViewShell); + +goToCell("A1:A5"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A6:A10"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("B1"); +typeString(u"="); + +Point aA1 = pViewShell->GetViewData().GetPrintTwipsPos(0, 0); +Point aA6 = pViewShell->GetViewData().GetPrintTwipsPos(0, 5); +Point aA7 = pViewShell->GetViewData().GetPrintTwipsPos(0, 6); + +pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONDOWN, aA1.X() + 5, aA1.Y() + 5, 1, MOUSE_LEFT, 0); +pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, aA6.X() + 5, aA6.Y() + 5, 1, MOUSE_LEFT, 0); +pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, aA7.X() + 5, aA7.Y() + 5, 1, MOUSE_LEFT, 0); +Scheduler::ProcessEventsToIdle(); + +CPPUNIT_ASSERT(pViewShell->IsRefInputMode()); +{ +const OUString* pInput = pViewShell->GetEditString(); +CPPUNIT_ASSERT(pInput); +CPPUNIT_ASSERT_EQUAL(OUString("=A1:A10"), *pInput); +} +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |4 ++-- sc/source/ui/docshell/docsh3.cxx |5 - 2 files changed, 6 insertions(+), 3 deletions(-) New commits: commit 40fdb741ae8c65356fb82a85f4c7bb431038834e Author: Szymon Kłos AuthorDate: Tue Jul 25 14:35:49 2023 +0200 Commit: Caolán McNamara CommitDate: Wed Jul 26 10:10:30 2023 +0200 lok: notify only affected tabs on cell resize When row has automatic height and we type something into one cell - it may be resized. That caused sending document size changed callback to all the views, also affecting all the parts/tabs. This patch calls that only for affected views which are looking at modified parts. It will not invalidate all the tabs when only one is modified. Change-Id: I93e574cf967d608696c1a95ad8b5a7614973c3f5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154891 Tested-by: Jenkins CollaboraOffice Reviewed-by: Caolán McNamara diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 039cffe5ab0e..8b0b66ed34ef 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -1206,7 +1206,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() dispatchCommand(mxComponent, ".uno:InsertRows", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 51240, 32212230, 63990), aView.m_aInvalidations[0]); // move on the right @@ -1223,7 +1223,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol() dispatchCommand(mxComponent, ".uno:InsertColumns", aArgs); Scheduler::ProcessEventsToIdle(); CPPUNIT_ASSERT(aView.m_bInvalidateTiles); -CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size()); +CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size()); CPPUNIT_ASSERT_EQUAL(tools::Rectangle(254925, -15, 32212230, 63990), aView.m_aInvalidations[0]); } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 803ba61f8a7a..1cec4abeb3fd 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -109,6 +109,7 @@ void ScDocShell::PostPaint( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sal_uInt16 nExtFlags ) { ScRangeList aPaintRanges; +std::set aTabsInvalidated; for (size_t i = 0, n = rRanges.size(); i < n; ++i) { const ScRange& rRange = rRanges[i]; @@ -167,6 +168,7 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa } } aPaintRanges.push_back(ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2)); +aTabsInvalidated.insert(nTab1); } Broadcast(ScPaintHint(aPaintRanges.Combine(), nPart)); @@ -176,7 +178,8 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa if ((nPart & (PaintPartFlags::Top | PaintPartFlags::Left)) && comphelper::LibreOfficeKit::isActive()) { ScModelObj* pModel = comphelper::getFromUnoTunnel(this->GetModel()); -SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel); +for (auto nTab : aTabsInvalidated) +SfxLokHelper::notifyPartSizeChangedAllViews(pModel, nTab); } }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/uicalc/uicalc.cxx | 27 ++ sc/source/ui/view/tabview2.cxx | 375 +++-- 2 files changed, 245 insertions(+), 157 deletions(-) New commits: commit d161b4b1290c42dfe4b7c7951408fa712c185a44 Author: Jaume Pujantell AuthorDate: Thu Jul 6 09:22:15 2023 +0200 Commit: Jaume Pujantell CommitDate: Fri Jul 7 08:59:49 2023 +0200 tdf#155796 sc: fix select with merged cells When selecting multiple cells or modifying a selection with shift+arrow make sure that a merge group is never partially selected. This also fixes tdf#128678 Change-Id: Ida00939cec11240c0d06375feb21afa82a6876da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154047 Reviewed-by: Szymon Kłos Tested-by: Jenkins CollaboraOffice Reviewed-by: Jaume Pujantell diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 19aa8a703943..9e1459d7fca6 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -3037,6 +3037,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152577) CPPUNIT_ASSERT(!pDBs->empty()); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf155796) +{ +createScDoc(); + +goToCell("A1:A3"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); +goToCell("A4:A6"); +dispatchCommand(mxComponent, ".uno:ToggleMergeCells", {}); + +goToCell("A1:A6"); + +ScModelObj* pModelObj = comphelper::getFromUnoTunnel(mxComponent); +pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_SHIFT | KEY_UP); +Scheduler::ProcessEventsToIdle(); + +ScRangeList aMarkedArea = getViewShell()->GetViewData().GetMarkData().GetMarkedRanges(); +ScDocument* pDoc = getScDoc(); +OUString aMarkedAreaString; +ScRangeStringConverter::GetStringFromRangeList(aMarkedAreaString, &aMarkedArea, pDoc, + formula::FormulaGrammar::CONV_OOO); + +// Without the fix in place, this test would have failed with +// - Expected: Sheet1.A1:Sheet1.A3 +// - Actual : Sheet1.A1:Sheet1.A5 +CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 6b1cfef156f7..442dc92ccb73 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -58,6 +58,19 @@ bool isCellQualified(const ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, return true; } +bool areCellsQualified(const ScDocument* pDoc, SCCOL nColStart, SCROW nRowStart, SCCOL nColEnd, + SCROW nRowEnd, SCTAB nTab, bool bSelectLocked, bool bSelectUnlocked) +{ +PutInOrder(nColStart, nColEnd); +PutInOrder(nRowStart, nRowEnd); +for (SCCOL col = nColStart; col <= nColEnd; ++col) +for (SCROW row = nRowStart; row <= nRowEnd; ++row) +if (!isCellQualified(pDoc, col, row, nTab, bSelectLocked, bSelectUnlocked)) +return false; + +return true; +} + void moveCursorByProtRule( SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, const ScDocument* pDoc) { @@ -180,13 +193,9 @@ bool checkBoundary(const ScDocument* pDoc, SCCOL& rCol, SCROW& rRow) return bGood; } -void moveCursorByMergedCell( -SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCTAB nTab, -const ScDocument* pDoc, const ScViewData& rViewData) +void moveCursorByMergedCell(SCCOL& rCol, SCROW& rRow, SCCOL nMovX, SCROW nMovY, SCCOL nStartX, +SCROW nStartY, SCTAB nTab, const ScDocument* pDoc) { -SCCOL nOrigX = rViewData.GetCurX(); -SCROW nOrigY = rViewData.GetCurY(); - const ScTableProtection* pTabProtection = pDoc->GetTabProtection(nTab); bool bSelectLocked = true; bool bSelectUnlocked = true; @@ -196,108 +205,198 @@ void moveCursorByMergedCell( bSelectUnlocked = pTabProtection->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS); } -const ScMergeAttr* pMergeAttr = pDoc->GetAttr(nOrigX, nOrigY, nTab, ATTR_MERGE); - -bool bOriginMerged = false; -SCCOL nColSpan = 1; -SCROW nRowSpan = 1; -if (pMergeAttr && pMergeAttr->IsMerged()) -{ -nColSpan = pMergeAttr->GetColMerge(); -nRowSpan = pMergeAttr->GetRowMerge(); -bOriginMerged = true; -} - if (nMovX > 0) { -SCCOL nOld = rCol; -if (bOriginMerged) -{ -// Original cell is merged. Push the block end outside the merged region. -if (nOrigX < pDoc->MaxCol() && nOrigX < rCol && rCol <= nOrigX + nColSpan - 1) -rCol = nOrigX + nColSpan; -} -else -{ -pDoc->SkipOverlapped(rCol, rRow, nTab); -} +SCROW rowStart = std::min(rRow, nStartY); +SCROW rowEnd = std::max(rRow, nStartY); -if (nOld < rCol) +
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/helper/qahelper.cxx | 38 ++ sc/source/core/data/dpoutput.cxx |6 +- 2 files changed, 43 insertions(+), 1 deletion(-) New commits: commit 021712f9500910c3433360ec54d35f3564f540ce Author: luigiiucci AuthorDate: Wed May 17 11:02:37 2023 +0200 Commit: Tomaž Vajngerl CommitDate: Thu Jun 29 04:52:40 2023 +0200 Header columns can disappear with filtered data in pivot tables When we set on a pivot table a filter that filters all the rows, the pivot table showed only the first header columns and computed column, but all the columns headers should still be shown so we can adjust the filter for the column. This fixes this issue. Also add more debug output and prevent a crash when running pivot table tests. Change-Id: I30b4ee72cf8436c4522ab4ba0781462b214816dd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151871 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 3551d18404cb19cdaa8edb170a549f5c5405d0cb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153686 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx index f9c7af04a813..d21571def5a3 100644 --- a/sc/qa/unit/helper/qahelper.cxx +++ b/sc/qa/unit/helper/qahelper.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include @@ -404,6 +405,43 @@ bool checkOutput( svl::GridPrinter printer(e.Row() - s.Row() + 1, e.Col() - s.Col() + 1, CALC_DEBUG_OUTPUT != 0); SCROW nOutRowSize = e.Row() - s.Row() + 1; SCCOL nOutColSize = e.Col() - s.Col() + 1; + +// Check if expected size iz smaller than actual size (and prevent a crash) +if (aCheck.size() < o3tl::make_unsigned(nOutRowSize) || aCheck[0].size() < o3tl::make_unsigned(nOutColSize)) +{ +// Dump the arrays to console, so we can compare +std::cout << "Expected data:" << std::endl; +for (size_t nRow = 0; nRow < aCheck.size(); ++nRow) +{ +for (size_t nCol = 0; nCol < aCheck[nRow].size(); ++nCol) +{ +const char* p = aCheck[nRow][nCol]; +if (p) +{ +OUString aCheckVal = OUString::createFromAscii(p); +std::cout << "'" << aCheckVal << "', "; +} +else +std::cout << "null, "; +} +std::cout << std::endl; +} + +std::cout << "Actual data:" << std::endl; +for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) +{ +for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) +{ +OUString aVal = pDoc->GetString(nCol + s.Col(), nRow + s.Row(), s.Tab()); +std::cout << "'" << aVal << "', "; +} +std::cout << std::endl; +} +std::cout << std::endl; + +return false; +} + for (SCROW nRow = 0; nRow < nOutRowSize; ++nRow) { for (SCCOL nCol = 0; nCol < nOutColSize; ++nCol) diff --git a/sc/source/core/data/dpoutput.cxx b/sc/source/core/data/dpoutput.cxx index 301e2c83ba4f..ff4335a81420 100644 --- a/sc/source/core/data/dpoutput.cxx +++ b/sc/source/core/data/dpoutput.cxx @@ -608,7 +608,11 @@ ScDPOutput::ScDPOutput( ScDocument* pD, uno::Reference aResult = xLevRes->getResults(); ++nRowDims; -if (!lcl_MemberEmpty(aResult)) +// We want only to remove the DATA column if it is empty +// and not any other empty columns (to still show the +// header columns) +bool bSkip = lcl_MemberEmpty(aResult) && bIsDataLayout; +if (!bSkip) { bool bFieldCompact = false; try
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sfx2/source
sc/qa/unit/tiledrendering/tiledrendering.cxx |3 ++- sfx2/source/appl/appserv.cxx |4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) New commits: commit f1633dc0e06b046a9ca0f2fa53e7858be1584ffb Author: Caolán McNamara AuthorDate: Fri Jun 9 15:27:12 2023 +0100 Commit: Andras Timar CommitDate: Sun Jun 11 14:54:48 2023 +0200 Related: tdf#155507 don't broadcast UI Theme change unless it did change a problem since: https://github.com/CollaboraOnline/online/commit/b6d4c88f9011845acae5c8537c0826055c8327a2 Change-Id: Iac1189ba7b892324b5f000f5f6240787b3209892 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152817 Tested-by: Jenkins CollaboraOffice Reviewed-by: Andras Timar diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 8e42f5c29a53..039cffe5ab0e 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -3231,9 +3231,10 @@ void ScTiledRenderingTest::testUndoReorderingMulti() void ScTiledRenderingTest::testGetViewRenderState() { -// Add an empty dark scheme to avoid a warning +// Add a pair of schemes, last added is the default svtools::EditableColorConfig aColorConfig; aColorConfig.AddScheme(u"Dark"); +aColorConfig.AddScheme(u"Light"); ScModelObj* pModelObj = createDoc("empty.ods"); int nFirstViewId = SfxLokHelper::getView(); diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index f2dfca480c5d..418bcb88430b 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -602,8 +602,10 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) SAL_WARN("sfx.appl", "FN_CHANGE_THEME: no theme name"); break; } +const OUString& rSchemeName = pNewThemeArg->GetValue(); svtools::EditableColorConfig aEditableConfig; -aEditableConfig.LoadScheme(pNewThemeArg->GetValue()); +if (aEditableConfig.GetCurrentSchemeName() != rSchemeName) +aEditableConfig.LoadScheme(rSchemeName); break; }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/data/xlsx/tablerefsnamed.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx | 17 sc/source/core/tool/interpr1.cxx | 43 +++ 3 files changed, 50 insertions(+), 10 deletions(-) New commits: commit 49d6567a196f4bfafb45b07b1b88e7c00c134bfd Author: Dennis Francis AuthorDate: Sat May 13 13:37:39 2023 +0530 Commit: Dennis Francis CommitDate: Sat May 20 17:06:40 2023 +0200 tdf#155369 ScIndirect: handle names that resolve to... table structured references. Change-Id: I897feeeb49e63c1758cf64450799acb192e2d593 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151720 Tested-by: Jenkins CollaboraOffice Reviewed-by: Dennis Francis diff --git a/sc/qa/unit/data/xlsx/tablerefsnamed.xlsx b/sc/qa/unit/data/xlsx/tablerefsnamed.xlsx new file mode 100644 index ..825103d54993 Binary files /dev/null and b/sc/qa/unit/data/xlsx/tablerefsnamed.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 850026d3bc46..f2fd4196dfa1 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -192,6 +192,7 @@ public: void testTdf151818_SmartArtFontColor(); void testTdf82984_zip64XLSXImport(); void testSingleLine(); +void testNamedTableRef(); CPPUNIT_TEST_SUITE(ScFiltersTest2); @@ -314,6 +315,7 @@ public: CPPUNIT_TEST(testTdf151818_SmartArtFontColor); CPPUNIT_TEST(testTdf82984_zip64XLSXImport); CPPUNIT_TEST(testSingleLine); +CPPUNIT_TEST(testNamedTableRef); CPPUNIT_TEST_SUITE_END(); }; @@ -3078,6 +3080,21 @@ void ScFiltersTest2::testSingleLine() testCells(pDoc); } +void ScFiltersTest2::testNamedTableRef() +{ +createScDoc("xlsx/tablerefsnamed.xlsx"); +ScDocument* pDoc = getScDoc(); +for (sal_Int32 nRow = 1; nRow < 7; ++nRow) +{ +ScFormulaCell* pFC = pDoc->GetFormulaCell(ScAddress(5, nRow, 0)); +CPPUNIT_ASSERT(pFC); +// Without the fix there will be #REF in F2:F7. +CPPUNIT_ASSERT_EQUAL(FormulaError::NONE, pFC->GetErrCode()); +// Without the fix value will be 0 (FALSE). +CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(ScAddress(6, nRow, 0))); +} +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest2); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index b833e3f48f24..7283002f328d 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8181,6 +8181,12 @@ void ScInterpreter::ScDBVarP() PushDouble(fVal/fCount); } +bool lcl_IsTableStructuredRef(const OUString& sRefStr, sal_Int32& nIndex) +{ +nIndex = ScGlobal::FindUnquoted(sRefStr, '['); +return (nIndex > 0 && ScGlobal::FindUnquoted(sRefStr, ']', nIndex + 1) > nIndex); +} + void ScInterpreter::ScIndirect() { sal_uInt8 nParamCount = GetByte(); @@ -8217,6 +8223,10 @@ void ScInterpreter::ScIndirect() const ScAddress::Details aDetailsXlA1( FormulaGrammar::CONV_XL_A1, aPos ); SCTAB nTab = aPos.Tab(); +bool bTableRefNamed = false; +sal_Int32 nTableRefNamedIndex = -1; +OUString sTabRefStr; + // Named expressions and DB range names need to be tried first, as older 1K // columns allowed names that would now match a 16k columns cell address. do @@ -8232,8 +8242,14 @@ void ScInterpreter::ScIndirect() // This is the usual way to treat named ranges containing // relative references. -if (!pData->IsReference( aRange, aPos)) +if (!pData->IsReference(aRange, aPos)) +{ +sTabRefStr = pData->GetSymbol(); +bTableRefNamed = lcl_IsTableStructuredRef(sTabRefStr, nTableRefNamedIndex); +// if bTableRefNamed is true, we have a name that maps to a table structured reference. +// Such a case is handled below. break; +} if (aRange.aStart == aRange.aEnd) PushSingleRef( aRange.aStart.Col(), aRange.aStart.Row(), @@ -8250,6 +8266,9 @@ void ScInterpreter::ScIndirect() do { +if (bTableRefNamed) +break; + const OUString & aName( sSharedRefStr.getIgnoreCaseString() ); ScDBCollection::NamedDBs& rDBs = mrDoc.GetDBCollection()->getNamedDBs(); const ScDBData* pData = rDBs.findByUpperName( aName); @@ -8285,9 +8304,10 @@ void ScInterpreter::ScIndirect() ScRefAddress aRefAd, aRefAd2; ScAddress::ExternalInfo aExtInfo; -if ( ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) || - ( bTryXlA1 && ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, -aRefAd2, aDetailsXlA1, &aExtInfo) ) ) +if ( !bTableRefNamed && + (ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetails, &aExtInfo) || +( bTryXlA1 && ConvertDoubleRef(mrDoc, sRefS
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/data/xlsx/condformat_databar.xlsx |binary sc/qa/unit/subsequent_filters_test.cxx | 23 +++ 2 files changed, 23 insertions(+) New commits: commit 65ffe4eac759363949c951abcc6f30df0f401e0c Author: Henry Castro AuthorDate: Fri Mar 17 15:49:45 2023 -0400 Commit: Henry Castro CommitDate: Thu May 18 18:17:33 2023 +0200 sc: qa: add databar unit test 0 1 Change-Id: Ib57dac07027e2c3c01ee556a3df791f49637be54 Signed-off-by: Henry Castro Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149070 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/data/xlsx/condformat_databar.xlsx b/sc/qa/unit/data/xlsx/condformat_databar.xlsx new file mode 100644 index ..2d2d727322b7 Binary files /dev/null and b/sc/qa/unit/data/xlsx/condformat_databar.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx index c080942d486d..3359aef79969 100644 --- a/sc/qa/unit/subsequent_filters_test.cxx +++ b/sc/qa/unit/subsequent_filters_test.cxx @@ -147,6 +147,7 @@ public: void testCondFormatImportCellIs(); void testCondFormatThemeColor2XLSX(); // negative bar color and axis color void testCondFormatThemeColor3XLSX(); // theme index 2 and 3 are switched +void testCondFormatCfvoScaleValueXLSX(); void testComplexIconSetsXLSX(); void testTdf101104(); void testTdf64401(); @@ -287,6 +288,7 @@ public: CPPUNIT_TEST(testCondFormatImportCellIs); CPPUNIT_TEST(testCondFormatThemeColor2XLSX); CPPUNIT_TEST(testCondFormatThemeColor3XLSX); +CPPUNIT_TEST(testCondFormatCfvoScaleValueXLSX); CPPUNIT_TEST(testComplexIconSetsXLSX); CPPUNIT_TEST(testTdf101104); CPPUNIT_TEST(testTdf64401); @@ -2593,6 +2595,27 @@ void ScFiltersTest::testCondFormatThemeColor2XLSX() CPPUNIT_ASSERT_EQUAL(Color(197, 90, 17), pDataBarFormatData->maAxisColor); } +void ScFiltersTest::testCondFormatCfvoScaleValueXLSX() +{ +createScDoc("xlsx/condformat_databar.xlsx"); + +ScDocument* pDoc = getScDoc(); +ScConditionalFormat* pFormat = pDoc->GetCondFormat(0, 0, 0); +const ScFormatEntry* pEntry = pFormat->GetEntry(0); +CPPUNIT_ASSERT(pEntry); +CPPUNIT_ASSERT_EQUAL(ScFormatEntry::Type::Databar, pEntry->GetType()); +const ScDataBarFormat* pDataBar = static_cast(pEntry); +const ScDataBarFormatData* pDataBarFormatData = pDataBar->GetDataBarData(); +const ScColorScaleEntry* pLower = pDataBarFormatData->mpLowerLimit.get(); +const ScColorScaleEntry* pUpper = pDataBarFormatData->mpUpperLimit.get(); + +CPPUNIT_ASSERT_EQUAL(COLORSCALE_VALUE, pLower->GetType()); +CPPUNIT_ASSERT_EQUAL(COLORSCALE_VALUE, pUpper->GetType()); + +CPPUNIT_ASSERT_EQUAL(double(0.0), pLower->GetValue()); +CPPUNIT_ASSERT_EQUAL(double(1.0), pUpper->GetValue()); +} + namespace { void checkDatabarPositiveColor(const ScConditionalFormat* pFormat, const Color& rColor)
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/unit/data/xls/cell-multi-line.xls |binary sc/qa/unit/data/xlsx/cell-multi-line.xlsx |binary sc/qa/unit/subsequent_filters_test2.cxx | 35 ++ 3 files changed, 35 insertions(+) New commits: commit 9c5e6b87d925bb36a9d80a5f9fb611259e505d44 Author: Henry Castro AuthorDate: Tue Feb 28 09:57:07 2023 -0400 Commit: Henry Castro CommitDate: Fri May 12 21:29:35 2023 +0200 sc: qa: filter: add import excel unit test single line. Signed-off-by: Henry Castro Change-Id: I2d76f54e0ccf943794bd817b2e80583b8dd69558 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148005 Tested-by: Jenkins CollaboraOffice diff --git a/sc/qa/unit/data/xls/cell-multi-line.xls b/sc/qa/unit/data/xls/cell-multi-line.xls new file mode 100644 index ..8ed0aded3243 Binary files /dev/null and b/sc/qa/unit/data/xls/cell-multi-line.xls differ diff --git a/sc/qa/unit/data/xlsx/cell-multi-line.xlsx b/sc/qa/unit/data/xlsx/cell-multi-line.xlsx new file mode 100644 index ..ecaf8124c86b Binary files /dev/null and b/sc/qa/unit/data/xlsx/cell-multi-line.xlsx differ diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx index 2e3f2a0ec88b..850026d3bc46 100644 --- a/sc/qa/unit/subsequent_filters_test2.cxx +++ b/sc/qa/unit/subsequent_filters_test2.cxx @@ -191,6 +191,7 @@ public: void testTdf83671_SmartArt_import2(); void testTdf151818_SmartArtFontColor(); void testTdf82984_zip64XLSXImport(); +void testSingleLine(); CPPUNIT_TEST_SUITE(ScFiltersTest2); @@ -312,6 +313,7 @@ public: CPPUNIT_TEST(testTdf83671_SmartArt_import2); CPPUNIT_TEST(testTdf151818_SmartArtFontColor); CPPUNIT_TEST(testTdf82984_zip64XLSXImport); +CPPUNIT_TEST(testSingleLine); CPPUNIT_TEST_SUITE_END(); }; @@ -3043,6 +3045,39 @@ void ScFiltersTest2::testTdf82984_zip64XLSXImport() createScDoc("xlsx/tdf82984_zip64XLSXImport.xlsx"); } +namespace +{ +void testCells(ScDocument* pDoc) +{ +{ +const EditTextObject* pObj = pDoc->GetEditText(ScAddress(0, 0, 0)); +CPPUNIT_ASSERT(pObj); +CPPUNIT_ASSERT_EQUAL(sal_Int32(1), pObj->GetParagraphCount()); +CPPUNIT_ASSERT_EQUAL(size_t(1), pObj->GetSharedStrings().size()); +} + +{ +const EditTextObject* pObj = pDoc->GetEditText(ScAddress(0, 1, 0)); +CPPUNIT_ASSERT(pObj); +CPPUNIT_ASSERT_EQUAL(sal_Int32(3), pObj->GetParagraphCount()); +CPPUNIT_ASSERT_EQUAL(size_t(3), pObj->GetSharedStrings().size()); +} +} +} + +void ScFiltersTest2::testSingleLine() +{ +createScDoc("xls/cell-multi-line.xls"); +ScDocument* pDoc = getScDoc(); +CPPUNIT_ASSERT(pDoc); +testCells(pDoc); + +createScDoc("xlsx/cell-multi-line.xlsx"); +pDoc = getScDoc(); +CPPUNIT_ASSERT(pDoc); +testCells(pDoc); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScFiltersTest2); CPPUNIT_PLUGIN_IMPLEMENT();
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa sc/source
sc/qa/unit/uicalc/data/simpleTable.xlsx |binary sc/qa/unit/uicalc/uicalc.cxx| 15 +++ sc/source/core/tool/dbdata.cxx |7 ++- 3 files changed, 21 insertions(+), 1 deletion(-) New commits: commit 280aa685081bf37df98703d97d20e079c6ec0bbe Author: Paris Oplopoios AuthorDate: Wed Mar 8 23:04:49 2023 +0200 Commit: Paris Oplopoios CommitDate: Fri Mar 17 00:08:54 2023 + tdf#154061 Make sure table column attributes size is correct Resize maTableColumnAttributes to match the amount of columns, fixes crash upon undoing a column insertion on a table Change-Id: Iad4b8ac5c38d5d1065d6ef1267ce3f5d3b28afa8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148492 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl (cherry picked from commit 2135706397d36aa7ea24650b65859be0b6860a65) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149016 Tested-by: Paris Oplopoios Reviewed-by: Paris Oplopoios diff --git a/sc/qa/unit/uicalc/data/simpleTable.xlsx b/sc/qa/unit/uicalc/data/simpleTable.xlsx new file mode 100644 index ..fd4e394732ba Binary files /dev/null and b/sc/qa/unit/uicalc/data/simpleTable.xlsx differ diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx index 42d0168aa833..98d3398b09d8 100644 --- a/sc/qa/unit/uicalc/uicalc.cxx +++ b/sc/qa/unit/uicalc/uicalc.cxx @@ -2025,6 +2025,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf142010) CPPUNIT_ASSERT_EQUAL(5.0, pDoc->GetValue(ScAddress(5, 71, 0))); } +CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154061) +{ +createScDoc("simpleTable.xlsx"); +ScDocument* pDoc = getScDoc(); +CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 0))); + +goToCell("B1"); + +// Without the fix in place, it would crash here due to an out of bounds array access +dispatchCommand(mxComponent, ".uno:InsertColumnsBefore", {}); +CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(2, 0, 0))); +dispatchCommand(mxComponent, ".uno:Undo", {}); +CPPUNIT_ASSERT_EQUAL(OUString("Column2"), pDoc->GetString(ScAddress(1, 0, 0))); +} + CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132431) { createScDoc("tdf132431.ods"); diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index dc10d6a0503e..293bb20a4976 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -116,6 +116,7 @@ ScDBData::ScDBData( const ScDBData& rData ) : bAutoFilter (rData.bAutoFilter), bModified (rData.bModified), maTableColumnNames (rData.maTableColumnNames), +maTableColumnAttributes(rData.maTableColumnAttributes), mbTableColumnNamesDirty(rData.mbTableColumnNamesDirty), nFilteredRowCount (rData.nFilteredRowCount) { @@ -150,6 +151,7 @@ ScDBData::ScDBData( const OUString& rName, const ScDBData& rData ) : bAutoFilter (rData.bAutoFilter), bModified (rData.bModified), maTableColumnNames (rData.maTableColumnNames), +maTableColumnAttributes(rData.maTableColumnAttributes), mbTableColumnNamesDirty (rData.mbTableColumnNamesDirty), nFilteredRowCount (rData.nFilteredRowCount) { @@ -199,6 +201,7 @@ ScDBData& ScDBData::operator= (const ScDBData& rData) else { maTableColumnNames = rData.maTableColumnNames; +maTableColumnAttributes = rData.maTableColumnAttributes; mbTableColumnNamesDirty = rData.mbTableColumnNamesDirty; } @@ -577,6 +580,7 @@ void ScDBData::UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos) aRange.aEnd.Row()); // Do not use SetTableColumnNames() because that resets mbTableColumnNamesDirty. maTableColumnNames = aNames; +maTableColumnAttributes.resize(aNames.size()); mbTableColumnNamesDirty = bTableColumnNamesDirty; } @@ -620,6 +624,7 @@ bool ScDBData::UpdateReference(const ScDocument* pDoc, UpdateRefMode eUpdateRefM MoveTo( theTab1, theCol1, theRow1, theCol2, theRow2 ); // Do not use SetTableColumnNames() because that resets mbTableColumnNamesDirty. maTableColumnNames = aNames; +maTableColumnAttributes.resize(aNames.size()); mbTableColumnNamesDirty = bTableColumnNamesDirty; } @@ -721,7 +726,6 @@ void ScDBData::AdjustTableColumnAttributes( UpdateRefMode eUpdateRefMode, SCCOL n += nDx; aNewNames.resize(n); aNewAttributes.resize(n); -maTableColumnAttributes.resize(n); // Copy head. for (size_t i = 0; i < nHead; ++i) { @@ -876,6 +880,7 @@ void ScDBData::RefreshTableColumnNames( ScDocument* pDoc ) } aNewNames.swap( maTableColumnNames); +maTableColumnAttributes.resize(maTableColumnNames.size()); mbTableColumnNamesDirty = false; }
[Libreoffice-commits] core.git: Branch 'distro/collabora/co-23.05' - sc/qa
sc/qa/uitest/validity/tdf137945.py |2 +- sc/qa/uitest/validity/validity.py |4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 3a53ca5197081e651dfcbd47f2dbd25bb3019ac7 Author: Miklos Vajna AuthorDate: Tue Mar 14 12:05:07 2023 +0100 Commit: Miklos Vajna CommitDate: Tue Mar 14 12:29:53 2023 + sc: fix UITest_validity ... after commit 48059620d89aa234a6529e8d555fa24c315dd98c (jsdialog: enable data validation dialog, 2023-03-13). Change-Id: I6f2f9e06875b7afd8cdb389c92fd7ae9b470d73c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148846 Tested-by: Miklos Vajna Reviewed-by: Miklos Vajna diff --git a/sc/qa/uitest/validity/tdf137945.py b/sc/qa/uitest/validity/tdf137945.py index abe7b26057f6..13370c91462b 100644 --- a/sc/qa/uitest/validity/tdf137945.py +++ b/sc/qa/uitest/validity/tdf137945.py @@ -18,7 +18,7 @@ class Tdf137945(UITestCase): with self.ui_test.execute_dialog_through_command(".uno:Validation") as xDialog: xTabs = xDialog.getChild("tabcontrol") select_pos(xTabs, "1") -xInput = xDialog.getChild("inputhelp") +xInput = xDialog.getChild("inputhelp_text") xTitle = xDialog.getChild("title") self.assertEqual("test", get_state_as_dict(xTitle)['Text']) diff --git a/sc/qa/uitest/validity/validity.py b/sc/qa/uitest/validity/validity.py index 25e691a42544..3112b7afb91e 100644 --- a/sc/qa/uitest/validity/validity.py +++ b/sc/qa/uitest/validity/validity.py @@ -61,7 +61,7 @@ class validity(UITestCase): select_pos(xTabs, "1") xtsbhelp = xDialog.getChild("tsbhelp") xtitle = xDialog.getChild("title") -xinputhelp = xDialog.getChild("inputhelp") +xinputhelp = xDialog.getChild("inputhelp_text") xtsbhelp.executeAction("CLICK", tuple()) xtitle.executeAction("TYPE", mkPropertyValues({"TEXT":"A"})) @@ -71,7 +71,7 @@ class validity(UITestCase): xTabs = xDialog.getChild("tabcontrol") xtsbhelp = xDialog.getChild("tsbhelp") xtitle = xDialog.getChild("title") -xinputhelp = xDialog.getChild("inputhelp") +xinputhelp = xDialog.getChild("inputhelp_text") select_pos(xTabs, "1") self.assertEqual(get_state_as_dict(xtsbhelp)["Selected"], "true") self.assertEqual(get_state_as_dict(xtitle)["Text"], "A")