diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-29 10:15:43 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2022-11-29 11:25:08 +0100 |
commit | 236a96c7cff4cbf8a4ee2499739e7a938b6bae64 (patch) | |
tree | 7484379c5385a427dcaa7451bd787741e7f188e6 | |
parent | 7d11bbb906f3fe49b243c3acca1cffbb28915a6a (diff) |
sc: test exporting to xls/xlsx with password protection
Change-Id: I79ebc0d4f65c26aab8c04399a47ce1cbc631cf76
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143432
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/unit/subsequent_export_test.cxx | 25 | ||||
-rw-r--r-- | test/source/unoapi_test.cxx | 5 |
2 files changed, 19 insertions, 11 deletions
diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx index f455f90b6ee5..9ef88173d47c 100644 --- a/sc/qa/unit/subsequent_export_test.cxx +++ b/sc/qa/unit/subsequent_export_test.cxx @@ -77,7 +77,7 @@ public: void testExtCondFormatXLSX(); void testTdf90104(); void testTdf111876(); - void testPasswordExportODS(); + void testPasswordExport(); void testTdf134332(); void testConditionalFormatExportODS(); void testConditionalFormatExportXLSX(); @@ -198,7 +198,7 @@ public: CPPUNIT_TEST(testExtCondFormatXLSX); CPPUNIT_TEST(testTdf90104); CPPUNIT_TEST(testTdf111876); - CPPUNIT_TEST(testPasswordExportODS); + CPPUNIT_TEST(testPasswordExport); CPPUNIT_TEST(testTdf134332); CPPUNIT_TEST(testConditionalFormatExportODS); CPPUNIT_TEST(testCondFormatExportCellIs); @@ -473,19 +473,24 @@ void ScExportTest::testTdf111876() CPPUNIT_ASSERT(sTarget != "../xls/bug-fixes.xls"); } -void ScExportTest::testPasswordExportODS() +void ScExportTest::testPasswordExport() { - createScDoc(); + std::vector<OUString> aFilterNames{ "calc8", "MS Excel 97", "Calc Office Open XML" }; - ScDocument* pDoc = getScDoc(); + for (size_t i = 0; i < aFilterNames.size(); ++i) + { + createScDoc(); - pDoc->SetValue(0, 0, 0, 1.0); + ScDocument* pDoc = getScDoc(); - saveAndReload("calc8", /*pPassword*/ "test"); + pDoc->SetValue(0, 0, 0, 1.0); - pDoc = getScDoc(); - double aVal = pDoc->GetValue(0, 0, 0); - ASSERT_DOUBLES_EQUAL(aVal, 1.0); + saveAndReload(aFilterNames[i], /*pPassword*/ "test"); + + pDoc = getScDoc(); + double aVal = pDoc->GetValue(0, 0, 0); + ASSERT_DOUBLES_EQUAL(aVal, 1.0); + } } void ScExportTest::testTdf134332() diff --git a/test/source/unoapi_test.cxx b/test/source/unoapi_test.cxx index 10ee4f01c06b..60c010c17e98 100644 --- a/test/source/unoapi_test.cxx +++ b/test/source/unoapi_test.cxx @@ -152,7 +152,7 @@ void UnoApiTest::save(const OUString& rFilter, const char* pPassword) if (pPassword) { - if (rFilter != "Office Open XML Text") + if (rFilter != "Office Open XML Text" && rFilter != "Calc Office Open XML") { aMediaDescriptor["Password"] <<= OUString::createFromAscii(pPassword); } @@ -164,6 +164,9 @@ void UnoApiTest::save(const OUString& rFilter, const char* pPassword) { "OOXPassword", uno::Any(sPassword) } }; aMediaDescriptor[utl::MediaDescriptor::PROP_ENCRYPTIONDATA] <<= aEncryptionData; + + // validation fails with "zip END header not found" + skipValidation(); } } |