[Libreoffice-commits] core.git: sc/qa

2023-12-04 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/data/xls/tdf158483.xls   |  624 
 sc/qa/unit/subsequent_filters_test4.cxx |1 
 2 files changed, 625 insertions(+)

New commits:
commit f1f75b1f80e7ba45ccf970985fb9c82e1a6add82
Author: Xisco Fauli 
AuthorDate: Mon Dec 4 11:20:03 2023 +0100
Commit: Xisco Fauli 
CommitDate: Mon Dec 4 12:18:29 2023 +0100

tdf#158483: sc_subsequent_filters_test4: Add unittest

Change-Id: I1635e5b9ad7a365e97dedaf92cdf436ae1ed814a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160295
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/xls/tdf158483.xls 
b/sc/qa/unit/data/xls/tdf158483.xls
new file mode 100644
index ..42f319d704bd
--- /dev/null
+++ b/sc/qa/unit/data/xls/tdf158483.xls
@@ -0,0 +1,624 @@
+
+
+
+Id
+
+
+9000
+36470
+False
+False
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+http://www.w3.org/TR/REC-html40;
+ss:Type="String">
+
+
+
+Id
+
+
+
+
+
+
+
+
+C�digo
+
+
+
+Descri��o
+
+
+
+Pre�o
+
+
+
+Stock Custo - Pre�o
+m�dio
+
+
+
+Ativo
+
+
+
+
+
+101110001
+
+
+Alimentacao
+Extra
+
+
+
+
+
+0
+
+
+true
+
+
+
+
+101110003
+
+
+Buffet
+Especial
+
+
+
+
+
+0
+
+
+true
+
+
+
+
+101210009
+
+
+Garoto Cafe C/
+Leite
+
+
+(1: 100.00) (2:
+100.00)
+
+
+0
+
+
+true
+
+
+
+
+101210003
+
+
+Cafe
+Expresso
+
+
+(1: 100.00) (2:
+100.00) (4: 150.00) (5: 100.00)
+
+
+0
+
+
+true
+
+
+
+
+101211001
+
+
+Cha
+
+
+(1: 100.00) (2:
+100.00) (4: 200.00) (5: 120.00)
+
+
+0
+
+
+true
+
+
+
+
+101210007
+
+
+
+Descafeinado
+
+
+(1: 100.00) (2:
+100.00) (4: 250.00) (5: 100.00)
+
+   

[Libreoffice-commits] core.git: sc/qa

2023-11-29 Thread Henry Castro (via logerrit)
 sc/qa/unit/subsequent_filters_test2.cxx |   38 
 1 file changed, 38 insertions(+)

New commits:
commit 3275f57221904426e5c136f5596a83050f8585a4
Author: Henry Castro 
AuthorDate: Fri Nov 24 10:00:54 2023 -0400
Commit: Henry Castro 
CommitDate: Wed Nov 29 20:54:34 2023 +0100

sc: qa: add unit test "testBackColorFilter"

Change-Id: Icdccd6778d1157bb31f38b510a58562a640bdeae
Signed-off-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159929
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160089
Tested-by: Jenkins

diff --git a/sc/qa/unit/subsequent_filters_test2.cxx 
b/sc/qa/unit/subsequent_filters_test2.cxx
index 790ab5c99057..22339c010e8f 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -27,6 +27,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -39,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -1626,6 +1629,41 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testSingleLine)
 testCells(pDoc);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testBackColorFilter)
+{
+Color aBackColor1(0xc99c00);
+Color aBackColor2(0x0369a3);
+
+createScDoc();
+ScDocument* pDoc = getScDoc();
+
+ScPatternAttr aPattern1(pDoc->GetPool());
+aPattern1.GetItemSet().Put(SvxBrushItem(aBackColor1, ATTR_BACKGROUND));
+
+ScPatternAttr aPattern2(pDoc->GetPool());
+aPattern2.GetItemSet().Put(SvxBrushItem(aBackColor2, ATTR_BACKGROUND));
+
+// Apply the pattern to cell A1:A2
+pDoc->ApplyPatternAreaTab(0, 0, 0, 1, 0, aPattern1);
+
+// Apply the pattern to cell A3:A5
+pDoc->ApplyPatternAreaTab(0, 2, 0, 4, 0, aPattern2);
+
+{
+ScRefCellValue aCell;
+aCell.assign(*pDoc, ScAddress(0, 0, 0));
+CPPUNIT_ASSERT_MESSAGE("Cell A1 should be empty.", aCell.isEmpty());
+aCell.assign(*pDoc, ScAddress(0, 2, 0));
+CPPUNIT_ASSERT_MESSAGE("Cell A3 should be empty.", aCell.isEmpty());
+}
+
+{
+ScFilterEntries aFilterEntries;
+pDoc->GetFilterEntriesArea(0, 0, 4, 0, true, aFilterEntries);
+CPPUNIT_ASSERT_EQUAL(size_t(2), 
aFilterEntries.getBackgroundColors().size());
+}
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sc/qa sc/source

2023-11-29 Thread Stephan Bergmann (via logerrit)
 sc/qa/unit/tiledrendering/tiledrendering.cxx   |   14 +++---
 sc/source/filter/excel/export/SparklineExt.cxx |2 +-
 sc/source/filter/excel/xeescher.cxx|4 ++--
 sc/source/filter/excel/xepivotxml.cxx  |   14 +++---
 sc/source/filter/lotus/lotform.cxx |2 +-
 sc/source/ui/view/tabvwshc.cxx |6 +++---
 6 files changed, 21 insertions(+), 21 deletions(-)

New commits:
commit f4ce98bd1a1b183bb21c60b85e17dc6575f9ce98
Author: Stephan Bergmann 
AuthorDate: Wed Nov 29 14:39:38 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Wed Nov 29 19:59:49 2023 +0100

Extended loplugin:ostr: sc

Change-Id: I2b69249d6e0e35945e37e04ea885bb8ab3e781f1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160103
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index b27664e5df41..b33960af5f22 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -173,7 +173,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testRowColumnSelections)
 
 // Check if all the rows from 5th to 10th get selected
 aResult = 
apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), 
"text/plain;charset=utf-8"_ostr);
-aExpected = 
"1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\n3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\n4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\n5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\n6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\n";
+aExpected = 
"1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\n3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\n4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\n5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\n6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\t22\t23\t24\t25\t26\n"_ostr;
 CPPUNIT_ASSERT_EQUAL(aExpected, aResult);
 
 // Select the 10th row with ctrl modifier
@@ -218,7 +218,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testRowColumnSelections)
 
 //  only row 5 should remain selected
 aResult = 
apitest::helper::transferable::getTextSelection(pModelObj->getSelection(), 
"text/plain;charset=utf-8"_ostr);
-aExpected = 
"1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n";
+aExpected = 
"1\t2\t3\t4\t5\t6\t7\t8\t9\t10\t11\t12\t13\t14\t15\t16\t17\t18\t19\t20\t21\n"_ostr;
 CPPUNIT_ASSERT_EQUAL(aExpected, aResult);
 }
 
@@ -2305,7 +2305,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testDeleteCellMultilineContent)
 ViewCallback aView1;
 CPPUNIT_ASSERT(!lcl_hasEditView(*pViewData));
 
-aView1.m_sInvalidateHeader = "";
+aView1.m_sInvalidateHeader = ""_ostr;
 ScDocument& rDoc = pDocSh->GetDocument();
 sal_uInt16 nRow1Height = rDoc.GetRowHeight(static_cast(0), 
static_cast(0), false);
 
@@ -2370,7 +2370,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testPasteIntoWrapTextCell)
 // Go to A2 and paste.
 pView->SetCursor(0, 1);
 Scheduler::ProcessEventsToIdle();
-aView.m_sInvalidateSheetGeometry = "";
+aView.m_sInvalidateSheetGeometry = ""_ostr;
 pView->GetViewFrame().GetBindings().Execute(SID_PASTE);
 Scheduler::ProcessEventsToIdle();
 
@@ -2399,7 +2399,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testPasteIntoWrapTextCell)
 // Go to A3 and paste.
 pView->SetCursor(0, 2);
 Scheduler::ProcessEventsToIdle();
-aView.m_sInvalidateSheetGeometry = "";
+aView.m_sInvalidateSheetGeometry = ""_ostr;
 pView->GetViewFrame().GetBindings().Execute(SID_PASTE);
 Scheduler::ProcessEventsToIdle();
 
@@ -2424,7 +2424,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testSortAscendingDescending)
 pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEMOVE, 820, 1336, 1, 
MOUSE_LEFT, 0);
 pModelObj->postMouseEvent(LOK_MOUSEEVENT_MOUSEBUTTONUP, 820, 1359, 1, 
MOUSE_LEFT, 0);
 Scheduler::ProcessEventsToIdle();
-aView.m_sInvalidateSheetGeometry = "";
+aView.m_sInvalidateSheetGeometry = ""_ostr;
 
 // sort ascending
 uno::Sequence aArgs;
@@ -2439,7 +2439,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testSortAscendingDescending)
 Scheduler::ProcessEventsToIdle();
 CPPUNIT_ASSERT_EQUAL("rows"_ostr, aView.m_sInvalidateSheetGeometry);
 
-aView.m_sInvalidateSheetGeometry = "";
+aView.m_sInvalidateSheetGeometry = ""_ostr;
 // sort descending
 dispatchCommand(mxComponent, ".uno:SortDescending", aArgs);
 
diff --git 

[Libreoffice-commits] core.git: sc/qa

2023-11-22 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/data/ods/tdf125580.ods   |binary
 sc/qa/unit/subsequent_filters_test4.cxx |   19 +++
 2 files changed, 19 insertions(+)

New commits:
commit 9602f8a9318dd4d3409856e2ae06abe96e72b51b
Author: Xisco Fauli 
AuthorDate: Wed Nov 22 16:37:44 2023 +0100
Commit: Xisco Fauli 
CommitDate: Wed Nov 22 21:57:28 2023 +0100

tdf#125580: sc_subsequent_filters_test4: Add unittest

Change-Id: Ia7be1c4dd1f4d748bb70fdc43c52825b4dade1b3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159836
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/ods/tdf125580.ods 
b/sc/qa/unit/data/ods/tdf125580.ods
new file mode 100644
index ..4ca1000efa93
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf125580.ods differ
diff --git a/sc/qa/unit/subsequent_filters_test4.cxx 
b/sc/qa/unit/subsequent_filters_test4.cxx
index 4a7401e84337..aa3dc5ab7adf 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -1946,6 +1946,25 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf142905)
 CPPUNIT_ASSERT_EQUAL(OUString(" 3M   "), pDoc->GetString(2, 0, 0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf125580)
+{
+createScDoc("ods/tdf125580.ods");
+ScDocument* pDoc = getScDoc();
+ScDocShell* pDocSh = getScDocShell();
+pDocSh->DoHardRecalc();
+
+// Without the fix in place, this test would have failed with
+// - Expected: 11/22/23 04:30 PM
+// - Actual  : 11/22/23 04:29 PM
+// - At row 19
+for (SCROW i = 0; i <= 40; ++i)
+{
+OString sMessage = "At row " + OString::number(i + 1);
+CPPUNIT_ASSERT_EQUAL_MESSAGE(sMessage.getStr(), pDoc->GetString(0, i, 
0),
+ pDoc->GetString(1, i, 0));
+}
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testRowImportCellStyleIssue)
 {
 // Test checks that the correct cell style is imported for the first 6 
rows and then the rest of the rows.


[Libreoffice-commits] core.git: sc/qa

2023-11-22 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/data/functions/date_time/fods/timevalue.fods |   19 
 1 file changed, 19 insertions(+)

New commits:
commit 9b2d6b36815cbfee8b44b87b7c0b3cb4bab61850
Author: Xisco Fauli 
AuthorDate: Wed Nov 22 15:30:30 2023 +0100
Commit: Xisco Fauli 
CommitDate: Wed Nov 22 16:27:28 2023 +0100

tdf#127498: sc_datetime_functions: Add unittest

it fails with
Sheet2.A9 '=TIMEVALUE(K9)' result: 0.35416664241, expected: 
0.3541667
without the fix in place

Change-Id: I4e6faff1b7eb1913ca668ef11b489076e793adc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159820
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/functions/date_time/fods/timevalue.fods 
b/sc/qa/unit/data/functions/date_time/fods/timevalue.fods
index 6ce8e134f89b..e465fd2312b8 100644
--- a/sc/qa/unit/data/functions/date_time/fods/timevalue.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/timevalue.fods
@@ -668,6 +668,25 @@
  
  
 
+
+ 
+  0.3541667
+ 
+ 
+  0.3541667
+ 
+ 
+  TRUE
+ 
+ 
+  =TIMEVALUE(K9)
+ 
+ 
+ 
+  01/09/2019 08:30:00
+ 
+ 
+
 
  
  


[Libreoffice-commits] core.git: sc/qa sc/source

2023-11-19 Thread Stephan Bergmann (via logerrit)
 sc/qa/extras/htmlexporttest.cxx  |   14 
 sc/qa/extras/macros-test.cxx |8 
 sc/qa/unit/SparklineImportExportTest.cxx |   67 +-
 sc/qa/unit/ThemeImportExportTest.cxx |   62 +-
 sc/qa/unit/dataproviders_test.cxx|6 
 sc/qa/unit/jumbosheets-test.cxx  |   14 
 sc/qa/unit/pivottable_filters_test.cxx   |  687 ++-
 sc/qa/unit/screenshots/screenshots.cxx   |   30 -
 sc/qa/unit/subsequent_export_test.cxx|  560 +++---
 sc/qa/unit/subsequent_export_test2.cxx   |  377 --
 sc/qa/unit/subsequent_export_test3.cxx   |  138 ++---
 sc/qa/unit/subsequent_export_test4.cxx   |  318 ++--
 sc/qa/unit/tiledrendering/tiledrendering.cxx |   42 -
 sc/qa/unit/ucalc_copypaste.cxx   |   10 
 sc/source/core/data/document10.cxx   |2 
 sc/source/core/data/table7.cxx   |4 
 sc/source/filter/excel/xecontent.cxx |   18 
 sc/source/filter/excel/xeescher.cxx  |2 
 sc/source/filter/excel/xeextlst.cxx  |   16 
 sc/source/filter/excel/xepivotxml.cxx|   24 
 sc/source/filter/excel/xeview.cxx|2 
 sc/source/filter/html/htmlexp.cxx|2 
 sc/source/ui/app/inputhdl.cxx|6 
 sc/source/ui/app/scmod.cxx   |2 
 sc/source/ui/unoobj/docuno.cxx   |8 
 sc/source/ui/view/drawview.cxx   |2 
 sc/source/ui/view/gridwin.cxx|   26 -
 sc/source/ui/view/tabview3.cxx   |2 
 sc/source/ui/view/tabvwsh4.cxx   |8 
 29 files changed, 1310 insertions(+), 1147 deletions(-)

New commits:
commit 099be392bfc5ddba21370726fa887a2fd6c99cd5
Author: Stephan Bergmann 
AuthorDate: Sun Nov 19 17:31:36 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Sun Nov 19 20:38:33 2023 +0100

Extended loplugin:ostr: sc

Change-Id: I44536a13f4c31558671c1166d06b7f6216456641
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159680
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/extras/htmlexporttest.cxx b/sc/qa/extras/htmlexporttest.cxx
index 6e28d791fbb3..774f75078a85 100644
--- a/sc/qa/extras/htmlexporttest.cxx
+++ b/sc/qa/extras/htmlexporttest.cxx
@@ -38,16 +38,16 @@ public:
 htmlDocUniquePtr pDoc = parseHtml(maTempFile);
 CPPUNIT_ASSERT (pDoc);
 
-assertXPath(pDoc, "/html/body", 1);
-assertXPath(pDoc, "/html/body/table/tr/td/img", 1);
+assertXPath(pDoc, "/html/body"_ostr, 1);
+assertXPath(pDoc, "/html/body/table/tr/td/img"_ostr, 1);
 
 setFilterOptions("SkipImages");
 save("HTML (StarCalc)");
 
 pDoc = parseHtml(maTempFile);
 CPPUNIT_ASSERT (pDoc);
-assertXPath(pDoc, "/html/body", 1);
-assertXPath(pDoc, "/html/body/table/tr/td/img", 0);
+assertXPath(pDoc, "/html/body"_ostr, 1);
+assertXPath(pDoc, "/html/body/table/tr/td/img"_ostr, 0);
 }
 
 void testTdf155244()
@@ -58,10 +58,10 @@ public:
 xmlDocUniquePtr pXmlDoc = parseXml(maTempFile);
 CPPUNIT_ASSERT(pXmlDoc);
 
-assertXPath(pXmlDoc, "/xhtml:html", 1);
+assertXPath(pXmlDoc, "/xhtml:html"_ostr, 1);
 // the problem was that there were 2 CSS styles named "Default"
-assertXPath(pXmlDoc, 
"/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td", "class", 
"cell-Default");
-OUString const styles = getXPathContent(pXmlDoc, 
"/xhtml:html/xhtml:head/xhtml:style");
+assertXPath(pXmlDoc, 
"/xhtml:html/xhtml:body/xhtml:table/xhtml:tr/xhtml:td"_ostr, "class"_ostr, 
"cell-Default");
+OUString const styles = getXPathContent(pXmlDoc, 
"/xhtml:html/xhtml:head/xhtml:style"_ostr);
 CPPUNIT_ASSERT(styles.indexOf(".graphic-Default{ 
background-color:#729fcf;") != -1);
 CPPUNIT_ASSERT(styles.indexOf(".cell-Default{ font-size:10pt; 
font-family:'Liberation Sans'; }") != -1);
 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), styles.indexOf(".Default"));
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index f1602465f7d2..c483a05c9300 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -167,13 +167,13 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, 
testMacroButtonFormControlXlsxExport)
 // Without the fix in place, this test would have failed with:
 // - XPath '//x:controlPr' no attribute 'macro' exist
 // i.e. the macro was lost on export.
-assertXPath(pSheetDoc, "//x:controlPr", "macro", "Module1.Button1_Click");
+assertXPath(pSheetDoc, "//x:controlPr"_ostr, "macro"_ostr, 
"Module1.Button1_Click");
 
 // Then also make sure that there is no defined name for the macro, which 
is only needed for
 // XLS:
 xmlDocUniquePtr pWorkbookDoc = parseExport("xl/workbook.xml");
 CPPUNIT_ASSERT(pWorkbookDoc);
-assertXPath(pWorkbookDoc, "//x:workbook/definedNames", 0);

[Libreoffice-commits] core.git: sc/qa

2023-11-10 Thread Stephan Bergmann (via logerrit)
 sc/qa/uitest/calc_tests8/navigator.py |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c1bd25e4674571e04b6445af36e4520a70ac166b
Author: Stephan Bergmann 
AuthorDate: Fri Nov 10 08:26:16 2023 +0100
Commit: Stephan Bergmann 
CommitDate: Fri Nov 10 13:33:26 2023 +0100

Disable flakey navigator UITest again

f2ba17fecb60d936599efb975d96a3ea06c2a43f "disable more flakey navigator 
UITest",
then 0a0c5a5b0521bea6cb695731d448e62c41ed4c57 "UITest_sw_navigator: avoid
oneprocess" enabled it again, apparently in the false hopes that 
non-oneprocess
would magically fix this issue.  But this still causes frequent failures, 
e.g.,
 failed with

> ==
> FAIL: test_tdf134390 (navigator.navigator)
> --
> Traceback (most recent call last):
>   File 
"/home/tdf/lode/jenkins/workspace/lo_ubsan/sc/qa/uitest/calc_tests8/navigator.py",
 line 145, in test_tdf134390
> self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
> AssertionError: '1' != '2'
> - 1
> + 2

and  failed with

> ==
> FAIL: test_tdf134390 (navigator.navigator)
> --
> Traceback (most recent call last):
>   File 
"/home/tdf/lode/jenkins/workspace/lo_ubsan/sc/qa/uitest/calc_tests8/navigator.py",
 line 145, in test_tdf134390
> self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
> AssertionError: '53' != '2'
> - 53
> + 2

Change-Id: I39e878c20085cca3233f7c8859b9a1d28fcc56c8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159262
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/uitest/calc_tests8/navigator.py 
b/sc/qa/uitest/calc_tests8/navigator.py
index f917e6e84b30..ec8fa2ae9a2e 100644
--- a/sc/qa/uitest/calc_tests8/navigator.py
+++ b/sc/qa/uitest/calc_tests8/navigator.py
@@ -142,7 +142,8 @@ class navigator(UITestCase):
 xColumn.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
 xColumn.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"RETURN"}))
 xToolkit.processEventsToIdle()
-self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
+# disable flakey UITest
+#self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
 
 xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
 xRow.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))


[Libreoffice-commits] core.git: sc/qa

2023-10-28 Thread Andrea Gelmini (via logerrit)
 0 files changed

New commits:
commit 341e15b7ba159527460f93922091bb575a525d79
Author: Andrea Gelmini 
AuthorDate: Sat Oct 28 14:53:13 2023 +0200
Commit: Julien Nabet 
CommitDate: Sat Oct 28 17:11:09 2023 +0200

Remove executable bit on ods files

Change-Id: Icd14fa8490f4e80451cb016a9d111b887c3d65ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158588
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sc/qa/unit/uicalc/data/tdf157897_linked.ods 
b/sc/qa/unit/uicalc/data/tdf157897_linked.ods
old mode 100755
new mode 100644
diff --git a/sc/qa/unit/uicalc/data/tdf157897_main.ods 
b/sc/qa/unit/uicalc/data/tdf157897_main.ods
old mode 100755
new mode 100644


[Libreoffice-commits] core.git: sc/qa sc/source

2023-10-26 Thread Andreas Heinisch (via logerrit)
 sc/qa/unit/uicalc/data/tdf157897_linked.ods |binary
 sc/qa/unit/uicalc/data/tdf157897_main.ods   |binary
 sc/qa/unit/uicalc/uicalc.cxx|   18 ++
 sc/source/core/data/documen2.cxx|2 ++
 4 files changed, 20 insertions(+)

New commits:
commit 96b91357fb93028d35d70bdb52b4bac3ecbfbf57
Author: Andreas Heinisch 
AuthorDate: Mon Oct 23 23:13:51 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Thu Oct 26 18:41:49 2023 +0200

tdf#157897 - Clear print ranges before adding additional ones

Otherwise, additional print ranges will be added for linked files after
the external link will be updated.

Change-Id: I0556fda6609d3e18f1ca992dc6a0399be01bc841
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158365
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sc/qa/unit/uicalc/data/tdf157897_linked.ods 
b/sc/qa/unit/uicalc/data/tdf157897_linked.ods
new file mode 100755
index ..bb75c31d82ae
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf157897_linked.ods differ
diff --git a/sc/qa/unit/uicalc/data/tdf157897_main.ods 
b/sc/qa/unit/uicalc/data/tdf157897_main.ods
new file mode 100755
index ..1e1af575145f
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf157897_main.ods differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 4259f56a..15795baceaa1 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1395,6 +1395,24 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf146994)
 CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.D3:Sheet1.D4"), aMarkedAreaString);
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf157897_duplicated_print_ranges)
+{
+createScDoc("tdf157897_main.ods");
+ScDocument* pDoc = getScDoc();
+
+const sal_uInt16 nPos = 0;
+const SCTAB nFirstTab = 0;
+// Ensure that there exists a print range in the first documents tab
+CPPUNIT_ASSERT_EQUAL(static_cast(1), 
pDoc->GetPrintRangeCount(nFirstTab));
+
+// Reload all links and check if the print range was not duplicated
+const auto initialPrintRange = pDoc->GetPrintRange(nFirstTab, nPos);
+pDoc->GetDocumentShell()->ReloadAllLinks();
+
+// Without the fix in place, the print range in the linked tab will be 
duplicated
+CPPUNIT_ASSERT_EQUAL(initialPrintRange, pDoc->GetPrintRange(nFirstTab, 
nPos));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154991)
 {
 createScDoc("tdf154991.ods");
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 4b07b0d33ff5..c53dc6b3e305 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -1040,6 +1040,8 @@ sal_uLong ScDocument::TransferTab( ScDocument& rSrcDoc, 
SCTAB nSrcPos,
 maTabs[nDestPos]->SetPrintEntireSheet();
 else
 {
+// tdf#157897 - clear print ranges before adding additional ones
+maTabs[nDestPos]->ClearPrintRanges();
 const auto nPrintRangeCount = 
rSrcDoc.maTabs[nSrcPos]->GetPrintRangeCount();
 for (auto nPos = 0; nPos < nPrintRangeCount; nPos++)
 {


[Libreoffice-commits] core.git: sc/qa sc/source

2023-10-20 Thread Stephan Bergmann (via logerrit)
 sc/qa/extras/macros-test.cxx |   12 ++--
 sc/qa/unit/ThemeImportExportTest.cxx |2 
 sc/qa/unit/helper/shared_test_impl.hxx   |2 
 sc/qa/unit/screenshots/screenshots.cxx   |2 
 sc/qa/unit/ucalc.cxx |2 
 sc/source/core/data/dpobject.cxx |2 
 sc/source/core/data/tabprotection.cxx|6 +-
 sc/source/core/tool/addincol.cxx |6 +-
 sc/source/core/tool/autoform.cxx |2 
 sc/source/core/tool/compiler.cxx |6 +-
 sc/source/core/tool/stylehelper.cxx  |2 
 sc/source/filter/excel/xechart.cxx   |2 
 sc/source/filter/excel/xestream.cxx  |2 
 sc/source/filter/excel/xiescher.cxx  |4 -
 sc/source/filter/oox/defnamesbuffer.cxx  |2 
 sc/source/filter/oox/pagesettings.cxx|4 -
 sc/source/filter/oox/querytablebuffer.cxx|2 
 sc/source/filter/xcl97/xcl97esc.cxx  |2 
 sc/source/filter/xml/XMLChangeTrackingImportHelper.cxx   |2 
 sc/source/filter/xml/XMLCodeNameProvider.cxx |4 -
 sc/source/filter/xml/XMLExportDatabaseRanges.cxx |2 
 sc/source/filter/xml/XMLStylesExportHelper.cxx   |2 
 sc/source/filter/xml/xmlexprt.cxx|8 +--
 sc/source/filter/xml/xmlimprt.cxx|4 -
 sc/source/ui/StatisticsDialogs/AnalysisOfVarianceDialog.cxx  |2 
 sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx |2 
 sc/source/ui/StatisticsDialogs/MatrixComparisonGenerator.cxx |2 
 sc/source/ui/dbgui/csvruler.cxx  |4 -
 sc/source/ui/docshell/datastream.cxx |2 
 sc/source/ui/docshell/docsh.cxx  |   10 +--
 sc/source/ui/docshell/docsh4.cxx |8 +--
 sc/source/ui/docshell/docsh8.cxx |   14 ++---
 sc/source/ui/docshell/impex.cxx  |2 
 sc/source/ui/miscdlgs/linkarea.cxx   |4 -
 sc/source/ui/miscdlgs/solverutil.cxx |2 
 sc/source/ui/sidebar/CellAppearancePropertyPanel.cxx |4 -
 sc/source/ui/unoobj/afmtuno.cxx  |2 
 sc/source/ui/unoobj/appluno.cxx  |6 +-
 sc/source/ui/unoobj/cellsuno.cxx |   18 +++
 sc/source/ui/unoobj/confuno.cxx  |2 
 sc/source/ui/unoobj/cursuno.cxx  |4 -
 sc/source/ui/unoobj/dapiuno.cxx  |2 
 sc/source/ui/unoobj/dispuno.cxx  |2 
 sc/source/ui/unoobj/docuno.cxx   |8 +--
 sc/source/ui/unoobj/filtuno.cxx  |   10 +--
 sc/source/ui/unoobj/funcuno.cxx  |4 -
 sc/source/ui/unoobj/nameuno.cxx  |2 
 sc/source/ui/unoobj/shapeuno.cxx |8 +--
 sc/source/ui/unoobj/srchuno.cxx  |4 -
 sc/source/ui/unoobj/styleuno.cxx |   16 +++---
 sc/source/ui/unoobj/viewuno.cxx  |4 -
 sc/source/ui/vba/vbaaxis.cxx |6 +-
 sc/source/ui/vba/vbaborders.cxx  |2 
 sc/source/ui/vba/vbachart.cxx|   28 +--
 sc/source/ui/vba/vbaformat.cxx   |4 -
 sc/source/ui/vba/vbainterior.cxx |6 +-
 sc/source/ui/vba/vbarange.cxx|   12 ++--
 sc/source/ui/vba/vbasheetobject.cxx  |4 -
 sc/source/ui/vba/vbastyle.cxx|2 
 sc/source/ui/view/formatsh.cxx   |2 
 sc/source/ui/view/viewdata.cxx   |2 
 61 files changed, 150 insertions(+), 150 deletions(-)

New commits:
commit da3a91e89f803d1c42b764c90071b30b547e686b
Author: Stephan Bergmann 
AuthorDate: Thu Oct 19 10:30:24 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Oct 20 09:45:32 2023 +0200

Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: sc

Change-Id: Ieed908bfa2cb6370ead922dfc00dbdb4f905f3cf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158216
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index d8590804a165..f1602465f7d2 100644
--- 

[Libreoffice-commits] core.git: sc/qa sw/qa sw/UITest_sw_navigator.mk

2023-10-19 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/calc_tests8/navigator.py |3 -
 sw/UITest_sw_navigator.mk |2 
 sw/qa/uitest/navigator/tdf134960.py   |5 --
 sw/qa/uitest/navigator/tdf137274.py   |   35 +++
 sw/qa/uitest/navigator/tdf144672.py   |   30 ++--
 sw/qa/uitest/navigator/tdf148198.py   |3 -
 sw/qa/uitest/navigator/tdf154521.py   |   79 --
 7 files changed, 76 insertions(+), 81 deletions(-)

New commits:
commit 0a0c5a5b0521bea6cb695731d448e62c41ed4c57
Author: Xisco Fauli 
AuthorDate: Thu Oct 19 15:46:45 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Oct 19 18:31:27 2023 +0200

UITest_sw_navigator: avoid oneprocess

This is just a test to see whether this is reason why
UITest_sw_navigator is failing some much recently.
if it's not the case, I'll revert this patch later on

This patch reverts
- 1775b0c25ab13dab94c5ce930d45347a25198af4 "disable unreliable navigator 
UITest"
- f2ba17fecb60d936599efb975d96a3ea06c2a43f "disable more flakey
  navigator UITest"
- 2e49ec0eaa59b5b513ea756861ecac5482b930b2 "disable more flakey
  navigator UITest"
- d09785691373009a72cef14fd67610404c8d6022 "disable more flakey
  navigator test"
- 6347dcbd3ab2e0a7cb2f7de3bcb5d007e8befc09 "disable more unreliable 
navigator UITest"

Change-Id: I6e3dde9ad412b0769edee551f7e0ee026586bf8b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158184
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/calc_tests8/navigator.py 
b/sc/qa/uitest/calc_tests8/navigator.py
index ec8fa2ae9a2e..f917e6e84b30 100644
--- a/sc/qa/uitest/calc_tests8/navigator.py
+++ b/sc/qa/uitest/calc_tests8/navigator.py
@@ -142,8 +142,7 @@ class navigator(UITestCase):
 xColumn.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
 xColumn.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"RETURN"}))
 xToolkit.processEventsToIdle()
-# disable flakey UITest
-#self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
+self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
 
 xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
 xRow.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
diff --git a/sw/UITest_sw_navigator.mk b/sw/UITest_sw_navigator.mk
index 270ca6a9844a..901807349812 100644
--- a/sw/UITest_sw_navigator.mk
+++ b/sw/UITest_sw_navigator.mk
@@ -15,6 +15,6 @@ $(eval $(call gb_UITest_set_defs,sw_navigator, \
 TDOC="$(SRCDIR)/sw/qa/uitest/data" \
 ))
 
-$(eval $(call gb_UITest_use_oneprocess,sw_navigator))
+$(eval $(call gb_UITest_avoid_oneprocess,sw_navigator))
 
 # vim: set noet sw=4 ts=4:
diff --git a/sw/qa/uitest/navigator/tdf134960.py 
b/sw/qa/uitest/navigator/tdf134960.py
index 031852d15fb4..8388b63e40f9 100644
--- a/sw/qa/uitest/navigator/tdf134960.py
+++ b/sw/qa/uitest/navigator/tdf134960.py
@@ -34,9 +34,8 @@ class tdf134960_hyperlinks(UITestCase):
 xHyperlinks.executeAction("EXPAND", tuple())
 
 expectedHyperlinksOrder = [1, 2, 8, 9, 7, 10, 11, 3, 12, 4, 5, 6]
-# disable flakey test
-#for i in range(12):
-#self.assertEqual('Hyperlink ' + str(expectedHyperlinksOrder[i]), 
get_state_as_dict(xHyperlinks.getChild(str(i)))['Text'])
+for i in range(12):
+self.assertEqual('Hyperlink ' + str(expectedHyperlinksOrder[i]), 
get_state_as_dict(xHyperlinks.getChild(str(i)))['Text'])
 
 xHyperlinks.executeAction("COLLAPSE", tuple())
 
diff --git a/sw/qa/uitest/navigator/tdf137274.py 
b/sw/qa/uitest/navigator/tdf137274.py
index f984d78b032a..5273ddcb2f91 100644
--- a/sw/qa/uitest/navigator/tdf137274.py
+++ b/sw/qa/uitest/navigator/tdf137274.py
@@ -59,24 +59,23 @@ class tdf137274(UITestCase):
 # wait until the second comment is available
 self.ui_test.wait_until_child_is_available('Comment2')
 
-# disable flakey test
-## xComments needs reassigned after content tree change
-#while True:
-#xComments = self.get_item(xContentTree, 'Comments')
-#if '1' in xComments.getChildren():
-#break
-#time.sleep(self.ui_test.get_default_sleep())
-#self.assertEqual('Comments', get_state_as_dict(xComments)['Text'])
-#
-#xComments.executeAction("EXPAND", tuple())
-#
-## Without the fix in place, this test would have failed with 
AssertionError: 2 != 0
-#self.assertEqual(2, len(xComments.getChildren()))
-#self.assertEqual('C1', 
get_state_as_dict(xComments.getChild('0'))['Text'])
-#
-#xComments.executeAction("COLLAPSE", tuple())
-#
-#self.xUITest.executeCommand(".uno:Sidebar")
+# xComments needs reassigned after content tree change
+while True:
+xComments = self.get_item(xContentTree, 'Comments')
+if 

[Libreoffice-commits] core.git: sc/qa

2023-10-17 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/data/functions/date_time/fods/day.fods |   17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

New commits:
commit 07a80b8940a16ba1b7fd047865179809bd74a563
Author: Xisco Fauli 
AuthorDate: Mon Oct 16 17:07:35 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Oct 17 08:51:15 2023 +0200

