summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/extras/macros-test.cxx57
-rw-r--r--sc/qa/unit/data/xlsx/tdf166413.xlsxbin0 -> 8903 bytes
-rw-r--r--sc/qa/unit/subsequent_export_test4.cxx35
-rw-r--r--sc/qa/unit/tiledrendering/data/split-panes.odsbin0 -> 8685 bytes
-rw-r--r--sc/qa/unit/tiledrendering/data/split-panes.xlsxbin0 -> 8224 bytes
-rw-r--r--sc/qa/unit/tiledrendering/tiledrendering2.cxx36
6 files changed, 128 insertions, 0 deletions
diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 6e2b81a01ecd..c9148f64854d 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -17,8 +17,11 @@
#include <document.hxx>
#include <scitems.hxx>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XCellRangeMovement.hpp>
#include <com/sun/star/sheet/XFunctionAccess.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XColumnRowRange.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
@@ -919,6 +922,60 @@ CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf159412)
CPPUNIT_ASSERT_EQUAL(u"1 Long/2 Double"_ustr, aReturnValue);
}
+CPPUNIT_TEST_FIXTURE(ScMacrosTest, testTdf47479)
+{
+ createScDoc();
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
+ auto xSheets = xDoc->getSheets().queryThrow<container::XIndexAccess>();
+ auto xSheet = xSheets->getByIndex(0).queryThrow<sheet::XCellRangeMovement>();
+ auto xSheetAddressable = xSheet.queryThrow<sheet::XCellRangeAddressable>();
+ auto xColRowRange = xSheet.queryThrow<table::XColumnRowRange>();
+ auto xColAddressable
+ = xColRowRange->getColumns()->getByIndex(1).queryThrow<sheet::XCellRangeAddressable>();
+ auto xRowAddressable
+ = xColRowRange->getRows()->getByIndex(1).queryThrow<sheet::XCellRangeAddressable>();
+ css::table::CellRangeAddress origSheetRange = xSheetAddressable->getRangeAddress();
+ css::table::CellRangeAddress origColRange = xColAddressable->getRangeAddress();
+ css::table::CellRangeAddress origRowRange = xRowAddressable->getRangeAddress();
+ css::table::CellRangeAddress addressToRemove(origSheetRange.Sheet, 1, 1, 1, 1);
+
+ xSheet->removeRange(addressToRemove, css::sheet::CellDeleteMode_UP);
+
+ auto currentRange = xSheetAddressable->getRangeAddress();
+ CPPUNIT_ASSERT_EQUAL(origSheetRange.Sheet, currentRange.Sheet);
+ CPPUNIT_ASSERT_EQUAL(origSheetRange.StartColumn, currentRange.StartColumn);
+ CPPUNIT_ASSERT_EQUAL(origSheetRange.StartRow, currentRange.StartRow);
+ CPPUNIT_ASSERT_EQUAL(origSheetRange.EndColumn, currentRange.EndColumn);
+ // Without the fix, this would fail with
+ // - Expected: 1048575
+ // - Actual : 0
+ CPPUNIT_ASSERT_EQUAL(origSheetRange.EndRow, currentRange.EndRow);
+
+ xSheet->removeRange(addressToRemove, css::sheet::CellDeleteMode_LEFT);
+
+ currentRange = xColAddressable->getRangeAddress();
+ CPPUNIT_ASSERT_EQUAL(origColRange.Sheet, currentRange.Sheet);
+ CPPUNIT_ASSERT_EQUAL(origColRange.StartColumn, currentRange.StartColumn);
+ // Without the fix, this would fail with
+ // - Expected: 0
+ // - Actual : 2
+ CPPUNIT_ASSERT_EQUAL(origColRange.StartRow, currentRange.StartRow);
+ CPPUNIT_ASSERT_EQUAL(origColRange.EndColumn, currentRange.EndColumn);
+ CPPUNIT_ASSERT_EQUAL(origColRange.EndRow, currentRange.EndRow);
+
+ xSheet->removeRange(origColRange, css::sheet::CellDeleteMode_UP);
+
+ currentRange = xRowAddressable->getRangeAddress();
+ CPPUNIT_ASSERT_EQUAL(origRowRange.Sheet, currentRange.Sheet);
+ // Without the fix, this would fail with
+ // - Expected: 0
+ // - Actual : 2
+ CPPUNIT_ASSERT_EQUAL(origRowRange.StartColumn, currentRange.StartColumn);
+ CPPUNIT_ASSERT_EQUAL(origRowRange.StartRow, currentRange.StartRow);
+ CPPUNIT_ASSERT_EQUAL(origRowRange.EndColumn, currentRange.EndColumn);
+ CPPUNIT_ASSERT_EQUAL(origRowRange.EndRow, currentRange.EndRow);
+}
+
ScMacrosTest::ScMacrosTest()
: ScModelTestBase(u"/sc/qa/extras/testdocuments"_ustr)
{
diff --git a/sc/qa/unit/data/xlsx/tdf166413.xlsx b/sc/qa/unit/data/xlsx/tdf166413.xlsx
new file mode 100644
index 000000000000..ae6e58a8fa09
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/tdf166413.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export_test4.cxx b/sc/qa/unit/subsequent_export_test4.cxx
index ef9d49c775da..7709a1451fe2 100644
--- a/sc/qa/unit/subsequent_export_test4.cxx
+++ b/sc/qa/unit/subsequent_export_test4.cxx
@@ -2241,6 +2241,41 @@ CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf165886)
assertXPathContent(pSheet, "/x:worksheet/x:sheetData/x:row[4]/x:c[2]/x:f", u"OR(D4=0,D4<>’’)");
}
+CPPUNIT_TEST_FIXTURE(ScExportTest4, testTdf166413)
+{
+ createScDoc("xlsx/tdf166413.xlsx");
+
+ save(u"Calc Office Open XML"_ustr);
+
+ xmlDocUniquePtr pSheet = parseExport(u"xl/worksheets/sheet1.xml"_ustr);
+ CPPUNIT_ASSERT(pSheet);
+
+ // Without the accompanying fix in place, this test would have failed with
+ // - Expected: NOT(ISERROR(SEARCH("""ABC""",A1)))
+ // - Actual : NOT(ISERROR(SEARCH(""ABC"",A1)))
+ assertXPathContent(pSheet,
+ "/x:worksheet/x:conditionalFormatting[@sqref=\"A1:C1\"]/x:cfRule/x:formula",
+ u"NOT(ISERROR(SEARCH(\"\"\"ABC\"\"\",A1)))");
+ // Similarly
+ // - Expected: ISERROR(SEARCH("""ABC""",A2))
+ // - Actual : ISERROR(SEARCH(""ABC"",A2))
+ assertXPathContent(pSheet,
+ "/x:worksheet/x:conditionalFormatting[@sqref=\"A2:C2\"]/x:cfRule/x:formula",
+ u"ISERROR(SEARCH(\"\"\"ABC\"\"\",A2))");
+ // Similarly
+ // - Expected: LEFT(A3,LEN("""ABC"""))="""ABC"""
+ // - Actual : LEFT(A3,LEN(""ABC""))=""ABC""
+ assertXPathContent(pSheet,
+ "/x:worksheet/x:conditionalFormatting[@sqref=\"A3:C3\"]/x:cfRule/x:formula",
+ u"LEFT(A3,LEN(\"\"\"ABC\"\"\"))=\"\"\"ABC\"\"\"");
+ // Similarly
+ // - Expected: RIGHT(A4,LEN("""ABC"""))="""ABC"""
+ // - Actual : RIGHT(A4,LEN(""ABC""))=""ABC""
+ assertXPathContent(pSheet,
+ "/x:worksheet/x:conditionalFormatting[@sqref=\"A4:C4\"]/x:cfRule/x:formula",
+ u"RIGHT(A4,LEN(\"\"\"ABC\"\"\"))=\"\"\"ABC\"\"\"");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/qa/unit/tiledrendering/data/split-panes.ods b/sc/qa/unit/tiledrendering/data/split-panes.ods
new file mode 100644
index 000000000000..f34df2ebd901
--- /dev/null
+++ b/sc/qa/unit/tiledrendering/data/split-panes.ods
Binary files differ
diff --git a/sc/qa/unit/tiledrendering/data/split-panes.xlsx b/sc/qa/unit/tiledrendering/data/split-panes.xlsx
new file mode 100644
index 000000000000..5687f7c0872f
--- /dev/null
+++ b/sc/qa/unit/tiledrendering/data/split-panes.xlsx
Binary files differ
diff --git a/sc/qa/unit/tiledrendering/tiledrendering2.cxx b/sc/qa/unit/tiledrendering/tiledrendering2.cxx
index 41fdcb17b936..ff6ed1881542 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering2.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering2.cxx
@@ -165,6 +165,42 @@ CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testCool11739LocaleDialogFieldUnit)
CPPUNIT_ASSERT_EQUAL(FieldUnit::CM, eMetric);
}
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSplitPanes)
+{
+ createDoc("split-panes.ods");
+
+ save(u"calc8"_ustr);
+
+ xmlDocUniquePtr pSettings = parseExport(u"settings.xml"_ustr);
+ CPPUNIT_ASSERT(pSettings);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: 0
+ // - Actual : 2
+ assertXPathContent(pSettings,
+ "/office:document-settings/office:settings/config:config-item-set[1]/"
+ "config:config-item-map-indexed/config:config-item-map-entry/"
+ "config:config-item-map-named/config:config-item-map-entry/"
+ "config:config-item[@config:name='VerticalSplitMode']",
+ u"0");
+}
+
+CPPUNIT_TEST_FIXTURE(ScTiledRenderingTest, testSplitPanesXLSX)
+{
+ createDoc("split-panes.xlsx");
+
+ save(u"Calc Office Open XML"_ustr);
+
+ xmlDocUniquePtr pSheet = parseExport(u"xl/worksheets/sheet1.xml"_ustr);
+ CPPUNIT_ASSERT(pSheet);
+
+ // Without the fix in place, this test would have failed with
+ // - Expected: topRight
+ // - Actual : bottomRight
+ // which also results in invalid XLSX
+ assertXPath(pSheet, "/x:worksheet/x:sheetViews/x:sheetView/x:pane", "activePane", u"topRight");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */