sc/qa/unit/data/fods/tdf144758-dbdata-no-orientation.fods | 17 +++++++++++ sc/qa/unit/subsequent_filters-test.cxx | 21 ++++++++++++++ sc/source/filter/xml/xmldrani.cxx | 2 - test/source/sheet/xdatabaserange.cxx | 2 - 4 files changed, 40 insertions(+), 2 deletions(-)
New commits: commit 7a31f198af9e7f2b53a0eb9cc3fb473a265fab45 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Oct 1 19:22:18 2021 +0300 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Sat Oct 2 11:10:07 2021 +0200 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.kagan...@collabora.com> Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122975 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> 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 75ff20e23034..7464e1214fae 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -70,6 +70,7 @@ #include <detfunc.hxx> #include <cellmergeoption.hxx> #include <undoblk.hxx> +#include <sortparam.hxx> #include <orcusfilters.hxx> #include <filter.hxx> @@ -213,6 +214,7 @@ public: void testTdf139782(); void testTdf129681(); void testTdf111974XLSM(); + void testTdf144758_DBDataDefaultOrientation(); CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testCondFormatOperatorsSameRangeXLSX); @@ -313,6 +315,7 @@ public: CPPUNIT_TEST(testTdf139782); CPPUNIT_TEST(testTdf129681); CPPUNIT_TEST(testTdf111974XLSM); + CPPUNIT_TEST(testTdf144758_DBDataDefaultOrientation); CPPUNIT_TEST_SUITE_END(); @@ -3078,6 +3081,24 @@ void ScFiltersTest::testTdf129681() void ScFiltersTest::testTdf111974XLSM() { testImportCrash(u"tdf111974.", FORMAT_XLSM); } +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 d1701179d912..565f5ef1bc9f 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -104,7 +104,7 @@ ScXMLDatabaseRangeContext::ScXMLDatabaseRangeContext( ScXMLImport& rImport, bSubTotalsAscending(true), bFilterConditionSourceRange(false), bHasHeader(true), - bByRow(false), + bByRow(true), meRangeType(ScDBCollection::GlobalNamed) { if( rAttrList.is() ) diff --git a/test/source/sheet/xdatabaserange.cxx b/test/source/sheet/xdatabaserange.cxx index 2c45ba0fbf0a..f1133ac00f5d 100644 --- a/test/source/sheet/xdatabaserange.cxx +++ b/test/source/sheet/xdatabaserange.cxx @@ -69,7 +69,7 @@ void XDatabaseRange::testGetSortDescriptor() { bool bIsSortColumns = true; aProp.Value >>= bIsSortColumns; - CPPUNIT_ASSERT(bIsSortColumns); + CPPUNIT_ASSERT(!bIsSortColumns); } else if (aProp.Name == "ContainsHeader") {