tdf#157786: sc_datetime_functions: Add unittest

Change-Id: I94f2d40ced8e59aea5875831289368722a58c42a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158056
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/functions/date_time/fods/day.fods 
b/sc/qa/unit/data/functions/date_time/fods/day.fods
index 61bf753c24fa..88898d5c9349 100644
--- a/sc/qa/unit/data/functions/date_time/fods/day.fods
+++ b/sc/qa/unit/data/functions/date_time/fods/day.fods
@@ -659,6 +659,21 @@
  
  
 
+
+ 
+  29
+ 
+ 
+  29
+ 
+ 
+  TRUE
+ 
+ 
+  DAY(1899-12-29T15:26:14)
+ 
+ 
+
 
  
  
@@ -698,7 +713,7 @@
  
 
 
- 
+ 
   
   
   


[Libreoffice-commits] core.git: sc/qa

2023-10-14 Thread Joel Puronaho (via logerrit)
 sc/qa/unit/subsequent_filters_test3.cxx |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 4bb809f4d1d4316d9723fe6d3c8064c3d974392c
Author: Joel Puronaho 
AuthorDate: Tue Jun 13 15:40:22 2023 +0300
Commit: Ilmari Lauhakangas 
CommitDate: Sat Oct 14 08:17:52 2023 +0200

tdf#141908: CppUnittests: replace usage of sal_Int32 with colors

Change-Id: I2835feb65d65dbfd7f0c23ac1e99b66d803c05ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153646
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index 7980e8083559..a88cc136d870 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -1348,12 +1348,12 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, 
testTdf151818_SmartArtFontColor)
 uno::UNO_QUERY);
 uno::Reference 
xPortion(xPara->createEnumeration()->nextElement(),
  uno::UNO_QUERY);
-sal_Int32 nActualColor{ 0 };
+Color nActualColor{ 0 };
 xPortion->getPropertyValue("CharColor") >>= nActualColor;
 // Without fix the test would have failed with:
-// - Expected:  4478058 (0x44546A)
-// - Actual  : 16777215 (0xFF), that is text was white
-CPPUNIT_ASSERT_EQUAL(sal_Int32(0x44546A), nActualColor);
+// - Expected: rgba[44546aff]
+// - Actual  : rgba[], that is text was white
+CPPUNIT_ASSERT_EQUAL(Color(0x44546A), nActualColor);
 
 // clrScheme. For map between name in xlsx and index from CharColorTheme 
see
 // oox::drawingml::Color::getSchemeColorIndex()


[Libreoffice-commits] core.git: sc/qa sw/qa

2023-10-11 Thread Ankit_Jaipuriar (via logerrit)
 sc/qa/uitest/autofilter2/tdf153972.py |2 +-
 sc/qa/uitest/calc_tests3/tdf77509.py  |2 +-
 sc/qa/uitest/calc_tests9/tdf156268.py |2 --
 sw/qa/uitest/navigator/tdf154545.py   |1 -
 4 files changed, 2 insertions(+), 5 deletions(-)

New commits:
commit 1f9cd62b67d679da078c50b4b48295918657a70a
Author: Ankit_Jaipuriar 
AuthorDate: Mon Oct 2 14:58:42 2023 +0530
Commit: Ilmari Lauhakangas 
CommitDate: Wed Oct 11 09:35:12 2023 +0200

tdf#132293 remove unused imports from uitest

Change-Id: I3c76c6f1e3561aaf0b4bb719a89feebecc65027a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157482
Tested-by: Jenkins
Tested-by: Ilmari Lauhakangas 
Reviewed-by: Ilmari Lauhakangas 

diff --git a/sc/qa/uitest/autofilter2/tdf153972.py 
b/sc/qa/uitest/autofilter2/tdf153972.py
index 423f9db185ef..fe994ea90577 100644
--- a/sc/qa/uitest/autofilter2/tdf153972.py
+++ b/sc/qa/uitest/autofilter2/tdf153972.py
@@ -9,7 +9,7 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict
 from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_cell_by_position, is_row_hidden
+from libreoffice.calc.document import is_row_hidden
 
 class tdf153972(UITestCase):
 def test_tdf153972(self):
diff --git a/sc/qa/uitest/calc_tests3/tdf77509.py 
b/sc/qa/uitest/calc_tests3/tdf77509.py
index 0cbd4a65c867..fe263599f1af 100644
--- a/sc/qa/uitest/calc_tests3/tdf77509.py
+++ b/sc/qa/uitest/calc_tests3/tdf77509.py
@@ -7,7 +7,7 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 from uitest.framework import UITestCase
-from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import get_state_as_dict
 from uitest.uihelper.common import select_by_text
 from uitest.uihelper.common import get_url_for_data_file
 from libreoffice.calc.document import get_cell_by_position
diff --git a/sc/qa/uitest/calc_tests9/tdf156268.py 
b/sc/qa/uitest/calc_tests9/tdf156268.py
index 373f0d90da85..d3544653691e 100644
--- a/sc/qa/uitest/calc_tests9/tdf156268.py
+++ b/sc/qa/uitest/calc_tests9/tdf156268.py
@@ -8,8 +8,6 @@
 #
 
 from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_cell_by_position
 from uitest.uihelper.common import get_url_for_data_file
 
 class Tdf156268(UITestCase):
diff --git a/sw/qa/uitest/navigator/tdf154545.py 
b/sw/qa/uitest/navigator/tdf154545.py
index 52e0a7599826..ac034af93025 100644
--- a/sw/qa/uitest/navigator/tdf154545.py
+++ b/sw/qa/uitest/navigator/tdf154545.py
@@ -10,7 +10,6 @@
 from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict
-import unohelper
 
 class tdf154545(UITestCase):
 


[Libreoffice-commits] core.git: sc/qa

2023-10-07 Thread Stephan Bergmann (via logerrit)
 sc/qa/extras/accessibility/basics.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 2a92fe4c529f438421fad14cfbb1a76a45902fd9
Author: Stephan Bergmann 
AuthorDate: Sat Oct 7 21:32:51 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Sat Oct 7 22:33:44 2023 +0200

loplugin:ostr

Change-Id: I6c5aefbf36d032751bc2b5a84995182adb2c83e8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157682
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/extras/accessibility/basics.cxx 
b/sc/qa/extras/accessibility/basics.cxx
index 06cce36ded49..06b6134ce10b 100644
--- a/sc/qa/extras/accessibility/basics.cxx
+++ b/sc/qa/extras/accessibility/basics.cxx
@@ -110,7 +110,7 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, 
Test64BitChildIndices)
 
 CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, tdf157568)
 {
-load(u"private:factory/scalc");
+load(u"private:factory/scalc"_ustr);
 
 uno::Reference sheet(
 
getDocumentAccessibleContext()->getAccessibleChild(0)->getAccessibleContext(), 
// sheet 1


[Libreoffice-commits] core.git: sc/qa

2023-10-06 Thread Henry Castro (via logerrit)
 sc/qa/uitest/calc_tests7/save_readonly_with_password.py |6 +++---
 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 +++---
 5 files changed, 12 insertions(+), 9 deletions(-)

New commits:
commit 8e3f6b9fd6915a20c8c9f5195e5ac5a7e085920a
Author: Henry Castro 
AuthorDate: Mon Sep 18 17:05:56 2023 -0400
Commit: Henry Castro 
CommitDate: Fri Oct 6 17:37:18 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 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157641
Tested-by: Jenkins

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 311293815398..c7d2f829e32c 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
@@ -46,8 +47,7 @@ class save_readonly_with_password(UITestCase):
 with self.ui_test.execute_dialog_through_action(xOk, 
"CLICK", close_button="save"):
 pass
 
-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())
 
 with 
self.ui_test.execute_dialog_through_command(".uno:EditDoc") as xDialog:
@@ -80,7 +80,7 @@ class save_readonly_with_password(UITestCase):
 xConfirmPassword = 
xPasswordDialog.getChild("confirmropassEntry")
 xConfirmPassword.executeAction("TYPE", 
mkPropertyValues({"TEXT": "password"}))
 
-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 906f79075b59..1be3d6adb276 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
@@ -44,7 +45,7 @@ class tdf147086(UITestCase):
 with self.ui_test.execute_dialog_through_action(xOk, 
"CLICK", close_button="save"):
 pass
 
-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
+++ 

[Libreoffice-commits] core.git: sc/qa sc/subsequent_setup.mk

2023-09-14 Thread Tomaž Vajngerl (via logerrit)
 sc/qa/unit/data/xlsx/RowImportCellStyleIssue.xlsx |binary
 sc/qa/unit/subsequent_filters_test4.cxx   |   49 --
 sc/subsequent_setup.mk|1 
 3 files changed, 38 insertions(+), 12 deletions(-)

New commits:
commit bbd1cae866630e1545b603b2b31417713d63d226
Author: Tomaž Vajngerl 
AuthorDate: Wed Sep 13 22:18:43 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Thu Sep 14 12:10:49 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 

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_test4.cxx 
b/sc/qa/unit/subsequent_filters_test4.cxx
index ae5c7ff7e4da..4439b3d9ba97 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -26,6 +26,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -69,20 +71,20 @@ using namespace ::com::sun::star::uno;
 class ScFiltersTest4 : public ScModelTestBase
 {
 public:
-ScFiltersTest4();
+ScFiltersTest4()
+: ScModelTestBase("sc/qa/unit/data")
+{
+}
 
 protected:
-void testImportCrash(const char* rFileName);
+void testImportCrash(const char* rFileName)
+{
+createScDoc(rFileName);
+ScDocument* pDoc = getScDoc();
+pDoc->CalcAll(); // perform hard re-calculation.
+}
 };
 
-void ScFiltersTest4::testImportCrash(const char* rFileName)
-{
-createScDoc(rFileName);
-
-ScDocument* pDoc = getScDoc();
-pDoc->CalcAll(); // perform hard re-calculation.
-}
-
 CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testPasswordNew)
 {
 //tests opening a file with new password algorithm
@@ -1944,9 +1946,32 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf142905)
 CPPUNIT_ASSERT_EQUAL(OUString(" 3M   "), pDoc->GetString(2, 0, 0));
 }
 
-ScFiltersTest4::ScFiltersTest4()
-: ScModelTestBase("sc/qa/unit/data")
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, 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_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: sc/qa

2023-09-09 Thread Noel Grandin (via logerrit)
 sc/qa/uitest/calc_tests8/navigator.py |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit c32b1b2dd2722a85d0bee5891a9a8d5c38f67642
Author: Noel Grandin 
AuthorDate: Sat Sep 9 15:42:58 2023 +0200
Commit: Noel Grandin 
CommitDate: Sat Sep 9 16:45:35 2023 +0200

disable more flaky navigator UITest

Change-Id: Ieadd35fef7f709e9eaf0f26238f7613076aa8c52
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156775
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/qa/uitest/calc_tests8/navigator.py 
b/sc/qa/uitest/calc_tests8/navigator.py
index d0a3280619a5..ec8fa2ae9a2e 100644
--- a/sc/qa/uitest/calc_tests8/navigator.py
+++ b/sc/qa/uitest/calc_tests8/navigator.py
@@ -155,7 +155,8 @@ class navigator(UITestCase):
 # Without the fix in place, this test would have failed with
 # AssertionError: '0' != '1'
 self.assertEqual(get_state_as_dict(xGridWin)["CurrentRow"], "1")
-self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], "1")
+# disable flaky test
+#self.assertEqual(get_state_as_dict(xGridWin)["CurrentColumn"], 
"1")
 
 self.xUITest.executeCommand(".uno:Sidebar")
 


[Libreoffice-commits] core.git: sc/qa sw/qa

2023-09-08 Thread Noel Grandin (via logerrit)
 sc/qa/uitest/calc_tests8/navigator.py |3 ++-
 sw/qa/uitest/navigator/tdf144672.py   |   30 +++---
 sw/qa/uitest/navigator/tdf154521.py   |7 ---
 3 files changed, 21 insertions(+), 19 deletions(-)

New commits:
commit f2ba17fecb60d936599efb975d96a3ea06c2a43f
Author: Noel Grandin 
AuthorDate: Fri Sep 8 14:41:58 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Sep 8 19:27:44 2023 +0200

disable more flakey navigator UITest

Change-Id: Icf6a28f1270fc95a4edfc81a06fc79d5d2da17df
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156720
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/qa/uitest/calc_tests8/navigator.py 
b/sc/qa/uitest/calc_tests8/navigator.py
index 313b0d572e31..d0a3280619a5 100644
--- a/sc/qa/uitest/calc_tests8/navigator.py
+++ b/sc/qa/uitest/calc_tests8/navigator.py
@@ -142,7 +142,8 @@ class navigator(UITestCase):
 xColumn.executeAction("TYPE", mkPropertyValues({"TEXT":"B"}))
 xColumn.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"RETURN"}))
 xToolkit.processEventsToIdle()
-self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
+# disable flakey UITest
+#self.assertEqual(get_state_as_dict(xColumn)['Value'], '2')
 
 xRow.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
 xRow.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"BACKSPACE"}))
diff --git a/sw/qa/uitest/navigator/tdf144672.py 
b/sw/qa/uitest/navigator/tdf144672.py
index 4bded66dcb08..790840ad3329 100644
--- a/sw/qa/uitest/navigator/tdf144672.py
+++ b/sw/qa/uitest/navigator/tdf144672.py
@@ -40,21 +40,21 @@ class tdf144672(UITestCase):
 # tdf#129625: Without the fix in place, this test would have 
failed with
 # AssertionError: 'true' != 'false'
 self.assertEqual('true', 
get_state_as_dict(xReferences)['IsSemiTransparent'])
-
-xIndexes = self.get_item(xContentTree, 'Indexes')
-self.assertEqual('Indexes', get_state_as_dict(xIndexes)['Text'])
-self.assertEqual('false', 
get_state_as_dict(xIndexes)['IsSemiTransparent'])
-
-xIndexes.executeAction("EXPAND", tuple())
-
-self.assertEqual('3', get_state_as_dict(xIndexes)['Children'])
-
-for i in range(3):
-# Without the fix in place, this test would have failed here 
with
-# AssertionError: 'false' != 'true'
-self.assertEqual('false', 
get_state_as_dict(xIndexes.getChild(i))['IsSemiTransparent'])
-
-xIndexes.executeAction("COLLAPSE", tuple())
+# disable flakey UITest
+#xIndexes = self.get_item(xContentTree, 'Indexes')
+#self.assertEqual('Indexes', get_state_as_dict(xIndexes)['Text'])
+#self.assertEqual('false', 
get_state_as_dict(xIndexes)['IsSemiTransparent'])
+#
+#xIndexes.executeAction("EXPAND", tuple())
+#
+#self.assertEqual('3', get_state_as_dict(xIndexes)['Children'])
+#
+#for i in range(3):
+## Without the fix in place, this test would have failed here 
with
+## AssertionError: 'false' != 'true'
+#self.assertEqual('false', 
get_state_as_dict(xIndexes.getChild(i))['IsSemiTransparent'])
+#
+#xIndexes.executeAction("COLLAPSE", tuple())
 
 self.xUITest.executeCommand(".uno:Sidebar")
 
diff --git a/sw/qa/uitest/navigator/tdf154521.py 
b/sw/qa/uitest/navigator/tdf154521.py
index 7b2125646ec6..c2140f2ce889 100644
--- a/sw/qa/uitest/navigator/tdf154521.py
+++ b/sw/qa/uitest/navigator/tdf154521.py
@@ -155,9 +155,10 @@ class tdf154521(UITestCase):
 
 # Try the same selection with Bookmark 2
 xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"UP"}))
-self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
2")
-
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
+# disable flakey UITest
+#self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
+#
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
2")
+#
self.assertEqual(get_state_as_dict(xContentTree)["SelectionCount"], "1")
 xContentTree.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
 self.ui_test.wait_until_property_is_updated(xContentTree, 
"SelectEntryText", "Bookmark 2")
 
self.assertEqual(get_state_as_dict(xContentTree)["SelectEntryText"], "Bookmark 
2")


[Libreoffice-commits] core.git: sc/qa

2023-09-04 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/ucalc_formula2.cxx |   21 +
 1 file changed, 21 insertions(+)

New commits:
commit 2ac7d339a97efa638124c2862551e0876487833b
Author: Xisco Fauli 
AuthorDate: Mon Sep 4 10:28:57 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Sep 4 16:12:30 2023 +0200

tdf#156985: sc_ucalc_formula2: Add unittest

Change-Id: Iaf6d4310eb40bfc4880902f57a75b7f85a8af906
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156508
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/ucalc_formula2.cxx b/sc/qa/unit/ucalc_formula2.cxx
index 14f0001f943d..3b068348685a 100644
--- a/sc/qa/unit/ucalc_formula2.cxx
+++ b/sc/qa/unit/ucalc_formula2.cxx
@@ -4606,6 +4606,27 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testTdf147398)
 m_pDoc->DeleteTab(0);
 }
 
+#if !defined(_WIN32)
+CPPUNIT_TEST_FIXTURE(TestFormula2, testTdf156985)
+{
+m_pDoc->InsertTab(0, "Test");
+
+m_pDoc->SetString(0, 0, 0, "=-170.87");
+m_pDoc->SetString(0, 1, 0, "-223.73");
+m_pDoc->SetString(0, 2, 0, "-12.58");
+m_pDoc->SetString(0, 3, 0, "234.98");
+m_pDoc->SetString(0, 4, 0, "172.2");
+m_pDoc->SetString(0, 5, 0, "=SUM(A1:A5)");
+
+// Without the fix in place, this test would have failed with
+// - Expected: 0
+// - Actual  : -1.59872115546023e-14
+CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(0, 5, 0));
+
+m_pDoc->DeleteTab(0);
+}
+#endif
+
 CPPUNIT_TEST_FIXTURE(TestFormula2, testFormulaAfterDeleteRows)
 {
 sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn auto calc on.


[Libreoffice-commits] core.git: sc/qa

2023-09-04 Thread Dan Horák (via logerrit)
 sc/qa/unit/functions_array.cxx |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit 3426c96d0e32e0c83e4ce5fdb3405787a0c81e6c
Author: Dan Horák 
AuthorDate: Fri Sep 1 18:45:42 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Mon Sep 4 14:46:34 2023 +0200

limit tests giving dubious results to x86_64

We have confirmed that ArrayFunctionsTest::testDubiousArrayFormulasFODS
gives different results depending on the -ffp-contract setting on
ppc64le and likely also on s390x in addition to aarch64. Thus limit the
check only to x86_64 where it's known to give consistent results.

Change-Id: Iedb63fb4340cfe9a88e374c7498d97574bcdfcc7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156453
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/unit/functions_array.cxx b/sc/qa/unit/functions_array.cxx
index 7584c4e0b309..2053c44dfad7 100644
--- a/sc/qa/unit/functions_array.cxx
+++ b/sc/qa/unit/functions_array.cxx
@@ -27,8 +27,9 @@ void ArrayFunctionsTest::testDubiousArrayFormulasFODS()
 {
 //TODO: sc/qa/unit/data/functions/array/dubious/fods/linest.fods produces 
widely different
 // values when built with -ffp-contract enabled (-ffp-contract=on default 
on Clang 14,
-// -ffp-contract=fast default when building with optimizations on GCC) on 
at least aarch64:
-#if !((defined __clang__ || defined __GNUC__) && defined __aarch64__)
+// -ffp-contract=fast default when building with optimizations on GCC) on 
at least aarch64
+// and ppc64le. Thus limit the check only to platforms with consistent 
results.
+#if defined X86_64
 OUString aDirectoryURL
 = 
m_directories.getURLFromSrc(u"/sc/qa/unit/data/functions/array/dubious/fods/");
 recursiveScan(test::pass, "OpenDocument Spreadsheet Flat XML", 
aDirectoryURL,


[Libreoffice-commits] core.git: sc/qa

2023-08-31 Thread Eike Rathke (via logerrit)
 sc/qa/unit/data/functions/statistical/fods/KahanSum.fods | 3830 +++
 1 file changed, 1971 insertions(+), 1859 deletions(-)

New commits:
commit 0603e8fd85f626340c756d80df5612343480beea
Author: Eike Rathke 
AuthorDate: Thu Aug 31 15:01:21 2023 +0200
Commit: Eike Rathke 
CommitDate: Thu Aug 31 18:53:15 2023 +0200

Related: tdf#156985 Adjust doc layout to what FunctionsTest::load() expects

In case of failure to show failure details sc/qa/unit/functions_test.cxx
FunctionsTest::load() assumes result in A, expected in B, check in C and
formula in D.

Change-Id: I48d9e123664da314a1f7791f949d89569150b0c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156346
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/qa/unit/data/functions/statistical/fods/KahanSum.fods 
b/sc/qa/unit/data/functions/statistical/fods/KahanSum.fods
index e2bba0018e1f..c2b87afcd480 100644
--- a/sc/qa/unit/data/functions/statistical/fods/KahanSum.fods
+++ b/sc/qa/unit/data/functions/statistical/fods/KahanSum.fods
@@ -1,227 +1,227 @@
 
 
-http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:oooc="http://openoffice.org/2004/calc; 
xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" 
xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:config="urn:oasis:nam
 es:tc:opendocument:xmlns:config:1.0" 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:drawooo="http://openoffice.org/2010/draw; 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:fo
 rm:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:xforms="http://www.w3.org/2002/xforms; office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:oooc="http://o
 penoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 

[Libreoffice-commits] core.git: sc/qa sc/source

2023-08-31 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/ods/tdf150815.ods   |binary
 sc/qa/unit/subsequent_filters_test3.cxx |   22 +-
 sc/source/ui/inc/viewfunc.hxx   |4 ++--
 sc/source/ui/view/viewfunc.cxx  |   22 ++
 4 files changed, 45 insertions(+), 3 deletions(-)

New commits:
commit d1411afab98f7b41e9e700ef26b43dc77242d917
Author: Tibor Nagy 
AuthorDate: Wed Aug 30 16:22:02 2023 +0200
Commit: László Németh 
CommitDate: Thu Aug 31 18:01:33 2023 +0200

tdf#150815 sc: fix repainting sparkline

On Windows, if the input range of the sparkline is not in the
same row as the output range, the sparkline wasn't repainted
after changing the data within its range. Force the update
to avoid of showing obsolete data.

Change-Id: Id56209b20387ee68144507a0102d3a0d093ff1ea
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156304
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sc/qa/unit/data/ods/tdf150815.ods 
b/sc/qa/unit/data/ods/tdf150815.ods
new file mode 100644
index ..2dd407b6cea5
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf150815.ods differ
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index d277e0858905..ff19d3d55c3c 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -393,7 +393,8 @@ struct PaintListener : public SfxListener
 {
 if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 
0)
 && ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
-|| (pPaintHint->GetStartRow() == 2 && 
pPaintHint->GetEndRow() == 3)))
+|| (pPaintHint->GetStartRow() == 2 && 
pPaintHint->GetEndRow() == 3)
+|| (pPaintHint->GetStartRow() == 1 && 
pPaintHint->GetEndRow() == 1)))
 {
 mbCalled = true;
 }
@@ -441,6 +442,25 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471)
 CPPUNIT_ASSERT(aListener.mbCalled);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf150815_RepaintSparkline)
+{
+createScDoc("ods/tdf150815.ods");
+
+ScDocument* pDoc = getScDoc();
+ScDocShell* pDocSh = getScDocShell();
+
+PaintListener aListener;
+aListener.StartListening(*pDocSh);
+
+auto pSparkline = pDoc->GetSparkline(ScAddress(0, 1, 0));
+CPPUNIT_ASSERT(pSparkline);
+
+ScTabViewShell* pViewShell = getViewShell();
+pViewShell->EnterData(0, 0, 0, "10");
+
+CPPUNIT_ASSERT(aListener.mbCalled);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091)
 {
 // Set the system locale to Turkish
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 0d8d7515441a..323e7cbbe793 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -90,8 +90,8 @@ public:
 boolAutoSum( const ScRange& rRange, bool bSubTotal, bool 
bSetCursor, bool bContinue, const OpCode eCode );
 OUStringGetAutoSumFormula( const ScRangeList& rRangeList, bool 
bSubTotal, const ScAddress& rAddr, const OpCode eCode );
 
-voidEnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const 
OUString& rString,
-   const EditTextObject* pData = nullptr, bool 
bMatrixExpand = false );
+SC_DLLPUBLIC void EnterData(SCCOL nCol, SCROW nRow, SCTAB nTab, const 
OUString& rString,
+const EditTextObject* pData = nullptr, bool 
bMatrixExpand = false);
 voidEnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
const EditTextObject& rData, bool bTestSimple = 
false );
 voidEnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const 
double& rValue );
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 13c4ce63c6e7..af0dc57357f9 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -77,6 +77,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -103,6 +104,26 @@ static void lcl_PostRepaintCondFormat( const 
ScConditionalFormat *pCondFmt, ScDo
 }
 }
 
+static void lcl_PostRepaintSparkLine(sc::SparklineList* pSparklineList, const 
ScRange& rRange,
+ ScDocShell* pDocSh)
+{
+if (pSparklineList)
+{
+for (auto& rSparkLineGroup : pSparklineList->getSparklineGroups())
+{
+for (auto& rSparkline : 
pSparklineList->getSparklinesFor(rSparkLineGroup))
+{
+if (rSparkline->getInputRange().Contains(rRange))
+{
+pDocSh->PostPaint(
+ScRange(rSparkline->getColumn(), rSparkline->getRow(), 
rRange.aStart.Tab()),
+PaintPartFlags::All, SC_PF_TESTMERGE);
+}
+}
+}
+}
+}
+
 ScViewFunc::ScViewFunc( vcl::Window* pParent, ScDocShell& 

[Libreoffice-commits] core.git: sc/qa

2023-08-31 Thread Eike Rathke (via logerrit)
 sc/qa/unit/functions_test.cxx |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 63582b234ddcca3bcb1f76843363e5e7d0b0a08e
Author: Eike Rathke 
AuthorDate: Thu Aug 31 14:53:37 2023 +0200
Commit: Eike Rathke 
CommitDate: Thu Aug 31 17:07:09 2023 +0200

Related: tdf#156985 Do not fail for first empty check cell in test failure 
case

So we can actually find a detail if there are empty rows and not
just bail out with "Sheet2.A1 '' result: 0, expected: 0" or such.

Change-Id: I163f84edebfb98f6f0351ba3dc889d3fab0e6789
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156344
Reviewed-by: Eike Rathke 
Tested-by: Jenkins

diff --git a/sc/qa/unit/functions_test.cxx b/sc/qa/unit/functions_test.cxx
index 8efdfa5b0f82..40504480d04d 100644
--- a/sc/qa/unit/functions_test.cxx
+++ b/sc/qa/unit/functions_test.cxx
@@ -40,8 +40,10 @@ bool FunctionsTest::load(const OUString& rFilter, const 
OUString& rURL,
 SCROW maxRow = rDoc.GetLastDataRow(tab, 2, 2, rDoc.MaxRow());
 for(SCROW row = 0; row <= maxRow; ++row)
 {
-// Column C has the check result, column D has the formula 
text.
-if(rDoc.HasStringData(2, row, tab))
+// Column A has the result value, column B has the expected
+// value, Column C has the check result (1 or 0), column D has
+// the formula text.
+if(rDoc.HasStringData(2, row, tab) || !rDoc.HasData(2, row, 
tab))
 continue;
 if(!rtl::math::approxEqual(1.0, rDoc.GetValue(2, row, 1)))
 CPPUNIT_FAIL( OUString( "Testing " + rURL + " failed, "


[Libreoffice-commits] core.git: sc/qa

2023-08-31 Thread Noel Grandin (via logerrit)
 sc/qa/uitest/inputLine/tdf67346.py |   13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 2279fce1292fb5d699dda51e3bd19efdff8fb077
Author: Noel Grandin 
AuthorDate: Thu Aug 31 09:45:29 2023 +0200
Commit: Noel Grandin 
CommitDate: Thu Aug 31 10:54:11 2023 +0200

disable failing inputline UITest

this test fails here on jenkins about 30% of the time

Change-Id: Ie82f4f2621b7d05b7a74bba1b0b5c96b98314b46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156324
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/qa/uitest/inputLine/tdf67346.py 
b/sc/qa/uitest/inputLine/tdf67346.py
index cc9dc14d628c..27764af5c377 100644
--- a/sc/qa/uitest/inputLine/tdf67346.py
+++ b/sc/qa/uitest/inputLine/tdf67346.py
@@ -39,12 +39,13 @@ class tdf67346(UITestCase):
 self.xUITest.executeCommand(".uno:Paste")
 self.assertEqual(get_cell_by_position(document, 0, 0, 
0).getString(), "Apple")
 self.assertEqual(get_cell_by_position(document, 0, 0, 
1).getString(), "Apple")
-self.assertEqual(get_state_as_dict(xInputWin)["Text"], "Apple")
-
-self.xUITest.executeCommand(".uno:Undo")
-self.assertEqual(get_cell_by_position(document, 0, 0, 
0).getString(), "Apple")
-self.assertEqual(get_cell_by_position(document, 0, 0, 
1).getString(), "")
-self.assertEqual(get_state_as_dict(xInputWin)["Text"], "")
+# this test keeps failing here on jenkins
+#self.assertEqual(get_state_as_dict(xInputWin)["Text"], "Apple")
+#
+#self.xUITest.executeCommand(".uno:Undo")
+#self.assertEqual(get_cell_by_position(document, 0, 0, 
0).getString(), "Apple")
+#self.assertEqual(get_cell_by_position(document, 0, 0, 
1).getString(), "")
+#self.assertEqual(get_state_as_dict(xInputWin)["Text"], "")
 
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:


[Libreoffice-commits] core.git: sc/qa sc/source

2023-08-28 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/subsequent_export_test3.cxx   |3 +--
 sc/source/filter/oox/sheetdatabuffer.cxx |2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

New commits:
commit 16d43b7c5396d6382926d514dc9ce10b3ce94cba
Author: Paris Oplopoios 
AuthorDate: Mon Aug 28 20:40:33 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Aug 28 22:12:43 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/+/156206
Tested-by: Jenkins
Reviewed-by: Paris Oplopoios 

diff --git a/sc/qa/unit/subsequent_export_test3.cxx 
b/sc/qa/unit/subsequent_export_test3.cxx
index ff8a27727a1b..45e65cf8bed8 100644
--- a/sc/qa/unit/subsequent_export_test3.cxx
+++ b/sc/qa/unit/subsequent_export_test3.cxx
@@ -1424,8 +1424,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest3, 
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");
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest3, testHiddenShapeXLS)
diff --git a/sc/source/filter/oox/sheetdatabuffer.cxx 
b/sc/source/filter/oox/sheetdatabuffer.cxx
index 76721ded0d17..d1410eb04970 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: sc/qa sc/source

2023-08-28 Thread Paris Oplopoios (via logerrit)
 sc/qa/unit/data/xlsx/wrap-text.xlsx   |binary
 sc/qa/unit/subsequent_export_test.cxx |   20 
 sc/source/filter/excel/xestyle.cxx|2 +-
 sc/source/filter/excel/xetable.cxx|2 +-
 4 files changed, 22 insertions(+), 2 deletions(-)

New commits:
commit 1760ee4d328cfb6ba22a5b3c84016625b12adb25
Author: Paris Oplopoios 
AuthorDate: Wed Aug 23 12:31:15 2023 +0300
Commit: Paris Oplopoios 
CommitDate: Mon Aug 28 10:27:37 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 

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 1ce8ef99c926..60b9f9fb1c0f 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -1805,6 +1805,26 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, 
testRichTextCellFormatXLSX)
 assertXPath(pStyles, aXPath3, "val", "true");
 }
 
+CPPUNIT_TEST_FIXTURE(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");
+}
+
 CPPUNIT_TEST_FIXTURE(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 191dab1822d9..f7f24c17d223 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1507,7 +1507,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 022da6cd754f..f7b9a81be9f0 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: sc/qa sc/source

2023-08-27 Thread Szymon Kłos (via logerrit)
 sc/qa/unit/tiledrendering/tiledrendering.cxx |4 ++--
 sc/source/ui/docshell/docsh3.cxx |5 -
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 34d5abf464dfbf4bdc36f6b87e606c84a1f4d99d
Author: Szymon Kłos 
AuthorDate: Tue Jul 25 14:35:49 2023 +0200
Commit: Caolán McNamara 
CommitDate: Sun Aug 27 20:42:13 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 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156156
Tested-by: Jenkins

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 35304683e724..76286912a698 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1054,7 +1054,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testInvalidateOnInserRowCol)
 aView.m_aInvalidations.clear();
 dispatchCommand(mxComponent, ".uno:InsertRows", aArgs);
 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
@@ -1070,7 +1070,7 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testInvalidateOnInserRowCol)
 aView.m_aInvalidations.clear();
 dispatchCommand(mxComponent, ".uno:InsertColumns", aArgs);
 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 789737e5f824..50e99f36f109 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 = GetModel();
-SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
+for (auto nTab : aTabsInvalidated)
+SfxLokHelper::notifyPartSizeChangedAllViews(pModel, nTab);
 }
 }
 


[Libreoffice-commits] core.git: sc/qa

2023-08-24 Thread Andrea Gelmini (via logerrit)
 sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit 30c3bfe43049a63d934dac192961a069f6c34a3f
Author: Andrea Gelmini 
AuthorDate: Thu Aug 24 10:28:50 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu Aug 24 22:16:22 2023 +0200

Fix typo

Change-Id: I86dbe2909b19a8a9108f3ba76529ef378c2d663e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156039
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py 
b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
index f54ee089b537..87ee09aa5d71 100644
--- a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
+++ b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
@@ -25,8 +25,8 @@ class tdf156611(UITestCase):
 urls =[["",""],["https://www.documentfoundation.org/",";]]
 texts =[["aaa bbb","bbb"],[" ddd","ddd"],["","aaa  
"]]
 
-# 1. run, we want hypelink insertion work like in MS excel (only 1 
hyperlink/cell is allowed)
-# 2. run, we want hypelink insertion work as it did in calc (more 
hyperlinks can be in 1 cell)
+# 1. run, we want hyperlink insertion work like in MS excel (only 
1 hyperlink/cell is allowed)
+# 2. run, we want hyperlink insertion work as it did in calc (more 
hyperlinks can be in 1 cell)
 for i in range(2):
 xCalcDoc = self.xUITest.getTopFocusWindow()
 xGridWindow = xCalcDoc.getChild("grid_window")
@@ -112,7 +112,7 @@ class tdf156611(UITestCase):
 xCell = get_cell_by_position(document, 0, 0, 0)
 self.assertEqual(xCell.getString(), texts[2][i])
 # 1. run: "" last hyperlink insertion overwritten the 
