[Libreoffice-commits] core.git: sc/qa sc/source test/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 1 23:44:04 UTC 2021
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 d830179a072072f3cc3ea5d942189647bcb7e1c7
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Oct 1 19:22:18 2021 +0300
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Oct 2 01:43:31 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.kaganski at collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.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 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() )
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")
{
More information about the Libreoffice-commits
mailing list