summaryrefslogtreecommitdiff
path: root/sc/qa
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-06-30 16:22:42 +0200
committerMiklos Vajna <vmiklos@collabora.com>2021-06-30 20:33:39 +0200
commit94678a7b9c6b7e577c15adacc885e03551bcf17b (patch)
tree1e48aea7c4b61cfa8e1f06c9a4d7aa95d25745db /sc/qa
parent7cbd6d768d282077053c354254315f3dc89bf254 (diff)
XLSX export: improve handling of checkbox (form controls)
This builds on top of commit fd238380ae7820f12ac1f7c52d0f7180a93f3ba3 (tdf#106181 XLSX export: output form controls, 2020-05-13) and adds the missing VML version which seems to be mandated by Excel 2019. It is not perfect (e.g. there is still an unwanted border around the checkbox), but the checkbox has a correct position and its label is readable, while it was just lost previously. Change-Id: I08198d068a0eb85061d138719cfc60d73c46398e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118168 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sc/qa')
-rw-r--r--sc/qa/unit/data/xlsx/checkbox-form-control.xlsxbin0 -> 11394 bytes
-rw-r--r--sc/qa/unit/subsequent_export-test2.cxx20
2 files changed, 20 insertions, 0 deletions
diff --git a/sc/qa/unit/data/xlsx/checkbox-form-control.xlsx b/sc/qa/unit/data/xlsx/checkbox-form-control.xlsx
new file mode 100644
index 000000000000..ad761a573aae
--- /dev/null
+++ b/sc/qa/unit/data/xlsx/checkbox-form-control.xlsx
Binary files differ
diff --git a/sc/qa/unit/subsequent_export-test2.cxx b/sc/qa/unit/subsequent_export-test2.cxx
index 1c088c813f21..eb6db21167d3 100644
--- a/sc/qa/unit/subsequent_export-test2.cxx
+++ b/sc/qa/unit/subsequent_export-test2.cxx
@@ -187,6 +187,7 @@ public:
void testTdf139258_rotated_image();
void testTdf126541_SheetVisibilityImportXlsx();
void testTdf140431();
+ void testCheckboxFormControlXlsxExport();
CPPUNIT_TEST_SUITE(ScExportTest2);
@@ -282,6 +283,7 @@ public:
CPPUNIT_TEST(testTdf139258_rotated_image);
CPPUNIT_TEST(testTdf126541_SheetVisibilityImportXlsx);
CPPUNIT_TEST(testTdf140431);
+ CPPUNIT_TEST(testCheckboxFormControlXlsxExport);
CPPUNIT_TEST_SUITE_END();
@@ -2301,6 +2303,24 @@ void ScExportTest2::testTdf140431()
xDocSh->DoClose();
}
+void ScExportTest2::testCheckboxFormControlXlsxExport()
+{
+ // Given a document that has a checkbox form control:
+ ScDocShellRef xShell = loadDoc(u"checkbox-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 VML markup is written and it has a correct position + size:
+ xmlDocUniquePtr pDoc
+ = XPathHelper::parseExport(pXPathFile, m_xSFactory, "xl/drawings/vmlDrawing1.vml");
+ // Without the fix in place, this test would have failed as there was no such stream.
+ CPPUNIT_ASSERT(pDoc);
+ assertXPathContent(pDoc, "/xml/v:shape/xx:ClientData/xx:Anchor", "1, 22, 3, 3, 3, 30, 6, 1");
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest2);
CPPUNIT_PLUGIN_IMPLEMENT();