whole cell text with ""
-# 2. run: "aaa  " as every hypelink insertion only 
overwritten the actually selected text
+# 2. run: "aaa  " as every hyperlink insertion only 
overwritten the actually selected text
 xTextFields = xCell.getTextFields()
 self.assertEqual(xTextFields.getCount(), i+1)
 self.assertEqual(xTextFields.getByIndex(i).URL, 
"https://aWrongLink/;)


[Libreoffice-commits] core.git: sc/qa

2023-08-24 Thread Andrea Gelmini (via logerrit)
 sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 9967f22ca160b1fe9784b8f67428c52ef8d4f2c2
Author: Andrea Gelmini 
AuthorDate: Thu Aug 24 10:27:42 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu Aug 24 22:15:13 2023 +0200

Fix typo

Change-Id: I1f4d28f834d7e9deb09460fde978bc30d05e351e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156037
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py 
b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
index ff2ac3280a20..f54ee089b537 100644
--- a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
+++ b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
@@ -111,7 +111,7 @@ class tdf156611(UITestCase):
 # Check contents of the cell
 xCell = get_cell_by_position(document, 0, 0, 0)
 self.assertEqual(xCell.getString(), texts[2][i])
-# 1. run: "" last hyperlink insertion overwritten the whol 
cell text with ""
+# 1. run: "" last hyperlink insertion overwritten the 
whole cell text with ""
 # 2. run: "aaa  " as every hypelink insertion only 
overwritten the actually selected text
 xTextFields = xCell.getTextFields()
 self.assertEqual(xTextFields.getCount(), i+1)


[Libreoffice-commits] core.git: sc/qa

2023-08-24 Thread Andrea Gelmini (via logerrit)
 sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 482ebb5b5e3cd75199b386584da9753066b64e39
Author: Andrea Gelmini 
AuthorDate: Thu Aug 24 11:13:16 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu Aug 24 22:14:51 2023 +0200

Fix typo

Change-Id: Iab3ff5a5f9c8917d7de1d886aa331e6110b0ae4a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156040
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py 
b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
index cf6770f5260f..ff2ac3280a20 100644
--- a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
+++ b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
@@ -21,7 +21,7 @@ class tdf156611(UITestCase):
 # but it does not need any data from the file, any xlsx or xls file 
can be opened for this test
 with 
self.ui_test.load_file(get_url_for_data_file("tdf126541_GridOff.xlsx")) as 
document:
 
-# datas that we will check against when hyperlink is inserted
+# data that we will check against when hyperlink is inserted
 urls =[["",""],["https://www.documentfoundation.org/",";]]
 texts =[["aaa bbb","bbb"],[" ddd","ddd"],["","aaa  
"]]
 


[Libreoffice-commits] core.git: sc/qa

2023-08-24 Thread Andrea Gelmini (via logerrit)
 sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 5391006caf76bfbb81238f709ad30ac37809b0f5
Author: Andrea Gelmini 
AuthorDate: Thu Aug 24 10:28:13 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu Aug 24 22:14:09 2023 +0200

Fix typo

Change-Id: Ief8634c54b5dcf8cdf92882e9026e42cf3e9935e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156038
Tested-by: Jenkins
Reviewed-by: Julien Nabet 

diff --git a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py 
b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
index a78106c11d66..cf6770f5260f 100644
--- a/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
+++ b/sc/qa/uitest/calc_tests9/tdf156611_hyperlink_interoper.py
@@ -25,8 +25,8 @@ class tdf156611(UITestCase):
 urls =[["",""],["https://www.documentfoundation.org/",";]]
 texts =[["aaa bbb","bbb"],[" ddd","ddd"],["","aaa  
"]]
 
-# 1. run, we want hypelink inserton work like in MS excel (only 1 
hyperlink/cell is allowed)
-# 2. run, we want hypelink inserton work as it did in calc (more 
hyperlinks can be in 1 cell)
+# 1. run, we want hypelink insertion work like in MS excel (only 1 
hyperlink/cell is allowed)
+# 2. run, we want hypelink insertion work as it did in calc (more 
hyperlinks can be in 1 cell)
 for i in range(2):
 xCalcDoc = self.xUITest.getTopFocusWindow()
 xGridWindow = xCalcDoc.getChild("grid_window")


[Libreoffice-commits] core.git: sc/qa sc/source

2023-08-22 Thread Czeber László Ádám (via logerrit)
 sc/qa/unit/ucalc_copypaste.cxx   |   17 +
 sc/source/core/data/documen3.cxx |9 -
 2 files changed, 25 insertions(+), 1 deletion(-)

New commits:
commit cb141564733eef078347b89ea657e46e193bd140
Author: Czeber László Ádám 
AuthorDate: Mon Jul 17 11:41:17 2023 +0200
Commit: László Németh 
CommitDate: Tue Aug 22 11:56:13 2023 +0200

tdf#103480 sc: fix lost hyperlink at merging an empty cell with its cell

Merging a cell containing a hyperlink with an empty cell
resulted the loss of the hyperlink, i.e. only the text
content was kept.

Change-Id: I5148ce55157e3ad7926f5b5a82a682b837a784ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154520
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index bad57d8646a7..575cfb90f9f7 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -10752,6 +10752,23 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, 
testUndoBackgroundColor)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCopyPaste, testMergedHyperlink)
+{
+m_pDoc->InsertTab(0, "Table1");
+m_pDoc->InitDrawLayer(m_xDocShell.get());
+
+ScFieldEditEngine& pEE = m_pDoc->GetEditEngine();
+pEE.SetTextCurrentDefaults("https://libreoffice.org/;);
+m_pDoc->SetEditText(ScAddress(1, 0, 0), pEE.CreateTextObject()); // B1
+
+m_pDoc->DoMergeContents(0, 0, 1, 0, 0); // A1:B1
+
+CPPUNIT_ASSERT_EQUAL(CELLTYPE_EDIT, m_pDoc->GetCellType(ScAddress(0, 0, 
0))); // A1
+const EditTextObject* pEditObj = m_pDoc->GetEditText(ScAddress(0, 0, 0)); 
// A1
+CPPUNIT_ASSERT(pEditObj);
+CPPUNIT_ASSERT_EQUAL(OUString("https://libreoffice.org/;), 
pEditObj->GetText(0));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 73cf516c4d49..b52deed7d85b 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -2030,6 +2030,7 @@ void ScDocument::DoMergeContents( SCCOL nStartCol, SCROW 
nStartRow,
 OUString aCellStr;
 SCCOL nCol;
 SCROW nRow;
+ScCellValue aCell;
 for (nRow=nStartRow; nRow<=nEndRow; nRow++)
 for (nCol=nStartCol; nCol<=nEndCol; nCol++)
 {
@@ -2039,12 +2040,18 @@ void ScDocument::DoMergeContents( SCCOL nStartCol, 
SCROW nStartRow,
 if (!aTotal.isEmpty())
 aTotal.append(' ');
 aTotal.append(aCellStr);
+ScAddress aPos(nCol, nRow, nTab);
+if ((GetCellType(aPos) == CELLTYPE_EDIT) && aCell.isEmpty())
+aCell = ScRefCellValue(*this, aPos);
 }
 if (nCol != nStartCol || nRow != nStartRow)
 SetString(nCol,nRow,nTab,"");
 }
 
-SetString(nStartCol,nStartRow,nTab,aTotal.makeStringAndClear());
+if (aCell.isEmpty() || !GetString(nStartCol, nStartRow, nTab).isEmpty())
+SetString(nStartCol, nStartRow, nTab, aTotal.makeStringAndClear());
+else
+aCell.release(*this, ScAddress(nStartCol, nStartRow, nTab));
 }
 
 void ScDocument::DoEmptyBlock( SCCOL nStartCol, SCROW nStartRow,


[Libreoffice-commits] core.git: sc/qa

2023-08-08 Thread Tomaž Vajngerl (via logerrit)
 sc/qa/unit/tiledrendering/tiledrendering.cxx |3 +++
 1 file changed, 3 insertions(+)

New commits:
commit 3dcf2acadb847ec76d7e1dff3b4b730a64b52c41
Author: Tomaž Vajngerl 
AuthorDate: Tue Aug 8 23:15:59 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Aug 9 07:33:26 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 

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index c0fc36968c58..35304683e724 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1079,6 +1079,9 @@ CPPUNIT_TEST_FIXTURE(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: sc/qa

2023-08-08 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/uicalc/data/tdf156286.ods |binary
 sc/qa/unit/uicalc/uicalc2.cxx|   17 +
 2 files changed, 17 insertions(+)

New commits:
commit d27c206faa600444d2753d1f2596b6ca83b4c117
Author: Xisco Fauli 
AuthorDate: Tue Aug 8 11:31:22 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Aug 8 20:21:58 2023 +0200

tdf#156286: sc_uicalc2: Add unittest

Change-Id: Iba1a473293f013e1d5d395ad6ee5f7e61fa759cc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155446
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/uicalc/data/tdf156286.ods 
b/sc/qa/unit/uicalc/data/tdf156286.ods
new file mode 100644
index ..9049e8170d7c
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf156286.ods differ
diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index 4e154f8bbb83..c5207a03c3d8 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1180,6 +1180,23 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152014)
 CPPUNIT_ASSERT_EQUAL(OUString("#N/A"), pDoc2->GetString(ScAddress(0, 0, 
0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf156286)
+{
+createScDoc("tdf156286.ods");
+ScDocument* pDoc = getScDoc();
+
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+// Without the fix in place, this test would have crash here
+dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
+
+CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(12, 2, 0)));
+
+dispatchCommand(mxComponent, ".uno:Undo", {});
+
+CPPUNIT_ASSERT_EQUAL(OUString(""), 
pDoc->GetString(ScAddress(12, 2, 0)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf126926)
 {
 createScDoc();


[Libreoffice-commits] core.git: sc/qa

2023-08-08 Thread Henry Castro (via logerrit)
 sc/qa/unit/uicalc/uicalc.cxx |   35 +++
 1 file changed, 35 insertions(+)

New commits:
commit ef538b5441875cc3af97e25c83ed15b393d9bfce
Author: Henry Castro 
AuthorDate: Tue Jul 18 15:22:08 2023 -0400
Commit: Tomaž Vajngerl 
CommitDate: Tue Aug 8 16:44:47 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/+/154602
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 2d1378c92c30..4259f56a 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -2099,6 +2099,41 @@ 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: sc/qa

2023-08-07 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/ucalc_formula2.cxx |   16 
 1 file changed, 16 insertions(+)

New commits:
commit 5eca134cf91307f0e7ffc89e9074b37d26fcac99
Author: Xisco Fauli 
AuthorDate: Mon Aug 7 17:06:00 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Aug 7 20:53:06 2023 +0200

tdf#127334: sc_ucalc_formula2: Add unittest

Change-Id: I61ce8847f0ac571815a02dca6456ce526ae711d6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155428
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/ucalc_formula2.cxx b/sc/qa/unit/ucalc_formula2.cxx
index 87f858ff4dc9..14f0001f943d 100644
--- a/sc/qa/unit/ucalc_formula2.cxx
+++ b/sc/qa/unit/ucalc_formula2.cxx
@@ -3754,6 +3754,22 @@ CPPUNIT_TEST_FIXTURE(TestFormula2, testTdf132519)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestFormula2, testTdf127334)
+{
+CPPUNIT_ASSERT(m_pDoc->InsertTab(0, "Sheet1"));
+
+m_pDoc->SetString(
+0, 0, 0,
+"= (((DATE(2019;9;17) + TIME(0;0;1)) - DATE(2019;9;17)) - 
TIME(0;0;1))/TIME(0;0;1)");
+
+// Without the fix in place, this test would have failed with
+// - Expected: 0
+// - Actual  : 2.32e-07
+CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(0, 0, 0));
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_TEST_FIXTURE(TestFormula2, testTdf100818)
 {
 CPPUNIT_ASSERT(m_pDoc->InsertTab(0, "Sheet1"));


[Libreoffice-commits] core.git: sc/qa

2023-08-04 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/ucalc_condformat.cxx |   12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

New commits:
commit 694bacca057c9f1d93ab27d61199aec9d060b868
Author: Tibor Nagy 
AuthorDate: Fri Aug 4 00:39:24 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Fri Aug 4 08:39:59 2023 +0200

Fix heap-use-after-free

The issue is caused by commit Ic87983fa6e3279a64841babc565fbe97710ff730
(tdf#99808 sc: fix background of conditional formatting in merged cell)

Change-Id: Ic72ba16c2649537dc3b486e07c12e2486cdf1957
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155328
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 6b79a4318501..7a0abc7cf026 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -1394,21 +1394,19 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testConditionStyleInMergedCell)
 // Add a conditional format.
 auto pFormat = std::make_unique(1, m_pDoc);
 pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0));
-auto pFormatTmp = pFormat.get();
-sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0);
 
 // Add condition in which if the value equals 1, set the "Good" style.
 ScCondFormatEntry* pEntry = new ScCondFormatEntry(
 ScConditionMode::Equal, "=1", "", *m_pDoc, ScAddress(0, 0, 0), 
ScResId(STR_STYLENAME_GOOD));
-pFormatTmp->AddEntry(pEntry);
+pFormat->AddEntry(pEntry);
 
 // Apply the format to the range.
-m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey);
+m_pDoc->AddCondFormatData(pFormat->GetRange(), 0, 1);
 
 ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
-sal_uInt32 nOldFormat = pFormatTmp->GetKey();
-const ScRangeList& rRangeList = pFormatTmp->GetRange();
-rFunc.ReplaceConditionalFormat(nOldFormat, pFormatTmp->Clone(), 0, 
rRangeList);
+sal_uInt32 nOldFormat = pFormat->GetKey();
+const ScRangeList& rRangeList = pFormat->GetRange();
+rFunc.ReplaceConditionalFormat(nOldFormat, std::move(pFormat), 0, 
rRangeList);
 
 CPPUNIT_ASSERT_EQUAL(true, aListener.mbPaintAllMergedCell);
 


[Libreoffice-commits] core.git: sc/qa

2023-08-03 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/data/xlsx/tdf147955.xlsx |binary
 sc/qa/unit/subsequent_filters_test4.cxx |   14 ++
 2 files changed, 14 insertions(+)

New commits:
commit 0e4429983eb73c8e0ce27feb3c5fa35bead64b88
Author: Xisco Fauli 
AuthorDate: Thu Aug 3 11:03:56 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Aug 3 12:54:14 2023 +0200

tdf#147955: sc_subsequent_filters_test4: Add unittest

Change-Id: I8247d55a5d31512deeb778ad3cbe4f2569d50440
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155281
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/xlsx/tdf147955.xlsx 
b/sc/qa/unit/data/xlsx/tdf147955.xlsx
new file mode 100644
index ..a32a724a19ba
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf147955.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test4.cxx 
b/sc/qa/unit/subsequent_filters_test4.cxx
index 27d9d6f29150..ae5c7ff7e4da 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -1369,6 +1369,20 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf151046)
 CPPUNIT_ASSERT_EQUAL(1.0, pDoc->GetValue(0, 2, 0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf147955)
+{
+createScDoc("xlsx/tdf147955.xlsx");
+
+ScDocument* pDoc = getScDoc();
+
+// Without the fix in place, this test would have failed with
+// - Expected: 892.75
+// - Actual  : 0
+CPPUNIT_ASSERT_EQUAL(892.75, pDoc->GetValue(1, 6, 0));
+CPPUNIT_ASSERT_EQUAL(130.25, pDoc->GetValue(1, 10, 0));
+CPPUNIT_ASSERT_EQUAL(10.98, pDoc->GetValue(1, 15, 0));
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testImportCrashes)
 {
 testImportCrash("ods/tdf149752.ods");


[Libreoffice-commits] core.git: sc/qa

2023-08-01 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/uicalc/data/tdf156462.ods |binary
 sc/qa/unit/uicalc/uicalc.cxx |   15 +++
 2 files changed, 15 insertions(+)

New commits:
commit cfb1e6354e095d0addf9f7a1114902b2bce5f627
Author: Xisco Fauli 
AuthorDate: Tue Aug 1 16:17:32 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue Aug 1 19:33:34 2023 +0200

tdf#156462: sc_uicalc: Add unittest

Change-Id: Ib02bcb33c243450cdc94328e07d02510d50eb7c2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155164
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/uicalc/data/tdf156462.ods 
b/sc/qa/unit/uicalc/data/tdf156462.ods
new file mode 100644
index ..3f77ac3be0b3
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf156462.ods differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index d96b78b87136..9a795f4a5bde 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1227,6 +1227,21 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf68290)
 lcl_AssertCurrentCursorPosition(*pDocSh, u"M3");
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf156462)
+{
+createScDoc("tdf156462.ods");
+ScDocShell* pDocSh = getScDocShell();
+
+lcl_AssertCurrentCursorPosition(*pDocSh, u"G2");
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | KEY_LEFT);
+Scheduler::ProcessEventsToIdle();
+
+// Without the fix in place, the cursor would have jumped to cell C2
+lcl_AssertCurrentCursorPosition(*pDocSh, u"D2");
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132057)
 {
 createScDoc("tdf132057.ods");


[Libreoffice-commits] core.git: sc/qa

2023-07-27 Thread Hossein (via logerrit)
 sc/qa/uitest/calc_tests9/tdf156268.py |   24 ++
 sc/qa/uitest/data/tdf156268.fods  |  358 ++
 2 files changed, 382 insertions(+)

New commits:
commit f58dc86c9c8a257f620b009e243ab591a4a67ced
Author: Hossein 
AuthorDate: Thu Jul 27 02:44:12 2023 +0200
Commit: Hossein 
CommitDate: Thu Jul 27 10:41:26 2023 +0200

tdf#156268 Add UITest for Calc ### display crash

UITest loads a minimal .fods example to check if Calc crashes with that.
The example file does not crash without UI, as it needs the ###
indication to be painted on the screen. Calc does not crash with the
CppUnitTest, tested using testImportCrash() to load the file in a test
added to sc/qa/unit/subsequent_filters_test4.cxx. Also, PDF export works
without problem. But, UITest leads to crash without the fix in place.

The UITest can be run using:

 make UITest_calc_tests9 UITEST_TEST_NAME=tdf156268.Tdf156268.test_tdf156268

Change-Id: I9712d70f057cfc11f10fd98caadbf6e10ee67d5e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154977
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/sc/qa/uitest/calc_tests9/tdf156268.py 
b/sc/qa/uitest/calc_tests9/tdf156268.py
new file mode 100644
index ..373f0d90da85
--- /dev/null
+++ b/sc/qa/uitest/calc_tests9/tdf156268.py
@@ -0,0 +1,24 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position
+from uitest.uihelper.common import get_url_for_data_file
+
+class Tdf156268(UITestCase):
+
+   def test_tdf156268(self):
+# In order to simulate copy from external source,
+# import the text in Writer, copy it and paste it in Calc
+with self.ui_test.load_file(get_url_for_data_file("tdf156268.fods")):
+
+self.xUITest.executeCommand(".uno:SelectAll")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf156268.fods b/sc/qa/uitest/data/tdf156268.fods
new file mode 100644
index ..aaa8ed1e13e4
--- /dev/null
+++ b/sc/qa/uitest/data/tdf156268.fods
@@ -0,0 +1,358 @@
+
+
+http://www.w3.org/TR/css3-text/; 
xmlns:grddl="http://www.w3.org/2003/g/data-view#; 
xmlns:xhtml="http://www.w3.org/1999/xhtml; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema; 
xmlns:xforms="http://www.w3.org/2002/xforms; 
xmlns:dom="http://www.w3.org/2001/xml-events; 
xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" 
xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" 
xmlns:math="http://www.w3.org/1998/Math/MathML; 
xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" 
xmlns:ooo="http://openoffice.org/2004/office; 
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" 
xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" 
xmlns:ooow="http://openoffice.org/2004/writer; 
xmlns:xlink="http://www.w3.org/1999/xlink; 
xmlns:drawooo="http://openoffice.org/2010/draw; xmlns:oooc="http://o
 penoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/; 
xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"
 xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" 
xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" 
xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" 
xmlns:tableooo="http://openoffice.org/2009/table; 
xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" 
xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" 
xmlns:rpt="http://openoffice.org/2005/report; 
xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0"
 xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" 
xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" 
xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" 
xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" 
xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" 
xmlns:meta="urn:oasis:name
 s:tc:opendocument:xmlns:meta:1.0" 
xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"
 office:version="1.3" 
office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
+ 
2013-06-26T09:55:092023-07-27T01:42:19.9176907498P23DT22H13M17SLibreOffice/7.5.1.2$Linux_X86_64
 
LibreOffice_project/fcbaee479e84c6cd81291587d2ee68cba099e129
+ 
+  
+   0
+   0
+   399
+   18062
+   
+
+ view1
+ 
+  
+   0
+   1
+   2
+   2
+   3
+   9
+   0
+   0
+   3
+   0
+   9

[Libreoffice-commits] core.git: sc/qa sc/source

2023-07-26 Thread Caolán McNamara (via logerrit)
 sc/qa/unit/tiledrendering/tiledrendering.cxx |3 +
 sc/source/ui/inc/tabview.hxx |6 ++-
 sc/source/ui/view/cellsh4.cxx|8 ++--
 sc/source/ui/view/tabview2.cxx   |   47 +--
 sc/source/ui/view/tabview3.cxx   |4 +-
 5 files changed, 56 insertions(+), 12 deletions(-)

New commits:
commit 6568a29fa256d143a332b424c0582b0e665b65d6
Author: Caolán McNamara 
AuthorDate: Tue Jul 25 14:16:39 2023 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jul 26 09:54:03 2023 +0200

cool#6931 on ctrl+[right/down] don't leap to the limits of the document

...when there is no more data, instead jump a generous block of emptiness.

Limit to direct interaction by user and the simple navigation case
(leaving block selection alone) and only for LibreOfficeKit::isActive

Change-Id: I66234394529785d3f0f8fe6a6524239dad8ffb32
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154892
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index fd2413e9f0af..254fb5e8a042 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1896,7 +1896,8 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testJumpToLastRowInvalidation)
 Scheduler::ProcessEventsToIdle();
 CPPUNIT_ASSERT(aView1.m_bInvalidateTiles);
 CPPUNIT_ASSERT_EQUAL(size_t(1), aView1.m_aInvalidations.size());
-CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 267386880), 
aView1.m_aInvalidations[0]);
+// 261375 because we limit how far we jump into empty space in online, 
267386880 if we don't limit
+CPPUNIT_ASSERT_EQUAL(tools::Rectangle(0, 13005, 26775, 261375), 
aView1.m_aInvalidations[0]);
 }
 
 // We need to ensure that views are not perterbed by rendering (!?) hmm ...
diff --git a/sc/source/ui/inc/tabview.hxx b/sc/source/ui/inc/tabview.hxx
index 3f270770ec89..edb9dd991971 100644
--- a/sc/source/ui/inc/tabview.hxx
+++ b/sc/source/ui/inc/tabview.hxx
@@ -241,7 +241,8 @@ private:
 static tools::Long GetScrollBarPos( const ScrollAdaptor& rScroll );
 
 voidGetAreaMoveEndPosition(SCCOL nMovX, SCROW nMovY, 
ScFollowMode eMode,
-   SCCOL& rAreaX, SCROW& rAreaY, 
ScFollowMode& rMode);
+   SCCOL& rAreaX, SCROW& rAreaY, 
ScFollowMode& rMode,
+   bool bInteractiveByUser = false);
 
 voidSkipCursorHorizontal(SCCOL& rCurX, SCROW& rCurY, SCCOL 
nOldX, SCCOL nMovX);
 voidSkipCursorVertical(SCCOL& rCurX, SCROW& rCurY, SCROW 
nOldY, SCROW nMovY);
@@ -435,7 +436,8 @@ public:
 voidMoveCursorPage( SCCOL nMovX, SCROW nMovY, ScFollowMode 
eMode,
 bool bShift, bool bKeepSel = false );
 voidMoveCursorArea( SCCOL nMovX, SCROW nMovY, ScFollowMode 
eMode,
-bool bShift, bool bKeepSel = false );
+bool bShift, bool bKeepSel = false,
+bool bInteractiveByUser = false );
 voidMoveCursorEnd( SCCOL nMovX, SCROW nMovY, ScFollowMode 
eMode,
bool bShift, bool bKeepSel = false );
 voidMoveCursorScreen( SCCOL nMovX, SCROW nMovY, ScFollowMode 
eMode, bool bShift );
diff --git a/sc/source/ui/view/cellsh4.cxx b/sc/source/ui/view/cellsh4.cxx
index e44dbe599dba..8cf13970bdeb 100644
--- a/sc/source/ui/view/cellsh4.cxx
+++ b/sc/source/ui/view/cellsh4.cxx
@@ -141,7 +141,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
 break;
 
 case SID_CURSORBLKDOWN:
-pTabViewShell->MoveCursorArea( 0, nRepeat, SC_FOLLOW_JUMP, bSel, 
bKeep );
+pTabViewShell->MoveCursorArea( 0, nRepeat, SC_FOLLOW_JUMP, bSel, 
bKeep, !rReq.IsAPI() );
 break;
 
 case SID_CURSORUP:
@@ -152,7 +152,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
 break;
 
 case SID_CURSORBLKUP:
-pTabViewShell->MoveCursorArea( 0, -nRepeat, SC_FOLLOW_JUMP, bSel, 
bKeep );
+pTabViewShell->MoveCursorArea( 0, -nRepeat, SC_FOLLOW_JUMP, bSel, 
bKeep, !rReq.IsAPI() );
 break;
 
 case SID_CURSORLEFT:
@@ -163,7 +163,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
 break;
 
 case SID_CURSORBLKLEFT:
-pTabViewShell->MoveCursorArea( static_cast(-nRepeat * 
nRTLSign), 0, SC_FOLLOW_JUMP, bSel, bKeep );
+pTabViewShell->MoveCursorArea( static_cast(-nRepeat * 
nRTLSign), 0, SC_FOLLOW_JUMP, bSel, bKeep, !rReq.IsAPI() );
 break;
 
 case SID_CURSORRIGHT:
@@ -174,7 +174,7 @@ void ScCellShell::ExecuteCursor( SfxRequest& rReq )
 break;
 
 

[Libreoffice-commits] core.git: sc/qa sc/source

2023-07-25 Thread Czeber László Ádám (via logerrit)
 sc/qa/unit/data/xlsx/tdf142905.xlsx |binary
 sc/qa/unit/subsequent_filters_test4.cxx |   12 
 sc/source/filter/oox/excelhandlers.cxx  |4 +++-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 7ec4c6df68233b73b1e257e013583ca49fc2ec9b
Author: Czeber László Ádám 
AuthorDate: Thu Jul 20 13:14:21 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 25 15:50:15 2023 +0200

tdf#142905 XLSX import: don't trim leading spaces in formula cell

When importing an XLSX file, there was a discrepancy between the
read and recalculated cell values if it contains leading/ending
spaces. With this fix, trimming in worksheet files is only applied
to elements that contain a parameter and do not have a
space="preserved" parameter.

Change-Id: I91e09eaa3cb79537ddbed36e1124e4afd124d8f0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154674
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/tdf142905.xlsx 
b/sc/qa/unit/data/xlsx/tdf142905.xlsx
new file mode 100644
index ..b6e8296581c3
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf142905.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test4.cxx 
b/sc/qa/unit/subsequent_filters_test4.cxx
index 646b1e66f5b7..27d9d6f29150 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -1918,6 +1918,18 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf155402)
 CPPUNIT_ASSERT_EQUAL(OUString("/[tdf155402.xlsx]Sheet1"), aFilename);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf142905)
+{
+createScDoc("xlsx/tdf142905.xlsx");
+ScDocument* pDoc = getScDoc();
+
+// Without the fix, trims the spaces in cell C1 after reading the XLSX 
file.
+// After recalculation it is fixed.
+// - Expected: " 3M   "
+// - Actual  : "3M"
+CPPUNIT_ASSERT_EQUAL(OUString(" 3M   "), pDoc->GetString(2, 0, 0));
+}
+
 ScFiltersTest4::ScFiltersTest4()
 : ScModelTestBase("sc/qa/unit/data")
 {
diff --git a/sc/source/filter/oox/excelhandlers.cxx 
b/sc/source/filter/oox/excelhandlers.cxx
index ab39116b695b..77b5dda2ade7 100644
--- a/sc/source/filter/oox/excelhandlers.cxx
+++ b/sc/source/filter/oox/excelhandlers.cxx
@@ -30,9 +30,11 @@ WorkbookFragmentBase::WorkbookFragmentBase(
 {
 }
 
+// tdf142905: Change mbEnableTrimSpace default value is false,
+// because it will not trim members that do not have an attribute.
 WorksheetFragmentBase::WorksheetFragmentBase(
 const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
-FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
+FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath, false ),
 WorksheetHelper( rHelper )
 {
 }


[Libreoffice-commits] core.git: sc/qa sc/source

2023-07-25 Thread Tünde Tóth (via logerrit)
 sc/qa/unit/uicalc/uicalc2.cxx|   26 ++
 sc/source/core/tool/refupdat.cxx |7 +--
 2 files changed, 27 insertions(+), 6 deletions(-)

New commits:
commit 94ca402cd1fe2fd9776d08448f7216b7f638e69a
Author: Tünde Tóth 
AuthorDate: Tue Jul 18 15:20:47 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 25 15:04:01 2023 +0200

tdf#156174 sc DBData: fix regression of database ranges

Regression from commit 0c0444c44107f1a18f23dd0833d462d8dbf56569
"tdf#126926 sc DBData: delete the database range".

Change-Id: If641af42a44cadbb8485bfa5b9a8eca5a757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154582
Tested-by: Jenkins
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index 44ebf12935bc..4e154f8bbb83 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1446,6 +1446,32 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf155796)
 CPPUNIT_ASSERT_EQUAL(OUString("Sheet1.A1:Sheet1.A3"), aMarkedAreaString);
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf156174)
+{
+createScDoc();
+ScDocument* pDoc = getScDoc();
+
+insertNewSheet(*pDoc);
+
+insertStringToCell("A1", u"1");
+insertStringToCell("A2", u"2");
+insertStringToCell("B1", u"3");
+insertStringToCell("B2", u"4");
+
+ScDBData* pDBData = new ScDBData("testDB", 1, 0, 0, 1, 1);
+bool bInserted
+= 
pDoc->GetDBCollection()->getNamedDBs().insert(std::unique_ptr(pDBData));
+CPPUNIT_ASSERT(bInserted);
+
+insertNewSheet(*pDoc);
+uno::Sequence aArgs(
+comphelper::InitPropertySequence({ { "Index", uno::Any(sal_uInt16(3)) 
} }));
+dispatchCommand(mxComponent, ".uno:Remove", aArgs);
+
+ScDBCollection* pDBs = pDoc->GetDBCollection();
+CPPUNIT_ASSERT(!pDBs->empty());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index ef0902aab3f4..e05a14d0137f 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -286,12 +286,7 @@ ScRefUpdateRes ScRefUpdate::Update( const ScDocument* 
pDoc, UpdateRefMode eUpdat
 bool bExp = (bExpand && IsExpand( theTab1, theTab2, nTab1, nDz ));
 bCut1 = lcl_MoveStart( theTab1, nTab1, nDz, nMaxTab );
 bCut2 = lcl_MoveEnd( theTab2, nTab1, nDz, nMaxTab );
-if ( theTab2 < theTab1 )
-{
-eRet = UR_INVALID;
-theTab2 = theTab1;
-}
-else if ( bCut1 || bCut2 )
+if ( bCut1 || bCut2 )
 eRet = UR_UPDATED;
 if ( bExp )
 {


[Libreoffice-commits] core.git: sc/qa sc/source

2023-07-25 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/ucalc_condformat.cxx   |   54 ++
 sc/source/ui/docshell/docfunc.cxx |2 -
 2 files changed, 55 insertions(+), 1 deletion(-)

New commits:
commit e384be0f6ea6453e57cd4a7c4402d26b49debc41
Author: Tibor Nagy 
AuthorDate: Thu Jul 13 14:54:55 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 25 14:12:34 2023 +0200

tdf#99808 sc: fix background of conditional formatting in merged cell

The background color of conditional formatting is applied only to the
first cell in the merged block, at least under Windows.

Note: Undo/Redo is still not perfect, at least under Linux.

Change-Id: Ic87983fa6e3279a64841babc565fbe97710ff730
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154390
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 634373b58ccc..6b79a4318501 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -12,6 +12,7 @@
 #include 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -25,6 +26,23 @@
 
 namespace {
 
+struct PaintListener : public SfxListener
+{
+bool mbPaintAllMergedCell = false;
+virtual void Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) override
+{
+const ScPaintHint* pPaintHint = dynamic_cast();
+if (pPaintHint)
+{
+if (pPaintHint->GetStartCol() == 0 && pPaintHint->GetEndCol() == 0
+&& pPaintHint->GetStartRow() == 0 && pPaintHint->GetEndRow() 
== 1)
+{
+mbPaintAllMergedCell = true;
+}
+}
+}
+};
+
 struct ScDataBarLengthData
 {
 double nVal;
@@ -1361,6 +1379,42 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testCondFormatVolatileFunctionRecalc)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testConditionStyleInMergedCell)
+{
+m_pDoc->InsertTab(0, "Test");
+
+PaintListener aListener;
+aListener.StartListening(*m_xDocShell);
+
+m_pDoc->DoMerge(0, 0, 0, 1, 0); // A1:A2
+CPPUNIT_ASSERT(m_pDoc->IsMerged(ScAddress(0, 0, 0)));
+
+m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0);
+
+// Add a conditional format.
+auto pFormat = std::make_unique(1, m_pDoc);
+pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0));
+auto pFormatTmp = pFormat.get();
+sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+// Add condition in which if the value equals 1, set the "Good" style.
+ScCondFormatEntry* pEntry = new ScCondFormatEntry(
+ScConditionMode::Equal, "=1", "", *m_pDoc, ScAddress(0, 0, 0), 
ScResId(STR_STYLENAME_GOOD));
+pFormatTmp->AddEntry(pEntry);
+
+// Apply the format to the range.
+m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey);
+
+ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
+sal_uInt32 nOldFormat = pFormatTmp->GetKey();
+const ScRangeList& rRangeList = pFormatTmp->GetRange();
+rFunc.ReplaceConditionalFormat(nOldFormat, pFormatTmp->Clone(), 0, 
rRangeList);
+
+CPPUNIT_ASSERT_EQUAL(true, aListener.mbPaintAllMergedCell);
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/docshell/docfunc.cxx 
b/sc/source/ui/docshell/docfunc.cxx
index 4d99824fe0a0..4d3288558c40 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5670,7 +5670,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong 
nOldFormat, std::unique_ptr<
 }
 
 if(pRepaintRange)
-rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid);
+rDocShell.PostPaint(*pRepaintRange, PaintPartFlags::Grid, 
SC_PF_TESTMERGE);
 
 aModificator.SetDocumentModified();
 SfxGetpApp()->Broadcast(SfxHint(SfxHintId::ScAreasChanged));


