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

Andreas Heinisch (via logerrit) logerrit at kemper.freedesktop.org
Sat Jun 12 15:45:04 UTC 2021


 sc/qa/uitest/statistics/descriptiveStatistics.py               |    6 +-
 sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx |   21 +++++++---
 2 files changed, 18 insertions(+), 9 deletions(-)

New commits:
commit e0237886450dcd3e6d3200ef533d2b3d7f0f8c19
Author:     Andreas Heinisch <andreas.heinisch at yahoo.de>
AuthorDate: Tue Jun 8 17:21:09 2021 +0200
Commit:     Andreas Heinisch <andreas.heinisch at yahoo.de>
CommitDate: Sat Jun 12 17:44:29 2021 +0200

    tdf#128018 - Add column/row labels to the descriptive statistics
    
    Change-Id: I22840433954a217ef5b5c1d3ea20e935d322e767
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116852
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heinisch at yahoo.de>

diff --git a/sc/qa/uitest/statistics/descriptiveStatistics.py b/sc/qa/uitest/statistics/descriptiveStatistics.py
index 112803418dac..b0fe011fee66 100644
--- a/sc/qa/uitest/statistics/descriptiveStatistics.py
+++ b/sc/qa/uitest/statistics/descriptiveStatistics.py
@@ -99,7 +99,7 @@ class descriptiveStatistics(UITestCase):
         self.assertEqual(get_cell_by_position(document, 0, 5, 14).getString() , "Sum")
         self.assertEqual(get_cell_by_position(document, 0, 5, 15).getString() , "Count")
 
-        self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString() , "Column 1")
+        self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString() , "Math")
         self.assertEqual(round(get_cell_by_position(document, 0, 6, 1).getValue(),12) , 41.909090909091)
         self.assertEqual(round(get_cell_by_position(document, 0, 6, 2).getValue(),13) , 3.5610380137731)
         self.assertEqual(get_cell_by_position(document, 0, 6, 3).getValue() , 47)
@@ -116,7 +116,7 @@ class descriptiveStatistics(UITestCase):
         self.assertEqual(get_cell_by_position(document, 0, 6, 14).getValue() , 461)
         self.assertEqual(get_cell_by_position(document, 0, 6, 15).getValue() , 11)
 
-        self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString() , "Column 2")
+        self.assertEqual(get_cell_by_position(document, 0, 7, 0).getString() , "Physics")
         self.assertEqual(round(get_cell_by_position(document, 0, 7, 1).getValue(),1) , 59.7)
         self.assertEqual(round(get_cell_by_position(document, 0, 7, 2).getValue(),14) , 5.35837869343164)
         self.assertEqual(get_cell_by_position(document, 0, 7, 3).getValue() , 49)
@@ -133,7 +133,7 @@ class descriptiveStatistics(UITestCase):
         self.assertEqual(get_cell_by_position(document, 0, 7, 14).getValue() , 597)
         self.assertEqual(get_cell_by_position(document, 0, 7, 15).getValue() , 10)
 
-        self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString() , "Column 3")
+        self.assertEqual(get_cell_by_position(document, 0, 8, 0).getString() , "Biology")
         self.assertEqual(get_cell_by_position(document, 0, 8, 1).getValue() , 44.7)
         self.assertEqual(round(get_cell_by_position(document, 0, 8, 2).getValue(),13) , 4.7680650629416)
         self.assertEqual(get_cell_by_position(document, 0, 8, 3).getValue() , 60)
diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
index f42e9cf12923..ca2da6458860 100644
--- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx
@@ -88,13 +88,22 @@ ScRange ScDescriptiveStatisticsDialog::ApplyOutput(ScDocShell* pDocShell)
     // Write column/row labels
     for( ; pIterator->hasNext(); pIterator->next() )
     {
-        if (mGroupedBy == BY_COLUMN)
-            aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE));
-        else
-            aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE));
+        // tdf#128018 - add column/row labels to the output
+        OUString aColRowLabel = mDocument.GetString(pIterator->get().aStart);
+        if (aColRowLabel.isEmpty())
+        {
+            if (mGroupedBy == BY_COLUMN)
+                aTemplate.setTemplate(ScResId(STR_COLUMN_LABEL_TEMPLATE));
+            else
+                aTemplate.setTemplate(ScResId(STR_ROW_LABEL_TEMPLATE));
 
-        aTemplate.applyNumber(u"%NUMBER%", pIterator->index() + 1);
-        aOutput.writeBoldString(aTemplate.getTemplate());
+            aTemplate.applyNumber(u"%NUMBER%", pIterator->index() + 1);
+            aOutput.writeBoldString(aTemplate.getTemplate());
+        }
+        else
+        {
+            aOutput.writeBoldString(aColRowLabel);
+        }
         aOutput.nextColumn();
     }
     aOutput.nextRow();


More information about the Libreoffice-commits mailing list