summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-01 19:22:18 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-02 01:43:31 +0200
commitd830179a072072f3cc3ea5d942189647bcb7e1c7 (patch)
tree2d294decaf56a9bc649b52d2cce77d0e13a50fd9 /sc
parent01807ad5e04966abeb396b7599cbbbf822de6a03 (diff)
tdf#144758: default value for 'table:orientation' attribute is 'row'
See [OpenDocument-v1.3-part3] section 19.690.3 <table:database-range>. Regression after commit ed88b144ce24b9a733d4a9ab6614307c96537baa. Also fixes relevant part of unit test first introduced in commit 6069ef7976c4455c1875afecf02c41c5731f6546, which was at that time testing that IsSortColumns property returned false; then in commit fc95d20500997a1a460be6f3553727299a5080eb, the correct value was changed to true, reflecting the regression fixed here. Change-Id: I6a12a0ad13405bc388efb7c2c3bbf31e89905620 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122955 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods17
-rw-r--r--sc/qa/unit/subsequent_filters_test.cxx21
-rw-r--r--sc/source/filter/xml/xmldrani.cxx2
3 files changed, 39 insertions, 1 deletions
diff --git a/sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods b/sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods
new file mode 100644
index 000000000000..922fba5ab6cb
--- /dev/null
+++ b/sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" office:version="1.3" office:mimetype="application/vnd.oasis.opendocument.spreadsheet">
+ <office:body>
+ <office:spreadsheet>
+ <table:table table:name="Sheet1">
+ <table:table-column/>
+ <table:table-row>
+ <table:table-cell/>
+ </table:table-row>
+ </table:table>
+ <table:database-ranges>
+ <table:database-range table:name="__Anonymous_Sheet_DB__0" table:target-range-address="Sheet1.A1:Sheet1.A1" table:contains-header="false"/>
+ </table:database-ranges>
+ </office:spreadsheet>
+ </office:body>
+</office:document> \ No newline at end of file
diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx
index 1bdfceb446ba..de4cea5dc961 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -71,6 +71,7 @@
#include <detfunc.hxx>
#include <cellmergeoption.hxx>
#include <undoblk.hxx>
+#include <sortparam.hxx>
#include <orcusfilters.hxx>
#include <filter.hxx>
@@ -217,6 +218,7 @@ public:
void testTdf129681();
void testTdf111974XLSM();
void testEscapedUnicodeXLSX();
+ void testTdf144758_DBDataDefaultOrientation();
CPPUNIT_TEST_SUITE(ScFiltersTest);
CPPUNIT_TEST(testCondFormatOperatorsSameRangeXLSX);
@@ -320,6 +322,7 @@ public:
CPPUNIT_TEST(testTdf129681);
CPPUNIT_TEST(testTdf111974XLSM);
CPPUNIT_TEST(testEscapedUnicodeXLSX);
+ CPPUNIT_TEST(testTdf144758_DBDataDefaultOrientation);
CPPUNIT_TEST_SUITE_END();
@@ -3123,6 +3126,24 @@ void ScFiltersTest::testEscapedUnicodeXLSX()
xDocSh->DoClose();
}
+void ScFiltersTest::testTdf144758_DBDataDefaultOrientation()
+{
+ ScDocShellRef xDocSh = loadDoc(u"tdf144758-dbdata-no-orientation.", FORMAT_FODS);
+ CPPUNIT_ASSERT(xDocSh);
+ ScDocument& rDoc = xDocSh->GetDocument();
+ ScDBData* pAnonDBData = rDoc.GetAnonymousDBData(0);
+ CPPUNIT_ASSERT(pAnonDBData);
+
+ ScSortParam aSortParam;
+ pAnonDBData->GetSortParam(aSortParam);
+
+ // Without the fix, the default value for bByRow (in absence of 'table:orientation' attribute
+ // in 'table:database-range' element) was false
+ CPPUNIT_ASSERT(aSortParam.bByRow);
+
+ xDocSh->DoClose();
+}
+
ScFiltersTest::ScFiltersTest()
: ScBootstrapFixture( "sc/qa/unit/data" )
{
diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx
index 820c42412b51..9d596740ef74 100644
--- a/sc/source/filter/xml/xmldrani.cxx
+++ b/sc/source/filter/xml/xmldrani.cxx
@@ -103,7 +103,7 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport,
bSubTotalsAscending(true),
bFilterConditionSourceRange(false),
bHasHeader(true),
- bByRow(false),
+ bByRow(true),
meRangeType(ScDBCollection::GlobalNamed)
{
if( rAttrList.is() )