[Libreoffice-commits] core.git: sc/qa sc/source

2023-07-25 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/ucalc_condformat.cxx  |   52 +++
 sc/source/core/data/fillinfo.cxx |   20 +++
 2 files changed, 72 insertions(+)

New commits:
commit ee4bd745be5dee15b68ca483f7f7771957ae3b3e
Author: Tibor Nagy 
AuthorDate: Wed Jul 12 17:17:10 2023 +0200
Commit: László Németh 
CommitDate: Tue Jul 25 10:28:32 2023 +0200

tdf#155322 sc: fix conditional format color scale in merged cells

Only first cell of a merged range got coloring, now all of them.

See also commit f142b3e84f97ae678bd0a94614e867d369680458
"tdf#131471 sc: fix background color of conditional formatting style".

Change-Id: I0e95bf49369de219e659295643aaf2659dd3de48
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154362
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index 78978daec33a..634373b58ccc 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -319,6 +319,58 @@ CPPUNIT_TEST_FIXTURE(TestCondformat, 
testDataBarCondCopyPaste)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleInMergedCell)
+{
+m_pDoc->InsertTab(0, "Test");
+m_pDoc->SetValue(ScAddress(0, 0, 0), 1.0);
+
+// Add a conditional format to A1.
+auto pFormat = std::make_unique(1, m_pDoc);
+pFormat->SetRange(ScRange(0, 0, 0, 0, 0, 0));
+auto pFormatTmp = pFormat.get();
+sal_uLong nKey = m_pDoc->AddCondFormat(std::move(pFormat), 0);
+
+// Add color scale entries.
+// The coloring is based on the value. (BLUE (x <= 0), GREEN (x == 1), RED 
(x >= 2))
+ScColorScaleFormat* pColorScaleFormat = new ScColorScaleFormat(m_pDoc);
+ScColorScaleEntry* pEntryBlue = new ScColorScaleEntry(0, COL_BLUE);
+ScColorScaleEntry* pEntryGreen = new ScColorScaleEntry(1, COL_GREEN);
+ScColorScaleEntry* pEntryRed = new ScColorScaleEntry(2, COL_RED);
+pColorScaleFormat->AddEntry(pEntryBlue);
+pColorScaleFormat->AddEntry(pEntryGreen);
+pColorScaleFormat->AddEntry(pEntryRed);
+
+pFormatTmp->AddEntry(pColorScaleFormat);
+
+// Apply the format to the range.
+m_pDoc->AddCondFormatData(pFormatTmp->GetRange(), 0, nKey);
+
+m_pDoc->DoMerge(0, 0, 0, 1, 0);  // A1:A2
+CPPUNIT_ASSERT(m_pDoc->IsMerged(ScAddress(0, 0, 0)));
+
+ScTableInfo aTabInfo;
+m_pDoc->FillInfo(aTabInfo, 0, 0, 0, 1, 0, 1, 1, false, false);
+RowInfo* pRowInfo = aTabInfo.mpRowInfo.get();
+
+RowInfo* pRowInfoA1 = [1];
+ScCellInfo* pCellInfoA1 = >cellInfo(0);
+// Check if there is a color scale in A1.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There is no color scale in cell A1!", true,
+ pCellInfoA1->mxColorScale.has_value());
+
+RowInfo* pRowInfoA2 = [2];
+ScCellInfo* pCellInfoA2 = >cellInfo(0);
+// Check if there is a color scale in A2.
+CPPUNIT_ASSERT_EQUAL_MESSAGE("There is no color scale in cell A2!", true,
+ pCellInfoA2->mxColorScale.has_value());
+
+// Check that cells A1 and A2 have the same color scale. (GREEN)
+
CPPUNIT_ASSERT(pCellInfoA1->mxColorScale.value().IsRGBEqual(pCellInfoA2->mxColorScale.value()));
+
+m_pDoc->DeleteTab(0);
+}
+
+
 CPPUNIT_TEST_FIXTURE(TestCondformat, testColorScaleCondCopyPaste)
 {
 m_pDoc->InsertTab(0, "Test");
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 94d79da68031..2e268239b048 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -743,6 +743,26 @@ void ScDocument::FillInfo(
 pInfo->pShadowAttr = pShadowItem;
 if (pInfo->pShadowAttr != pDefShadow)
 bAnyShadow = true;
+
+const ScCondFormatIndexes& rCondFormatIndex
+= 
pStartPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
+
+if (pCondFormList && !pStartCond && 
!rCondFormatIndex.empty())
+{
+for (const auto& rItem : rCondFormatIndex)
+{
+const ScConditionalFormat* pCondForm = 
pCondFormList->GetFormat(rItem);
+if (pCondForm)
+{
+ScCondFormatData aData = pCondForm->GetData(
+pInfo->maCell, ScAddress(nStartX, nStartY, 
nTab));
+
+// Color scale
+if (aData.mxColorScale && !pInfo->mxColorScale)
+pInfo->mxColorScale = aData.mxColorScale;
+}
+}
+}
 }
 }
 }


[Libreoffice-commits] core.git: sc/qa sc/source

2023-07-24 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/ods/tdf131471.ods   |binary
 sc/qa/unit/subsequent_filters_test3.cxx |   25 +++--
 sc/source/ui/unoobj/docuno.cxx  |2 +-
 3 files changed, 24 insertions(+), 3 deletions(-)

New commits:
commit f142b3e84f97ae678bd0a94614e867d369680458
Author: Tibor Nagy 
AuthorDate: Mon Jul 10 17:53:49 2023 +0200
Commit: László Németh 
CommitDate: Mon Jul 24 15:03:58 2023 +0200

tdf#131471 sc: fix background color of conditional formatting style

The issue appears for merged cells when you trigger a change that
causes the condition to be evaluated again.

Manual test: open unit test document, put "1" in A1, and press Undo:
the green background color of the condition was removed only
partially.

Change-Id: I8bb17c77ac49a1ee897c3e2b4902723d237765d8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154277
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sc/qa/unit/data/ods/tdf131471.ods 
b/sc/qa/unit/data/ods/tdf131471.ods
new file mode 100644
index ..31f079274256
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf131471.ods differ
diff --git a/sc/qa/unit/subsequent_filters_test3.cxx 
b/sc/qa/unit/subsequent_filters_test3.cxx
index 44cd7024506c..54d5061d2cd9 100644
--- a/sc/qa/unit/subsequent_filters_test3.cxx
+++ b/sc/qa/unit/subsequent_filters_test3.cxx
@@ -391,8 +391,9 @@ struct PaintListener : public SfxListener
 const ScPaintHint* pPaintHint = dynamic_cast();
 if (pPaintHint)
 {
-if (pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 0
-&& pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
+if ((pPaintHint->GetStartCol() <= 0 && pPaintHint->GetEndCol() >= 
0)
+&& ((pPaintHint->GetStartRow() <= 9 && pPaintHint->GetEndRow() 
>= 9)
+|| (pPaintHint->GetStartRow() == 2 && 
pPaintHint->GetEndRow() == 3)))
 {
 mbCalled = true;
 }
@@ -420,6 +421,26 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest3, 
testCondFormatFormulaListenerXLSX)
 CPPUNIT_ASSERT(aListener.mbCalled);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf131471)
+{
+// Repaint range of conditional format in merged cell.
+createScDoc("ods/tdf131471.ods");
+ScDocShell* pDocSh = getScDocShell();
+PaintListener aListener;
+aListener.StartListening(*pDocSh);
+ScDocument* pDoc = getScDoc();
+ScConditionalFormatList* pList = pDoc->GetCondFormList(0);
+CPPUNIT_ASSERT(pList);
+
+CPPUNIT_ASSERT_EQUAL(size_t(1), pList->size());
+ScConditionalFormat* pFormat = pList->begin()->get();
+CPPUNIT_ASSERT(pFormat);
+pDoc->SetDocVisible(true);
+pDoc->SetValue(0, 0, 0, 1.0);
+
+CPPUNIT_ASSERT(aListener.mbCalled);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest3, testTdf137091)
 {
 // Set the system locale to Turkish
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 33ffbd393f12..66c2667a1a1f 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -488,7 +488,7 @@ void ScModelObj::RepaintRange( const ScRange& rRange )
 void ScModelObj::RepaintRange( const ScRangeList& rRange )
 {
 if (pDocShell)
-pDocShell->PostPaint( rRange, PaintPartFlags::Grid );
+pDocShell->PostPaint(rRange, PaintPartFlags::Grid, SC_PF_TESTMERGE);
 }
 
 static ScViewData* lcl_getViewMatchingDocZoomTab(const Fraction& rZoomX,


[Libreoffice-commits] core.git: sc/qa sc/source

2023-07-07 Thread Jaume Pujantell (via logerrit)
 sc/qa/unit/uicalc/uicalc2.cxx  |   27 ++
 sc/source/ui/view/tabview2.cxx |  375 +++--
 2 files changed, 245 insertions(+), 157 deletions(-)

New commits:
commit 341029de72cf957b7bc7775e51544070d4a49874
Author: Jaume Pujantell 
AuthorDate: Thu Jul 6 09:22:15 2023 +0200
Commit: Jaume Pujantell 
CommitDate: Fri Jul 7 08:59:31 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/+/154093
Tested-by: Jenkins
Reviewed-by: Jaume Pujantell 

diff --git a/sc/qa/unit/uicalc/uicalc2.cxx b/sc/qa/unit/uicalc/uicalc2.cxx
index 3be123de219d..44ebf12935bc 100644
--- a/sc/qa/unit/uicalc/uicalc2.cxx
+++ b/sc/qa/unit/uicalc/uicalc2.cxx
@@ -1419,6 +1419,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, testTdf152577)
 CPPUNIT_ASSERT(!pDBs->empty());
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest2, 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, 
, 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)
+for (SCROW i = rowStart; i <= rowEnd && rCol < 

[Libreoffice-commits] core.git: sc/qa

2023-07-06 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/ucalc.cxx |   17 +
 1 file changed, 17 insertions(+)

New commits:
commit faadaa111d0c4025af5cffb8c8dbd084040f7217
Author: Xisco Fauli 
AuthorDate: Thu Jul 6 17:47:08 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jul 6 21:12:52 2023 +0200

tdf#153517: sc_ucalc: Add unittest

Change-Id: Idaa8bd4e0d6e34b0f45faa1ab49b46c5fb154475
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154138
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a72fb326029c..afbe5b8432a0 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -4581,6 +4581,23 @@ CPPUNIT_TEST_FIXTURE(Test, testAutoFill)
 CPPUNIT_ASSERT_EQUAL( OUString("2nd"), m_pDoc->GetString( 0, 1, 0 ) );
 CPPUNIT_ASSERT_EQUAL( OUString("3rd"), m_pDoc->GetString( 0, 2, 0 ) );
 
+// Clear column A for a new test.
+clearRange(m_pDoc, ScRange(0,0,0,0,m_pDoc->MaxRow(),0));
+m_pDoc->SetRowHidden(0, m_pDoc->MaxRow(), 0, false); // Show all rows.
+
+m_pDoc->SetString( 0, 200, 0, "15:00" );
+m_pDoc->SetString( 0, 201, 0, "15:20" );
+m_pDoc->Fill( 0, 200, 0, 201, nullptr, aMarkData, 25, FILL_TO_BOTTOM, 
FILL_AUTO );
+
+CPPUNIT_ASSERT_EQUAL( OUString("03:00:00 PM"), m_pDoc->GetString( 0, 200, 
0 ) );
+
+// tdf#153517: Without the fix in place, this test would have failed with
+// - Expected: 03:20:00 PM
+// - Actual  : 03:19:59 PM
+CPPUNIT_ASSERT_EQUAL( OUString("03:20:00 PM"), m_pDoc->GetString( 0, 201, 
0 ) );
+CPPUNIT_ASSERT_EQUAL( OUString("03:40:00 PM"), m_pDoc->GetString( 0, 202, 
0 ) );
+CPPUNIT_ASSERT_EQUAL( OUString("04:00:00 PM"), m_pDoc->GetString( 0, 203, 
0 ) );
+
 m_pDoc->DeleteTab(0);
 }
 


[Libreoffice-commits] core.git: sc/qa

2023-07-04 Thread Mike Kaganski (via logerrit)
 sc/qa/unit/ThemeImportExportTest.cxx |   26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

New commits:
commit b68e4a2d0179558180085bfe28a32a1510aeb3e1
Author: Mike Kaganski 
AuthorDate: Tue Jul 4 11:50:01 2023 +0200
Commit: Mike Kaganski 
CommitDate: Tue Jul 4 16:07:17 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 

diff --git a/sc/qa/unit/ThemeImportExportTest.cxx 
b/sc/qa/unit/ThemeImportExportTest.cxx
index c04a90dc6f54..b7dcce552d4d 100644
--- a/sc/qa/unit/ThemeImportExportTest.cxx
+++ b/sc/qa/unit/ThemeImportExportTest.cxx
@@ -111,9 +111,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
@@ -130,7 +130,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));
 }
 }
 
@@ -172,9 +172,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
@@ -191,7 +191,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));
 }
 }
 
@@ -247,9 +247,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();
@@ -260,9 +260,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->GetBottom();
@@ -273,7 +273,7 @@ void 

[Libreoffice-commits] core.git: sc/qa

2023-07-04 Thread Tomaž Vajngerl (via logerrit)
 sc/qa/unit/ThemeImportExportTest.cxx |   61 +--
 1 file changed, 38 insertions(+), 23 deletions(-)

New commits:
commit 8164915520b27b655372e7521b2a58978516f88d
Author: Tomaž Vajngerl 
AuthorDate: Fri Jun 30 15:46:22 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 4 10:40:58 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 

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: sc/qa sc/source

2023-07-04 Thread Tomaž Vajngerl (via logerrit)
 sc/qa/unit/ThemeImportExportTest.cxx   |   34 +--
 sc/qa/unit/subsequent_export_test4.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 42bbc9fbdf940e55213ee2a259c1d31de2e4cbec
Author: Tomaž Vajngerl 
AuthorDate: Sat Jul 1 14:26:08 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Tue Jul 4 08:42:51 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 

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)
 auto& rTransformations = aComplexColor.getTransformations();
 CPPUNIT_ASSERT_EQUAL(size_t(2), rTransformations.size());
 CPPUNIT_ASSERT_EQUAL(model::TransformationType::LumMod, 

[Libreoffice-commits] core.git: sc/qa

2023-07-01 Thread Tomaž Vajngerl (via logerrit)
 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 f0c8ccaef39dc7cb876e00679f70c36ca60883d9
Author: Tomaž Vajngerl 
AuthorDate: Thu Jun 29 16:51:26 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Sat Jul 1 08:54:03 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 

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, );
+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, );
+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, );
+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, 
rTransformations[1].meType);
+CPPUNIT_ASSERT_EQUAL(sal_Int16(3999), rTransformations[1].mnValue);
+}
+
+// B3
+{
+const ScPatternAttr* pPattern = pDoc->GetPattern(1, 2, 0);
+const SfxPoolItem* 

[Libreoffice-commits] core.git: sc/qa sc/source

2023-06-27 Thread luigiiucci (via logerrit)
 sc/qa/unit/helper/qahelper.cxx   |   38 ++
 sc/source/core/data/dpoutput.cxx |6 +-
 2 files changed, 43 insertions(+), 1 deletion(-)

New commits:
commit 3551d18404cb19cdaa8edb170a549f5c5405d0cb
Author: luigiiucci 
AuthorDate: Wed May 17 11:02:37 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Wed Jun 28 02:07:03 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 

diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 890a330f147d..eff2c62d9aeb 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -481,6 +482,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 00d8f2aabeb4..c964dda14c7a 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: sc/qa sc/source

2023-06-27 Thread Tibor Nagy (via logerrit)
 sc/qa/uitest/calc_tests8/tdf54768.py |   32 
 sc/qa/uitest/data/tdf54768.ods   |binary
 sc/source/ui/view/drawvie4.cxx   |   16 
 3 files changed, 36 insertions(+), 12 deletions(-)

New commits:
commit f5bf91ea73bf8a7cd3abc0f343ab2bdceaad905a
Author: Tibor Nagy 
AuthorDate: Thu Jun 22 09:53:59 2023 +0200
Commit: László Németh 
CommitDate: Tue Jun 27 14:18:42 2023 +0200

tdf#54768 sc: fix resizing of cropped images to original size

This is a follow up to commit a4e12cbfc69cfe668fa30756a3c5843e911e22b1
(tdf#155863 sd: fix resizing of cropped images to original size)

Change-Id: I923ed8b1df6c6559d527d43e4abe842497c4c28f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153449
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/uitest/calc_tests8/tdf54768.py 
b/sc/qa/uitest/calc_tests8/tdf54768.py
new file mode 100644
index ..a4342fb8e238
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf54768.py
@@ -0,0 +1,32 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf54768(UITestCase):
+def test_tdf54768(self):
+# This document contains an image with an original size of 7.99cm x 
5.74cm.
+# The image has been cropped 2.73cm at the top.
+# Also, it has been resized to a width of 4.04cm.
+with self.ui_test.load_file(get_url_for_data_file("tdf54768.ods")) as 
document:
+xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+# select the image
+xGridWin.executeAction("SELECT", 
mkPropertyValues({"OBJECT":"Image"}))
+
+# click "Original Size"
+self.xUITest.executeCommand(".uno:OriginalSize")
+
+# tdf#155863: Without the fix in place, the image stays cropped,
+# but stretches to the size of original image
+self.assertEqual(7988, 
document.DrawPages[0].getByIndex(0).Size.Width)
+self.assertEqual(3005, 
document.DrawPages[0].getByIndex(0).Size.Height)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf54768.ods b/sc/qa/uitest/data/tdf54768.ods
new file mode 100644
index ..222481db8bb0
Binary files /dev/null and b/sc/qa/uitest/data/tdf54768.ods differ
diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx
index 5cc1655b83c4..2bd329098206 100644
--- a/sc/source/ui/view/drawvie4.cxx
+++ b/sc/source/ui/view/drawvie4.cxx
@@ -476,9 +476,9 @@ void ScDrawView::SetMarkedOriginalSize()
 }
 else if (nIdent == SdrObjKind::Graphic)
 {
-const Graphic& rGraphic = 
static_cast(pObj)->GetGraphic();
+const SdrGrafObj* pSdrGrafObj = static_cast(pObj);
 
-MapMode aSourceMap = rGraphic.GetPrefMapMode();
+MapMode aSourceMap = pSdrGrafObj->GetGraphic().GetPrefMapMode();
 MapMode aDestMap( MapUnit::Map100thMM );
 if (aSourceMap.GetMapUnit() == MapUnit::MapPixel)
 {
@@ -488,16 +488,8 @@ void ScDrawView::SetMarkedOriginalSize()
 aDestMap.SetScaleX(aNormScaleX);
 aDestMap.SetScaleY(aNormScaleY);
 }
-if (pViewData)
-{
-vcl::Window* pActWin = pViewData->GetActiveWin();
-if (pActWin)
-{
-aOriginalSize = pActWin->LogicToLogic(
-rGraphic.GetPrefSize(), , 
 );
-bDo = true;
-}
-}
+aOriginalSize = pSdrGrafObj->getOriginalSize();
+bDo = true;
 }
 
 if ( bDo )


[Libreoffice-commits] core.git: sc/qa sc/source

2023-06-27 Thread Tibor Nagy (via logerrit)
 sc/qa/unit/data/xlsx/tdf156028.xlsx|binary
 sc/qa/unit/subsequent_filters_test.cxx |   11 +++
 sc/source/core/data/colorscale.cxx |2 +-
 3 files changed, 12 insertions(+), 1 deletion(-)

New commits:
commit 3e0537a6e746db6ea746af6b91f94aeb9d2b05d9
Author: Tibor Nagy 
AuthorDate: Mon Jun 26 11:35:38 2023 +0200
Commit: László Németh 
CommitDate: Tue Jun 27 14:09:27 2023 +0200

tdf#156028 sc: use color of the highest value if only one value

(in a single cell or the same value repeating in all cells of the
data set) on percentile color scale, like other spreadsheets do.

This is a follow up to commit 6a059f8d1b0a7a5b64bd272e1e7b8291979bcd56
(tdf#155321 sc: fix color of the highest value on percentile color scale
if the highest value occurs multiple times in the data set.)

Change-Id: I630df332e403705e8338e3441af093c2de95c280
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153577
Reviewed-by: László Németh 
Tested-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/tdf156028.xlsx 
b/sc/qa/unit/data/xlsx/tdf156028.xlsx
new file mode 100644
index ..6fc2fc814fe3
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf156028.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index f633073c85f9..d02ebc075e3e 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -134,6 +134,17 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, 
testTdf155321_CondFormatColor_XLSX)
 CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf156028_ColorScale_XLSX)
+{
+createScDoc("xlsx/tdf156028.xlsx");
+
+ScDocument* pDoc = getScDoc();
+ScConditionalFormat* pCondFormat = pDoc->GetCondFormat(0, 0, 0);
+ScRefCellValue aCellA1(*pDoc, ScAddress(0, 0, 0));
+Color aColor = pCondFormat->GetData(aCellA1, ScAddress(0, 0, 
0)).mxColorScale.value();
+CPPUNIT_ASSERT_EQUAL(Color(99, 190, 123), aColor);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest, testTdf138601_CondFormatXLSX)
 {
 createScDoc("xlsx/tdf138601.xlsx");
diff --git a/sc/source/core/data/colorscale.cxx 
b/sc/source/core/data/colorscale.cxx
index 4e61dbdbc228..20ea2b5186f6 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -647,7 +647,7 @@ std::optional ScColorScaleFormat::GetColor( const 
ScAddress& rAddr ) cons
 calcMinMax(nMin, nMax);
 
 // this check is for safety
-if(nMin >= nMax)
+if(nMin > nMax)
 return std::optional();
 
 ScColorScaleEntries::const_iterator itr = begin();


[Libreoffice-commits] core.git: sc/qa

2023-06-22 Thread Henry Castro (via logerrit)
 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   |   33 ++
 3 files changed, 33 insertions(+)

New commits:
commit 0533b51dbe13838d2bffdf59fdf6fcfe36c4a451
Author: Henry Castro 
AuthorDate: Tue Feb 28 09:57:07 2023 -0400
Commit: Henry Castro 
CommitDate: Fri Jun 23 03:22:23 2023 +0200

sc: qa: filter: add import excel unit test

single line.

Change-Id: I2d76f54e0ccf943794bd817b2e80583b8dd69558
Signed-off-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148005
Tested-by: Jenkins CollaboraOffice 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153473
Tested-by: Jenkins

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 a00558730d0b..a0a4a92d299b 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -1580,6 +1580,39 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, testNamedTableRef)
 }
 }
 
+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());
+}
+}
+}
+
+CPPUNIT_TEST_FIXTURE(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_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sc/qa sc/source

2023-06-17 Thread Balazs Varga (via logerrit)
 sc/qa/unit/data/xlsx/tdf155402.xlsx |binary
 sc/qa/unit/subsequent_filters_test4.cxx |   13 
 sc/source/core/tool/interpr1.cxx|   50 +++-
 3 files changed, 56 insertions(+), 7 deletions(-)

New commits:
commit 5c7196acbdd949005c1b52aeab34b5448e09011e
Author: Balazs Varga 
AuthorDate: Wed Jun 14 23:01:26 2023 +0200
Commit: Balazs Varga 
CommitDate: Sat Jun 17 15:59:02 2023 +0200

tdf#155402 - sc improving CELL() function return value in case of OOXML

In case of Excel/OOXML formula syntax:
Before the patch =CELL("FILENAME";D2) returns 
'file:///X:/dr/own.ods'#$Sheet1
After the patch =CELL("FILENAME";D2) returns file:///X:/dr/[own.ods]Sheet1

Change-Id: I34c805aef813632c45ac3fe930d690ae3c1d5d96
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153098
Tested-by: Jenkins
Reviewed-by: Balazs Varga 

diff --git a/sc/qa/unit/data/xlsx/tdf155402.xlsx 
b/sc/qa/unit/data/xlsx/tdf155402.xlsx
new file mode 100644
index ..c1f73562547f
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf155402.xlsx differ
diff --git a/sc/qa/unit/subsequent_filters_test4.cxx 
b/sc/qa/unit/subsequent_filters_test4.cxx
index d6b853607e51..646b1e66f5b7 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -1905,6 +1905,19 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testForcepoint107)
 pDocSh->DoHardRecalc();
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testTdf155402)
+{
+createScDoc("xlsx/tdf155402.xlsx");
+ScDocument* pDoc = getScDoc();
+
+// Before the fix =CELL("FILENAME"; D2) returns 
'file:///X:/dr/own.ods'#$Sheet1
+// After the fix =CELL("FILENAME"; D2) returns file 
:///X:/dr/[own.ods]Sheet1
+OUString aFilename = pDoc->GetString(1, 0, 0);
+sal_Int32 nPos = aFilename.lastIndexOf('/');
+aFilename = OUString::Concat(aFilename.subView(nPos));
+CPPUNIT_ASSERT_EQUAL(OUString("/[tdf155402.xlsx]Sheet1"), aFilename);
+}
+
 ScFiltersTest4::ScFiltersTest4()
 : ScModelTestBase("sc/qa/unit/data")
 {
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 2f48398827ed..bf8c89d0d125 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -2331,7 +2331,7 @@ void ScInterpreter::ScCell()
 PushString(aStr);
 }
 else if( aInfoType == "FILENAME" )
-{   // file name and table name: 'FILENAME'#$TABLE
+{
 SCTAB nTab = aCellPos.Tab();
 OUString aFuncResult;
 if( nTab < mrDoc.GetTableCount() )
@@ -2346,9 +2346,27 @@ void ScInterpreter::ScCell()
 const INetURLObject& rURLObj = 
pShell->GetMedium()->GetURLObject();
 OUString aTabName;
 mrDoc.GetName( nTab, aTabName );
-aFuncResult = "'"
-+ 
rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous)
-+ "'#$" + aTabName;
+
+FormulaGrammar::AddressConvention eConv = 
maCalcConfig.meStringRefAddressSyntax;
+if (eConv == FormulaGrammar::CONV_UNSPECIFIED)
+eConv = mrDoc.GetAddressConvention();
+
+if (eConv == FormulaGrammar::CONV_XL_A1 ||
+eConv == FormulaGrammar::CONV_XL_R1C1 ||
+eConv == FormulaGrammar::CONV_XL_OOX)
+{
+// file name and table name: 
FILEPATH/[FILENAME]TABLE
+aFuncResult = rURLObj.GetPartBeforeLastName()
++ "[" + 
rURLObj.GetLastName(INetURLObject::DecodeMechanism::Unambiguous)
++ "]" + aTabName;
+}
+else
+{
+// file name and table name: 
'FILEPATH/FILENAME'#$TABLE
+aFuncResult = "'"
++ 
rURLObj.GetMainURL(INetURLObject::DecodeMechanism::Unambiguous)
++ "'#$" + aTabName;
+}
 }
 }
 }
@@ -2515,8 +2533,6 @@ void ScInterpreter::ScCellExternal()
 }
 else if ( aInfoType == "FILENAME" )
 {
-// 'file URI'#$SheetName
-
 const OUString* p = pRefMgr->getExternalFileName(nFileId);
 if (!p)
 {
@@ -2525,7 +2541,27 @@ void ScInterpreter::ScCellExternal()
 return;
 }
 
-OUString aBuf = "'" + *p + "'#$" + aTabName;
+OUString aBuf;
+FormulaGrammar::AddressConvention eConv = 
maCalcConfig.meStringRefAddressSyntax;
+if (eConv == FormulaGrammar::CONV_UNSPECIFIED)
+eConv = mrDoc.GetAddressConvention();
+
+if (eConv == FormulaGrammar::CONV_XL_A1 ||
+eConv 

[Libreoffice-commits] core.git: sc/qa

2023-06-15 Thread Henry Castro (via logerrit)
 sc/qa/unit/data/xlsx/condformat_databar.xlsx |binary
 sc/qa/unit/subsequent_filters_test.cxx   |   21 +
 2 files changed, 21 insertions(+)

New commits:
commit 02ba31714a5f72495df203833ec9772b380b1b77
Author: Henry Castro 
AuthorDate: Fri Mar 17 15:49:45 2023 -0400
Commit: Henry Castro 
CommitDate: Thu Jun 15 22:43:30 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 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153120
Tested-by: Jenkins

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 d206ce2cbf69..f633073c85f9 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -1639,6 +1639,27 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, 
testRowIndex1BasedXLSX)
 CPPUNIT_ASSERT_EQUAL(OUString("Third line."), aStr);
 }
 
+CPPUNIT_TEST_FIXTURE(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(0.0, pLower->GetValue());
+CPPUNIT_ASSERT_EQUAL(1.0, pUpper->GetValue());
+}
+
 ScFiltersTest::ScFiltersTest()
 : ScModelTestBase("sc/qa/unit/data")
 {


[Libreoffice-commits] core.git: sc/qa

2023-06-12 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/autofilter2/tdf153972.py  |6 +++---
 sc/qa/uitest/autofilter2/tdf95520.py   |2 --
 sc/qa/uitest/data/autofilter/tdf153972.ods |binary
 3 files changed, 3 insertions(+), 5 deletions(-)

New commits:
commit 15a88c00ef4b48009abff781d960c84d6d878ecc
Author: Xisco Fauli 
AuthorDate: Mon Jun 12 13:05:56 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 12 15:51:48 2023 +0200

sc: uitest: fix sporadic test failures

Sometimes theses tests fail with

==
FAIL: test_tdf153972 (tdf153972.tdf153972)
--
Traceback (most recent call last):
  File 
"/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64_branch/sc/qa/uitest/autofilter2/tdf153972.py",
 line 37, in test_tdf153972
self.assertEqual('Lime', 
get_state_as_dict(xSubMenu.getChild('0'))['Text'])
AssertionError: 'Lime' != '#81D41A'
- Lime
+ #81D41A

==
FAIL: test_tdf95520 (tdf95520.tdf95520)
--
Traceback (most recent call last):
  File 
"/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64_branch/sc/qa/uitest/autofilter2/tdf95520.py",
 line 36, in test_tdf95520
self.assertEqual('Red', 
get_state_as_dict(xSubMenu.getChild('1'))['Text'])
AssertionError: 'Red' != '#FF'
- Red
+ #FF

See 
https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil_branch/10807/consoleFull#4610001379567f988-cbcf-4519-af05-6000b834f13f

and I believe the reason is the color palette fails to load in
sc/source/ui/view/gridwin.cxx:752 and then its not able to
translate #81D41A to Lime.
Adapt the test and document to use colors without a color name

Change-Id: Ie1119fe0ff31147b5395076969e41481706d8dfb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152897
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter2/tdf153972.py 
b/sc/qa/uitest/autofilter2/tdf153972.py
index 1697300c95a4..423f9db185ef 100644
--- a/sc/qa/uitest/autofilter2/tdf153972.py
+++ b/sc/qa/uitest/autofilter2/tdf153972.py
@@ -34,9 +34,9 @@ class tdf153972(UITestCase):
 # Without the fix in place, this test would have failed with
 # AssertionError: 4 != 0
 self.assertEqual(4, len(xSubMenu.getChildren()))
-self.assertEqual('Lime', 
get_state_as_dict(xSubMenu.getChild('0'))['Text'])
-self.assertEqual('Red', 
get_state_as_dict(xSubMenu.getChild('1'))['Text'])
-self.assertEqual('Yellow', 
get_state_as_dict(xSubMenu.getChild('2'))['Text'])
+self.assertEqual('#7FD41A', 
get_state_as_dict(xSubMenu.getChild('0'))['Text'])
+self.assertEqual('#FE', 
get_state_as_dict(xSubMenu.getChild('1'))['Text'])
+self.assertEqual('#FEFF00', 
get_state_as_dict(xSubMenu.getChild('2'))['Text'])
 self.assertEqual('No Fill', 
get_state_as_dict(xSubMenu.getChild('3'))['Text'])
 
 # Choose Red
diff --git a/sc/qa/uitest/autofilter2/tdf95520.py 
b/sc/qa/uitest/autofilter2/tdf95520.py
index 33b9e1948b9a..c5339c3f8db0 100644
--- a/sc/qa/uitest/autofilter2/tdf95520.py
+++ b/sc/qa/uitest/autofilter2/tdf95520.py
@@ -33,9 +33,7 @@ class tdf95520(UITestCase):
 self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('0'))['IsChecked'])
 self.assertEqual('#00FF00', 
get_state_as_dict(xSubMenu.getChild('0'))['Text'])
 self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('1'))['IsChecked'])
-self.assertEqual('Red', 
get_state_as_dict(xSubMenu.getChild('1'))['Text'])
 self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('2'))['IsChecked'])
-self.assertEqual('Yellow', 
get_state_as_dict(xSubMenu.getChild('2'))['Text'])
 
 # Choose Red
 xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"DOWN"}))
diff --git a/sc/qa/uitest/data/autofilter/tdf153972.ods 
b/sc/qa/uitest/data/autofilter/tdf153972.ods
index e720419bda2e..e60828be9c8b 100644
Binary files a/sc/qa/uitest/data/autofilter/tdf153972.ods and 
b/sc/qa/uitest/data/autofilter/tdf153972.ods differ


[Libreoffice-commits] core.git: sc/qa sfx2/source

2023-06-11 Thread Caolán McNamara (via logerrit)
 sc/qa/unit/tiledrendering/tiledrendering.cxx |3 ++-
 sfx2/source/appl/appserv.cxx |4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit d5a973fee90820b529e5fbafbef35917625ffd19
Author: Caolán McNamara 
AuthorDate: Fri Jun 9 15:27:12 2023 +0100
Commit: Caolán McNamara 
CommitDate: Sun Jun 11 22:16:30 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/+/152799
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 6eb2aa134e69..fd2413e9f0af 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -3058,9 +3058,10 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, 
testUndoReorderingMulti)
 
 CPPUNIT_TEST_FIXTURE(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 7b233434dc57..2d57c7e562dc 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -583,8 +583,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: sc/qa

2023-06-05 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/autofilter2/tdf153972.py  |   60 +
 sc/qa/uitest/data/autofilter/tdf153972.ods |binary
 2 files changed, 60 insertions(+)

New commits:
commit bdad6055eb32fa6e7ee9e43cf1a54edbd2318fcd
Author: Xisco Fauli 
AuthorDate: Mon Jun 5 14:17:07 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 5 16:53:20 2023 +0200

tdf#153972: sc: Add UItest

Change-Id: I7479be100d2c0abd9484a4095b3b2acf958beffd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152616
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter2/tdf153972.py 
b/sc/qa/uitest/autofilter2/tdf153972.py
new file mode 100644
index ..1697300c95a4
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf153972.py
@@ -0,0 +1,60 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position, is_row_hidden
+
+class tdf153972(UITestCase):
+def test_tdf153972(self):
+
+with self.ui_test.load_file(get_url_for_data_file("tdf153972.ods")) as 
doc:
+calcDoc = self.xUITest.getTopFocusWindow()
+xGridWin = calcDoc.getChild("grid_window")
+
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xMenu = xFloatWindow.getChild("menu")
+
+# Filter by Color
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+xSubFloatWindow = self.xUITest.getFloatWindow()
+xSubMenu = xSubFloatWindow.getChild("background")
+
+# Without the fix in place, this test would have failed with
+# AssertionError: 4 != 0
+self.assertEqual(4, len(xSubMenu.getChildren()))
+self.assertEqual('Lime', 
get_state_as_dict(xSubMenu.getChild('0'))['Text'])
+self.assertEqual('Red', 
get_state_as_dict(xSubMenu.getChild('1'))['Text'])
+self.assertEqual('Yellow', 
get_state_as_dict(xSubMenu.getChild('2'))['Text'])
+self.assertEqual('No Fill', 
get_state_as_dict(xSubMenu.getChild('3'))['Text'])
+
+# Choose Red
+xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"DOWN"}))
+xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"RETURN"}))
+
+self.assertTrue(is_row_hidden(doc, 1))
+self.assertTrue(is_row_hidden(doc, 2))
+self.assertTrue(is_row_hidden(doc, 3))
+self.assertTrue(is_row_hidden(doc, 4))
+self.assertTrue(is_row_hidden(doc, 5))
+self.assertFalse(is_row_hidden(doc, 6))
+self.assertTrue(is_row_hidden(doc, 7))
+self.assertTrue(is_row_hidden(doc, 8))
+self.assertFalse(is_row_hidden(doc, 9))
+self.assertTrue(is_row_hidden(doc, 10))
+self.assertFalse(is_row_hidden(doc, 11))
+self.assertTrue(is_row_hidden(doc, 12))
+self.assertFalse(is_row_hidden(doc, 13))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/autofilter/tdf153972.ods 
b/sc/qa/uitest/data/autofilter/tdf153972.ods
new file mode 100644
index ..e720419bda2e
Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf153972.ods differ


[Libreoffice-commits] core.git: sc/qa

2023-06-05 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/calc_tests8/tdf132026.py |   44 ---
 sc/qa/unit/uicalc/uicalc.cxx  |   48 ++
 2 files changed, 48 insertions(+), 44 deletions(-)

New commits:
commit b0d49beb1b9b875e82c98439587fcf37b56050b4
Author: Xisco Fauli 
AuthorDate: Mon Jun 5 13:03:04 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon Jun 5 15:32:37 2023 +0200

tdf#132026: sc: move UItest to CppUnittest

Change-Id: I4a8b40c1618421a0c1775d0585c53d90196f0937
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152608
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/calc_tests8/tdf132026.py 
b/sc/qa/uitest/calc_tests8/tdf132026.py
deleted file mode 100644
index abd3a86e720b..
--- a/sc/qa/uitest/calc_tests8/tdf132026.py
+++ /dev/null
@@ -1,44 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
-#
-
-from uitest.framework import UITestCase
-from uitest.uihelper.common import get_url_for_data_file
-from libreoffice.calc.document import get_cell_by_position
-from libreoffice.uno.propertyvalue import mkPropertyValues
-
-class tdf132026(UITestCase):
-
-def test_tdf132026(self):
-with self.ui_test.load_file(get_url_for_data_file("tdf132026.ods")) as 
calc_doc:
-MainWindow = self.xUITest.getTopFocusWindow()
-grid_window = MainWindow.getChild("grid_window")
-
-chars=["=","+","-"]
-directions=["UP","DOWN","LEFT","RIGHT"]
-
-# format general, should select cell
-for c in chars:
-sign=-1 if c=="-" else 1
-for i,direction in enumerate(directions):
-grid_window.executeAction("SELECT", 
mkPropertyValues({"CELL": "B2"}))
-grid_window.executeAction("TYPE", 
mkPropertyValues({"TEXT": c}))
-grid_window.executeAction("TYPE", 
mkPropertyValues({"KEYCODE": direction}))
-grid_window.executeAction("TYPE", 
mkPropertyValues({"KEYCODE": "RETURN"}))
-self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 
1).getString(), str(sign*(i+1)))
-
-# format text, shouldn't select cell
-for c in chars:
-for direction in directions:
-grid_window.executeAction("SELECT", 
mkPropertyValues({"CELL": "E2"}))
-grid_window.executeAction("TYPE", 
mkPropertyValues({"TEXT": c}))
-grid_window.executeAction("TYPE", 
mkPropertyValues({"KEYCODE": direction}))
-grid_window.executeAction("TYPE", 
mkPropertyValues({"KEYCODE": "RETURN"}))
-self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 
1).getString(), c)
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf132026.ods 
b/sc/qa/unit/uicalc/data/tdf132026.ods
similarity index 100%
rename from sc/qa/uitest/data/tdf132026.ods
rename to sc/qa/unit/uicalc/data/tdf132026.ods
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index 820f44ad4604..89bdeeb1fa6d 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -715,6 +715,54 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124820)
  aFont.GetStrikeout());
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf132026)
+{
+createScDoc("tdf132026.ods");
+ScDocument* pDoc = getScDoc();
+std::vector aChars{ u"=", u"+", u"-" };
+std::vector aDirections{ KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT 
};
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+for (auto aChar = aChars.begin(); aChar != aChars.end(); ++aChar)
+{
+for (size_t i = 0; i < aDirections.size(); ++i)
+{
+goToCell("B2");
+typeString(*aChar);
+
+sal_uInt16 nDir = aDirections[i];
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, nDir);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, nDir);
+Scheduler::ProcessEventsToIdle();
+
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, 
awt::Key::RETURN);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN);
+Scheduler::ProcessEventsToIdle();
+
+sal_Int16 nSign = (*aChar == u"-") ? -1 : 1;
+sal_Int16 nExpected = nSign * (i + 1);
+OUString sExpectedResult = OUString::number(nExpected);
+CPPUNIT_ASSERT_EQUAL(sExpectedResult, pDoc->GetString(ScAddress(1, 
1, 0)));
+
+goToCell("E2");
+typeString(*aChar);
+
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, nDir);
+

[Libreoffice-commits] core.git: sc/qa sc/source

2023-06-02 Thread Baole Fang (via logerrit)
 sc/qa/uitest/calc_tests8/tdf132026.py |   44 ++
 sc/qa/uitest/data/tdf132026.ods   |binary
 sc/source/ui/view/tabvwsha.cxx|   12 ++---
 3 files changed, 53 insertions(+), 3 deletions(-)

New commits:
commit 0450c7177f61ba5be15f7b4175b9fb5e89f850ae
Author: Baole Fang 
AuthorDate: Sun May 28 10:28:24 2023 -0400
Commit: Mike Kaganski 
CommitDate: Fri Jun 2 20:02:39 2023 +0200

tdf#132026: Fix selection in text cell

Change-Id: Ic2bf869efa198cba83d1b781b419c3a9e0e606f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152356
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/uitest/calc_tests8/tdf132026.py 
b/sc/qa/uitest/calc_tests8/tdf132026.py
new file mode 100644
index ..abd3a86e720b
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf132026.py
@@ -0,0 +1,44 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf132026(UITestCase):
+
+def test_tdf132026(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf132026.ods")) as 
calc_doc:
+MainWindow = self.xUITest.getTopFocusWindow()
+grid_window = MainWindow.getChild("grid_window")
+
+chars=["=","+","-"]
+directions=["UP","DOWN","LEFT","RIGHT"]
+
+# format general, should select cell
+for c in chars:
+sign=-1 if c=="-" else 1
+for i,direction in enumerate(directions):
+grid_window.executeAction("SELECT", 
mkPropertyValues({"CELL": "B2"}))
+grid_window.executeAction("TYPE", 
mkPropertyValues({"TEXT": c}))
+grid_window.executeAction("TYPE", 
mkPropertyValues({"KEYCODE": direction}))
+grid_window.executeAction("TYPE", 
mkPropertyValues({"KEYCODE": "RETURN"}))
+self.assertEqual(get_cell_by_position(calc_doc, 0, 1, 
1).getString(), str(sign*(i+1)))
+
+# format text, shouldn't select cell
+for c in chars:
+for direction in directions:
+grid_window.executeAction("SELECT", 
mkPropertyValues({"CELL": "E2"}))
+grid_window.executeAction("TYPE", 
mkPropertyValues({"TEXT": c}))
+grid_window.executeAction("TYPE", 
mkPropertyValues({"KEYCODE": direction}))
+grid_window.executeAction("TYPE", 
mkPropertyValues({"KEYCODE": "RETURN"}))
+self.assertEqual(get_cell_by_position(calc_doc, 0, 4, 
1).getString(), c)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf132026.ods b/sc/qa/uitest/data/tdf132026.ods
new file mode 100644
index ..03c6c654fdc5
Binary files /dev/null and b/sc/qa/uitest/data/tdf132026.ods differ
diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx
index 4021f1937f91..f1305672a096 100644
--- a/sc/source/ui/view/tabvwsha.cxx
+++ b/sc/source/ui/view/tabvwsha.cxx
@@ -640,13 +640,19 @@ bool ScTabViewShell::IsRefInputMode() const
 ScInputHandler* pHdl = pScMod->GetInputHdl();
 if ( pHdl )
 {
+const ScViewData& rViewData = GetViewData();
+ScDocument& rDoc = rViewData.GetDocument();
+const ScAddress aPos( rViewData.GetCurPos() );
+const sal_uInt32 nIndex = rDoc.GetAttr(aPos, ATTR_VALUE_FORMAT 
)->GetValue();
+const SvNumFormatType nType = 
rDoc.GetFormatTable()->GetType(nIndex);
+if (nType == SvNumFormatType::TEXT)
+{
+return false;
+}
 OUString aString = pHdl->GetEditString();
 if ( !pHdl->GetSelIsRef() && aString.getLength() > 1 &&
  ( aString[0] == '+' || aString[0] == '-' ) )
 {
-const ScViewData& rViewData = GetViewData();
-ScDocument& rDoc = rViewData.GetDocument();
-const ScAddress aPos( rViewData.GetCurPos() );
 ScCompiler aComp( rDoc, aPos, rDoc.GetGrammar() );
 aComp.SetCloseBrackets( false );
 std::unique_ptr 
pArr(aComp.CompileString(aString));


[Libreoffice-commits] core.git: sc/qa sc/source

2023-06-02 Thread Baole Fang (via logerrit)
 sc/qa/uitest/calc_tests8/tdf131638.py |   26 ++
 sc/qa/uitest/data/tdf131638.ods   |binary
 sc/source/ui/view/viewfunc.cxx|   10 +-
 3 files changed, 31 insertions(+), 5 deletions(-)

New commits:
commit 730e6fa063fccbd12913362dd5d3c74ea14957be
Author: Baole Fang 
AuthorDate: Sat May 27 21:05:01 2023 -0400
Commit: Mike Kaganski 
CommitDate: Fri Jun 2 10:22:10 2023 +0200

tdf#131638: Fix text cell incorrect formula

Change-Id: I086f077540f52c6ed5fb4df9f0ea64aa95aea152
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152348
Tested-by: Jenkins
Reviewed-by: Mike Kaganski 

diff --git a/sc/qa/uitest/calc_tests8/tdf131638.py 
b/sc/qa/uitest/calc_tests8/tdf131638.py
new file mode 100644
index ..bafbfc5d8567
--- /dev/null
+++ b/sc/qa/uitest/calc_tests8/tdf131638.py
@@ -0,0 +1,26 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+class tdf137726(UITestCase):
+
+def test_tdf137726(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf131638.ods")) as 
calc_doc:
+MainWindow = self.xUITest.getTopFocusWindow()
+grid_window = MainWindow.getChild("grid_window")
+grid_window.executeAction("SELECT", mkPropertyValues({"CELL": 
"A1"}))
+grid_window.executeAction("TYPE", mkPropertyValues({"TEXT": 
"-/2"}))
+grid_window.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
+self.assertEqual(get_cell_by_position(calc_doc, 0, 0, 
0).getString(), "-/2")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf131638.ods b/sc/qa/uitest/data/tdf131638.ods
new file mode 100644
index ..a66a7e9c9de9
Binary files /dev/null and b/sc/qa/uitest/data/tdf131638.ods differ
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 78080364e928..bc149f62b40e 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -408,8 +408,11 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB 
nTab,
 
 bool bFormula = false;
 
+// do not check formula if it is a text cell
+sal_uInt32 format = rDoc.GetNumberFormat( nCol, nRow, nTab );
+SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
 // a single '=' character is handled as string (needed for special filters)
-if ( rString.getLength() > 1 )
+if ( pFormatter->GetType(format) != SvNumFormatType::TEXT && 
rString.getLength() > 1 )
 {
 if ( rString[0] == '=' )
 {
@@ -431,10 +434,8 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB 
nTab,
 // is non-empty and not a number, handle as formula
 if ( aString.getLength() > 1 )
 {
-sal_uInt32 nFormat = rDoc.GetNumberFormat( nCol, nRow, nTab );
-SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
 double fNumber = 0;
-if ( !pFormatter->IsNumberFormat( aString, nFormat, fNumber ) )
+if ( !pFormatter->IsNumberFormat( aString, format, fNumber ) )
 {
 bFormula = true;
 }
@@ -568,7 +569,6 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB 
nTab,
 
 ScFormulaCell aCell(rDoc, aPos, std::move( pArr ), 
formula::FormulaGrammar::GRAM_DEFAULT, ScMatrixMode::NONE);
 
-SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
 for (const auto& rTab : rMark)
 {
 i = rTab;


[Libreoffice-commits] core.git: sc/qa sc/source

2023-06-02 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/ucalc.cxx   |4 
 sc/source/core/data/table1.cxx |6 ++
 2 files changed, 6 insertions(+), 4 deletions(-)

New commits:
commit 8731701481de649a65d59e018d0ba0c381f670c3
Author: Xisco Fauli 
AuthorDate: Tue May 30 11:34:21 2023 +0200
Commit: Noel Grandin 
CommitDate: Fri Jun 2 08:04:19 2023 +0200

sc: fix bug in GetPrintAreaVer

it should return false when checking a non-exising column.
Since ad2bc869bfe2d34bde7d42e10593db1c5ffccc2a
"tdf#50916 : Refactor table1.cxx wherever there is column access"

Change-Id: I01a53f5fec7e2029badc5c23c1e26fc0723ba0ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152386
Tested-by: Jenkins
Reviewed-by: Noel Grandin 

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index a1951cdc5b95..f966fdecea18 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5269,6 +5269,10 @@ CPPUNIT_TEST_FIXTURE(Test, testAreasWithNotes)
 CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer found", dataFound);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row for notes", 
static_cast(2), row);
 
+dataFound = m_pDoc->GetPrintAreaVer(0,20,21,row, bNotes); // cols 20 & 21
+CPPUNIT_ASSERT_MESSAGE("PrintAreaVer found", !dataFound);
+CPPUNIT_ASSERT_EQUAL_MESSAGE("PrintAreaVer wrong row for notes", 
static_cast(0), row);
+
 bNotes = false;
 dataFound = m_pDoc->GetPrintAreaVer(0,0,1,row, bNotes); // col 0 & 1
 CPPUNIT_ASSERT_MESSAGE("No PrintAreaVer should be found", !dataFound);
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 6cb5384c05f9..99e0c5f39b0d 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -756,13 +756,11 @@ bool ScTable::GetPrintAreaHor( SCROW nStartRow, SCROW 
nEndRow,
 bool ScTable::GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol,
 SCROW& rEndRow, bool bNotes ) const
 {
-nStartCol = std::min( nStartCol, aCol.size()-1 );
-nEndCol   = std::min( nEndCol,   aCol.size()-1 );
 bool bFound = false;
 SCROW nMaxY = 0;
 SCCOL i;
 
-for (i=nStartCol; i<=nEndCol; i++)  // Test attribute
+for (i=nStartCol; i<=nEndCol && i < aCol.size(); i++)  // Test 
attribute
 {
 SCROW nLastRow;
 if (aCol[i].GetLastVisibleAttr( nLastRow ))
@@ -773,7 +771,7 @@ bool ScTable::GetPrintAreaVer( SCCOL nStartCol, SCCOL 
nEndCol,
 }
 }
 
-for (i=nStartCol; i<=nEndCol; i++)  // Test data
+for (i=nStartCol; i<=nEndCol && i < aCol.size(); i++)  // Test 
data
 {
 if (!aCol[i].IsEmptyData())
 {


[Libreoffice-commits] core.git: sc/qa

2023-06-01 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/calc_tests9/tdf154174.py |   35 --
 sc/qa/unit/uicalc/uicalc.cxx  |   32 +++
 2 files changed, 32 insertions(+), 35 deletions(-)

New commits:
commit b6b28854c77731f7506b2551dc5dd47f798ca946
Author: Xisco Fauli 
AuthorDate: Thu Jun 1 11:52:52 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu Jun 1 14:27:40 2023 +0200

tdf#154174: sc: move UItest to CppUnittest

Change-Id: I62e1e9a0dbcbea509d5d9a9b493c2484dc373854
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152483
Reviewed-by: László Németh 
Tested-by: Jenkins

diff --git a/sc/qa/uitest/calc_tests9/tdf154174.py 
b/sc/qa/uitest/calc_tests9/tdf154174.py
deleted file mode 100644
index 3cb0da9ea2a3..
--- a/sc/qa/uitest/calc_tests9/tdf154174.py
+++ /dev/null
@@ -1,35 +0,0 @@
-# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
-#
-from uitest.framework import UITestCase
-from libreoffice.uno.propertyvalue import mkPropertyValues
-from libreoffice.calc.document import get_cell_by_position
-from uitest.uihelper.calc import enter_text_to_cell
-
-#Bug 154174 - empty edit cell after fill (Ctrl+Shft+Y)
-
-class tdf154174(UITestCase):
-def test_tdf154174_repeat_empty(self):
-with self.ui_test.create_doc_in_start_center("calc") as document:
-xCalcDoc = self.xUITest.getTopFocusWindow()
-gridwin = xCalcDoc.getChild("grid_window")
-# enter data
-enter_text_to_cell(gridwin, "A1", "")
-# focus on A2
-gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
-# repeat (Ctrl+Shft+Y)
-gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"SHIFT+CTRL+Y"}))
-# edit A2 data
-gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F2"}))
-# if is empty, then erased, else unchanged
-gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DELETE"}))
-gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
-# test A2
-self.assertEqual(get_cell_by_position(document, 0, 0, 
1).getString(), "")
-
-# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index b6a0db8bcd74..820f44ad4604 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -594,6 +594,38 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf56036)
 CPPUNIT_ASSERT_EQUAL(OUString("6"), pDoc->GetString(ScAddress(0, 0, 0)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf154174_repeat_empty)
+{
+createScDoc();
+
+insertStringToCell("A1", u"");
+
+ScModelObj* pModelObj = 
comphelper::getFromUnoTunnel(mxComponent);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | KEY_SHIFT | 
awt::Key::Y);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | KEY_SHIFT | 
awt::Key::Y);
+Scheduler::ProcessEventsToIdle();
+
+ScDocument* pDoc = getScDoc();
+CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 1, 
0)));
+
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F2);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F2);
+Scheduler::ProcessEventsToIdle();
+
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DELETE);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DELETE);
+Scheduler::ProcessEventsToIdle();
+
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::RETURN);
+pModelObj->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::RETURN);
+Scheduler::ProcessEventsToIdle();
+
+// Without the fix in place, this test would have failed with
+// - Expected: 
+// - Actual  :
+CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 1, 
0)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119162)
 {
 createScDoc();


[Libreoffice-commits] core.git: sc/qa sc/source

2023-06-01 Thread Czeber László Ádám (via logerrit)
 sc/qa/uitest/calc_tests9/tdf154174.py |   35 ++
 sc/source/ui/view/viewfunc.cxx|2 +
 2 files changed, 37 insertions(+)

New commits:
commit a5c1b749a89b662f9a136d774b3dfd5fbd639c50
Author: Czeber László Ádám 
AuthorDate: Wed May 31 13:06:50 2023 +0200
Commit: László Németh 
CommitDate: Thu Jun 1 09:55:40 2023 +0200

tdf#154174 sc: fix input line to update to the repeated content

Repeating the last text edit by Repeat, e.g. by pressing
Ctrl-Shift-Y, the input line still contained the old content
of the cell, and only updated to the new content after moving
the cursor to another cell and back. Now the input line is updated
automatically, and the actual content of the cell can be modified
immediately by pressing F2 or clicking in the input line.

Change-Id: Ia38b833ff77c75d37700715638aa71c7f1863e91
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152423
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/uitest/calc_tests9/tdf154174.py 
b/sc/qa/uitest/calc_tests9/tdf154174.py
new file mode 100644
index ..3cb0da9ea2a3
--- /dev/null
+++ b/sc/qa/uitest/calc_tests9/tdf154174.py
@@ -0,0 +1,35 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position
+from uitest.uihelper.calc import enter_text_to_cell
+
+#Bug 154174 - empty edit cell after fill (Ctrl+Shft+Y)
+
+class tdf154174(UITestCase):
+def test_tdf154174_repeat_empty(self):
+with self.ui_test.create_doc_in_start_center("calc") as document:
+xCalcDoc = self.xUITest.getTopFocusWindow()
+gridwin = xCalcDoc.getChild("grid_window")
+# enter data
+enter_text_to_cell(gridwin, "A1", "")
+# focus on A2
+gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
+# repeat (Ctrl+Shft+Y)
+gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"SHIFT+CTRL+Y"}))
+# edit A2 data
+gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "F2"}))
+# if is empty, then erased, else unchanged
+gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"DELETE"}))
+gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": 
"RETURN"}))
+# test A2
+self.assertEqual(get_cell_by_position(document, 0, 0, 
1).getString(), "")
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 204d5d31bae7..78080364e928 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -832,6 +832,8 @@ void ScViewFunc::EnterDataAtCursor( const OUString& rString 
)
 SCTAB nTab = GetViewData().GetTabNo();
 
 EnterData( nPosX, nPosY, nTab, rString );
+// tdf#154174: update repeated data in the cell
+GetViewData().GetViewShell()->UpdateInputHandler();
 }
 
 void ScViewFunc::EnterMatrix( const OUString& rString, 
::formula::FormulaGrammar::Grammar eGram )


[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-31 Thread Czeber László Ádám (via logerrit)
 sc/qa/unit/ucalc_copypaste.cxx |   43 +
 sc/source/core/data/table1.cxx |9 ++--
 2 files changed, 50 insertions(+), 2 deletions(-)

New commits:
commit 7be7e1ff95af485a9cb00748800d3d084f96387c
Author: Czeber László Ádám 
AuthorDate: Wed May 24 09:05:16 2023 +0200
Commit: László Németh 
CommitDate: Wed May 31 11:49:58 2023 +0200

tdf#153437 sc: fix broken formatting at Undo of row/column insertion

Performance fix for the 16k rows resulted broken
formatting during Undo of row insertion, e.g. rows
with background color fell apart, highlighting partially
also the row under the deleted row removed by Undo, or
Undo of inserted/copied columns removed the background
coloring at the place of the removed columns.

Formatting was always deleted after the last column
containing data, because the row was only allocated until
then. When deleting row(s) or column(s), allocate the last
column before updating the references.

Regression from commit 2e86718626a07e1656661df3ad69a64848bf4614
"don't allocate unnecessary columns when inserting a row".

Change-Id: I8d74d59ff0051fdfe183e14a16d987edc71d55e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152185
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index 695b5b8f6214..bad57d8646a7 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -10709,6 +10710,48 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, 
testCopyPasteMatrixFormula)
 m_pDoc->DeleteTab(0);
 }
 
+CPPUNIT_TEST_FIXTURE(TestCopyPaste, testUndoBackgroundColor)
+{
+m_pDoc->InsertTab(0, "Table1");
+
+ScDocument aClipDoc(SCDOCMODE_CLIP);
+ScMarkData aMark(m_pDoc->GetSheetLimits());
+
+// Set Values to B1, C2, D5
+m_pDoc->SetValue(ScAddress(1, 0, 0), 1.0); // B1
+m_pDoc->SetValue(ScAddress(2, 1, 0), 2.0); // C2
+m_pDoc->SetValue(ScAddress(3, 4, 0), 3.0); // D5
+
+// Add patterns
+ScPatternAttr aCellBlueColor(m_pDoc->GetPool());
+aCellBlueColor.GetItemSet().Put(SvxBrushItem(COL_BLUE, ATTR_BACKGROUND));
+m_pDoc->ApplyPatternAreaTab(0, 3, m_pDoc->MaxCol(), 3, 0, aCellBlueColor);
+
+// Insert a new row at row 3
+ScRange aRowOne(0, 2, 0, m_pDoc->MaxCol(), 2, 0);
+aMark.SetMarkArea(aRowOne);
+ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
+rFunc.InsertCells(aRowOne, , INS_INSROWS_BEFORE, true, true);
+
+// Check patterns
+const SfxPoolItem* pItem = nullptr;
+m_pDoc->GetPattern(ScAddress(1000, 4, 
0))->GetItemSet().HasItem(ATTR_BACKGROUND, );
+CPPUNIT_ASSERT(pItem);
+CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast(pItem)->GetColor());
+
+// Undo the new row
+m_pDoc->GetUndoManager()->Undo();
+
+// Check patterns
+// Failed if row 3 is not blue all the way through
+pItem = nullptr;
+m_pDoc->GetPattern(ScAddress(1000, 3, 
0))->GetItemSet().HasItem(ATTR_BACKGROUND, );
+CPPUNIT_ASSERT(pItem);
+CPPUNIT_ASSERT_EQUAL(COL_BLUE, static_cast(pItem)->GetColor());
+
+m_pDoc->DeleteTab(0);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 78c49912bcc9..6cb5384c05f9 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -1851,8 +1851,13 @@ void ScTable::UpdateReference(
 }
 else
 {
-for( SCCOL col : GetAllocatedColumnsRange( 0, rDocument.MaxCol()))
-bUpdated |= aCol[col].UpdateReference(rCxt, pUndoDoc);
+// When deleting row(s) or column(s), allocate the last column
+// before updating the references
+if (nDx < 0 || nDy < 0)
+CreateColumnIfNotExists(rDocument.MaxCol());
+
+for (SCCOL col : GetColumnsRange(0, rDocument.MaxCol()))
+bUpdated |= CreateColumnIfNotExists(col).UpdateReference(rCxt, 
pUndoDoc);
 }
 
 if ( bIncludeDraw )


[Libreoffice-commits] core.git: sc/qa

2023-05-30 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/uicalc/data/tdf152037.xlsx |binary
 sc/qa/unit/uicalc/uicalc.cxx  |   14 ++
 2 files changed, 14 insertions(+)

New commits:
commit 8b5f9debcdb861589c6c9b01858388603dec0d24
Author: Xisco Fauli 
AuthorDate: Tue May 30 16:09:39 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 30 19:25:48 2023 +0200

tdf#152037: sc_uicalc: Add unittest

Change-Id: Ia0fbea3ecc4fab741940a453e8508f417e31e6a1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152394
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/uicalc/data/tdf152037.xlsx 
b/sc/qa/unit/uicalc/data/tdf152037.xlsx
new file mode 100644
index ..b6d482e99b2c
Binary files /dev/null and b/sc/qa/unit/uicalc/data/tdf152037.xlsx differ
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index daccc08c2600..b6a0db8bcd74 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -683,6 +683,20 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf124820)
  aFont.GetStrikeout());
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf152037)
+{
+createScDoc("tdf152037.xlsx");
+
+insertStringToCell("C2", u"abcdefghi");
+
+ScDocument* pDoc = getScDoc();
+
+// Without the fix in place, this test would have failed with
+// - Expected: abcdefghi
+// - Actual  :
+CPPUNIT_ASSERT_EQUAL(OUString("abcdefghi"), pDoc->GetString(ScAddress(2, 
1, 0)));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf119155)
 {
 createScDoc("tdf119155.xlsx");


[Libreoffice-commits] core.git: sc/qa svl/qa svl/source xmloff/source

2023-05-26 Thread Laurent Balland (via logerrit)
 sc/qa/unit/data/xlsx/seconds-without-truncate-and-decimals.xlsx |binary
 sc/qa/unit/subsequent_export_test4.cxx  |   18 
+++---
 svl/qa/unit/svl.cxx |   17 
+
 svl/source/numbers/zforscan.cxx |6 +++
 xmloff/source/style/xmlnumfe.cxx|8 ++--
 5 files changed, 42 insertions(+), 7 deletions(-)

New commits:
commit 6dd2ebbba23b20864d3cf74322540c628088375c
Author: Laurent Balland 
AuthorDate: Tue May 16 09:24:55 2023 +0200
Commit: Eike Rathke 
CommitDate: Fri May 26 18:20:26 2023 +0200

tdf#150028 Treat decimal separator after [SS]

Only decimal separator after S or SS was treated
This change adds [S] and [SS] to treat formats like
[SS].00
Update: correct export to XML
Add QA unit tests

Change-Id: I97ce4084d3caab2fcd18f1c70cd4221596290563
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151823
Tested-by: Jenkins
Reviewed-by: Eike Rathke 

diff --git a/sc/qa/unit/data/xlsx/seconds-without-truncate-and-decimals.xlsx 
b/sc/qa/unit/data/xlsx/seconds-without-truncate-and-decimals.xlsx
new file mode 100644
index ..a26b3630708e
Binary files /dev/null and 
b/sc/qa/unit/data/xlsx/seconds-without-truncate-and-decimals.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 9d7dddc99c78..b34a8fcdadf6 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -1460,24 +1460,34 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf148820)
 
 namespace
 {
-void lcl_TestEmbeddedTextInDecimal(ScDocument& rDoc)
+void lcl_TestNumberFormat(ScDocument& rDoc, const OUString& rFormatStrOK)
 {
 sal_uInt32 nNumberFormat = rDoc.GetNumberFormat(0, 0, 0);
 const SvNumberformat* pNumberFormat = 
rDoc.GetFormatTable()->GetEntry(nNumberFormat);
 const OUString& rFormatStr = pNumberFormat->GetFormatstring();
 
-CPPUNIT_ASSERT_EQUAL(OUString("#,##0.000\" \"###\" \"###"), rFormatStr);
+CPPUNIT_ASSERT_EQUAL(rFormatStrOK, rFormatStr);
 }
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testSecondsWithoutTruncateAndDecimals)
+{
+createScDoc("xlsx/seconds-without-truncate-and-decimals.xlsx");
+lcl_TestNumberFormat(*getScDoc(), "[SS].00");
+
+// save to ODS and reload
+saveAndReload("calc8");
+lcl_TestNumberFormat(*getScDoc(), "[SS].00");
+}
+
 CPPUNIT_TEST_FIXTURE(ScExportTest4, testEmbeddedTextInDecimal)
 {
 createScDoc("xlsx/embedded-text-in-decimal.xlsx");
-lcl_TestEmbeddedTextInDecimal(*getScDoc());
+lcl_TestNumberFormat(*getScDoc(), "#,##0.000\" \"###\" \"###");
 
 // save to ODS and reload
 saveAndReload("calc8");
-lcl_TestEmbeddedTextInDecimal(*getScDoc());
+lcl_TestNumberFormat(*getScDoc(), "#,##0.000\" \"###\" \"###");
 }
 
 CPPUNIT_TEST_FIXTURE(ScExportTest4, testTotalsRowFunction)
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 06d018f3b624..8f5070c934bb 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1728,6 +1728,23 @@ void Test::testUserDefinedNumberFormats()
 sExpected = "1900-01-02 23:53.605";
 checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
 }
+{   // tdf#150028 decimals of seconds fraction withtout truncate on 
overflow
+sCode = "[SS]";
+sExpected = "271434";
+checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+// One decimal.
+sCode = "[SS].0";
+sExpected = "271433.6";
+checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+// Two decimals.
+sCode = "[SS].00";
+sExpected = "271433.61";
+checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+// Three decimals.
+sCode = "[SS].000";
+sExpected = "271433.605";
+checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
+}
 {   // tdf#33689 use English NfKeywords in non-English language
 eLang = LANGUAGE_DUTCH;
 sExpected = "Dutch: 1900/01/02 03:23:53";
diff --git a/svl/source/numbers/zforscan.cxx b/svl/source/numbers/zforscan.cxx
index 10ff6a591b35..537c19415ff7 100644
--- a/svl/source/numbers/zforscan.cxx
+++ b/svl/source/numbers/zforscan.cxx
@@ -1467,6 +1467,11 @@ sal_Int32 ImpSvNumberformatScan::ScanType()
 }
 else if (pLoc->getTime100SecSep() == sStrArray[i])
 bDecSep = true;
+else if ( sStrArray[i][0] == ']' && i < nStringsCnt - 1 && 
pLoc->getTime100SecSep() == sStrArray[i+1] )
+{
+bDecSep = true;
+i++;
+}
 }
 eNewType = SvNumFormatType::UNDEFINED;
 break;
