diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-07-01 12:34:52 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-07-01 17:15:30 +0200 |
commit | 1e3263a677b61c718d0fd1be15c066b933f7de18 (patch) | |
tree | 621a09584a2f57f1060c23baf66faca2d50589b6 /sc/qa | |
parent | e190196f255b7d0147d61fd967a2b2a61a932185 (diff) |
XLSX export: handle button form controls
This builds on top of commit 94678a7b9c6b7e577c15adacc885e03551bcf17b
(XLSX export: improve handling of checkbox (form controls), 2021-06-30),
so now both checkboxes and buttons are handled during export.
Change-Id: I278b4925414d29399401cc15ab3d944db88ee0c5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118219
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'sc/qa')
-rw-r--r-- | sc/qa/unit/data/xlsx/button-form-control.xlsx | bin | 0 -> 11190 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_export-test2.cxx | 25 |
2 files changed, 25 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/button-form-control.xlsx b/sc/qa/unit/data/xlsx/button-form-control.xlsx Binary files differnew file mode 100644 index 000000000000..c5e9fe65a245 --- /dev/null +++ b/sc/qa/unit/data/xlsx/button-form-control.xlsx diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx index 6036bddd8369..d23145c67cf2 100644 --- a/sc/qa/unit/subsequent_export-test2.cxx +++ b/sc/qa/unit/subsequent_export-test2.cxx @@ -188,6 +188,7 @@ public: void testTdf126541_SheetVisibilityImportXlsx(); void testTdf140431(); void testCheckboxFormControlXlsxExport(); + void testButtonFormControlXlsxExport(); CPPUNIT_TEST_SUITE(ScExportTest2); @@ -284,6 +285,7 @@ public: CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx); CPPUNIT_TEST(testTdf140431); CPPUNIT_TEST(testCheckboxFormControlXlsxExport); + CPPUNIT_TEST(testButtonFormControlXlsxExport); CPPUNIT_TEST_SUITE_END(); @@ -2323,6 +2325,29 @@ void ScExportTest2::testCheckboxFormControlXlsxExport() assertXPathContent(pDoc, "/xml/v:shape/xx:ClientData/xx:Anchor", "1, 22, 3, 3, 3, 30, 6, 1"); } +void ScExportTest2::testButtonFormControlXlsxExport() +{ + // Given a document that has a checkbox form control: + ScDocShellRef xShell = loadDoc(u"button-form-control.", FORMAT_XLSX); + CPPUNIT_ASSERT(xShell.is()); + + // When exporting to XLSX: + std::shared_ptr<utl::TempFile> pXPathFile + = ScBootstrapFixture::exportTo(&(*xShell), FORMAT_XLSX); + + // Then make sure its control markup is written and it has a correct position + size: + xmlDocUniquePtr pDoc + = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/worksheets/sheet1.xml"); + CPPUNIT_ASSERT(pDoc); + // Without the fix in place, this test would have failed with: + // - XPath '//x:anchor/x:from/xdr:col' not found + // i.e. the control markup was missing, the button was lost on export. + assertXPathContent(pDoc, "//x:anchor/x:from/xdr:col", "1"); + assertXPathContent(pDoc, "//x:anchor/x:from/xdr:row", "3"); + assertXPathContent(pDoc, "//x:anchor/x:to/xdr:col", "3"); + assertXPathContent(pDoc, "//x:anchor/x:to/xdr:row", "7"); +} + CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2); CPPUNIT_PLUGIN_IMPLEMENT(); |