@@ -2592,6 +2597,7 @@ sal_Int32 ImpSvNumberformatScan::FinalScan( OUString& 

[Libreoffice-commits] core.git: sc/qa test/source

2023-05-23 Thread Stephan Bergmann (via logerrit)
 sc/qa/extras/scdatapilotfieldobj.cxx |3 +--
 test/source/sheet/xdatabaserange.cxx |3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit f1ac4376ffaee143ad24931744637aa0a4717016
Author: Stephan Bergmann 
AuthorDate: Tue May 23 12:56:33 2023 +0200
Commit: Stephan Bergmann 
CommitDate: Tue May 23 14:35:03 2023 +0200

Don't even bother to introduce unused variables

With  "More conservative
SAL_WARN_UNUSED to avoid -Werror,-Wunused-private-field", these two cases 
would
have started to cause "unused variable declaration [loplugin:casttovoid]"
(because the call to isWarnUnusedType in 
compilerplugins/clang/casttovoid.cxx
would no longer return true).  Just avoid that by not introducing the 
variables
in the first place.

Change-Id: I3d2b085082555d1765fbd32045b5157deb0af67e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152158
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann 

diff --git a/sc/qa/extras/scdatapilotfieldobj.cxx 
b/sc/qa/extras/scdatapilotfieldobj.cxx
index df10c2292761..f7ead7940576 100644
--- a/sc/qa/extras/scdatapilotfieldobj.cxx
+++ b/sc/qa/extras/scdatapilotfieldobj.cxx
@@ -96,8 +96,7 @@ uno::Reference ScDataPilotFieldObj::init()
 
 uno::Reference xDPTS(xSheet, 
uno::UNO_QUERY_THROW);
 uno::Reference xDPT(xDPTS->getDataPilotTables(), 
uno::UNO_SET_THROW);
-uno::Sequence aElementNames = xDPT->getElementNames();
-(void)aElementNames;
+(void)xDPT->getElementNames();
 
 uno::Reference 
xDPDsc(xDPT->getByName("DataPilot1"),
uno::UNO_QUERY_THROW);
diff --git a/test/source/sheet/xdatabaserange.cxx 
b/test/source/sheet/xdatabaserange.cxx
index f1133ac00f5d..9f0828a30513 100644
--- a/test/source/sheet/xdatabaserange.cxx
+++ b/test/source/sheet/xdatabaserange.cxx
@@ -125,8 +125,7 @@ void XDatabaseRange::testGetFilterDescriptor()
 void XDatabaseRange::testGetImportDescriptor()
 {
 uno::Reference xDBRange(init("ImportDescriptor"), 
UNO_QUERY_THROW);
-uno::Sequence xImportDescr = 
xDBRange->getImportDescriptor();
-(void)xImportDescr;
+(void)xDBRange->getImportDescriptor();
 }
 
 void XDatabaseRange::testRefresh()


[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-23 Thread Czeber László Ádám (via logerrit)
 sc/qa/unit/data/xlsx/tdf100034.xlsx|binary
 sc/qa/unit/subsequent_export_test4.cxx |   16 
 sc/source/filter/excel/xename.cxx  |5 +
 3 files changed, 21 insertions(+)

New commits:
commit 639519dc2bad058197b6ff73c9e3df622f979f97
Author: Czeber László Ádám 
AuthorDate: Mon May 22 09:58:29 2023 +0200
Commit: László Németh 
CommitDate: Tue May 23 12:15:56 2023 +0200

tdf#100034: Fix to persistently remove print-range

Don't save print range if the builtin index is unknow
and sheet index is vaild (this is a deleted range).

Change-Id: I10dfa98ad4f24d0f5958053974bd75cb19c85147
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152081
Tested-by: László Németh 
Reviewed-by: László Németh 

diff --git a/sc/qa/unit/data/xlsx/tdf100034.xlsx 
b/sc/qa/unit/data/xlsx/tdf100034.xlsx
new file mode 100644
index ..b053a34bca43
Binary files /dev/null and b/sc/qa/unit/data/xlsx/tdf100034.xlsx differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 46ea2547eadc..9d7dddc99c78 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -1697,6 +1697,22 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152980)
 CPPUNIT_ASSERT_EQUAL(OUString("a\n\nb"), pDoc->GetString(0, 7, 0));
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf100034)
+{
+createScDoc("xlsx/tdf100034.xlsx");
+ScDocument* pDoc = getScDoc();
+
+// Clear print ranges
+pDoc->ClearPrintRanges(0);
+
+// Save and load back
+saveAndReload("Calc Office Open XML");
+
+// Check if the same print ranges are present
+pDoc = getScDoc();
+CPPUNIT_ASSERT_EQUAL(static_cast(0), 
pDoc->GetPrintRangeCount(0));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/excel/xename.cxx 
b/sc/source/filter/excel/xename.cxx
index 4e837a97fadf..5ce4a2ff18c4 100644
--- a/sc/source/filter/excel/xename.cxx
+++ b/sc/source/filter/excel/xename.cxx
@@ -324,6 +324,11 @@ OUString XclExpName::GetWithDefaultRangeSeparator( const 
OUString& rSymbol ) con
 
 void XclExpName::SaveXml( XclExpXmlStream& rStrm )
 {
+// tdf#100034: Don't save print range if the built-in index is unknown
+// and sheet index is valid (this is a deleted range)
+if (mcBuiltIn == EXC_BUILTIN_UNKNOWN && mnScTab != SCTAB_GLOBAL)
+return;
+
 sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
 rWorkbook->startElement( XML_definedName,
 // OOXTODO: XML_comment, "",


[Libreoffice-commits] core.git: sc/qa

2023-05-22 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/data/ods/tdf155368.ods |binary
 sc/qa/unit/subsequent_export_test.cxx |   21 +
 2 files changed, 21 insertions(+)

New commits:
commit e34bb6e67aefde2fa1e7e12635a016a2076a11bd
Author: Xisco Fauli 
AuthorDate: Mon May 22 13:53:19 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon May 22 15:48:28 2023 +0200

tdf#155368: sc_subsequent_export: Add unittest

Change-Id: Ie177342720df50d160600cf133b87bdf3411203d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152114
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/ods/tdf155368.ods 
b/sc/qa/unit/data/ods/tdf155368.ods
new file mode 100644
index ..69442e8ca122
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf155368.ods differ
diff --git a/sc/qa/unit/subsequent_export_test.cxx 
b/sc/qa/unit/subsequent_export_test.cxx
index fc894f5d9e9f..76459e765347 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -2217,6 +2217,27 @@ CPPUNIT_TEST_FIXTURE(ScExportTest, testCellBordersXLSX)
 testExcelCellBorders("Calc Office Open XML");
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest, testTdf155368)
+{
+createScDoc("ods/tdf155368.ods");
+
+dispatchCommand(mxComponent, ".uno:SelectAll", {});
+
+dispatchCommand(mxComponent, ".uno:WrapText", {});
+
+save("Calc Office Open XML");
+
+xmlDocUniquePtr pStyles = parseExport("xl/styles.xml");
+CPPUNIT_ASSERT(pStyles);
+
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[1]/x:alignment", 
"wrapText", "false");
+
+// Without the fix in place, this test would have failed with
+// - Expected: false
+// - Actual  : true
+assertXPath(pStyles, "/x:styleSheet/x:cellXfs/x:xf[2]/x:alignment", 
"wrapText", "false");
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-20 Thread Dennis Francis (via logerrit)
 sc/qa/unit/data/xlsx/tablerefsnamed.xlsx |binary
 sc/qa/unit/subsequent_filters_test2.cxx  |   15 ++
 sc/source/core/tool/interpr1.cxx |   43 +++
 3 files changed, 48 insertions(+), 10 deletions(-)

New commits:
commit 4536694edb7e564ea1f4ae871e9107f52ed0972f
Author: Dennis Francis 
AuthorDate: Sat May 13 13:37:39 2023 +0530
Commit: Dennis Francis 
CommitDate: Sat May 20 17:07:21 2023 +0200

tdf#155369 ScIndirect: handle names that resolve to...

table structured references.

Conflicts:
sc/qa/unit/subsequent_filters_test2.cxx

Change-Id: I897feeeb49e63c1758cf64450799acb192e2d593
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151888
Tested-by: Jenkins
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 cd5f073f46c4..a00558730d0b 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -1565,6 +1565,21 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest2, 
testBorderDirectionsXLSXML)
 }
 }
 
+CPPUNIT_TEST_FIXTURE(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_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 9e2277f60392..2f48398827ed 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8187,6 +8187,12 @@ void ScInterpreter::ScDBVarP()
 PushDouble(fVal/fCount);
 }
 
+static 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();
@@ -8223,6 +8229,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
@@ -8238,8 +8248,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(),
@@ -8256,6 +8272,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);
@@ -8291,9 +8310,10 @@ void ScInterpreter::ScIndirect()
 
 ScRefAddress aRefAd, aRefAd2;
 ScAddress::ExternalInfo aExtInfo;
-if ( ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetails, 
) ||
- ( bTryXlA1 && ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd,
-aRefAd2, aDetailsXlA1, ) ) )
+if ( !bTableRefNamed &&
+ (ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd, aRefAd2, aDetails, 
) ||
+( bTryXlA1 && ConvertDoubleRef(mrDoc, sRefStr, nTab, aRefAd,
+   aRefAd2, aDetailsXlA1, ) ) 
) )
 {
 if (aExtInfo.mbExternal)
 {
@@ -8305,9 +8325,10 @@ void ScInterpreter::ScIndirect()
 else
 PushDoubleRef( aRefAd, aRefAd2);
 }
-else if ( ConvertSingleRef(mrDoc, sRefStr, nTab, aRefAd, aDetails, 
) ||
-  ( bTryXlA1 && ConvertSingleRef 

[Libreoffice-commits] core.git: sc/qa

2023-05-18 Thread Andrea Gelmini (via logerrit)
 sc/qa/unit/scshapetest.cxx |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit ba9908f2ecfaa51b3def099ac3b86ae6cfb714ea
Author: Andrea Gelmini 
AuthorDate: Thu May 18 15:24:47 2023 +0200
Commit: Julien Nabet 
CommitDate: Thu May 18 22:20:22 2023 +0200

Fix typo

Change-Id: Ida74d3ff99c4e8c7e6c6402d580ae9d279217105
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151961
Tested-by: Julien Nabet 
Reviewed-by: Julien Nabet 

diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 21406c52cc7d..b658e44f03d5 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -1202,7 +1202,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf154821_shape_in_group)
 pViewShell->GetViewData().SetCurX(0);
 pViewShell->GetViewData().SetCurY(5);
 pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_SHOW);
-// Expande the upper group
+// Expand the upper group
 pViewShell = getViewShell();
 pViewShell->GetViewData().SetCurX(0);
 pViewShell->GetViewData().SetCurY(1);


[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-18 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/tdf154821_shape_in_group.ods |binary
 sc/qa/unit/scshapetest.cxx   |   46 
 sc/source/core/data/drwlayer.cxx |   24 +-
 sc/source/filter/xml/xmlexprt.cxx|  230 +++
 4 files changed, 173 insertions(+), 127 deletions(-)

New commits:
commit 800f9233513a45aa8f8950cf929fd44cb9381d72
Author: Regina Henschel 
AuthorDate: Sat May 13 01:36:44 2023 +0200
Commit: Regina Henschel 
CommitDate: Thu May 18 14:45:48 2023 +0200

tdf#154821 improve shape export with hidden row/col

XML needs shape geometry so as if no rows/cols are hidden. This had
been calculated by using the shape start and end cell. But that did
not work in some cases. Now the snap rectangle of the shape is used.

During testing I noticed, that the fix in tdf#154005 does not work
correctly. The fix had provided only a workaround for controls. It did
not address the root cause that a shape was size protected but has an
anchor 'To Cell (resize with cell)' at the same time. Such combination
is no longer needed as we have 'To Cell' anchor now, but shapes using
it still exist. The current solution catches such cases now in general.

As large parts of the method are changed anyway, I have put existance
tests at the beginning. That allows shorter conditions and flattens
if-constructions.

Change-Id: I6bd1e15dbdafc43e309a6e12c1c5e3218bb12675
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151717
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/sc/qa/unit/data/ods/tdf154821_shape_in_group.ods 
b/sc/qa/unit/data/ods/tdf154821_shape_in_group.ods
new file mode 100644
index ..905a64418cf6
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf154821_shape_in_group.ods 
differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 0e4f1b555f99..21406c52cc7d 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -1169,6 +1169,52 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf125938_anchor_after_copy_paste)
 CPPUNIT_ASSERT_EQUAL(aExpectedAddress, (*pObjData).maStart);
 }
 
+CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf154821_shape_in_group)
+{
+// The document contains a shape in A7, a group spanning rows 2 to 4 and a 
second group spanning
+// rows 6 to 10. Error was, that when the document was saved with 
collapsed groups, the shape
+// lost its position.
+createScDoc("ods/tdf154821_shape_in_group.ods");
+
+// Get snap rectangle before collapse and save
+ScDocument* pDoc = getScDoc();
+SdrObject* pObj = lcl_getSdrObjectWithAssert(*pDoc, 0);
+tools::Rectangle aRectOrig = pObj->GetSnapRect();
+
+// Collapse the lower group
+ScTabViewShell* pViewShell = getViewShell();
+pViewShell->GetViewData().SetCurX(0);
+pViewShell->GetViewData().SetCurY(5);
+pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_HIDE);
+// Collapse the upper group
+pViewShell->GetViewData().SetCurX(0);
+pViewShell->GetViewData().SetCurY(1);
+pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_HIDE);
+
+// Save and reload
+// FIXME: validation fails with
+// Error: unexpected attribute "drawooo:display"
+skipValidation();
+saveAndReload("calc8");
+
+// Expand the lower group
+pViewShell = getViewShell();
+pViewShell->GetViewData().SetCurX(0);
+pViewShell->GetViewData().SetCurY(5);
+pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_SHOW);
+// Expande the upper group
+pViewShell = getViewShell();
+pViewShell->GetViewData().SetCurX(0);
+pViewShell->GetViewData().SetCurY(1);
+pViewShell->GetViewData().GetDispatcher().Execute(SID_OUTLINE_SHOW);
+
+// Verify shape position is not changed besides rounding errors from 
twips<->mm
+pDoc = getScDoc();
+pObj = lcl_getSdrObjectWithAssert(*pDoc, 0);
+tools::Rectangle aRectReload = pObj->GetSnapRect();
+CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aRectOrig, aRectReload, 1);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 134c7258ed4a..8e989012b4e8 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -776,15 +776,6 @@ void lcl_SetLogicRectFromAnchor(SdrObject* pObj, const 
ScDrawObjData& rAnchor, c
 if (!pObj || !pDoc || !rAnchor.maEnd.IsValid() || 
!rAnchor.maStart.IsValid())
 return;
 
-SCROW nHiddenRows = 0;
-SCCOL nHiddenCols = 0;
-// tdf#154005: Handle hidden row/col: remove hidden row/cols size from the 
ScDrawObjData shape size in case of forms
-if (pObj->GetObjIdentifier() == SdrObjKind::UNO && pObj->GetObjInventor() 
== SdrInventor::FmForm)
-{
-nHiddenRows = pDoc->CountHiddenRows(rAnchor.maStart.Row(), 
rAnchor.maEnd.Row(), 

[Libreoffice-commits] core.git: sc/qa

2023-05-18 Thread Xisco Fauli (via logerrit)
 sc/qa/extras/vba-macro-test.cxx |   62 
 1 file changed, 31 insertions(+), 31 deletions(-)

New commits:
commit 60c00abc2e57351b265e97c635b331197eaa802e
Author: Xisco Fauli 
AuthorDate: Thu May 18 10:34:15 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu May 18 14:28:37 2023 +0200

CppunitTest_sc_vba_macro_test: don't concatenate the name file

Otherwise these files will be flagged as unused

Change-Id: I6ae0f8327bc81f57fb63e65dde66742177fc693d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151938
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/extras/vba-macro-test.cxx b/sc/qa/extras/vba-macro-test.cxx
index ffe77d21fe7d..7e92dd681110 100644
--- a/sc/qa/extras/vba-macro-test.cxx
+++ b/sc/qa/extras/vba-macro-test.cxx
@@ -326,33 +326,33 @@ CPPUNIT_TEST_FIXTURE(VBAMacroTest, testMacroKeyBinding)
 CPPUNIT_TEST_FIXTURE(VBAMacroTest, testVba)
 {
 TestMacroInfo testInfo[] = {
-{ OUString("TestAddress."),
+{ OUString("TestAddress.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
 {
-OUString("vba."),
+OUString("vba.xls"),
 OUString(
 
"vnd.sun.Star.script:VBAProject.Modul1.Modul1?language=Basic=document"),
 },
-{ OUString("MiscRangeTests."),
+{ OUString("MiscRangeTests.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("bytearraystring."),
+{ OUString("bytearraystring.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacro.test?language=Basic=document")
 },
-{ OUString("AutoFilter."),
+{ OUString("AutoFilter.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("CalcFont."),
+{ OUString("CalcFont.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("TestIntersection."),
+{ OUString("TestIntersection.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("TestUnion."),
+{ OUString("TestUnion.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("range-4."),
+{ OUString("range-4.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
 // FIXME: sometimes it fails on Windows with
@@ -363,62 +363,62 @@ CPPUNIT_TEST_FIXTURE(VBAMacroTest, testVba)
 // Tests passed: 4
 // Tests failed: 4
 #if !defined(_WIN32)
-{ OUString("Ranges-3."),
+{ OUString("Ranges-3.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
 #endif
-{ OUString("TestCalc_Rangetest."),
+{ OUString("TestCalc_Rangetest.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("TestCalc_Rangetest2."),
+{ OUString("TestCalc_Rangetest2.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("Ranges-2."),
+{ OUString("Ranges-2.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("pagesetup."),
+{ OUString("pagesetup.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("Window."),
+{ OUString("Window.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("window2."),
+{ OUString("window2.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("PageBreaks."),
+{ OUString("PageBreaks.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("Shapes."),
+{ OUString("Shapes.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("Ranges."),
+{ OUString("Ranges.xls"),
   OUString(
   
"vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic=document")
 },
-{ OUString("CheckOptionToggleValue."),
+{ OUString("CheckOptionToggleValue.xls"),
   OUString(
   

[Libreoffice-commits] core.git: sc/qa

2023-05-18 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/subsequent_filters_test.cxx |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

New commits:
commit 7bb26a7371219eb2196abb6b1b159e591f3c
Author: Xisco Fauli 
AuthorDate: Thu May 18 11:21:04 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu May 18 14:05:35 2023 +0200

CppunitTest_sc_subsequent_filters_test: re-enable test

Commented out since it was introduced in
731a9aab0fa42ed42b5470e2c6f7e9fc6b1e3a85
"add first test for user defined functions"
it no longer crashes

Change-Id: I8a35dc2a737c946e9af1bafb4cc913bb9dc925fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151941
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/subsequent_filters_test.cxx 
b/sc/qa/unit/subsequent_filters_test.cxx
index 35392fc7cb3c..535afe72d818 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -687,12 +687,12 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest, testFunctionsODS)
 aCSVPath = createFilePath(u"contentCSV/date-time-functions.csv");
 testFile(aCSVPath, *pDoc, 0, StringType::PureString);
 
-// crashes at exit while unloading StarBasic code
-// xDocSh = loadDoc("user-defined-function.", FORMAT_ODS);
-// xDocSh->DoHardRecalc();
-// ScDocument& rDocUserDef = xDocSh->GetDocument();
-// createCSVPath("user-defined-function.", aCSVFileName);
-// testFile(aCSVFileName, rDocUserDef, 0);
+createScDoc("ods/user-defined-function.ods");
+pDocSh = getScDocShell();
+pDocSh->DoHardRecalc();
+pDoc = getScDoc();
+aCSVPath = createFilePath(u"contentCSV/user-defined-function.csv");
+testFile(aCSVPath, *pDoc, 0);
 }
 
 CPPUNIT_TEST_FIXTURE(ScFiltersTest, testFunctionsExcel2010)


[Libreoffice-commits] core.git: sc/qa

2023-05-17 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/opencl-test-1.cxx |  464 ++-
 1 file changed, 113 insertions(+), 351 deletions(-)

New commits:
commit b3c88dc039d447322b8c8c564ab6e2f0ce9c5b90
Author: Xisco Fauli 
AuthorDate: Wed May 17 13:50:55 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 17 22:38:31 2023 +0200

CppunitTest_sc_opencl-1: use CPPUNIT_TEST_FIXTURE()

Avoiding the declaration/registration/definition of each
test manually saves a lot of space.

Change-Id: Ifd12aaa560be4aa69db87a3aa3f37e03940f68eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151878
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/opencl-test-1.cxx b/sc/qa/unit/opencl-test-1.cxx
index 0be7b1d8c1e2..2cb392b3fe4b 100644
--- a/sc/qa/unit/opencl-test-1.cxx
+++ b/sc/qa/unit/opencl-test-1.cxx
@@ -20,245 +20,9 @@ class ScOpenCLTest1
 {
 public:
 ScOpenCLTest1();
-
-void testSystematic();
-void testSharedFormulaXLS();
-void testFinacialFormula();
-void testStatisticalFormulaFisher();
-void testStatisticalFormulaFisherInv();
-void testStatisticalFormulaGamma();
-void testFinacialFvscheduleFormula();
-// this test has intermittent failures on OSX
-#if !defined MACOSX
-void testFinacialIRRFormula();
-#endif
-void testFinacialMIRRFormula();
-void testFinacialRateFormula();
-void testFinancialAccrintmFormula();
-void testFinancialAccrintFormula();
-void testCompilerHorizontal();
-void testCompilerNested();
-void testFinacialSLNFormula();
-void testStatisticalFormulaGammaLn();
-void testStatisticalFormulaGauss();
-void testStatisticalFormulaGeoMean();
-void testStatisticalFormulaHarMean();
-void testFinancialCoupdaybsFormula();
-void testFinacialDollardeFormula();
-void testCompilerString();
-void testCompilerInEq();
-void testCompilerPrecision();
-void testFinacialDollarfrFormula();
-void testFinacialSYDFormula();
-void testStatisticalFormulaCorrel();
-void testFinancialCoupdaysFormula();
-void testFinancialCoupdaysncFormula();
-void testFinacialDISCFormula();
-void testFinacialINTRATEFormula();
-void testMathFormulaCos();
-void testMathFormulaCsc();
-void testStatisticalFormulaRsq();
-void testStatisticalFormulaPearson();
-void testStatisticalFormulaNegbinomdist();
-void testFinacialXNPVFormula();
-void testFinacialPriceMatFormula();
-void testFinacialFormulaReceived();
-void testFinancialFormulaCumipmt();
-void testFinancialFormulaCumprinc();
-void testFinacialRRIFormula();
-void testFinacialEFFECT_ADDFormula();
-void testFinacialNominalFormula();
-void testFinacialTBILLEQFormula();
-void testFinacialTBILLPRICEFormula();
-void testFinacialTBILLYIELDFormula();
-void testFinacialYIELDFormula();
-void testFinacialYIELDDISCFormula();
-void testFinacialYIELDMATFormula();
-void testFinacialPMTFormula();
-void testFinacialPPMTFormula();
-void testFinancialISPMTFormula();
-void testFinacialPriceFormula();
-void testFinancialDurationFormula();
-void testFinancialCoupnumFormula();
-void testMathFormulaSinh();
-void testMathFormulaAbs();
-void testFinacialPVFormula();
-void testMathFormulaSin();
-void testMathFormulaTan();
-void testMathFormulaTanH();
-void testStatisticalFormulaStandard();
-void testStatisticalFormulaWeibull();
-void testStatisticalFormulaMedian();
-void testFinancialDuration_ADDFormula();
-void testFinancialAmordegrcFormula();
-void testFinancialAmorlincFormula();
-void testFinancialDDBFormula();
-void testFinancialFVFormula();
-void testFinancialMDurationFormula();
-void testMathSumIfsFormula();
-void testFinancialVDBFormula();
-void testStatisticalFormulaKurt();
-void testFinacialNPERFormula();
-void testStatisticalFormulaNormdist();
-void testMathFormulaArcCos();
-void testMathFormulaSqrt();
-void testMathFormulaArcCosHyp();
-void testFinacialNPVFormula();
-void testStatisticalFormulaNormsdist();
-void testStatisticalFormulaNorminv();
-void testStatisticalFormulaNormsinv();
-void testStatisticalFormulaPermut();
-void testStatisticalFormulaPermutation();
-void testStatisticalFormulaPhi();
-void testFinancialIPMTFormula();
-void testStatisticalFormulaConfidence();
-void testStatisticalFormulaIntercept();
-void testFinacialODDLPRICEFormula();
-void testFinacialOddlyieldFormula();
-void testFinacialPriceDiscFormula();
-void testFinancialDBFormula();
-void testFinancialCouppcdFormula();
-void testFinancialCoupncdFormula();
-void testStatisticalFormulaLogInv();
-void testMathFormulaArcCot();
-void testMathFormulaCosh();
-void testStatisticalFormulaCritBinom();
-void testMathFormulaArcCotHyp();
-void testMathFormulaArcSin();
-void 

[Libreoffice-commits] core.git: sc/qa

2023-05-17 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/opencl-test-1.cxx |   49 ---
 1 file changed, 49 deletions(-)

New commits:
commit 7723e3f627175a09c074fd8bcb38ebbaa4867874
Author: Xisco Fauli 
AuthorDate: Wed May 17 13:36:26 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 17 22:38:08 2023 +0200

CppunitTest_sc_opencl-1: remove commented out tests

These were commented out in 9247a100e3aa0c1ebd81254683eef2311a516a17
"The test documents for these tests are not available."

Change-Id: Icbaf29de91c7828efbca3c8e55a123b44591d308
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151877
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/opencl-test-1.cxx b/sc/qa/unit/opencl-test-1.cxx
index 3352ab3e4ad6..0be7b1d8c1e2 100644
--- a/sc/qa/unit/opencl-test-1.cxx
+++ b/sc/qa/unit/opencl-test-1.cxx
@@ -23,10 +23,6 @@ public:
 
 void testSystematic();
 void testSharedFormulaXLS();
-#if 0
-void testSharedFormulaXLSGroundWater();
-void testSharedFormulaXLSStockHistory();
-#endif
 void testFinacialFormula();
 void testStatisticalFormulaFisher();
 void testStatisticalFormulaFisherInv();
@@ -356,51 +352,6 @@ void ScOpenCLTest1::testCompilerPrecision()
 }
 }
 
-#if 0
-void ScOpenCLTest1::testSharedFormulaXLSStockHistory()
-{
-initTestEnv(u"xls/stock-history.xls");
-ScDocument* pDoc = getScDoc();
-ScDocument* pDocRes = getScDoc2();
-ScDocShell* pDocSh = getScDocShell();
-pDocSh->DoHardRecalc();
-
-// Check the results of formula cells in the shared formula range.
-for (SCROW i = 33; i < 44; ++i)
-{   // Cell H34:H44 in S 500 (tab 1)
-double fLibre = pDoc->GetValue(ScAddress(7, i, 1));
-double fExcel = pDocRes->GetValue(ScAddress(7, i, 1));
-CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
-}
-
-for (SCROW i = 33; i < 44; ++i)
-{   // Cell J34:J44 in S 500 (tab 1)
-double fLibre = pDoc->GetValue(ScAddress(9, i, 1));
-double fExcel = pDocRes->GetValue(ScAddress(9, i, 1));
-CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, 0.0001*fExcel);
-}
-}
-
-void ScOpenCLTest1::testSharedFormulaXLSGroundWater()
-{
-initTestEnv(u"xls/ground-water-daily.xls");
-ScDocument* pDoc = getScDoc();
-ScDocument* pDocRes = getScDoc2();
-ScDocShell* pDocSh = getScDocShell();
-pDocSh->DoHardRecalc();
-
-// Check the results of formula cells in the shared formula range.
-for (SCROW i = 5; i <= 77; ++i)
-{
-double fLibre = pDoc->GetValue(ScAddress(11,i,1));
-double fExcel = pDocRes->GetValue(ScAddress(11,i,1));
-ASSERT_DOUBLES_EQUAL(fExcel, fLibre);
-}
-
-
-}
-#endif
-
 void ScOpenCLTest1::testSystematic()
 {
 initTestEnv(u"xls/systematic.xls");


[Libreoffice-commits] core.git: sc/qa

2023-05-17 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/uicalc/uicalc.cxx |   27 +++
 1 file changed, 27 insertions(+)

New commits:
commit 45229e679aead3c1b5f91069d2a87e9597eb93b5
Author: Xisco Fauli 
AuthorDate: Wed May 17 12:29:41 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 17 20:02:21 2023 +0200

tdf#153790: sc_uicalc: Add unittest

Change-Id: Idf1628f3367fba3c196a63766ea298996bcbbb73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151875
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index a6854ae76d56..bfba6bd235e1 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1893,6 +1893,33 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf150219)
 CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 1)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf153790)
+{
+createScDoc();
+ScDocument* pDoc = getScDoc();
+
+insertStringToCell("A1", u"=SUM($Sheet1.B1:C1)");
+
+CPPUNIT_ASSERT_EQUAL(OUString("0"), pDoc->GetString(ScAddress(0, 0, 0)));
+
+goToCell("A1");
+dispatchCommand(mxComponent, ".uno:Copy", {});
+goToCell("A2");
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+CPPUNIT_ASSERT_EQUAL(OUString("=SUM($Sheet1.B2:C2)"), pDoc->GetFormula(0, 
1, 0));
+
+goToCell("A1");
+dispatchCommand(mxComponent, ".uno:Cut", {});
+goToCell("A3");
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+// Without the fix in place, this test would have failed wiht
+// - Expected: =SUM($Sheet1.B1:C1)
+// - Actual  : =SUM($Sheet1.B1:$Sheet1.C1)
+CPPUNIT_ASSERT_EQUAL(OUString("=SUM($Sheet1.B1:C1)"), pDoc->GetFormula(0, 
2, 0));
+}
+
 CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf141440)
 {
 createScDoc();


[Libreoffice-commits] core.git: sc/qa sc/uiconfig

2023-05-16 Thread Bogdan B (via logerrit)
 sc/qa/uitest/solver/solver.py |6 +++---
 sc/uiconfig/scalc/ui/solverdlg.ui |   24 
 2 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 8107a65b17e5eaab41027cfd69ae227fb2e26ee8
Author: Bogdan B 
AuthorDate: Mon May 15 14:29:59 2023 -0600
Commit: Hossein 
CommitDate: Tue May 16 13:36:51 2023 +0200

tdf#155179 Improve Solver symbols

Co-authored-by: Adolfo Jayme Barrientos 
Change-Id: I608330f175ebf41f282d07752d593661138963b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151623
Tested-by: Jenkins
Tested-by: Hossein 
Reviewed-by: Hossein 

diff --git a/sc/qa/uitest/solver/solver.py b/sc/qa/uitest/solver/solver.py
index dcdb8fa1ea63..faabdfb1ce50 100644
--- a/sc/qa/uitest/solver/solver.py
+++ b/sc/qa/uitest/solver/solver.py
@@ -37,10 +37,10 @@ class solver(UITestCase):
 self.assertEqual("true", get_state_as_dict(xmax)["Checked"])
 
 xvalue.executeAction("CLICK", tuple())
-select_by_text(xop2list, ">=")
+select_by_text(xop2list, "≥")
 
-self.assertEqual("<=", 
get_state_as_dict(xop1list)["SelectEntryText"])
-self.assertEqual(">=", 
get_state_as_dict(xop2list)["SelectEntryText"])
+self.assertEqual("≤", 
get_state_as_dict(xop1list)["SelectEntryText"])
+self.assertEqual("≥", 
get_state_as_dict(xop2list)["SelectEntryText"])
 
 xvalueedit.executeAction("TYPE", 
mkPropertyValues({"TEXT":"1000"}))
 xchangeedit.executeAction("TYPE", 
mkPropertyValues({"TEXT":"C2"}))
diff --git a/sc/uiconfig/scalc/ui/solverdlg.ui 
b/sc/uiconfig/scalc/ui/solverdlg.ui
index eadf5df37e7b..895df3e41c57 100644
--- a/sc/uiconfig/scalc/ui/solverdlg.ui
+++ b/sc/uiconfig/scalc/ui/solverdlg.ui
@@ -594,9 +594,9 @@
 True
 False
 
-  =
-  =
-  =
+  ≤
+  =
+  ≥
   Integer
   Binary
 
@@ -616,9 +616,9 @@
 True
 False
 
-  =
-  =
-  =
+  ≤
+  =
+  ≥
   Integer
   Binary
 
@@ -638,9 +638,9 @@
 True
 False
 
-  =
-  =
-  =
+  ≤
+  =
+  ≥
   Integer
   Binary
 
@@ -660,9 +660,9 @@
 True
 False
 
-  =
-  =
-  =
+  ≤
+  =
+  ≥
   Integer
   Binary
 


[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-16 Thread Andreas Heinisch (via logerrit)
 sc/qa/unit/ucalc_copypaste.cxx   |   14 --
 sc/qa/unit/uicalc/uicalc.cxx |   35 +++
 sc/source/core/data/document.cxx |5 +++--
 3 files changed, 46 insertions(+), 8 deletions(-)

New commits:
commit 535f8fde0c33c435e4a8e9f768003516ce933666
Author: Andreas Heinisch 
AuthorDate: Mon May 15 09:01:21 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Tue May 16 11:05:04 2023 +0200

tdf#141440 - Do not delete notes when pasting contents

Contents include cells with values, datetimes, strings, formulas, outlines, 
and sparklines.

Change-Id: I9acf3a33c7723300d6b85f0abe468db28de6ebcb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151759
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index 43f9272a13c0..695b5b8f6214 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -9407,10 +9407,11 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, 
testCopyPasteSkipEmpty)
 
 // Check the content after the paste.
 {
+// tdf#141440 - do not delete notes when pasting contents
 static const Check aChecks[] = {
-{ "Clip1", COL_YELLOW, false }, { "B", COL_BLUE, true },
-{ "Clip2", COL_YELLOW, false }, { "D", COL_BLUE, true },
-{ "Clip3", COL_YELLOW, false },
+{ "Clip1", COL_YELLOW, true }, { "B", COL_BLUE, true },
+{ "Clip2", COL_YELLOW, true }, { "D", COL_BLUE, true },
+{ "Clip3", COL_YELLOW, true },
 };
 
 bool bRes
@@ -9434,10 +9435,11 @@ CPPUNIT_TEST_FIXTURE(TestCopyPaste, 
testCopyPasteSkipEmpty)
 // Redo, and check the content again.
 aUndo.Redo();
 {
+// tdf#141440 - do not delete notes when pasting contents
 static const Check aChecks[] = {
-{ "Clip1", COL_YELLOW, false }, { "B", COL_BLUE, true },
-{ "Clip2", COL_YELLOW, false }, { "D", COL_BLUE, true },
-{ "Clip3", COL_YELLOW, false },
+{ "Clip1", COL_YELLOW, true }, { "B", COL_BLUE, true },
+{ "Clip2", COL_YELLOW, true }, { "D", COL_BLUE, true },
+{ "Clip3", COL_YELLOW, true },
 };
 
 bool bRes
diff --git a/sc/qa/unit/uicalc/uicalc.cxx b/sc/qa/unit/uicalc/uicalc.cxx
index d3ae6e4d02fe..a6854ae76d56 100644
--- a/sc/qa/unit/uicalc/uicalc.cxx
+++ b/sc/qa/unit/uicalc/uicalc.cxx
@@ -1893,6 +1893,41 @@ CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf150219)
 CPPUNIT_ASSERT_EQUAL(OUString(""), pDoc->GetString(ScAddress(0, 0, 1)));
 }
 
+CPPUNIT_TEST_FIXTURE(ScUiCalcTest, testTdf141440)
+{
+createScDoc();
+ScDocument* pDoc = getScDoc();
+
+// Insert a note to cell A1
+goToCell("A1");
+uno::Sequence aArgs
+= comphelper::InitPropertySequence({ { "Text", uno::Any(OUString("Note 
in A1")) } });
+dispatchCommand(mxComponent, ".uno:InsertAnnotation", aArgs);
+
+// Insert a formula to cell A2
+insertStringToCell("A2", u"=1+1");
+CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(0, 1, 0)));
+
+// Copy content of A2 to A1 using paste special command as a formula 
(Flags F)
+goToCell("A2");
+dispatchCommand(mxComponent, ".uno:Copy", {});
+goToCell("A1");
+aArgs = comphelper::InitPropertySequence(
+{ { "Flags", uno::Any(OUString("F")) },
+  { "FormulaCommand", uno::Any(sal_uInt16(ScPasteFunc::ADD)) },
+  { "SkipEmptyCells", uno::Any(false) },
+  { "Transpose", uno::Any(false) },
+  { "AsLink", uno::Any(false) },
+  { "MoveMode", uno::Any(sal_uInt16(InsCellCmd::INS_NONE)) } });
+dispatchCommand(mxComponent, ".uno:InsertContents", aArgs);
+
+// Check if string in cell A2 was copied to cell A1
+CPPUNIT_ASSERT_EQUAL(OUString("2"), pDoc->GetString(ScAddress(0, 0, 0)));
+// Without the fix in place, there would be no note in cell A1 after using 
paste special
+CPPUNIT_ASSERT_MESSAGE("There should be a note on A1", 
pDoc->HasNote(ScAddress(0, 0, 0)));
+CPPUNIT_ASSERT_EQUAL(OUString("Note in A1"), pDoc->GetNote(ScAddress(0, 0, 
0))->GetText());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 25d0363c35f4..cab1dc364b31 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -2905,8 +2905,9 @@ void ScDocument::CopyFromClip(
 InsertDeleteFlags nDelFlag = InsertDeleteFlags::NONE;
 if ( (nInsFlag & (InsertDeleteFlags::CONTENTS | 
InsertDeleteFlags::ADDNOTES)) == (InsertDeleteFlags::NOTE | 
InsertDeleteFlags::ADDNOTES) )
 nDelFlag |= InsertDeleteFlags::NOTE;
-else if ( nInsFlag & InsertDeleteFlags::CONTENTS )
-nDelFlag |= InsertDeleteFlags::CONTENTS;
+// tdf#141440 - do not delete notes when pasting contents (see 
InsertDeleteFlags::CONTENTS)
+else if 

[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-15 Thread Justin Luth (via logerrit)
 sc/qa/unit/data/xls/tdf79542_radioGroupBox.xls |binary
 sc/qa/unit/subsequent_filters_test4.cxx|   20 
 sc/source/filter/excel/xiescher.cxx|   60 +
 sc/source/filter/inc/xiescher.hxx  |6 ++
 4 files changed, 86 insertions(+)

New commits:
commit 25fed4ae027b9680597ea498c25acc3f854db4bf
Author: Justin Luth 
AuthorDate: Thu Aug 4 19:52:23 2022 -0400
Commit: Justin Luth 
CommitDate: Tue May 16 01:01:27 2023 +0200

tdf#79542 xls: applyGroupBox to radiobutton groups

A group box control links radiobuttons together,
and so does a sheet.

No matching unit tests were found.

make CppunitTest_sc_subsequent_filters_test4 \
CPPUNIT_TEST_NAME=testLegacyOptionButtonGroupBox

Change-Id: Ib5b03c68b5218649268f283d11981cc03fe4850a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137838
Tested-by: Jenkins
Reviewed-by: Justin Luth 

diff --git a/sc/qa/unit/data/xls/tdf79542_radioGroupBox.xls 
b/sc/qa/unit/data/xls/tdf79542_radioGroupBox.xls
new file mode 100644
index ..1861913020d3
Binary files /dev/null and b/sc/qa/unit/data/xls/tdf79542_radioGroupBox.xls 
differ
diff --git a/sc/qa/unit/subsequent_filters_test4.cxx 
b/sc/qa/unit/subsequent_filters_test4.cxx
index fcbc02ebe0a3..d6b853607e51 100644
--- a/sc/qa/unit/subsequent_filters_test4.cxx
+++ b/sc/qa/unit/subsequent_filters_test4.cxx
@@ -116,6 +116,26 @@ CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testControlImport)
  UNO_QUERY_THROW);
 }
 
+CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testLegacyOptionButtonGroupBox)
+{
+createScDoc("xls/tdf79542_radioGroupBox.xls");
+uno::Reference xDoc(mxComponent, 
UNO_QUERY_THROW);
+uno::Reference xIA(xDoc->getSheets(), 
UNO_QUERY_THROW);
+uno::Reference 
xDrawPageSupplier(xIA->getByIndex(0),
+ 
UNO_QUERY_THROW);
+uno::Reference 
xIA_DrawPage(xDrawPageSupplier->getDrawPage(),
+ UNO_QUERY_THROW);
+
+OUString sGroupName;
+uno::Reference 
xControlShape(xIA_DrawPage->getByIndex(1),
+ UNO_QUERY_THROW);
+uno::Reference 
xPropertySet(xControlShape->getControl(),
+ uno::UNO_QUERY_THROW);
+// The radio buttons are grouped by GroupBoxes - so the name comes from 
the group shape name
+xPropertySet->getPropertyValue("GroupName") >>= sGroupName;
+CPPUNIT_ASSERT_EQUAL(OUString("Casella di gruppo 1"), sGroupName);
+}
+
 CPPUNIT_TEST_FIXTURE(ScFiltersTest4, testActiveXOptionButtonGroup)
 {
 createScDoc("xlsx/tdf111980_radioButtons.xlsx");
diff --git a/sc/source/filter/excel/xiescher.cxx 
b/sc/source/filter/excel/xiescher.cxx
index e9a47fada31c..1805b7a26312 100644
--- a/sc/source/filter/excel/xiescher.cxx
+++ b/sc/source/filter/excel/xiescher.cxx
@@ -378,6 +378,11 @@ void XclImpDrawObjBase::SetAnchor( const XclObjAnchor& 
rAnchor )
 mbHasAnchor = true;
 }
 
+const tools::Rectangle& XclImpDrawObjBase::GetDffRect() const
+{
+return maDffRect;
+}
+
 void XclImpDrawObjBase::SetDffData(
 const DffObjData& rDffObjData, const OUString& rObjName, const OUString& 
rHyperlink,
 bool bVisible, bool bAutoMargin )
@@ -388,6 +393,7 @@ void XclImpDrawObjBase::SetDffData(
 maHyperlink = rHyperlink;
 mbVisible = bVisible;
 mbAutoMargin = bAutoMargin;
+maDffRect = rDffObjData.aChildAnchor;
 }
 
 OUString XclImpDrawObjBase::GetObjName() const
@@ -2086,6 +2092,16 @@ void XclImpTbxObjBase::SetDffProperties( const 
DffPropSet& rDffPropSet )
 ::set_flag( maLineData.mnAuto, EXC_OBJ_FILL_AUTO, false );
 }
 
+void XclImpControlHelper::SetStringProperty(const OUString& sName, const 
OUString& sVal)
+{
+Reference xCtrlModel = 
XclControlHelper::GetControlModel(mxShape);
+if (!xCtrlModel.is())
+return;
+
+ScfPropertySet aProps(xCtrlModel);
+aProps.SetStringProperty(sName, sVal);
+}
+
 bool XclImpTbxObjBase::FillMacroDescriptor( ScriptEventDescriptor& rDescriptor 
) const
 {
 return XclControlHelper::FillMacroDescriptor( rDescriptor, 
DoGetEventType(), GetMacroName(), GetDocShell() );
@@ -2393,6 +2409,11 @@ XclTbxEventType XclImpOptionButtonObj::DoGetEventType() 
const
 return EXC_TBX_EVENT_ACTION;
 }
 
+bool XclImpOptionButtonObj::IsInGroup() const
+{
+return mnNextInGroup;
+}
+
 XclImpLabelObj::XclImpLabelObj( const XclImpRoot& rRoot ) :
 XclImpTbxObjBase( rRoot )
 {
@@ -4070,6 +4091,43 @@ const XclImpObjTextData* XclImpDrawing::FindTextData( 
const DffRecordHeader& rHe
 return nullptr;
 }
 
+void XclImpDrawing::ApplyGroupBoxes()
+{
+// sorted: smallest to largest - looking for smallest contained-in GroupBox
+// multimap: allows duplicate key values - may have identical areas.
+std::multimap aGroupBoxAreaMap;
+for (auto& 

[Libreoffice-commits] core.git: sc/qa sc/uiconfig

2023-05-12 Thread Bogdan B (via logerrit)
 sc/qa/uitest/solver/solver.py |4 ++--
 sc/uiconfig/scalc/ui/solverdlg.ui |8 
 2 files changed, 6 insertions(+), 6 deletions(-)

New commits:
commit f6782ca20a5b0405beffdea4062a99cd043ffe9f
Author: Bogdan B 
AuthorDate: Thu May 11 06:11:37 2023 +0200
Commit: Hossein 
CommitDate: Fri May 12 10:34:24 2023 +0200

tdf#155179 Replace in Solver "=>" with ">="

Change-Id: I4c20f755e042cee114cc81a8135b9801261c8451
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151616
Tested-by: Jenkins
Reviewed-by: Hossein 

diff --git a/sc/qa/uitest/solver/solver.py b/sc/qa/uitest/solver/solver.py
index 7a1ad19019a8..dcdb8fa1ea63 100644
--- a/sc/qa/uitest/solver/solver.py
+++ b/sc/qa/uitest/solver/solver.py
@@ -37,10 +37,10 @@ class solver(UITestCase):
 self.assertEqual("true", get_state_as_dict(xmax)["Checked"])
 
 xvalue.executeAction("CLICK", tuple())
-select_by_text(xop2list, "=>")
+select_by_text(xop2list, ">=")
 
 self.assertEqual("<=", 
get_state_as_dict(xop1list)["SelectEntryText"])
-self.assertEqual("=>", 
get_state_as_dict(xop2list)["SelectEntryText"])
+self.assertEqual(">=", 
get_state_as_dict(xop2list)["SelectEntryText"])
 
 xvalueedit.executeAction("TYPE", 
mkPropertyValues({"TEXT":"1000"}))
 xchangeedit.executeAction("TYPE", 
mkPropertyValues({"TEXT":"C2"}))
diff --git a/sc/uiconfig/scalc/ui/solverdlg.ui 
b/sc/uiconfig/scalc/ui/solverdlg.ui
index f5b1e7ebe036..eadf5df37e7b 100644
--- a/sc/uiconfig/scalc/ui/solverdlg.ui
+++ b/sc/uiconfig/scalc/ui/solverdlg.ui
@@ -596,7 +596,7 @@
 
   =
   =
-  =
+  =
   Integer
   Binary
 
@@ -618,7 +618,7 @@
 
   =
   =
-  =
+  =
   Integer
   Binary
 
@@ -640,7 +640,7 @@
 
   =
   =
-  =
+  =
   Integer
   Binary
 
@@ -662,7 +662,7 @@
 
   =
   =
-  =
+  =
   Integer
   Binary
 


[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-12 Thread Andreas Heinisch (via logerrit)
 sc/qa/uitest/pasteSpecial/tdf139858.py |   60 +
 sc/source/ui/miscdlgs/inscodlg.cxx |3 +
 2 files changed, 62 insertions(+), 1 deletion(-)

New commits:
commit 28bcb35b12f19858eca3d08559d7914e36ad1d2b
Author: Andreas Heinisch 
AuthorDate: Wed May 10 09:08:47 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Fri May 12 09:01:56 2023 +0200

tdf#139858 - Do not delete existing cell contents when pasting notes

Change-Id: I9befa9e28f70ba767bbd9c4694521964a40c4463
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151603
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sc/qa/uitest/pasteSpecial/tdf139858.py 
b/sc/qa/uitest/pasteSpecial/tdf139858.py
new file mode 100755
index ..ca81c7715cb6
--- /dev/null
+++ b/sc/qa/uitest/pasteSpecial/tdf139858.py
@@ -0,0 +1,60 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+
+from uitest.framework import UITestCase
+
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.paste_special import reset_default_values
+
+class tdf139858(UITestCase):
+def test_tdf139858_paste_comment(self):
+with self.ui_test.create_doc_in_start_center("calc") as document:
+xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+
+# Write text to cell A1 and B1
+enter_text_to_cell(xGridWin, "A1", "A1 sample text")
+enter_text_to_cell(xGridWin, "B1", "B1 sample text")
+
+# Insert a comment in cell B1
+xArgs = mkPropertyValues({"Text": "Comment 1"})
+self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", 
xArgs)
+
+# Insert a comment in cell A2
+xGridWin.executeAction("SELECT", mkPropertyValues({"CELL":"A2"}))
+xArgs = mkPropertyValues({"Text": "Comment 2"})
+self.xUITest.executeCommandWithParameters(".uno:InsertAnnotation", 
xArgs)
+
+# Copy cell A2 to clipboard
+xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "A2"}))
+self.xUITest.executeCommand(".uno:Copy")
+
+# Set cursor to cells and paste data using special options (check 
only comments)
+targetCells = ["A1", "B1"]
+for index, targetCell in enumerate(targetCells):
+xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": 
targetCell}))
+with 
self.ui_test.execute_dialog_through_command(".uno:PasteSpecial") as 
xPasteSpecialDlg:
+reset_default_values(self, xPasteSpecialDlg)
+xDateTimeChkBox = xPasteSpecialDlg.getChild("datetime")
+xDateTimeChkBox.executeAction("CLICK", tuple())
+xTextChkBox = xPasteSpecialDlg.getChild("text")
+xTextChkBox.executeAction("CLICK", tuple())
+xNumbersChkBox = xPasteSpecialDlg.getChild("numbers")
+xNumbersChkBox.executeAction("CLICK", tuple())
+xCommentsChkBox = xPasteSpecialDlg.getChild("comments")
+xCommentsChkBox.executeAction("CLICK", tuple())
+
+# Without the fix in place, this test would have failed with
+# AssertionError: 'A1 sample text' != ''
+# i.e., the cell content was overwritten
+self.assertEqual(targetCell + " sample text", 
get_cell_by_position(document, 0, index, 0).getString())
+self.assertEqual("Comment 2", get_cell_by_position(document, 
0, index, 0).Annotation.String)
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/miscdlgs/inscodlg.cxx 
b/sc/source/ui/miscdlgs/inscodlg.cxx
index ca4fd1cfa8bd..84292dcd91c4 100644
--- a/sc/source/ui/miscdlgs/inscodlg.cxx
+++ b/sc/source/ui/miscdlgs/inscodlg.cxx
@@ -213,8 +213,9 @@ InsertDeleteFlags 
ScInsertContentsDlg::GetInsContentsCmdBits() const
 ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::DATETIME;
 if ( mxBtnInsFormulas->get_active())
 ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::FORMULA;
+// tdf#139858 - do not delete existing cell contents when pasting notes
 if ( mxBtnInsNotes->get_active()   )
-ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::NOTE;
+ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::ADDNOTES;
 if ( mxBtnInsAttrs->get_active()   )
 ScInsertContentsDlg::nPreviousChecks |= InsertDeleteFlags::ATTRIB;
 if ( mxBtnInsObjects->get_active() )


[Libreoffice-commits] core.git: sc/qa

2023-05-10 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/autofilter2/tdf95520.py |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 444c598f53cdcd6230af01e279f5e74feab94597
Author: Xisco Fauli 
AuthorDate: Wed May 10 14:25:25 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 10 17:23:35 2023 +0200

sc: improve test a bit

Change-Id: I26e06d76b6af1221fdfad1ae2c8dda4f10c70e19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151632
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter2/tdf95520.py 
b/sc/qa/uitest/autofilter2/tdf95520.py
index ec245912c5a2..33b9e1948b9a 100644
--- a/sc/qa/uitest/autofilter2/tdf95520.py
+++ b/sc/qa/uitest/autofilter2/tdf95520.py
@@ -7,7 +7,7 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 from uitest.framework import UITestCase
-from uitest.uihelper.common import get_url_for_data_file
+from uitest.uihelper.common import get_url_for_data_file, get_state_as_dict
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from libreoffice.calc.document import get_cell_by_position
 
@@ -27,9 +27,17 @@ class tdf95520(UITestCase):
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
 xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
 
-# Choose Red
 xSubFloatWindow = self.xUITest.getFloatWindow()
 xSubMenu = xSubFloatWindow.getChild("textcolor")
+self.assertEqual(3, len(xSubMenu.getChildren()))
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('0'))['IsChecked'])
+self.assertEqual('#00FF00', 
get_state_as_dict(xSubMenu.getChild('0'))['Text'])
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('1'))['IsChecked'])
+self.assertEqual('Red', 
get_state_as_dict(xSubMenu.getChild('1'))['Text'])
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('2'))['IsChecked'])
+self.assertEqual('Yellow', 
get_state_as_dict(xSubMenu.getChild('2'))['Text'])
+
+# Choose Red
 xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"DOWN"}))
 xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"RETURN"}))
 


[Libreoffice-commits] core.git: sc/qa

2023-05-10 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/autofilter/colorfilter.py |   57 +
 1 file changed, 57 insertions(+)

New commits:
commit 6ec2d6461fe9c41025ce2bde13ddeb02acb01cb3
Author: Xisco Fauli 
AuthorDate: Wed May 10 14:20:24 2023 +0200
Commit: Xisco Fauli 
CommitDate: Wed May 10 15:45:33 2023 +0200

tdf#76258: sc: Add UITest

Change-Id: I670950f499ebc268318913f3f3743e8d99d9ab84
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151631
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter/colorfilter.py 
b/sc/qa/uitest/autofilter/colorfilter.py
index ecfc6924d37f..bc66c5411844 100644
--- a/sc/qa/uitest/autofilter/colorfilter.py
+++ b/sc/qa/uitest/autofilter/colorfilter.py
@@ -177,4 +177,61 @@ class ColorFilterTest(UITestCase):
 self.assertFalse(is_row_hidden(doc, 6))
 self.assertFalse(is_row_hidden(doc, 7))
 
+def test_tdf76258(self):
+# Reuse existing document
+with self.ui_test.load_file(get_url_for_data_file("tdf142579.xlsx")) 
as doc:
+calcDoc = self.xUITest.getTopFocusWindow()
+xGridWin = calcDoc.getChild("grid_window")
+
+# Blue Background Color rows are displayed
+self.assertFalse(is_row_hidden(doc, 0))
+self.assertFalse(is_row_hidden(doc, 1))
+self.assertTrue(is_row_hidden(doc, 2))
+self.assertTrue(is_row_hidden(doc, 3))
+self.assertTrue(is_row_hidden(doc, 4))
+self.assertTrue(is_row_hidden(doc, 5))
+self.assertTrue(is_row_hidden(doc, 6))
+self.assertTrue(is_row_hidden(doc, 7))
+
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "0", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xMenu = xFloatWindow.getChild("menu")
+
+# Filter by Color
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+xSubFloatWindow = self.xUITest.getFloatWindow()
+xSubMenu = xSubFloatWindow.getChild("background")
+self.assertEqual(7, len(xSubMenu.getChildren()))
+self.assertEqual('true', 
get_state_as_dict(xSubMenu.getChild('0'))['IsChecked'])
+self.assertEqual('#5A8AC6', 
get_state_as_dict(xSubMenu.getChild('0'))['Text'])
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('1'))['IsChecked'])
+self.assertEqual('#90B0D9', 
get_state_as_dict(xSubMenu.getChild('1'))['Text'])
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('2'))['IsChecked'])
+self.assertEqual('#C6D6EC', 
get_state_as_dict(xSubMenu.getChild('2'))['Text'])
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('3'))['IsChecked'])
+self.assertEqual('#F8696B', 
get_state_as_dict(xSubMenu.getChild('3'))['Text'])
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('4'))['IsChecked'])
+self.assertEqual('#FA9A9D', 
get_state_as_dict(xSubMenu.getChild('4'))['Text'])
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('5'))['IsChecked'])
+self.assertEqual('#FBCBCE', 
get_state_as_dict(xSubMenu.getChild('5'))['Text'])
+self.assertEqual('false', 
get_state_as_dict(xSubMenu.getChild('6'))['IsChecked'])
+self.assertEqual('#FCFCFF', 
get_state_as_dict(xSubMenu.getChild('6'))['Text'])
+
+# Choose another one
+xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"DOWN"}))
+xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"RETURN"}))
+
+self.assertFalse(is_row_hidden(doc, 0))
+self.assertTrue(is_row_hidden(doc, 1))
+self.assertFalse(is_row_hidden(doc, 2))
+self.assertTrue(is_row_hidden(doc, 3))
+self.assertTrue(is_row_hidden(doc, 4))
+self.assertTrue(is_row_hidden(doc, 5))
+self.assertTrue(is_row_hidden(doc, 6))
+self.assertTrue(is_row_hidden(doc, 7))
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:


[Libreoffice-commits] core.git: sc/qa

2023-05-09 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/opencl-test-2.cxx |  454 ++-
 1 file changed, 112 insertions(+), 342 deletions(-)

New commits:
commit daf30c29be67b8b8fa361b0efd1a6cdbe087b6f8
Author: Xisco Fauli 
AuthorDate: Tue May 9 16:39:59 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 9 21:44:52 2023 +0200

CppunitTest_sc_opencl-2: use CPPUNIT_TEST_FIXTURE()

Avoiding the declaration/registration/definition of each
test manually saves a lot of space.

Change-Id: I3a6253d259bac58f8d8ca78cd5d4f9e357a2c315
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151589
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/opencl-test-2.cxx b/sc/qa/unit/opencl-test-2.cxx
index a53613560e71..4c7fbdbcb96d 100644
--- a/sc/qa/unit/opencl-test-2.cxx
+++ b/sc/qa/unit/opencl-test-2.cxx
@@ -20,237 +20,9 @@ class ScOpenCLTest2
 {
 public:
 ScOpenCLTest2();
-
-void testStatisticalFormulaFDist();
-void testStatisticalFormulaVar();
-void testStatisticalFormulaChiDist();
-void testMathFormulaPower();
-void testMathFormulaOdd();
-void testStatisticalFormulaChiSqDist();
-void testStatisticalFormulaChiSqInv();
-void testStatisticalFormulaGammaInv();
-void testMathFormulaFloor();
-void testStatisticalFormulaFInv();
-void testStatisticalFormulaFTest();
-void testStatisticalFormulaB();
-void testStatisticalFormulaBetaDist();
-void testMathFormulaCscH();
-void testMathFormulaExp();
-void testMathFormulaLog10();
-void testStatisticalFormulaExpondist();
-void testMathAverageIfsFormula();
-void testMathCountIfsFormula();
-void testMathFormulaCombina();
-void testMathFormulaEven();
-void testMathFormulaLog();
-void testMathFormulaMod();
-void testMathFormulaTrunc();
-void testStatisticalFormulaSkew();
-void testMathFormulaArcTan2();
-void testMathFormulaBitOr();
-void testMathFormulaBitLshift();
-void testMathFormulaBitRshift();
-void testMathFormulaBitXor();
-void testStatisticalFormulaChiInv();
-void testStatisticalFormulaPoisson();
-void testMathFormulaSumSQ();
-void testStatisticalFormulaSkewp();
-void testMathFormulaSqrtPi();
-void testStatisticalFormulaBinomDist();
-void testStatisticalFormulaVarP();
-void testMathFormulaCeil();
-void testMathFormulaKombin();
-void testStatisticalFormulaDevSq();
-void testStatisticalFormulaStDev();
-void testStatisticalFormulaSlope();
-void testStatisticalFormulaSTEYX();
-void testStatisticalFormulaZTest();
-void testMathFormulaPi();
-void testMathFormulaRandom();
-void testMathFormulaConvert();
-void testMathFormulaProduct();
-void testStatisticalFormulaHypGeomDist();
-void testArrayFormulaSumX2MY2();
-void testArrayFormulaSumX2PY2();
-void testStatisticalFormulaBetainv();
-void testStatisticalFormulaTTest();
-void testStatisticalFormulaTDist();
-void testStatisticalFormulaTInv();
-void testArrayFormulaSumXMY2();
-void testStatisticalFormulaStDevP();
-void testStatisticalFormulaCovar();
-void testLogicalFormulaAnd();
-void testLogicalFormulaOr();
-void testMathFormulaSumProduct();
-void testMathFormulaSumProduct2();
-void testStatisticalParallelCountBug();
-void testSpreadSheetFormulaVLookup();
-void testLogicalFormulaNot();
-void testLogicalFormulaXor();
-void testDatabaseFormulaDmax();
-void testDatabaseFormulaDmin();
-void testDatabaseFormulaDproduct();
-void testDatabaseFormulaDaverage();
-void testDatabaseFormulaDstdev();
-void testDatabaseFormulaDstdevp();
-void testDatabaseFormulaDsum();
-void testDatabaseFormulaDvar();
-void testDatabaseFormulaDvarp();
-void testMathFormulaAverageIf();
-void testDatabaseFormulaDcount();
-void testDatabaseFormulaDcountA();
-void testMathFormulaDegrees();
-void testMathFormulaRoundUp();
-void testMathFormulaRoundDown();
-void testMathFormulaInt();
-void testMathFormulaRadians();
-void testMathFormulaCountIf();
-void testMathFormulaIsEven();
-void testMathFormulaIsOdd();
-void testMathFormulaFact();
-void testStatisticalFormulaMina();
-void testStatisticalFormulaCountA();
-void testStatisticalFormulaMaxa();
-void testStatisticalFormulaAverageA();
-void testStatisticalFormulaVarA();
-void testStatisticalFormulaVarPA();
-void testStatisticalFormulaStDevA();
-void testStatisticalFormulaStDevPA();
-void testMathFormulaSEC();
-void testMathFormulaSECH();
-void testMathFormulaMROUND();
-void testMathFormulaSeriesSum();
-void testMathFormulaQuotient();
-void testMathFormulaSumIf();
-void testAddInFormulaBesseLJ();
-void testNegSub();
-void testStatisticalFormulaAvedev();
-void testMathFormulaAverageIf_Mix();
-void testStatisticalFormulaKurt1();
-void 

[Libreoffice-commits] core.git: sc/qa

2023-05-09 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/autofilter2/tdf95520.py |   49 +++
 1 file changed, 49 insertions(+)

New commits:
commit efdbe4179d151899c8a9a9de8f5bc1660700b27d
Author: Xisco Fauli 
AuthorDate: Tue May 9 14:37:31 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 9 19:26:36 2023 +0200

tdf#95520: sc: Add UItest

Change-Id: Ia4e30a1e4dea3dbd9eb40c29c96e5ab3d700e54e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151578
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter2/tdf95520.py 
b/sc/qa/uitest/autofilter2/tdf95520.py
new file mode 100644
index ..ec245912c5a2
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf95520.py
@@ -0,0 +1,49 @@
+# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-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/.
+#
+from uitest.framework import UITestCase
+from uitest.uihelper.common import get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position
+
+class tdf95520(UITestCase):
+def test_tdf95520(self):
+# Reuse existing document
+with self.ui_test.load_file(get_url_for_data_file("tdf144549.ods")) as 
doc:
+calcDoc = self.xUITest.getTopFocusWindow()
+xGridWin = calcDoc.getChild("grid_window")
+
+xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": 
"", "COL": "1", "ROW": "0"}))
+xFloatWindow = self.xUITest.getFloatWindow()
+xMenu = xFloatWindow.getChild("menu")
+
+# Sort by Color
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"DOWN"}))
+xMenu.executeAction("TYPE", mkPropertyValues({"KEYCODE":"RETURN"}))
+
+# Choose Red
+xSubFloatWindow = self.xUITest.getFloatWindow()
+xSubMenu = xSubFloatWindow.getChild("textcolor")
+xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"DOWN"}))
+xSubMenu.executeAction("TYPE", 
mkPropertyValues({"KEYCODE":"RETURN"}))
+
+self.assertEqual("Jan", get_cell_by_position(doc, 0, 0, 
1).getString())
+self.assertEqual("Dez", get_cell_by_position(doc, 0, 0, 
2).getString())
+self.assertEqual("Aug", get_cell_by_position(doc, 0, 0, 
3).getString())
+self.assertEqual("Nov", get_cell_by_position(doc, 0, 0, 
4).getString())
+self.assertEqual("Jun", get_cell_by_position(doc, 0, 0, 
5).getString())
+self.assertEqual("Apr", get_cell_by_position(doc, 0, 0, 
6).getString())
+self.assertEqual("Mai", get_cell_by_position(doc, 0, 0, 
7).getString())
+self.assertEqual("Okt", get_cell_by_position(doc, 0, 0, 
8).getString())
+self.assertEqual("Feb", get_cell_by_position(doc, 0, 0, 
9).getString())
+self.assertEqual("Mär", get_cell_by_position(doc, 0, 0, 
10).getString())
+self.assertEqual("Jul", get_cell_by_position(doc, 0, 0, 
11).getString())
+self.assertEqual("Sep", get_cell_by_position(doc, 0, 0, 
12).getString())
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:


[Libreoffice-commits] core.git: sc/qa

2023-05-09 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/opencl-test-2.cxx |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit 7b6dbbcb5a42bb51b3e84b54f9950f3f43e97c97
Author: Xisco Fauli 
AuthorDate: Tue May 9 12:59:29 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 9 15:32:53 2023 +0200

CppunitTest_sc_opencl-2: re-enable test

Disable in 836abd393d126cfbba6b0bd1fdda5b03095516c9
"GPU Calc: temporarily disable Kombin unit test"

Change-Id: I311caae5450874c61a6bf5e40940513f614da965
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151572
Tested-by: Xisco Fauli 
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/opencl-test-2.cxx b/sc/qa/unit/opencl-test-2.cxx
index e3f79293e1eb..a99808da19c4 100644
--- a/sc/qa/unit/opencl-test-2.cxx
+++ b/sc/qa/unit/opencl-test-2.cxx
@@ -68,7 +68,7 @@ public:
 void testStatisticalFormulaBinomDist();
 void testStatisticalFormulaVarP();
 void testMathFormulaCeil();
-// void testMathFormulaKombin();
+void testMathFormulaKombin();
 void testStatisticalFormulaDevSq();
 void testStatisticalFormulaStDev();
 void testStatisticalFormulaSlope();
@@ -182,8 +182,7 @@ public:
 CPPUNIT_TEST(testStatisticalFormulaBinomDist);
 CPPUNIT_TEST(testStatisticalFormulaVarP);
 CPPUNIT_TEST(testMathFormulaCeil);
-// This test fails MacOS 10.8. Disabled temporarily
-// CPPUNIT_TEST(testMathFormulaKombin);
+CPPUNIT_TEST(testMathFormulaKombin);
 CPPUNIT_TEST(testStatisticalFormulaDevSq);
 CPPUNIT_TEST(testStatisticalFormulaStDev);
 CPPUNIT_TEST(testStatisticalFormulaSlope);
@@ -1177,7 +1176,6 @@ void ScOpenCLTest2::testMathFormulaProduct()
 }
 }
 
-#if 0 //Disabled temporarily
 void ScOpenCLTest2::testMathFormulaKombin()
 {
 initTestEnv(u"ods/opencl/math/Kombin.ods");
@@ -1193,7 +1191,6 @@ void ScOpenCLTest2::testMathFormulaKombin()
 CPPUNIT_ASSERT_DOUBLES_EQUAL(fExcel, fLibre, fabs(0.0001*fExcel));
 }
 }
-#endif
 
 void ScOpenCLTest2:: testArrayFormulaSumX2MY2()
 {


[Libreoffice-commits] core.git: sc/qa

2023-05-09 Thread Xisco Fauli (via logerrit)
 sc/qa/extras/vba-macro-test.cxx |  101 +---
 1 file changed, 24 insertions(+), 77 deletions(-)

New commits:
commit 3efb1714d7095898389f86258e805a62e7468a19
Author: Xisco Fauli 
AuthorDate: Tue May 9 10:40:02 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 9 12:28:57 2023 +0200

CppunitTest_sc_vba_macro_test: use CPPUNIT_TEST_FIXTURE()

Avoid the declaration/registration/definition of each
test manually saves a lot of space.

Change-Id: Ifbefb1950f7fe547489f279c8b229c43dac57f3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151564
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/extras/vba-macro-test.cxx b/sc/qa/extras/vba-macro-test.cxx
index 73dab6bba921..ffe77d21fe7d 100644
--- a/sc/qa/extras/vba-macro-test.cxx
+++ b/sc/qa/extras/vba-macro-test.cxx
@@ -47,61 +47,9 @@ public:
 : UnoApiTest("/sc/qa/extras/testdocuments")
 {
 }
-
-void testSimpleCopyAndPaste();
-void testMultiDocumentCopyAndPaste();
-void testSheetAndColumnSelectAndHide();
-void testPrintArea();
-void testSelectAllChaged();
-void testRangeSelect();
-void testWindowState();
-void testScroll();
-void testMacroKeyBinding();
-
-void testVba();
-void testTdf149579();
-void testVbaRangeSort();
-void testTdf107885();
-void testTdf131562();
-void testTdf52602();
-void testTdf107902();
-void testTdf90278();
-void testTdf149531();
-void testTdf118247();
-void testTdf126457();
-void testVbaPDFExport();
-void testForEachInSelection();
-void testNonAsciiMacroIRI();
-
-CPPUNIT_TEST_SUITE(VBAMacroTest);
-CPPUNIT_TEST(testSimpleCopyAndPaste);
-CPPUNIT_TEST(testMultiDocumentCopyAndPaste);
-CPPUNIT_TEST(testSheetAndColumnSelectAndHide);
-CPPUNIT_TEST(testPrintArea);
-CPPUNIT_TEST(testSelectAllChaged);
-CPPUNIT_TEST(testRangeSelect);
-CPPUNIT_TEST(testWindowState);
-CPPUNIT_TEST(testScroll);
-CPPUNIT_TEST(testMacroKeyBinding);
-
-CPPUNIT_TEST(testVba);
-CPPUNIT_TEST(testTdf149579);
-CPPUNIT_TEST(testVbaRangeSort);
-CPPUNIT_TEST(testTdf107885);
-CPPUNIT_TEST(testTdf131562);
-CPPUNIT_TEST(testTdf52602);
-CPPUNIT_TEST(testTdf107902);
-CPPUNIT_TEST(testTdf90278);
-CPPUNIT_TEST(testTdf149531);
-CPPUNIT_TEST(testTdf118247);
-CPPUNIT_TEST(testTdf126457);
-CPPUNIT_TEST(testVbaPDFExport);
-CPPUNIT_TEST(testForEachInSelection);
-CPPUNIT_TEST(testNonAsciiMacroIRI);
-CPPUNIT_TEST_SUITE_END();
 };
 
-void VBAMacroTest::testSimpleCopyAndPaste()
+CPPUNIT_TEST_FIXTURE(VBAMacroTest, testSimpleCopyAndPaste)
 {
 // Copy-paste values in the same sheet
 
@@ -138,7 +86,7 @@ void VBAMacroTest::testSimpleCopyAndPaste()
 CPPUNIT_ASSERT_EQUAL(30.0, rDoc.GetValue(ScAddress(1, 5, 0)));
 }
 
-void VBAMacroTest::testMultiDocumentCopyAndPaste()
+CPPUNIT_TEST_FIXTURE(VBAMacroTest, testMultiDocumentCopyAndPaste)
 {
 // Creates a new workbook (document) and copy-pastes values
 // between the documents.
@@ -172,7 +120,7 @@ void VBAMacroTest::testMultiDocumentCopyAndPaste()
 CPPUNIT_ASSERT_EQUAL(0.0, rDoc.GetValue(ScAddress(1, 3, 0)));
 }
 
-void VBAMacroTest::testSheetAndColumnSelectAndHide()
+CPPUNIT_TEST_FIXTURE(VBAMacroTest, testSheetAndColumnSelectAndHide)
 {
 loadFromURL(u"SheetAndColumnSelectAndHide.xlsm");
 
@@ -233,7 +181,7 @@ void VBAMacroTest::testSheetAndColumnSelectAndHide()
 CPPUNIT_ASSERT_EQUAL(SCTAB(0), rViewData.GetTabNo());
 }
 
-void VBAMacroTest::testPrintArea()
+CPPUNIT_TEST_FIXTURE(VBAMacroTest, testPrintArea)
 {
 // Sets the print area to A1:B5
 // ActiveSheet.PageSetup.PrintArea = "$A$1:$B$5"
@@ -258,7 +206,7 @@ void VBAMacroTest::testPrintArea()
 }
 }
 
-void VBAMacroTest::testSelectAllChaged()
+CPPUNIT_TEST_FIXTURE(VBAMacroTest, testSelectAllChaged)
 {
 // Columns("A:A").Select
 // Range(Selection, Selection.End(xlToRight)).Select
@@ -280,7 +228,7 @@ void VBAMacroTest::testSelectAllChaged()
 CPPUNIT_ASSERT_EQUAL(ScRange(0, 0, 0, 4, MAXROW, 0), 
pViewData.GetMarkData().GetMarkArea());
 }
 
-void VBAMacroTest::testRangeSelect()
+CPPUNIT_TEST_FIXTURE(VBAMacroTest, testRangeSelect)
 {
 // Range("B2").Select
 // Range(Selection, Selection.End(xlToRight)).Select
@@ -302,7 +250,7 @@ void VBAMacroTest::testRangeSelect()
 CPPUNIT_ASSERT_EQUAL(ScRange(1, 1, 0, 4, 1, 0), 
pViewData.GetMarkData().GetMarkArea());
 }
 
-void VBAMacroTest::testWindowState()
+CPPUNIT_TEST_FIXTURE(VBAMacroTest, testWindowState)
 {
 // Application.WindowState = xlMinimized
 // Application.WindowState = xlMaximized
@@ -313,7 +261,7 @@ void VBAMacroTest::testWindowState()
  "location=document");
 }
 
-void VBAMacroTest::testScroll()
+CPPUNIT_TEST_FIXTURE(VBAMacroTest, testScroll)
 {
 // ActiveWindow.ScrollColumn = 30
 // ActiveWindow.ScrollRow = 100
@@ -340,7 +288,7 @@ void VBAMacroTest::testScroll()

[Libreoffice-commits] core.git: sc/qa

2023-05-09 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/data/xls/tdf120177.xls  |binary
 sc/qa/unit/subsequent_export_test4.cxx |   32 
 2 files changed, 32 insertions(+)

New commits:
commit 332ac45c73952af7e2c2a868fc03e17d96a7de2c
Author: Xisco Fauli 
AuthorDate: Tue May 9 10:31:28 2023 +0200
Commit: Xisco Fauli 
CommitDate: Tue May 9 11:55:17 2023 +0200

tdf#120177: sc_subsequent_export_test4: Add unittest

Change-Id: I71846e6e80674dc61126069d13ddd431560b071b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151563
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/data/xls/tdf120177.xls 
b/sc/qa/unit/data/xls/tdf120177.xls
new file mode 100644
index ..b843060f6f71
Binary files /dev/null and b/sc/qa/unit/data/xls/tdf120177.xls differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 233195b2ebde..46ea2547eadc 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -132,6 +132,38 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testRotatedImageODS)
 CPPUNIT_ASSERT(sY.endsWith("mm"));
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf120177)
+{
+createScDoc("xls/tdf120177.xls");
+
+// Error: unexpected attribute "form:input-required"
+skipValidation();
+
+save("calc8");
+xmlDocUniquePtr pXmlDoc = parseExport("content.xml");
+CPPUNIT_ASSERT(pXmlDoc);
+
+// Without the fix in place, this test would have failed with
+// no attribute 'value' exist
+assertXPath(pXmlDoc,
+
"/office:document-content/office:body/office:spreadsheet/table:table/office:forms/"
+"form:form/form:radio[1]",
+"value", "1");
+assertXPath(pXmlDoc,
+
"/office:document-content/office:body/office:spreadsheet/table:table/office:forms/"
+"form:form/form:radio[2]",
+"value", "2");
+const OUString sGroupName1 = getXPath(pXmlDoc,
+  
"/office:document-content/office:body/office:spreadsheet/"
+  
"table:table/office:forms/form:form/form:radio[1]",
+  "group-name");
+const OUString sGroupName2 = getXPath(pXmlDoc,
+  
"/office:document-content/office:body/office:spreadsheet/"
+  
"table:table/office:forms/form:form/form:radio[2]",
+  "group-name");
+CPPUNIT_ASSERT_EQUAL(sGroupName1, sGroupName2);
+}
+
 CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf85553)
 {
 createScDoc("ods/tdf85553.ods");


[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-08 Thread Czeber László Ádám (via logerrit)
 sc/qa/unit/data/csv/tdf152980.csv  |9 ++
 sc/qa/unit/subsequent_export_test4.cxx |   27 +++
 sc/source/filter/oox/richstring.cxx|  112 -
 3 files changed, 37 insertions(+), 111 deletions(-)

New commits:
commit 96965871f4cd2e4afbdf3bcae9dc0c43d1543e1d
Author: Czeber László Ádám 
AuthorDate: Mon May 8 09:33:07 2023 +0200
Commit: Eike Rathke 
CommitDate: Tue May 9 00:05:57 2023 +0200

tdf#152980 CSV import: Fix control character length in XLSX save

Converting from CSV to XLSX corrupts text that looks like a control
character. Only 4 numeric length escape character allowed, in _x000D_
format, not _x0D_ for exampled.

Change lcl_unEscapeUnicodeChars function to decodeXString. Delete not used 
functions and add multiple occurence for unit test.

Change-Id: Id1d4bfcf7d27cf5005e7bea8e289303c5d9aca73
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151494
Reviewed-by: Eike Rathke 
Tested-by: Eike Rathke 

diff --git a/sc/qa/unit/data/csv/tdf152980.csv 
b/sc/qa/unit/data/csv/tdf152980.csv
new file mode 100644
index ..c5050b86d968
--- /dev/null
+++ b/sc/qa/unit/data/csv/tdf152980.csv
@@ -0,0 +1,9 @@
+"a_x1_b"
+"a_x01_b"
+"a_x001_b"
+"a_x0001_b"
+"a_xfoo
b"
+"a b"
+"a
+b"
+"a

b"
diff --git a/sc/qa/unit/subsequent_export_test4.cxx 
b/sc/qa/unit/subsequent_export_test4.cxx
index 79b5441c8f17..233195b2ebde 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -1638,6 +1638,33 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf119565)
  
xShapeProps->getPropertyValue("LineJoint").get());
 }
 
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf152980)
+{
+createScDoc("csv/tdf152980.csv");
+ScDocShell* pDocSh = getScDocShell();
+pDocSh->DoHardRecalc();
+saveAndReload("Calc Office Open XML");
+pDocSh = getScDocShell();
+pDocSh->DoHardRecalc();
+
+ScDocument* pDoc = getScDoc();
+
+// - Expected: The part between a and b does not change
+// - Actual  : Only the characters a and b remain
+CPPUNIT_ASSERT_EQUAL(OUString("a_x1_b"), pDoc->GetString(0, 0, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("a_x01_b"), pDoc->GetString(0, 1, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("a_x001_b"), pDoc->GetString(0, 2, 0));
+
+// The character code does not change in both cases
+CPPUNIT_ASSERT_EQUAL(OUString("a_x0001_b"), pDoc->GetString(0, 3, 0));
+
+// The escape characters are handled correctly in both cases
+CPPUNIT_ASSERT_EQUAL(OUString("a_xfoo\nb"), pDoc->GetString(0, 4, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("a\tb"), pDoc->GetString(0, 5, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("a\nb"), pDoc->GetString(0, 6, 0));
+CPPUNIT_ASSERT_EQUAL(OUString("a\n\nb"), pDoc->GetString(0, 7, 0));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/filter/oox/richstring.cxx 
b/sc/source/filter/oox/richstring.cxx
index a9b272d62a9a..8d2f964362d0 100644
--- a/sc/source/filter/oox/richstring.cxx
+++ b/sc/source/filter/oox/richstring.cxx
@@ -48,116 +48,6 @@ bool lclNeedsRichTextFormat( const oox::xls::Font* pFont )
 return pFont && pFont->needsRichTextFormat();
 }
 
-sal_Int32 lcl_getHexLetterValue(sal_Unicode nCode)
-{
-if (nCode >= '0' && nCode <= '9')
-return nCode - '0';
-
-if (nCode >= 'A' && nCode <= 'F')
-return nCode - 'A' + 10;
-
-if (nCode >= 'a' && nCode <= 'f')
-return nCode - 'a' + 10;
-
-return -1;
-}
-
-bool lcl_validEscape(sal_Unicode nCode)
-{
-// Valid XML chars that can be escaped (ignoring the restrictions) as in 
the OOX open spec
-// 2.1.1742 Part 1 Section 22.9.2.19, ST_Xstring (Escaped String)
-if (nCode == 0x000D || nCode == 0x000A || nCode == 0x0009 || nCode == 
0x005F)
-return true;
-
-// Other valid XML chars in basic multilingual plane that cannot be 
escaped.
-if ((nCode >= 0x0020 && nCode <= 0xD7FF) || (nCode >= 0xE000 && nCode <= 
0xFFFD))
-return false;
-
-return true;
-}
-
-OUString lcl_unEscapeUnicodeChars(const OUString& rSrc)
-{
-// Example: Escaped representation of unicode char 0x000D is _x000D_
-
-sal_Int32 nLen = rSrc.getLength();
-if (!nLen)
-return rSrc;
-
-sal_Int32 nStart = 0;
-bool bFound = false;
-const OUString aPrefix = "_x";
-sal_Int32 nPrefixStart = rSrc.indexOf(aPrefix, nStart);
-
-if (nPrefixStart == -1)
-return rSrc;
-
-OUStringBuffer aBuf(rSrc);
-sal_Int32 nOffset = 0; // index offset in aBuf w.r.t rSrc.
-
-do
-{
-sal_Int32 nEnd = -1;
-sal_Unicode nCode = 0;
-bool bFoundThis = false;
-for (sal_Int32 nIdx = 0; nIdx < 5; ++nIdx)
-{
-sal_Int32 nThisIdx = nPrefixStart + nIdx + 2;
-if (nThisIdx >= nLen)
-break;
-
-sal_Unicode nThisCode = rSrc[nThisIdx];
-sal_Int32 

[Libreoffice-commits] core.git: sc/qa

2023-05-08 Thread Xisco Fauli (via logerrit)
 sc/qa/uitest/autofilter/colorfilter.py |   40 +
 sc/qa/uitest/data/autofilter/tdf144549.ods |binary
 2 files changed, 40 insertions(+)

New commits:
commit 2c4bfbf224aa5ced905bbe569ca56ecf5e00115f
Author: Xisco Fauli 
AuthorDate: Mon May 8 13:24:10 2023 +0200
Commit: Xisco Fauli 
CommitDate: Mon May 8 22:40:21 2023 +0200

tdf#144549: sc: Add UItest

Change-Id: If0839d3f33e6fb7d5264b61d033b33e98f3ff44d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151504
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/uitest/autofilter/colorfilter.py 
b/sc/qa/uitest/autofilter/colorfilter.py
index 967b17e36d6a..ecfc6924d37f 100644
--- a/sc/qa/uitest/autofilter/colorfilter.py
+++ b/sc/qa/uitest/autofilter/colorfilter.py
@@ -102,6 +102,46 @@ class ColorFilterTest(UITestCase):
 self.assertTrue(is_row_hidden(doc, 6))
 self.assertFalse(is_row_hidden(doc, 7))
 
+def test_tdf144549(self):
+with self.ui_test.load_file(get_url_for_data_file("tdf144549.ods")) as 
doc:
+
+xGridWin = self.xUITest.getTopFocusWindow().getChild("grid_window")
+xGridWin.executeAction("SELECT", mkPropertyValues({"CELL": "B1"}))
+
+for i in range(12):
+self.assertFalse(is_row_hidden(doc, i))
+
+with 
self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
 as xDialog:
+xField1 = xDialog.getChild("field1")
+xCond1 = xDialog.getChild("cond1")
+
+self.assertEqual("Value", 
get_state_as_dict(xField1)['DisplayText'])
+
+select_by_text(xCond1, "Font color")
+self.assertEqual("Font color", 
get_state_as_dict(xCond1)['DisplayText'])
+
+xColor1 = xDialog.getChild("color1")
+
+# Without the fix in place, this test would have failed with
+# AssertionError: '3' != '1'
+self.assertEqual('3', get_state_as_dict(xColor1)["EntryCount"])
+
+select_pos(xColor1, "0")
+
+self.assertFalse(is_row_hidden(doc, 0))
+self.assertTrue(is_row_hidden(doc, 1))
+self.assertTrue(is_row_hidden(doc, 2))
+self.assertTrue(is_row_hidden(doc, 3))
+self.assertFalse(is_row_hidden(doc, 4))
+self.assertFalse(is_row_hidden(doc, 5))
+self.assertTrue(is_row_hidden(doc, 6))
+self.assertTrue(is_row_hidden(doc, 7))
+self.assertTrue(is_row_hidden(doc, 8))
+self.assertTrue(is_row_hidden(doc, 9))
+self.assertFalse(is_row_hidden(doc, 10))
+self.assertTrue(is_row_hidden(doc, 11))
+self.assertTrue(is_row_hidden(doc, 12))
+
 def test_tdf142579_conditional_format(self):
 with 
self.ui_test.load_file(get_url_for_data_file("tdf142579_cond_format.ods")) as 
doc:
 
diff --git a/sc/qa/uitest/data/autofilter/tdf144549.ods 
b/sc/qa/uitest/data/autofilter/tdf144549.ods
new file mode 100644
index ..811e5676a2df
Binary files /dev/null and b/sc/qa/uitest/data/autofilter/tdf144549.ods differ


[Libreoffice-commits] core.git: sc/qa

2023-05-08 Thread Regina Henschel (via logerrit)
 sc/qa/unit/data/ods/tdf125938_anchor_after_copy_paste.ods|binary
 sc/qa/unit/data/ods/tdf155091_paste_duplicates.ods   |binary
 sc/qa/unit/data/ods/tdf155094_paste_transposed.ods   |binary
 sc/qa/unit/data/ods/tdf155095_shape_over_collapsed_group.ods |binary
 sc/qa/unit/scshapetest.cxx   |  123 +++
 5 files changed, 123 insertions(+)

New commits:
commit 43f72183ce12835f6a3a5185e708a00e968d27da
Author: Regina Henschel 
AuthorDate: Mon May 8 00:25:18 2023 +0200
Commit: Regina Henschel 
CommitDate: Mon May 8 22:20:10 2023 +0200

tdf#139083 Further unit tests for commit dfb0d118

The tests cover bugs tdf#125938, tdf#155091, tdf#155094 and tdf#155095.

Change-Id: Ifb5fdb2375656934822e7b705062c559f073aacd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151488
Tested-by: Jenkins
Reviewed-by: Regina Henschel 

diff --git a/sc/qa/unit/data/ods/tdf125938_anchor_after_copy_paste.ods 
b/sc/qa/unit/data/ods/tdf125938_anchor_after_copy_paste.ods
new file mode 100644
index ..38bd2caa5e68
Binary files /dev/null and 
b/sc/qa/unit/data/ods/tdf125938_anchor_after_copy_paste.ods differ
diff --git a/sc/qa/unit/data/ods/tdf155091_paste_duplicates.ods 
b/sc/qa/unit/data/ods/tdf155091_paste_duplicates.ods
new file mode 100644
index ..987d372d1180
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf155091_paste_duplicates.ods 
differ
diff --git a/sc/qa/unit/data/ods/tdf155094_paste_transposed.ods 
b/sc/qa/unit/data/ods/tdf155094_paste_transposed.ods
new file mode 100644
index ..b81ff02faa53
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf155094_paste_transposed.ods 
differ
diff --git a/sc/qa/unit/data/ods/tdf155095_shape_over_collapsed_group.ods 
b/sc/qa/unit/data/ods/tdf155095_shape_over_collapsed_group.ods
new file mode 100644
index ..4c762e172a1b
Binary files /dev/null and 
b/sc/qa/unit/data/ods/tdf155095_shape_over_collapsed_group.ods differ
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 6f9a39c8eafa..0e4f1b555f99 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -1046,6 +1046,129 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf155093_double_names)
 CPPUNIT_ASSERT(pObjOrig->GetName() != pObjPasted->GetName());
 }
 
+CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf155095_shape_collapsed_group)
+{
+// Load a document, which has a shape in range C9:C16, anchored 'To cell 
(resize with cell)'.
+// The rows 11 to 14 are in a collapsed group. So the shape effectively 
spans 4 rows. When
+// copying the range B5:C19 and pasting it to B22, the group is expanded 
and the shape should
+// increase its height so that it spans 8 rows.
+createScDoc("ods/tdf155095_shape_over_collapsed_group.ods");
+ScDocument* pDoc = getScDoc();
+
+// Copy and paste
+goToCell("$B$5:$C$19");
+dispatchCommand(mxComponent, ".uno:Copy", {});
+goToCell("$B$22");
+dispatchCommand(mxComponent, ".uno:Paste", {});
+
+// Make sure the shape has the correct size and spans C26:C33
+SdrObject* pObj = lcl_getSdrObjectWithAssert(*pDoc, 1); // pasted shape
+// Without fix the shape had position(6708,11564) and size(407,2013).
+tools::Rectangle aExpectedRect(tools::Rectangle(Point(6708, 10743), 
Size(407, 3473)));
+tools::Rectangle aSnapRect(pObj->GetSnapRect());
+CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aExpectedRect, aSnapRect, 1);
+
+// Without fix the shape spans C28:C32
+ScDrawObjData* pObjData = ScDrawLayer::GetObjData(pObj);
+ScAddress aExpectedStart(SCCOL(2), SCROW(25), SCTAB(0)); // zero based
+ScAddress aExpectedEnd(SCCOL(2), SCROW(32), SCTAB(0));
+CPPUNIT_ASSERT_EQUAL(aExpectedStart, (*pObjData).maStart);
+CPPUNIT_ASSERT_EQUAL(aExpectedEnd, (*pObjData).maEnd);
+}
+
+CPPUNIT_TEST_FIXTURE(ScShapeTest, testTdf155094_paste_transposed)
+{
+// Load a document, which has a page anchored shape "Red" in C4, a cell 
anchored shape "Green" in
+// D4 and a cell anchored shape "Blue" with 'resize with cell' in E4. The 
range C3:E5 is copied
+// and pasted with 'Transpose all' to cell K6. The pasted content had 
these errors:
+// Pasted shape "Red" was missing.
+// Pasted shape "Green" was resized although 'resize with cell' was not 
set.
+// Pasted shape "Blue" was in cell K5 instead of L8.
+// The behavior of paste transposed is changed since LO 7.6 so that no 
shape is resized.
+createScDoc("ods/tdf155094_paste_transposed.ods");
+ScDocument* pDoc = getScDoc();
+
+// Copy and paste
+goToCell("$C$3:$E$5");
+dispatchCommand(mxComponent, ".uno:Copy", {});
+goToCell("$K$6");
+uno::Sequence aPropertyValues
+= { comphelper::makePropertyValue("Flags", OUString("A")),
+comphelper::makePropertyValue("FormulaCommand", sal_uInt16(0)),
+comphelper::makePropertyValue("SkipEmptyCells", false),
+ 

[Libreoffice-commits] core.git: sc/qa sc/source

2023-05-07 Thread Andreas Heinisch (via logerrit)
 sc/qa/uitest/calc_tests6/moveCopySheet.py |   32 ++
 sc/source/ui/inc/mvtabdlg.hxx |3 ++
 sc/source/ui/miscdlgs/mvtabdlg.cxx|   15 ++
 3 files changed, 42 insertions(+), 8 deletions(-)

New commits:
commit 6f67eb36d035fa3fe4103e497207452602ff993b
Author: Andreas Heinisch 
AuthorDate: Fri May 5 19:28:58 2023 +0200
Commit: Andreas Heinisch 
CommitDate: Sun May 7 13:39:12 2023 +0200

tdf#96854 - Remember last used option in copy/move sheet dialog

Change-Id: Iebfd224091c108bb5068b716c39da0979a7ab3ac
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151437
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch 

diff --git a/sc/qa/uitest/calc_tests6/moveCopySheet.py 
b/sc/qa/uitest/calc_tests6/moveCopySheet.py
index 80bd9f830a27..5b21e6e86cb0 100644
--- a/sc/qa/uitest/calc_tests6/moveCopySheet.py
+++ b/sc/qa/uitest/calc_tests6/moveCopySheet.py
@@ -23,8 +23,10 @@ class moveCopySheet(UITestCase):
 newName.executeAction("TYPE", 
mkPropertyValues({"TEXT":"newName"}))
 #verify, the file has 2 sheets; first one "newName" is selected
 self.assertEqual(document.Sheets.getCount(), 2)
-# dialog move/copy sheet ; Move is selected; select -move to end 
position - ; New Name = moveName
+# dialog move/copy sheet ; Copy is selected; Select move and -move 
to end position - ; New Name = moveName
 with self.ui_test.execute_dialog_through_command(".uno:Move") as 
xDialog:
+xMoveButton = xDialog.getChild("move")
+xMoveButton.executeAction("CLICK", tuple())
 insertBefore = xDialog.getChild("insertBefore")
 
 xTreeEntry = insertBefore.getChild('2')
@@ -76,6 +78,29 @@ class moveCopySheet(UITestCase):
 self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], 
"false")
 self.assertEqual(get_state_as_dict(xMoveButton)["Enabled"], 
"false")
 
+# tdf#96854 - remember last used option for copy/move sheet
+def test_tdf96854_remember_copy_move_option(self):
+with self.ui_test.create_doc_in_start_center("calc"):
+# Add a second sheet to the calc document
+with self.ui_test.execute_dialog_through_command(".uno:Move") as 
xDialog:
+pass
+
+# Check if the copy option was remembered
+with self.ui_test.execute_dialog_through_command(".uno:Move") as 
xDialog:
+xCopyButton = xDialog.getChild("copy")
+self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], 
"true")
+xMoveButton = xDialog.getChild("move")
+self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], 
"false")
+# Move selected sheet and check if option was remembered
+xMoveButton.executeAction("CLICK", tuple())
+
+# Check if move option was remembered
+with self.ui_test.execute_dialog_through_command(".uno:Move") as 
xDialog:
+xCopyButton = xDialog.getChild("copy")
+self.assertEqual(get_state_as_dict(xCopyButton)["Checked"], 
"false")
+xMoveButton = xDialog.getChild("move")
+self.assertEqual(get_state_as_dict(xMoveButton)["Checked"], 
"true")
+
 #tdf#139464 Set OK button label to selected action: Move or Copy
 def test_tdf139464_move_sheet(self):
 with self.ui_test.create_doc_in_start_center("calc"):
@@ -87,11 +112,10 @@ class moveCopySheet(UITestCase):
 xOkButton = xDialog.getChild("ok")
 xCopyButton = xDialog.getChild("copy")
 xMoveButton = xDialog.getChild("move")
-self.assertEqual(get_state_as_dict(xMoveButton)['Text'], 
get_state_as_dict(xOkButton)['Text'])
-xCopyButton.executeAction("CLICK", tuple())
 self.assertEqual(get_state_as_dict(xCopyButton)['Text'], 
get_state_as_dict(xOkButton)['Text'])
 xMoveButton.executeAction("CLICK", tuple())
 self.assertEqual(get_state_as_dict(xMoveButton)['Text'], 
get_state_as_dict(xOkButton)['Text'])
-
+xCopyButton.executeAction("CLICK", tuple())
+self.assertEqual(get_state_as_dict(xCopyButton)['Text'], 
get_state_as_dict(xOkButton)['Text'])
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx
index c6e89ab9fed0..665d3cd46085 100644
--- a/sc/source/ui/inc/mvtabdlg.hxx
+++ b/sc/source/ui/inc/mvtabdlg.hxx
@@ -61,6 +61,9 @@ private:
 boolbRenameTable:1;
 boolmbEverEdited:1;
 
+// tdf#96854 - remember last used option for copy/move sheet
+static bool mbRememeberedCopy;
+
 std::unique_ptr m_xBtnMove;
 std::unique_ptr m_xBtnCopy;
 std::unique_ptr m_xFtDoc;
diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx 

[Libreoffice-commits] core.git: sc/qa

2023-05-04 Thread Xisco Fauli (via logerrit)
 sc/qa/extras/macros-test.cxx |  289 +++
 1 file changed, 103 insertions(+), 186 deletions(-)

New commits:
commit b6e68913f7086a816483cdf6f5e548b1fcf1d41e
Author: Xisco Fauli 
AuthorDate: Thu May 4 14:48:16 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu May 4 22:28:59 2023 +0200

CppunitTest_sc_macros_test: inherit from ScModelTestBase

so the code can be simplified

Change-Id: Iedbb844e5f11b993d73fb32d6871d74779919e10
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151368
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 1135fbd38f69..b35266db5b03 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -8,7 +8,7 @@
  */
 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -33,7 +33,7 @@ using namespace ::com::sun::star::uno;
 
 /* Implementation of Macros test */
 
-class ScMacrosTest : public UnoApiXmlTest
+class ScMacrosTest : public ScModelTestBase
 {
 public:
 ScMacrosTest();
@@ -47,7 +47,7 @@ public:
 // module, we could move the test there then ) - relates to fdo#67547
 CPPUNIT_TEST_FIXTURE(ScMacrosTest, testMSP)
 {
-loadFromURL(u"MasterScriptProviderProblem.ods");
+createScDoc("MasterScriptProviderProblem.ods");
 
 Any aRet = 
executeMacro("vnd.sun.Star.script:Standard.Module1.TestMSP?language=Basic=document");
 OUString sResult;
@@ -59,128 +59,104 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testMSP)
 
 CPPUNIT_TEST_FIXTURE(ScMacrosTest, testPasswordProtectedStarBasic)
 {
-loadFromURL(u"testTypePassword.ods");
-
-SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(mxComponent);
-
-CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
-ScDocShell* pDocSh = static_cast(pFoundShell);
-ScDocument& rDoc = pDocSh->GetDocument();
+createScDoc("testTypePassword.ods");
+ScDocument* pDoc = getScDoc();
 
 // User defined types
-
 
executeMacro("vnd.sun.Star.script:Standard.Module1.LoadAndExecuteTest?language=Basic=document");
 
-OUString aValue = rDoc.GetString(0,0,0);
+OUString aValue = pDoc->GetString(0,0,0);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("User defined types script did not change the 
value of Sheet1.A1", OUString("success"), aValue);
 
 // Big Module
 
 
executeMacro("vnd.sun.Star.script:MyLibrary.BigModule.bigMethod?language=Basic=document");
 
-aValue = rDoc.GetString(1,0,0);
+aValue = pDoc->GetString(1,0,0);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Big module script did not change the value 
of Sheet1.B1", OUString("success"), aValue);
 
 // far big method tdf#94617
 
 
executeMacro("vnd.sun.Star.script:MyLibrary.BigModule.farBigMethod?language=Basic=document");
 
-aValue = rDoc.GetString(2,0,0);
+aValue = pDoc->GetString(2,0,0);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Far Method script did not change the value 
of Sheet1.C1", OUString("success"), aValue);
 }
 
 CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf142391)
 {
-loadFromURL(u"tdf142391.ods");
-
-SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(mxComponent);
-CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
-ScDocShell* pDocSh = static_cast(pFoundShell);
-ScDocument& rDoc = pDocSh->GetDocument();
+createScDoc("tdf142391.ods");
+ScDocument* pDoc = getScDoc();
 
 // User defined types
 executeMacro(
 
"vnd.sun.Star.script:Standard.Module1.LoadAndExecuteTest?language=Basic=document");
-OUString aValue = rDoc.GetString(0, 0, 0);
+OUString aValue = pDoc->GetString(0, 0, 0);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("User defined types script did not change the 
value of Sheet1.A1",
  OUString("success"), aValue);
 
 // Big Module
 executeMacro(
 
"vnd.sun.Star.script:MyLibrary.BigModule.bigMethod?language=Basic=document");
-aValue = rDoc.GetString(1, 0, 0);
+aValue = pDoc->GetString(1, 0, 0);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Big module script did not change the value 
of Sheet1.B1",
  OUString("success"), aValue);
 
 // tdf#142391 - method exceeds 0x offset for methods
 executeMacro(
 
"vnd.sun.Star.script:MyLibrary.BigModule.farBigMethod?language=Basic=document");
-aValue = rDoc.GetString(2, 0, 0);
+aValue = pDoc->GetString(2, 0, 0);
 CPPUNIT_ASSERT_EQUAL_MESSAGE("Far Method script did not change the value 
of Sheet1.C1",
  OUString("success"), aValue);
 }
 
 CPPUNIT_TEST_FIXTURE(ScMacrosTest, testStarBasic)
 {
-loadFromURL(u"StarBasic.ods");
-
-SfxObjectShell* pFoundShell = 
SfxObjectShell::GetShellFromComponent(mxComponent);
-
-CPPUNIT_ASSERT_MESSAGE("Failed to access document shell", pFoundShell);
-ScDocShell* pDocSh = static_cast(pFoundShell);
-ScDocument& rDoc = 

[Libreoffice-commits] core.git: sc/qa

2023-05-04 Thread Xisco Fauli (via logerrit)
 sc/qa/unit/scshapetest.cxx |   37 -
 1 file changed, 8 insertions(+), 29 deletions(-)

New commits:
commit 491866af90346c0af014f9d77300ca055b25af76
Author: Xisco Fauli 
AuthorDate: Thu May 4 14:31:30 2023 +0200
Commit: Xisco Fauli 
CommitDate: Thu May 4 20:48:55 2023 +0200

CppunitTest_sc_shapetest: use existing method to go to cell

Change-Id: I96f8f676964920a9bf9c31d8fa81a17788f763af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151367
Tested-by: Jenkins
Reviewed-by: Xisco Fauli 

diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 465e69693b3e..814384effe83 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -145,12 +145,9 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf143619_validation_circle_pos)
 
 // Error was, that deleting row and col before E6 does not move circle to 
D5, but to B3.
 // Delete first row and first column.
-uno::Sequence aPropertyValues = {
-comphelper::makePropertyValue("ToPoint", OUString("$A$1")),
-};
-dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+goToCell("$A$1");
 dispatchCommand(mxComponent, ".uno:DeleteRows", {});
-dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+goToCell("$A$1");
 dispatchCommand(mxComponent, ".uno:DeleteColumns", {});
 
 // Without fix in place the position was (2007, 833)
@@ -566,10 +563,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf137576_LogicRectInDefaultMeasureline)
 pTabViewShell->SetDrawShell(false);
 
 // Hide column A.
-uno::Sequence aPropertyValues = {
-comphelper::makePropertyValue("ToPoint", OUString("$A$1")),
-};
-dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+goToCell("$A$1");
 dispatchCommand(mxComponent, ".uno:HideColumn", {});
 
 // Get current position. I will not use absolute values for comparison, 
because document is loaded
@@ -676,10 +670,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testHideColsShow)
 tools::Rectangle aSnapRectOrig(pObj->GetSnapRect());
 
 // Hide cols C and D.
-uno::Sequence aPropertyValues = {
-comphelper::makePropertyValue("ToPoint", OUString("$C$1:$D$1")),
-};
-dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+goToCell("$C$1:$D$1");
 
 ScTabViewShell* pViewShell = getViewShell();
 pViewShell->GetViewData().GetDispatcher().Execute(FID_COL_HIDE);
@@ -688,10 +679,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, testHideColsShow)
 CPPUNIT_ASSERT_MESSAGE("Hide: Object should be invisible", 
!pObj->IsVisible());
 
 // Show cols C and D
-aPropertyValues = {
-comphelper::makePropertyValue("ToPoint", OUString("$C$1:$D$1")),
-};
-dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+goToCell("$C$1:$D$1");
 pViewShell->GetViewData().GetDispatcher().Execute(FID_COL_SHOW);
 
 // Check object is visible and has old size
@@ -744,10 +732,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf138138_MoveCellWithRotatedShape)
 CPPUNIT_ASSERT_RECTANGLE_EQUAL_WITH_TOLERANCE(aExpectedRect, aSnapRect, 1);
 
 // Insert two columns after column B
-uno::Sequence aPropertyValues = {
-comphelper::makePropertyValue("ToPoint", OUString("$A$1:$B$1")),
-};
-dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+goToCell("$A$1:$B$1");
 
 ScTabViewShell* pViewShell = getViewShell();
 pViewShell->GetViewData().GetDispatcher().Execute(FID_INS_COLUMNS_AFTER);
@@ -840,10 +825,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf137355_UndoHideRows)
 
 // Hide rows 3 to 6 in UI. [Note: Simple pDoc->SetRowHidden(2,5,0,true) 
does not work, because it
 // does not produce the needed undo items.]
-uno::Sequence aPropertyValues = {
-comphelper::makePropertyValue("ToPoint", OUString("$A$3:$A$6")),
-};
-dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+goToCell("$A$3:$A$6");
 ScTabViewShell* pViewShell = getViewShell();
 pViewShell->GetViewData().GetDispatcher().Execute(FID_ROW_HIDE);
 
@@ -871,10 +853,7 @@ CPPUNIT_TEST_FIXTURE(ScShapeTest, 
testTdf152081_UndoHideColsWithNotes)
 CPPUNIT_ASSERT_MESSAGE("Load: Note object should be visible", 
pObj->IsVisible());
 
 // Hide B column
-uno::Sequence aPropertyValues = {
-comphelper::makePropertyValue("ToPoint", OUString("$B$2:$B$2")),
-};
-dispatchCommand(mxComponent, ".uno:GoToCell", aPropertyValues);
+goToCell("$B$2:$B$2");
 ScTabViewShell* pViewShell = getViewShell();
 pViewShell->GetViewData().GetDispatcher().Execute(FID_COL_HIDE);
 


  1   2   3   4   5   6   7   8   9   10   >